[ http://jira.codehaus.org/browse/JIBX-294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=173677#action_173677 ]
Ken Preudhomme commented on JIBX-294: ------------------------------------- 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? > Programmatically calling CodeGen.generate (from a maven plugin) causes a > NullPointerException > ---------------------------------------------------------------------------------------------- > > Key: JIBX-294 > URL: http://jira.codehaus.org/browse/JIBX-294 > Project: JiBX > Issue Type: Bug > Components: CodeGen > Affects Versions: JiBX 1.2.1 > Environment: Apache 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" > Reporter: Ken Preudhomme > > 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). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ jibx-devs mailing list jibx-devs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-devs