Compliling issue in 10.1.1

0
Hello Forum,   I want to upgrade our application to the newly version 10.1.1 . When trying it locally it gives me an error  i don’t understand.   C:\Users\behee\OneDrive\Documenten\Mendix\Winst uit je woning-review_IT607\javasource\emailtemplate\actions\SendEmail.java:199: error: cannot assign a value to final variable PlainBody                 this.PlainBody = ConvertHTMLBodyToPlainText.removeHTML(this.HtmlBody);                     ^ C:\Users\behee\OneDrive\Documenten\Mendix\Winst uit je woning-review_IT607\javasource\xlsreport\actions\GenerateExcelDoc.java:151: error: cannot assign a value to final variable OutputDocument                 OutputDocument = new FileDocument(getContext());                 ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compile'. > Compilation failed; see the compiler error output for details. * Try: > Run with --stacktrace option to get the stack trace. > Run with --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 9s   Does somebody know what the issue is about and how to solve it ?   kind regards,   Jasper
asked
2 answers
0

Hi Jasper,

This looks like an issue with a deprecated Java API in the email template module.  I would make sure that your email template module is up to date and if this issue still persists this may be a Mendix 10 support issue with the email template module.

The email template module is older at this point and the email connector module is where Mendix is moving their attention and support for email capabilities going forward so I’m not sure if you can count on an update to fix this in a timely manner.

I would also add that Mendix 10 is still in Beta.  While it does have many nice new features that are tempting to upgrade to, if you have business users relying on your application for their needs I would suggest waiting for the first MTS release of Mendix 10 projected for December.

Hope this helps,
Danny

answered
3

In the newer versions of Mendix, the final keyword is added to class parameters. These parameters cannot be changed later: ”We can apply the final keyword to the instance or class variables. That way, we ensure that their value assignment can be done only once.”

For the emailtemplate module, you might use a workaround like this by editing SendEmail.java:


The source code for the Excel exporter is changed by new Mx version from

public class GenerateExcelDoc extends CustomJavaAction<IMendixObject>
{
    private IMendixObject __TemplateObject;
    private xlsreport.proxies.MxTemplate TemplateObject;
    private IMendixObject __OutputDocument;
    private system.proxies.FileDocument OutputDocument;
    private IMendixObject InputObject;

 

to


public class GenerateExcelDoc extends CustomJavaAction<IMendixObject>
{
    /** @deprecated use TemplateObject.getMendixObject() instead. */
    @java.lang.Deprecated(forRemoval = true)
    private final IMendixObject __TemplateObject;
    private final xlsreport.proxies.MxTemplate TemplateObject;
    /** @deprecated use OutputDocument.getMendixObject() instead. */
    @java.lang.Deprecated(forRemoval = true)
    private final IMendixObject __OutputDocument;
    private final system.proxies.FileDocument OutputDocument;
    private final IMendixObject InputObject;


Here the final keyword is added to all parameters too, making it impossible to change these parameters later.

For the Excel exporter module, this issue seems to be fixed in v.7.1.1, so you might try to update the module to the latest version.

Regards,
Edwin van Elk

 

answered