Issue #40

Strange XML error while reversing Java project

Added by Normand Rivard over 7 years ago. Updated over 7 years ago.

Status:ResolvedStart date:09 March 2012
Priority:MediumDue date:
Assignee:François Jaouen% Done:

50%

Category:-
Target version:2.1.00

Description

Hi

while reversing a rather large Java project, I got this strange error:

javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 138678; columnNumber: 46; Le type d'élément "enumeration-literal" doit se terminer par la balise de fin correspondante 

I have no clue what this is about, we have no XML code in our source. It doesn’t seem to relate to anything in the source code, more like a problem with Java Designer module itself.

Thanks

console.png - Console log and XML file example (265 KB) Christophe Malgouyres, 12 March 2012 15:24

History

#1 Updated by Christophe Malgouyres over 7 years ago

  • Status changed from New to Feedback

Hi,

your error message indicates an unexpected error happened during the java source file parsing phase. Java Designer generates an XML file once this parsing is done, but it failed somehow.

It seems to be something in an Enumeration declaration, maybe a commented area, an initialisation or something.

I can’t really identify what caused this error without having the source files. (not necessary the whole project, but at least the file causing the error.)

To help us find what went wrong and maybe find a workaround, could you please follow this procedure:

  • Launch modelio with the option -consoleLog (requires editing your shortcut)
  • Open the project you wanted to reverse sources into.
  • Launch the command triggering the error you posted earlier.
  • Open the XML file indicated in Modelio’s console log.
  • Look for an unclosed marker, it should be part of the Enumeration causing the error

=> now, you can find the source file causing the error, and add it here…

#2 Updated by Normand Rivard over 7 years ago

Hello

Just did that, but I must have missed something. Started Modelio with -consoleLog in the shortcut and re-did the test (with same result). Not sure where this console is supposed to show. I saw 2 .log files in Modelio’s folder, but none of them changed after the reverse.

I am missing something? Thx

#3 Updated by Christophe Malgouyres over 7 years ago

#4 Updated by Christophe Malgouyres over 7 years ago

I added a screenshot here with:

  • My Modelio shortcut
  • Modelio on the right, with an edited file C1.
  • The console log window in the top left, containing some traces about the reverse.
  • An example of XML file created from C1 during the reverse.

Hope this helps…

#5 Updated by Normand Rivard over 7 years ago

Thanks, it actually helped. This console is well hidden!

The XML snippet reads like this:

...
<group name="D:\Projets\20120923_CartePrepayee_20120308\auportADCommunModele\src\fcdq\auport\adcommun\servicepublic\outil\bloc\BlocElement.java">
...
<enumeration id="_5199" name="Format"  visibility="Public" is-leaf="false" is-abstract="false">
<enumeration-literal name="STRING_DEFAUT" ></group>
<group name="D:\Projets\20120923_CartePrepayee_20120308\auportADCommunModele\src\fcdq\auport\adcommun\servicepublic\outil\bloc\BlocElementType.java">
<element-import>
...

I am not allowed to send any source code on the internet, so I’m afraid your investigation will be limited with this console file. You can see on the second line above that the group end tag is indeed closing but the previous enumeration-literal start tag was never closed. The BlocElement source file defines an @interface with 2 enum inside. One of them is called Format and has a lot of values defined inside. For some reason, the XML only shows the first one called STRING_DEFAULT and then interrupts the list, going directly to </group>

Not sure it helps you…

#6 Updated by Normand Rivard over 7 years ago

In case it also helps, this is what was in the console:

trace: Finalizing the session 0
Modelio/ModelerModule 7.1.04 - Copyright 2008-2012 Modeliosoft
Initialisation du mdac "ModelingWizard"
Modelio/ModelingWizard 4.0.03 - Copyright 2008-2011 Modeliosoft
Modelio/JavaDesigner 2.0.13 - Copyright 2008-2012 Modeliosoft
Parsing start at 12 Mar 2012 14:45:11 GMT
Reversing C:\DOCUME~1\ascj148\LOCALS~1\Temp\java4258032703403306879.xml into 'AccesD' {b4f16388-69f7-11e1-aa43-e89d87b6602c} Package
Start of reverse core at 12 Mar 2012 14:46:43 GMT
Unmarshal at 12 Mar 2012 14:46:43 GMT
End of reverse core at 12 Mar 2012 14:46:44 GMT
java.lang.InterruptedException
        at com.modeliosoft.modelio.javadesigner.reverse.RTReverseProgressBar.run(RTReverseProgressBar.java:74)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

#7 Updated by Christophe Malgouyres over 7 years ago

Thank you, i believe it’s the initialization of the STRING_DEFAUT value that caused JavaDesigner to fail instead of generating the appropriate content and adding < /enumeration-literal >< /enumeration >.

I know FJA fixed a few things about enums in the parsing part of the reverse (for now, only in his branch).

For example, this code is breaking the reverse in 2.0.13, but working fine in 2.1.00:

1public enum E{
2   A (-1/* a comment here*/), B(-12); 
3
4   E(int value) {
5     // do something
6   }
7}

Without the enum declaration itself, i can only hope your problem is part of those fixes…

#8 Updated by Normand Rivard over 7 years ago

I can only say there is no comment inside the enum declaration. It’s just a long list of values :

    public enum Format {
        
        STRING_DEFAUT(Type.STRING.type(), "TrimPadDroiteBlanc"),
        STRING_NUMERIQUE(Type.STRING.type(), "TrimPadGaucheZero"),
...

#9 Updated by Christophe Malgouyres over 7 years ago

  • Assignee set to François Jaouen
  • Target version set to 2.1.00

Thank you, it should be enough for now. Strings in initializations are reversed, but not method calls like ‘Type.STRING.type()’…

Assigning the issue, it should be fixed in 2.1.00 when the new reverse branch is merged.

#10 Updated by François Jaouen over 7 years ago

fix committed 17/04/12 11:42

#11 Updated by Christophe Malgouyres over 7 years ago

  • Status changed from Feedback to Resolved

#12 Updated by Normand Rivard over 7 years ago

Any target date for release 2.1.0? I am really looking for this fix.

Thx

#13 Updated by Christophe Malgouyres over 7 years ago

We’re currently doing our final tests before release, 2.1.0 should be uploaded this week.

Also available in: Atom PDF