[jira] [Commented] (CXFXJC-34) Code generation breaks on boolean restricted to 0 or 1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (CXFXJC-34) Code generation breaks on boolean restricted to 0 or 1

Andriy Redko (Jira)

    [ https://issues.apache.org/jira/browse/CXFXJC-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16925411#comment-16925411 ]

Ruud de Jong commented on CXFXJC-34:
------------------------------------

[~cyril4j] there does not seem to be any update. Apparantly, there is a [fix|https://github.com/eclipse-ee4j/jaxb-ri/commit/0042068395f720bbe368762832e33ede1141f67a], but not yet a release.

You could downgrade your JAXB dependency to 2.2 as a workaround.

For me, I'm using this plugin only for code generation before compile phase.

I force the plugin to use JAXB 2.2 during code generation, but there is no problem in using JAXB 2.3 on runtime.

We are using Java 11

> Code generation breaks on boolean restricted to 0 or 1
> ------------------------------------------------------
>
>                 Key: CXFXJC-34
>                 URL: https://issues.apache.org/jira/browse/CXFXJC-34
>             Project: CXF XJC Utils
>          Issue Type: Bug
>          Components: Maven Plugin
>    Affects Versions: 3.3.0
>            Reporter: Ruud de Jong
>            Assignee: Freeman Fang
>            Priority: Major
>
> Exception in thread "main" java.lang.InternalError: Unable to load source code of com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter as a resource
>  at com.sun.codemodel.fmt.JStaticJavaFile$ResourceLoader.getResourceAsStream(JStaticJavaFile.java:234)
>  at com.sun.codemodel.fmt.JStaticJavaFile.build(JStaticJavaFile.java:84)
>  at com.sun.codemodel.JPackage.build(JPackage.java:446)
>  at com.sun.codemodel.JCodeModel.build(JCodeModel.java:327)
>  at com.sun.codemodel.JCodeModel.build(JCodeModel.java:317)
>  at org.apache.cxf.maven_plugin.XSDToJavaRunner.run(XSDToJavaRunner.java:226)
>  at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.run(AbstractXSDToJavaMojo.java:368)
>  at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:276)
>  at org.apache.cxf.maven_plugin.XSDToJavaMojo.execute(XSDToJavaMojo.java:41)
>  
> This happens in 3.3.0 (not in 3.2.3).
>  
> The XSD uses this definition:
> <xs:attribute name="mustUnderstand" >
>  <xs:simpleType>
>  <xs:restriction base='xs:boolean'>
>  <xs:pattern value='0|1' />
> </xs:restriction>
>  </xs:simpleType>
> </xs:attribute>
> which triggers a special piece of code within JCodeModel of jaxb-xjc and tries to copy some Java source file from classpath.
> Apparently, this has changed from 3.2.3 to 3.3.0 and does not work properly anymore within the Maven plugin scope.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)