NullPointerException after upgrading to JChem 5.12

User 7a902f260f

16-04-2013 14:28:09

 


Hi all,


I recently upgraded my libs to the latest JChem version (5.12) from 5.6, and I am encountering a NullPointerException at startup of my client.  I have a thick client with an embedded Marvin Sketch, and I am getting the following stack trace: 


Exception in thread "Thread-15" java.lang.NullPointerException
at java.lang.System.arraycopy(Native Method)
at java.lang.String.getChars(String.java:854)
at com.ctc.wstx.sw.BufferingXmlWriter.writeRaw(BufferingXmlWriter.java:298)
at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:440)
at chemaxon.marvin.io.formats.cml.CMLExport.writeNewLineToStream(CMLExport.java:374)
at chemaxon.marvin.io.formats.cml.CMLExport.close(CMLExport.java:314)
at chemaxon.marvin.io.formats.cml.MrvExport.close(MrvExport.java:2278)
at chemaxon.formats.MolExporter.close(MolExporter.java:833)
at chemaxon.formats.MolExporter.close(MolExporter.java:813)
at chemaxon.marvin.sketch.templates.TemplateSetLocation.save(TemplateSetLocation.java:266)
at chemaxon.marvin.sketch.templates.TemplateLibrary.setMyTemplates(TemplateLibrary.java:170)
at chemaxon.marvin.sketch.swing.templates.TemplateHandler.getMoleculesWithAbbreviations(TemplateHandler.java:642)
at chemaxon.marvin.sketch.swing.SketchPanel$10.run(SketchPanel.java:3483)



That stacktrace also shows up when I try to copy and paste structures.  Displaying them seems to work fine though.  Any suggestions as to what is causing this?

ChemAxon 25dcd765a3

18-04-2013 07:35:12

It seems to be some problem when the sketcher wants to import the template library.


The Marvin GUI team will follow up.

ChemAxon 5433b8e56b

18-04-2013 13:02:29

Hi, 


can you attach your marvin.mytemplates file from %USERHOME%\chemaxon directory please?


Regards,
Istvan 

User 7a902f260f

18-04-2013 14:01:01

Here is my marvin.templates file (renamed with .txt extension so the forum will alllow me to upload).  It looks fairly empty....

User 7a902f260f

18-04-2013 21:44:53

So here are a few things that I found out while dealing with this issue.  First off, the marvin.mytemplates file that Marvin generates is an invalid XML file as it does not have an end tag for cml.  This is likely caused by the fact that it encounters a NullPointerException before it can finish writing to the file and closing the XML.  Now after searching the forums, it seems like if I modify my marvin.mytemplates file to this:




<?xml version='1.0' encoding='UTF-8'?><cml version="ChemAxon file format v5.10.0, generated by v5.12.2">
<MDocument>
</MDocument>
</cml>

then I don't see the stacktrace anymore.  But I don't know if this breaks anything due to it being empty....


 

ChemAxon 2c555f5717

19-04-2013 09:16:41

I am suspicious: Where you testing your client on a Mac OS X?

User 7a902f260f

19-04-2013 13:09:05

Yes, I am testing on a Mac OS X.

User 7a902f260f

23-04-2013 20:01:56

So... is this a bug or am I doing something incorrectly?

ChemAxon 2c555f5717

26-04-2013 12:12:26

Sorry for the late answer: We have this phenomenon, of missin mytemplates file on Mac OS X, and it can appear in any suite... We could not reproduce it ever localy. However we work hard to localize the root of the problem and get rid of it. Thank you for the report. We are glad to hear that you have solved the issue. If you have anything else to ask, please do not heasitate to ask.


Regards:
Balázs 

User 7a902f260f

01-05-2013 19:58:57

Just to round out this discussion, I have found that the NullPointerException I was getting was due to having the  woodstox XML parser library in my classpath.  JChem 5.12 was picking that up and is not generating the mytemplates file properly.  This has been verified as a bug and a fix will be incoming.  Further discussion can be found here:


https://www.chemaxon.com/forum/ftopic10499.html