Error in AuditLog module on Upgrade to 5.13.1

0
I am upgrading an app from 5.9.1 to 5.13.1. Everything seems to be going well except I received a Java compile error in the AuditLog module from the appstore. I receive the following error when I try to start the upgraded app in the modeler: Buildfile: C:------------- Branch\deployment\build_core.xml compile: [javac] Compiling 599 source files to C:-------------Branch\deployment\run\bin [javac] C:-------------Branch\javasource\audittrail\log\CreateLogObject.java:80: error: cannot find symbol [javac] if( inputObject.isNew() || inputObject.getState() == ObjectState.NEW || inputObject.getState() == ObjectState.INSTANTIATED || inputObject.getState() == ObjectState.AUTOCOMMITTED ) [javac] ^ [javac] symbol: variable NEW [javac] location: class ObjectState [javac] C:------------- Branch\javasource\audittrail\log\CreateLogObject.java:185: error: cannot find symbol [javac] if( inputObject.getState() == ObjectState.NEW || inputObject.getState() == ObjectState.INSTANTIATED || inputObject.getState() == ObjectState.AUTOCOMMITTED ){ [javac] ^ [javac] symbol: variable NEW [javac] location: class ObjectState [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 2 errors Any pointers about how to resolve this issue would be appreciated.
asked
3 answers
2

The Mx5.13 release no longer includes the old function, the audit module hasn't been updated yet. The ObjectState NEW has been removed and replaced by the function isNew(). We are going to fix this in the module as soon as possible.

For now so you can continue testing, you could replace the first part of the if statement: inputObject.getState() == ObjectState.NEW with inputObject.isNew()

The expression should be:

 if( inputObject.isNew() || inputObject.getState() == ObjectState.INSTANTIATED || inputObject.getState() == ObjectState.AUTOCOMMITTED ){

On line number 80 and on line 185, you can replace the part in the CreateLogObject.java file where it says inputObject.getState() == ObjectState.NEW ||

As far as I know the module should still work without any problems even without that expression. But I wasn't aware of this problem, so we still have to do some testing to be a 100% sure.
You could do a simple test to make sure this doesn't break anything, this expression is to identify if the audit log line is for a 'create' action. After the change, the create log lines should still be created as they were before.

As the error message is saying, you can find the line of code in the file:
\javasource\audittrail\log\CreateLogObject.java:80



* Edited to included Bas's feedback for easy readability.

answered
1

On line number 80, you can remove the part in the CreateLogObject.java file saying inputObject.getState() == ObjectState.NEW ||

So the whole line should just be if( inputObject.isNew() || inputObject.getState() == ObjectState.INSTANTIATED || inputObject.getState() == ObjectState.AUTOCOMMITTED )

Some similar code exists on line 185, there you can remove the same thing, so the whole line becomes if( inputObject.getState() == ObjectState.NEW || inputObject.getState() == ObjectState.INSTANTIATED || inputObject.getState() == ObjectState.AUTOCOMMITTED ){

This is actually part of the same thing mentioned in the release notes for 5.13.0 at https://world.mendix.com/display/ReleaseNotes/5.13.0, down the bottom at "Removed deprecated methods" but unfortunately it seems that this particular enumeration value was not mentioned as being removed. It very much belongs to the same thing though, it's an old object state from Mendix 3 and lower when objects were still created immediately into the database when you made a new object.

answered
1

To prevent this It would be a good idea to add a step to the release procedure of a Mendix version: Check all actual appstore content.

answered