Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoSuchAtomException issue in MDLV2000Reader #388

Merged
merged 1 commit into from Nov 30, 2017
Merged

Conversation

galgonek
Copy link

In two lines of code, method 'readAtomContainer' of class
'MDLV2000Reader' uses variable 'molecule' instead of variable
'outputContainer'. If a loaded molfile contains a query bond, then
'molecule' and 'outputContainer' do not reference the same container.
This can cause an issue in next parts of the code because atoms are
searched in the empty container referenced by 'molecule'.

To reproduce the issue, you can use the following code:

import java.net.URL;
import org.openscience.cdk.io.MDLV2000Reader;
import org.openscience.cdk.silent.AtomContainer;

public class Test
{
public static void main(String[] args) throws Exception
{
URL url = new URL("http://www.ebi.ac.uk/chebi/saveStructure.do?"
+ "sdf=true&chebiId=48572");
new MDLV2000Reader(url.openStream()).read(new AtomContainer());
}
}

In two lines of code, method 'readAtomContainer' of class
'MDLV2000Reader' uses variable 'molecule' instead of variable
'outputContainer'. If a loaded molfile contains a query bond, then
'molecule' and 'outputContainer' do not reference the same container.
This can cause an issue in next parts of the code because atoms are
searched in the empty container referenced by 'molecule'.


To reproduce the issue, you can use the following code:

import java.net.URL;
import org.openscience.cdk.io.MDLV2000Reader;
import org.openscience.cdk.silent.AtomContainer;

public class Test
{
    public static void main(String[] args) throws Exception
    {
        URL url = new URL("http://www.ebi.ac.uk/chebi/saveStructure.do?"
                + "sdf=true&chebiId=48572");
        new MDLV2000Reader(url.openStream()).read(new AtomContainer());
    }
}
@johnmay
Copy link
Member

johnmay commented Nov 29, 2017

Thanks! Not sure how I missed that.

@johnmay johnmay closed this Nov 29, 2017
@exaexa
Copy link

exaexa commented Nov 29, 2017

Is this going to get merged?

@johnmay johnmay reopened this Nov 30, 2017
@johnmay johnmay merged commit 6cf1b9f into cdk:master Nov 30, 2017
@johnmay
Copy link
Member

johnmay commented Nov 30, 2017

Sorry clicked wrong button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants