NPE in MoleculeGraph.clean

User d5d3760021

19-05-2016 18:21:44

I encountered the following NPE:


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at chemaxon.struc.MoleculeGraph.regenCtabs(Unknown Source)
at chemaxon.struc.MoleculeGraph.getCtab(Unknown Source)
at chemaxon.struc.MoleculeGraph.findBasicFrags0(Unknown Source)
at chemaxon.struc.MoleculeGraph.findBasicFrags(Unknown Source)
at chemaxon.calculations.clean.Clean2D.cleanMoleculeStructure(Clean2D.java:1134)
at chemaxon.calculations.clean.Clean2D.clean(Clean2D.java:669)
at chemaxon.calculations.clean.Clean2D.clean(Clean2D.java:650)
at chemaxon.calculations.clean.Cleaner.cleanMolGraph(Cleaner.java:240)
at chemaxon.calculations.clean.Cleaner.cleanMol(Cleaner.java:325)
at chemaxon.calculations.clean.Cleaner.clean(Cleaner.java:64)
at chemaxon.calculations.clean.CleanerUtil.clean(CleanerUtil.java:28)
at chemaxon.struc.MoleculeGraph.clean(Unknown Source)
at chemaxon.struc.MoleculeGraph.clean(Unknown Source)



 


When I run code that looks like this:


      RxnMolecule rxn = new RxnMolecule();
      Molecule m = data.getMolecule();
      rxn.addComponent(m,RxnMolecule.REACTANTS);
      rxn.addComponent(m,RxnMolecule.PRODUCTS);
      rxn.clean(2,"");

where I'm constructing an "identity" reaction and then arranging its components. On the other hand, if I call "Clean in 2D" from the MarvinSketch GUI, then it works, which is why it took me a little bit longer to figure out that I must call cloneMolecule. I'm not sure what addComponent's beNew parameter means, but it didn't help.


I've got a working solution, so this post is just in case ChemAxon cares about NPE that arise when someone's misusing its API.


 


 






































Product Version:



MarvinSketch 6.0.1



Build Date:



2013-06-21



Internal build id:



6.0.1_b94



Operating System:



x86_64 Mac OS X 10.11.4



Java:



Oracle Corporation Java 1.7.0_79



Memory:



3641.0M maximum, 245.5M total, 192.4M free



Environment:



Application



Browser:



-



 


 


 


 


 


 


 

ChemAxon cbb451ac1e

23-05-2016 09:21:34

Hello Amos,


Thank you for sharing this information. Most appreciated!


Best regards,