Skip to content

Problem with empty "COMPND" line in PDB file import #870

@JonasSchaub

Description

@JonasSchaub

Dear CDK developers,

I tried to import a PDB format file created with GaussView containing the structure of alanine (attached).
This raised an exception:

java.lang.StringIndexOutOfBoundsException: String index out of range: -4
at java.base/java.lang.String.substring(String.java:1841)
at org.openscience.cdk.io.PDBReader.readChemFile(PDBReader.java:397)
at org.openscience.cdk.io.PDBReader.read(PDBReader.java:198)

After looking into it, I think the problem is line 3 in the file that has the property key "COMPND". In the class PDBReader line 396 and following, the functionality tries to parse the rest of the line as a title for the imported compound. But it is not checked whether there is actually something more than just "COMPND" in the line. Maybe, you can add a check for the line length before it is parsed (as it is done above for "REMARK").

If I can be of any further help, please let me know!

Kind regards,
Jonas Schaub

Ala_PDB.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions