Which is besides maybe not very robust behaviour of cdk, I think.
This, if you agree it should be fixed in CDK, suggests a test case
where cor.read() is simply called twice.

Because the JCP code sequentially tests if SMILESReader.accepts
IChemFile.class, MoleculeSet.class, and others *WITHOUT checking if
the IChemFile was actually read, the file was attempted to be read
twice in succession, namely into an IChemFile and into a MoleculeSet.
The latter of which then bombed.

This is simple to fix though - surely just use "else if" instead of only if?

Which is besides maybe not very robust behaviour of cdk, I think.
This, if you agree it should be fixed in CDK, suggests a test case
where cor.read() is simply called twice.

I'm guessing this should thrown an IOException… in effect this is what is happening:

        BufferedReader reader = new BufferedReader(new StringReader("hello"));
        reader.readLine();
        reader.readLine();

Thread AWT-EventQueue-0 (Suspended (exception NullPointerException))
SMILESReader.readMoleculeSet(IMoleculeSet) line: 184

Also I noticed with this you're on the event dispatch thread. You should probably change this so
IO is done on a worker and the GUI isn't locked up.

http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html


On 16 Oct 2012, at 08:39, ralf@ark.in-berlin.de wrote:

Actually, it's a JCP bug in that JCP relied up to that commit on
undocumented behaviour of the SMILESReader.accepts function,
specifically that the result from accepts() are mutually exclusive
when called with several classes as parameters; the commit changed
this, as now both IMolecule and IChemFile are accepted.
Because the JCP code sequentially tests if SMILESReader.accepts
IChemFile.class, MoleculeSet.class, and others *WITHOUT checking if
the IChemFile was actually read, the file was attempted to be read
twice in succession, namely into an IChemFile and into a MoleculeSet.
The latter of which then bombed.

Which is besides maybe not very robust behaviour of cdk, I think.
This, if you agree it should be fixed in CDK, suggests a test case
where cor.read() is simply called twice.


Regards,
ralf

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Cdk-devel mailing list
Cdk-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-devel