[ 
http://jira.codehaus.org/browse/JIBX-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=258579#action_258579
 ] 

Johann Burkard commented on JIBX-422:
-------------------------------------

Don,

sorry, I will not create an example for three reasons:

# No time. I have a lot of personal and professional projects and the last 
thing I am interested in right now is creating test cases for other people's 
software bugs, especially if I don't even use their software in the first place 
and only my employer does.
# Creating a file, especially after path manipulation, without creating its 
parent directory will not work. This is clear from the Apidoc.
# I have no idea if I even could reproduce this bug since I have almost zero 
knowledge of JiBX and anything that starts with "X" isn't very high on my list, 
either.

With that said, I found another case of writing to files without having created 
their parent directories first, this time in MungedClass. This is how I patched 
the class:

{code}
            File directory = new File
                (root, pack.replace('.', File.separatorChar));
            String cpath = directory.getCanonicalPath();
            if (s_directories.get(cpath) == null) {
                File dir = new File(cpath);
                if (!dir.exists()) {
                        dir.mkdirs();
                }
                File[] matches = dir.listFiles(new JiBXFilter());
{code}

With these two changes, I could compile the bindings through Maven.

> NullPointerExceptions and wrong paths when using the JiBX Maven plugin
> ----------------------------------------------------------------------
>
>                 Key: JIBX-422
>                 URL: http://jira.codehaus.org/browse/JIBX-422
>             Project: JiBX
>          Issue Type: Bug
>          Components: maven plugin
>    Affects Versions: JiBX 1.2.2, JiBX 1.2.3
>         Environment: Ubuntu Linux, Maven 3 something
>            Reporter: Johann Burkard
>            Assignee: Don Corley
>
> I have been trying to get the Maven-JiBX plugin to work on a project I work 
> on. The binding files are in src/main/binding
> With maven-jibx-plugin 1.2.3, jibx-run 1.2.2 and jibx-extras 1.2.2 in the 
> dependencies, I get:
> {code}
> Caused by: java.lang.NullPointerException
>       at 
> org.jibx.binding.classes.MungedClass.checkDirectory(MungedClass.java:238)
>       at org.jibx.binding.classes.BoundClass.getInstance(BoundClass.java:405)
>       at org.jibx.binding.classes.BoundClass.getInstance(BoundClass.java:443)
>       at org.jibx.binding.def.ObjectBinding.<init>(ObjectBinding.java:294)
> {code}
> With maven-jibx-plugin 1.2.2, jibx-run 1.2.2 and jibx-extras 1.2.2 in the 
> dependencies, I get:
> {code}
> Caused by: java.io.FileNotFoundException: 
> .../.hudson/jobs/<jobname>/workspace/<project>/target/classes/config/<project>/bindings/<project>/JiBX_binding_<project>_request_commonFactory.class
>  (No such file or directory)
>       at java.io.FileOutputStream.open(Native Method)
>       at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
>       at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
>       at org.jibx.binding.classes.ClassFile.writeFile(ClassFile.java:1999)
>       at 
> org.jibx.binding.classes.MungedClass.writeChanges(MungedClass.java:424)
> {code}
> Note that /target/classes/config? Shouldn't that be /target/classes?
> Thanks

-- 
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

        

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to