Open ericjvandervelden opened 7 years ago
I also had this error running the xjc
task from an Ant script. Previous version 2.2.5 was OK. As far as I can see the task runs correctly but throws a BuildException anyway. Looking at the code:
https://github.com/javaee/jaxb-v2/blob/5d4083371d10b541fee9b2f74ae32a0ea00fc95e/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCBase.java#L729-L732
The variable ok
is set to false on line 670 but, if the process is not forked (which I think is the default) then it is never set to true and the code will always throw the exception.
Hope that helps.
I found out that in your samples that in build.xml you must add thefork="true"
attribute to the <xjc .../>. So for example in modify-marshal's build.xml:
<xjc schema=" po.xsd" package="primer.po" destdir="gen-src" fork="true">
...
</xjc>
When you do this, compile works, otherwise an error message appears. I think you should modify the samples at this point.
As a matter of interest what version of jaxb are you using? When I tried with 2.3.0 it wouldn't accept fork="true"
as an attribute.
Another workaround is to set failonerror="false"
.
The problem is in com.sun.tools.xjc.XJCBase.execute()
. There is a boolean ok
variable which is set to true
if and only if forked process returned status 0
. The variable is not set to true
in other cases - for instance if XJC is executed directly. However, the variable is checked later on in any case.
The fix is actually trivial: set ok
to true
after doXJC();
successfully completed.
Below is a reproducing test case.
I can provide a pull request with a fix. But first please tell me if you'll be willing to accept it (I am an official contributor with signed OCA) and against which branch should it be (jaxb-2.3.0
?). Don't get me wrong, I just don't want to invest time in a PR which will be in vain.
It should be fixed already in master: https://github.com/javaee/jaxb-v2/pull/1170
On Sun, Jun 3, 2018 at 10:51 PM, Alexey Valikov notifications@github.com wrote:
The problem is in com.sun.tools.xjc.XJCBase.execute(). There is a boolean ok variable which is set to true if and only if forked process returned status 0. The variable is not set to true in other cases - for instance if XJC is executed directly. However, the variable is checked later on in any case.
The fix is actually trivial: set ok to true after doXJC(); successfully completed.
Below is a reproducing test case.
jaxb2-sample-po-ant.zip https://github.com/javaee/jaxb-v2/files/2066338/jaxb2-sample-po-ant.zip
I can provide a pull request with a fix. But first please tell me if you'll be willing to accept it (I am an official contributor with signed OCA) and against which branch should it be (jaxb-2.3.0?). Don't get me wrong, I just don't want to invest time in a PR which will be in vain.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/javaee/jaxb-v2/issues/1147#issuecomment-394190445, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8ZtiDr8LO9PZ43cXlx3nrii3z0TC0Oks5t5ExugaJpZM4P4Dcb .
So, can this bug (and #1144) be closed?
Happy to test it if you need additional confirmation.
closing..
On Mon, Jun 4, 2018 at 5:51 PM, pedro-w notifications@github.com wrote:
So, can this bug (and #1144 https://github.com/javaee/jaxb-v2/issues/1144) be closed?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/javaee/jaxb-v2/issues/1147#issuecomment-394404847, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8Ztj0cVcPImLb4Hr0c07ICTJiw1n-9ks5t5Vd9gaJpZM4P4Dcb .
Hello,
In the build.xml of the modify-marshal sample there is:
This does not work on my machine with java 8. When I do in the modify-marshal sample (in eclipse) : ant compile, then the Java files are generated, but then I see an error: