Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: JiBX 1.2.1
-
Fix Version/s: None
-
Component/s: CodeGen
-
Labels:None
-
Environment:HideApache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
Java version: 1.5.0_16
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.6" arch: "i386" Family: "unix"ShowApache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400) Java version: 1.5.0_16 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Default locale: en_US, platform encoding: MacRoman OS name: "mac os x" version: "10.5.6" arch: "i386" Family: "unix"
-
Number of attachments :
Description
Was attempting to write a maven plugin to generate java code and bindings from a schema during the maven build life cycle. Here is what the plugin is doing.
CodeGenCommandLine cmdLine = new CodeGenCommandLine();
cmdLine.processArgs(args);
CodeGen codegen = new CodeGen(cmdLine);
codegen.generate(true);
I am getting a null pointer exception on the generate call. Here is the stack trace.
java.lang.NullPointerException
at org.jibx.schema.codegen.CodeGen.generate(CodeGen.java:1388)
Looking at the source it appears that m_packageDirectory is null as its not being set. In the source it only appears that m_packageDirectory is getting set in the load method which is private and only called by the main method (which is why it works from the command line and not from a codeGen.generate).
I was able to statically call the main method from the CodeGen class to resolve the issue. If that is the intended use of the code generator perhaps the generate method should be moved to private or protected access. Or clearly state as such in the API documentation?