Skip to content

Instantly share code, notes, and snippets.

@egonw
Created June 1, 2010 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egonw/421022 to your computer and use it in GitHub Desktop.
Save egonw/421022 to your computer and use it in GitHub Desktop.
// CDK 1.3.5
import java.io.*;
import org.openscience.cdk.io.*;
import org.openscience.cdk.Molecule;
class ErrorHandler implements IChemObjectReaderErrorHandler {
public void handleError(String message) {
println message;
};
public void handleError(String message, Exception exception) {
println message + "\n -> " + exception.getMessage();
};
public void handleError(String message, int row, int colStart, int colEnd) {
print "location: " + row + ", " + colStart + "-" + colEnd + ": ";
println message;
};
public void handleError(String message, int row, int colStart, int colEnd, Exception exception) {
print "location: " + row + ", " + colStart + "-" + colEnd + ": ";
println message + "\n -> " + exception.getMessage();
};
}
reader = new MDLV2000Reader(new FileReader(args[0]))
reader.setErrorHandler(new ErrorHandler());
mol = reader.read(new Molecule());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment