Skip to content

Commit

Permalink
Added check if results not equal size as request
Browse files Browse the repository at this point in the history
  • Loading branch information
olas committed Jul 12, 2012
1 parent 87ca409 commit c64015d
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -312,6 +312,11 @@ private List<ICDKMolecule> getMoleculesWithExtendedInfo(int[] results, IProgress
} catch (RemoteException e1) {
e1.printStackTrace();
}

if (info.length!=results.length){
logger.warn("Chemspider results and extendedinfo do not have same " +
"size: info=" + info.length + " and results=" + results.length);
}

for (int i = 0; i< results.length; i++){
int crid = results[i];
Expand All @@ -325,7 +330,7 @@ private List<ICDKMolecule> getMoleculesWithExtendedInfo(int[] results, IProgress
//Set properties on mol from Chemspider info
ICDKMolecule cdkmol = cdk.asCDKMolecule(csmol);

if (info!=null && info[i]!=null){
if (info!=null && i<info.length && info[i]!=null){
cdkmol.setProperty("chemspider.commonname", info[i].getCommonName());
cdkmol.setProperty("chemspider.inchi", info[i].getInChI());
cdkmol.setProperty("chemspider.inchikey", info[i].getInChIKey());
Expand Down

0 comments on commit c64015d

Please sign in to comment.