MSketchPane in app, error on loading

User c30a4b265a

11-09-2009 22:03:48

Hi, I am using Marvin version 5.2.3, in a desktop app running under Windows XP Pro Service Pack 3, and Java 6, build 16.


Something a big nonstandard I am doing is loading my own molecule templates for the MSketch toolbar at the bottom of the drawing pane.


Sometimes it works just fine, other times I get an error "Molfile cannot be loaded because an error occurred: java.util.zip.ZipException: invalid stored block lengths, #10200".  The stacktrace with the details is attached.


The code used to actually initialize the MSketchPane is given below.  Does anyone know what might be wrong and how it can be addressed???


     Thanks!


     Barry




 


    public void useCustomTemplates(String path)
    {
      if (path != null) {
        //Strip any leading drive spec - causes a problem in MSketchPane:
        int ind= path.indexOf(":");
        if (ind > -1)
          path= path.substring(ind+1);


        String params= "ttmpls0=:Barry's:" + path + "\n";
        MSketchPane locSketchPane = new chemaxon.marvin.beans.MSketchPane();
        locSketchPane.setParams(params);
        mainPanel.remove(molSketchPane);
        mainPanel.add(locSketchPane, java.awt.BorderLayout.CENTER);
        molSketchPane= locSketchPane;
      }


    }


 

ChemAxon 909aee4527

14-09-2009 12:40:40

Hi Barry,


does it mean the problem occurs only if you use the custom templates?


Btw. is it necessary to recreate the MSketchPane component in the method you posted?
You could simply set the parameters to the MSketchPane that already exists, couldn't you?


(So far we did not manage to reproduce the problem.)


Kind regards,
Judit

User c30a4b265a

14-09-2009 16:46:53

Hi Judit - as far as recreating the MSketchPane, the reason I am doing that is to try to get rid of these Exceptions.  The API doc for setParams(java.lang.String s), says "Sets the parameter string. Must be called before any other property setting method.", so I was thinking that this might be some consequence of whatever is going on internally in MSketchPane that invalidates the method call if it's not the very first one, and tried to fix it by constructing MSketchPane just prior to the call to setParams(). 


The Exceptions don't occur consistently - sometimes it works fine, and sometimes I get that, so it's not easy to put my finger on precisely why it's happening, that's why I am asking for help.


I don't *think* there is anything wrong with the templates file (an SD file) - at least it looks ok by eye, plus other code of my own to read up SD files and display them in a JTable works fine with that file, and even MSketchPane works properly using it, some of the time.  I am attaching the SD template file here though, for your review - perhaps I missed something?


I didn't see this error in my very first test, but of course that was a simple modification of the SketchTemplates.java example, which just brings up the editor once and that's it.


   Thanks for your help,


   Barry


 

User c30a4b265a

14-09-2009 18:00:36

Hi, here is a bit more information - I have now tried simply commenting out the section where I use the custom ring templates so that isn't used at all, and then running the app so as to bring up the dialogs with MSketchPane repeatedly (I have 3 dialogs that use it), and then just canceling the dialogs... it's again somewhat random in terms of when it occurs, but after 3, 4 or 5 invocations, I get an exception. 


The trace from this one out of Netbeans runtime window is below, and I have also attached images of the Marvin error dialog trace info again, which looks similar (perhaps the same) as that was before:




Exception occurred during event dispatching:
java.lang.NullPointerException
        at java.io.StringReader.<init>(StringReader.java:33)
        at chemaxon.marvin.sketch.AbbrevGroupCollection.<init>(AbbrevGroupCollection.java:62)
        at chemaxon.marvin.sketch.swing.SketchPanel.molLoaderFinished(SketchPanel.java:3344)
        at chemaxon.marvin.util.MolLoader.run(MolLoader.java:371)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
        at java.awt.Dialog$1.run(Dialog.java:1045)
        at java.awt.Dialog$3.run(Dialog.java:1097)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:1095)
        at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:853)
        at chemaxon.marvin.common.swing.modules.ExceptionFrame.runErrorDialog(ExceptionFrame.java:167)
        at chemaxon.marvin.common.swing.modules.ExceptionFrame.show(ExceptionFrame.java:141)
        at chemaxon.marvin.common.swing.modules.ExceptionFrame.access$000(ExceptionFrame.java:29)
        at chemaxon.marvin.common.swing.modules.ExceptionFrame$1.run(ExceptionFrame.java:98)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
        at java.awt.Dialog$1.run(Dialog.java:1045)
        at java.awt.Dialog$3.run(Dialog.java:1097)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:1095)
        at java.awt.Component.show(Component.java:1563)
        at java.awt.Component.setVisible(Component.java:1515)
        at java.awt.Window.setVisible(Window.java:841)
        at java.awt.Dialog.setVisible(Dialog.java:985)
        at sde.SDEView.pubchemQueryItemActionPerformed(SDEView.java:1318)
        at sde.SDEView.access$1600(SDEView.java:73)
        at sde.SDEView$12.actionPerformed(SDEView.java:656)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
        at java.awt.Component.processMouseEvent(Component.java:6263)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
        at java.awt.Component.processEvent(Component.java:6028)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


 

ChemAxon 909aee4527

15-09-2009 13:10:48

Hi Barry,


thanks for the more information.


If the exception always appeared it could mean that the jar file is corrupt. Since it's not the case, we have some ideas, but these are just hints, we haven't faced with this problem yet.



I am sorry that we can only give such hints that require extra efforts from you and might not bring a solution.


In the meanwhile we continue to investigate the problem.


Kind regards,
Judit

User e7455c8684

03-02-2010 14:56:52

As I'm compiling a project with java6, this problem happens all the time, and we are not using any custom template.


java.util.zip.ZipException: invalid stored block lengths
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
    at java.io.FilterInputStream.read(FilterInputStream.java:116)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
    at chemaxon.marvin.io.PositionedInputStream.bufincRead(PositionedInputStream.java:182)
    at chemaxon.marvin.io.PositionedInputStream.init(PositionedInputStream.java:138)
    at chemaxon.marvin.io.PositionedInputStream.<init>(PositionedInputStream.java:131)
    at chemaxon.formats.MolInputStream.<init>(MolInputStream.java:114)
    at chemaxon.marvin.util.MolLoader.loadMol(MolLoader.java:597)
    at chemaxon.marvin.util.MolLoader.run(MolLoader.java:418)
    at java.lang.Thread.run(Thread.java:637)

ChemAxon 909aee4527

03-02-2010 15:21:34

Hi,


this problem seems to be a bit different, since this is not related to Abbreviated Groups.


Which version do you use? Is it an applet or a bean? Do you set any input molecule?


Kind regards,
Judit

User e7455c8684

03-02-2010 16:34:35

there is another stack trace from the console:


[javaWrapper] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
[javaWrapper]     at chemaxon.marvin.sketch.AbbrevGroupCollection.<init>(AbbrevGroupCollection.java:108)
[javaWrapper]     at chemaxon.marvin.sketch.swing.SketchPanel.setUsrAbbrevGroups(SketchPanel.java:3422)
[javaWrapper]     at chemaxon.marvin.sketch.swing.TemplateHandler.templateLoadingFinished(TemplateHandler.java:249)
[javaWrapper]     at chemaxon.marvin.sketch.swing.SketchPanel.molLoaderFinished(SketchPanel.java:3341)
[javaWrapper]     at chemaxon.marvin.util.MolLoader.run(MolLoader.java:371)
[javaWrapper]     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
[javaWrapper]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
[javaWrapper]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
[javaWrapper]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
[javaWrapper]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:205)
[javaWrapper]     at java.awt.Dialog$1.run(Dialog.java:1045)
[javaWrapper]     at java.awt.Dialog$3.run(Dialog.java:1097)
[javaWrapper]     at java.security.AccessController.doPrivileged(Native Method)
[javaWrapper]     at java.awt.Dialog.show(Dialog.java:1095)
[javaWrapper]     at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:853)
[javaWrapper]     at chemaxon.marvin.common.swing.modules.ExceptionFrame.runErrorDialog(ExceptionFrame.java:167)
[javaWrapper]     at chemaxon.marvin.common.swing.modules.ExceptionFrame.show(ExceptionFrame.java:141)
[javaWrapper]     at chemaxon.marvin.common.swing.modules.ExceptionFrame.access$000(ExceptionFrame.java:29)
[javaWrapper]     at chemaxon.marvin.common.swing.modules.ExceptionFrame$1.run(ExceptionFrame.java:98)
[javaWrapper]     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
[javaWrapper]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
[javaWrapper]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
[javaWrapper]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
[javaWrapper]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
[javaWrapper]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
[javaWrapper]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
[javaWrapper]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


 


I'm using Jchem 5.2.04p1.jar, it's webstart application, I didn't set any input molecule.


Best,


 


Jun

ChemAxon 909aee4527

05-02-2010 08:14:32

Dear Jun,


thank you for the details.


One more thing that could help us is your marvin.properties file if you can show it to us.
It should be located at userhome/(.)chemaxon/marvin.properties.


I suspect that it can be affected by the molecules in My Templates (being stored in this file).


Thanks,
Judit

User e7455c8684

05-02-2010 13:27:07

#Marvin parameters
#Thu Jan 21 08:05:18 EST 2010
tmpls128=*My Templates*chemaxon/marvin/templates/custom.t

ChemAxon 909aee4527

05-02-2010 14:04:44

Can you please try to edit the file, so that it contains only this:


#Marvin parameters
#Thu Jan 21 08:05:18 EST 2010
tmpls128=*My Templates*


(so please remove the path completely)


Is there any change this way?

User e7455c8684

05-02-2010 14:39:13

it fixed the problem, but is there a better solution?


since it will be deployed as a webstart app, many users might encounter this problem themselves.


 


Update:


Sorry, it appeared the problem is still there


 


Update again:


It appeared that the problem no longer happens every time, just occasionally.

ChemAxon 909aee4527

08-02-2010 14:50:49

Well, the problem should not happen with the 5.3 series where the whole template handling was redesigned.


Would it be a solution for you to upgrade? I understand that people usually don't upgrade to a fresh major release.

ChemAxon 909aee4527

10-02-2010 16:10:03

It seems the problem is not related to template handling, this seems to be an threading related problem in the import. Upgrading to 5.3 will not be a solution.


We will notify you as soon as we can fix the issue. We handle it with high priority.


There is another forum post that looks like the same problem: http://www.chemaxon.com/forum/ftopic5759.html


Kind regards,
Judit

ChemAxon 909aee4527

15-02-2010 10:57:00

Update: it seems that my colleagues have already fixed this problem in 5.3.


Please tell us if you do not prefer to upgrade to 5.3 yet and you need the fix in 5.2.x.