User fe913a1448
28-11-2012 00:29:38
I am using JChem Version 5.11.3 with Java 7 and using an MSketchPane to retreive a Molecule from a sketch.
I have the following code executing a substructure search, where mol is a Molecule object:
try (Connection conn = ConnectionPool.getConnection()) {
final JChemSearch searcher = new JChemSearch();
searcher.setQueryStructure(mol);
final ConnectionHandler connHdl = new ConnectionHandler(conn, ConnectionHandler.DEFAULT_PROPERTY_TABLE);
searcher.setConnectionHandler(connHdl);
searcher.setStructureTable("structures");
final JChemSearchOptions options = new JChemSearchOptions(
SearchConstants.SUBSTRUCTURE);
searcher.setSearchOptions(options);
searcher.setResultTableMode(JChemSearch.NO_RESULT_TABLE);
searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE);
searcher.run();
while (searcher.isRunning()) {
;
}
final int cells = searcher.getResultCount();
}
Whenever I execute this code, an error occurs in the searcher, and I get the following stack trace:
java.lang.NullPointerException
at chemaxon.jchem.db.JChemSearch.printSearchInfo(JChemSearch.java:2932)
at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2847)
at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2489)
at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2207)
at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2236)
at edu.iup.chem.inventory.Test.findSubstructure(Test.java:48)
I'm not sure what is wrong, or what is causing the NullPointException here.
Any help would be much appreciated. Full source attached.