Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Resolves two long standing errors in 'cdk-extra'. The method should t…
…hrow an exception when one tries to attach to an invalid atom number (e.g. 7-chlorohexane). The existing error was using the ParseException constructor incorrectly and thus would throw an error. The constructor is for generating error messages to do with syntax. As this is a semantic error the constructor did not function as intended. Simply replacing the use of this constructor with a normal error message resolves the issue.

Change-Id: I896e3a3d07322e0a98f317cb331f4ebfe66f8e15
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Aug 5, 2013
1 parent c4c63dd commit 4f5b704
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/main/org/openscience/cdk/iupac/parser/NomParser.jj
Expand Up @@ -119,18 +119,8 @@ public class NomParser {
{
if (Integer.parseInt(tok.image) > mainChainPrefix)
{
//Create a tiny 2D array with a single slot for data,
//insert 0 into it as as to reference the first slot in the stringArray
int [][] intArray = new int [1][1];
intArray [0][0] = 0;

//Put useful message in stringArray
String [] stringArray = new String [1];
stringArray [0] = " MUST BE BELOW " + (mainChainPrefix + 1) + " ";

tok.next = tok;

throw new ParseException (tok, intArray, stringArray);
String mesg = "invalid attachment point " + Integer.parseInt(tok.image) + " must be below " + (mainChainPrefix + 1);
throw new ParseException(mesg);
}
}
catch (NumberFormatException nfe)
Expand Down

0 comments on commit 4f5b704

Please sign in to comment.