User 6686efeff7
09-02-2009 14:33:57
Hi
I am getting a ArrayIndexOutOfBoundsException when running concurrent search using JChemBase.
I am using JChem 5.1.2
Platform Windows XP SP2 / Java 1.6
The code that is called concurrently by the two threads and the exception stack trace is given below.
Thanks
Wiraj
CODE:
public int[] find( String smiles, int jChemSearchType ) throws ChemistryException
{
try
{
if ( SMILESRecognizer.canBeSMILES( smiles ))
{
JChemSearch searcher = new JChemSearch();
searcher.setQueryStructure(smiles);
searcher.setConnectionHandler(wrapper.getHandler());
searcher.setStructureTable( DatabaseConstants.TABLE_NAME );
JChemSearchOptions searchOptions = new JChemSearchOptions();
searchOptions.setSearchType( jChemSearchType );
searcher.setSearchOptions(searchOptions);
// searcher.setRunMode( JChemSearch.RUN_MODE_SYNCH_COMPLETE );
runSearch( searcher );
int ids[] = searcher.getResults();
return ids;
}
return new int[0];
}
catch (SQLException e)
{
throw new ChemistryException( e );
}
}
private void runSearch(JChemSearch searcher) throws ChemistryException
{
assert ( searcher != null );
try
{
searcher.run();
}
catch (MolFormatException e)
{
throw new ChemistryException ( e );
}
catch (DatabaseSearchException e)
{
throw new ChemistryException ( e );
}
catch (SQLException e)
{
throw new ChemistryException ( e );
}
catch (IOException e)
{
throw new ChemistryException ( e );
}
catch (PropertyNotSetException e)
{
throw new ChemistryException ( e );
}
}
Thread 1 stack trace
java.lang.ArrayIndexOutOfBoundsException: 2
at chemaxon.enumeration.QueryBondListEnumerator.generateOutMol(QueryBondListEnumerator.java:164)
at chemaxon.enumeration.BondListEnumerator.nextElement0(BondListEnumerator.java:138)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.MolEnumerator.nextElement(MolEnumerator.java:560)
at chemaxon.jchem.db.JChemSearch.enumeratedSearch(JChemSearch.java:5237)
at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2524)
at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)
at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)
at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)
Thread 2 stack trace
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.remove(ArrayList.java:392)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:470)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.MolEnumerator.nextElement(MolEnumerator.java:560)
at chemaxon.jchem.db.JChemSearch.enumeratedSearch(JChemSearch.java:5237)
at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2524)
at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)
at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)
at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)
I am getting a ArrayIndexOutOfBoundsException when running concurrent search using JChemBase.
I am using JChem 5.1.2
Platform Windows XP SP2 / Java 1.6
The code that is called concurrently by the two threads and the exception stack trace is given below.
Thanks
Wiraj
CODE:
public int[] find( String smiles, int jChemSearchType ) throws ChemistryException
{
try
{
if ( SMILESRecognizer.canBeSMILES( smiles ))
{
JChemSearch searcher = new JChemSearch();
searcher.setQueryStructure(smiles);
searcher.setConnectionHandler(wrapper.getHandler());
searcher.setStructureTable( DatabaseConstants.TABLE_NAME );
JChemSearchOptions searchOptions = new JChemSearchOptions();
searchOptions.setSearchType( jChemSearchType );
searcher.setSearchOptions(searchOptions);
// searcher.setRunMode( JChemSearch.RUN_MODE_SYNCH_COMPLETE );
runSearch( searcher );
int ids[] = searcher.getResults();
return ids;
}
return new int[0];
}
catch (SQLException e)
{
throw new ChemistryException( e );
}
}
private void runSearch(JChemSearch searcher) throws ChemistryException
{
assert ( searcher != null );
try
{
searcher.run();
}
catch (MolFormatException e)
{
throw new ChemistryException ( e );
}
catch (DatabaseSearchException e)
{
throw new ChemistryException ( e );
}
catch (SQLException e)
{
throw new ChemistryException ( e );
}
catch (IOException e)
{
throw new ChemistryException ( e );
}
catch (PropertyNotSetException e)
{
throw new ChemistryException ( e );
}
}
Thread 1 stack trace
java.lang.ArrayIndexOutOfBoundsException: 2
at chemaxon.enumeration.QueryBondListEnumerator.generateOutMol(QueryBondListEnumerator.java:164)
at chemaxon.enumeration.BondListEnumerator.nextElement0(BondListEnumerator.java:138)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.MolEnumerator.nextElement(MolEnumerator.java:560)
at chemaxon.jchem.db.JChemSearch.enumeratedSearch(JChemSearch.java:5237)
at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2524)
at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)
at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)
at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)
Thread 2 stack trace
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.remove(ArrayList.java:392)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:470)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)
at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)
at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)
at chemaxon.enumeration.MolEnumerator.nextElement(MolEnumerator.java:560)
at chemaxon.jchem.db.JChemSearch.enumeratedSearch(JChemSearch.java:5237)
at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2524)
at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)
at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)
at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)