Skip to content

Commit

Permalink
Fail if a molecule was not atom typed - otherwise this cause a runtim…
Browse files Browse the repository at this point in the history
…e exception in the aromaticity CDK model.

Signed-off-by: Stephan Beisken <sbeisken@gmail.com>
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Dec 18, 2013
1 parent 9abeacc commit d7c629b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.common.io.CharStreams;
import org.junit.Assert;
import org.junit.Test;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.CDKTestCase;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.aromaticity.Aromaticity;
Expand Down Expand Up @@ -396,6 +397,14 @@ public void match(String smarts, String smiles) throws Exception {
while (reader.hasNext()) {
IAtomContainer container = (IAtomContainer) reader.next();
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);

// skip un-typed atoms, they can't be run through the CDK aromatic
// model
for (IAtom atom : container.atoms()) {
if (atom.getAtomTypeName() == null)
Assert.fail("a atom could not be typed by the CDKAtomTypeMatcher");
}

if (sqt.matches(container)) {
nmatch++;
}
Expand Down

0 comments on commit d7c629b

Please sign in to comment.