Menu

#113 IUPACNAmeGenerator java.lang.NullPointerException issue

ambit-3.0.3
open
None
5
2019-09-10
2019-09-08
No

Hi all,

Thank you for this amazing library. I cam across the structure2name package, and decided to try the IUPACNameGenerator, which offers a capability I really need.
Unfortunately, I get a java.lang.NullPointerException when using the process function. See code below:

public class Test {
    public static void main(String[] args) throws Exception {
        IChemObjectBuilder  builder = SilentChemObjectBuilder.getInstance();
        SmilesParser    smiParser       = new SmilesParser(builder);    
        IUPACNameGenerator iupacNG = new IUPACNameGenerator();
        IAtomContainer atc = smiParser.parseSmiles("CC(=O)OC");
        System.out.println(atc == null);
        System.out.println(iupacNG.generateIUPACName(atc));
}
}

This code returns false on the atc==null test, and an exception:

Exception in thread "main" java.lang.NullPointerException
    at ambit2.structure2name.IUPACNameGenerator.generateIUPACName(IUPACNameGenerator.java:39)
    at camer.Test.main(Test.java:21)

Could you please help me solve this?

Best,
Yannick

Discussion

  • Nina Jeliazkova

    Nina Jeliazkova - 2019-09-09
    • assigned_to: Nikolay Kochev
     
  • Nina Jeliazkova

    Nina Jeliazkova - 2019-09-09
    • try using latest ambit 4.0.0-SNAPSHOT
    • AFAIK the structure2name package is not yet completely functional, Nick could help with details
     
  • Nikolay Kochev

    Nikolay Kochev - 2019-09-09

    Dear Yannick
    Thank you for the interest with Ambit module structure2name
    structure2name module is currently under development and it is a quite far way from being useable at all.

     
  • Yannick Djoumbou

    Hi Nikolay,
    Thank you for your quick reply.

    Best,
    Yannick

     

Log in to post a comment.