Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ConcurrentModificationException w/ jax-xew-plugin 1.7 #72

Closed
mattrpav opened this issue Jul 27, 2016 · 5 comments
Closed

ConcurrentModificationException w/ jax-xew-plugin 1.7 #72

mattrpav opened this issue Jul 27, 2016 · 5 comments

Comments

@mattrpav
Copy link
Collaborator

While using jaxb-xew-plugin 1.7 and jaxb2-basics 0.13.1 a ConcurrentModificationException is thrown.

Downgrading jaxb-xew-plugin to 1.2 resolves the issue

Linked to jaxb-xew-plugin issue: dmak/jaxb-xew-plugin#48

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.806 s
[INFO] Finished at: 2016-07-27T14:07:46-05:00
[INFO] Final Memory: 18M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate (generate) on project aaa.bbb.ccc: Execution generate of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed. ConcurrentModificationException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

Full stacktrace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate (generate) on project aaa.bbb.ccc: Execution generate of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:394)
at java.util.LinkedHashMap$ValueIterator.next(LinkedHashMap.java:409)
at org.jvnet.jaxb2_commons.plugin.codegenerator.AbstractCodeGeneratorPlugin.run(AbstractCodeGeneratorPlugin.java:72)
at com.sun.tools.xjc.model.Model.generateCode(Model.java:292)
at org.jvnet.mjiip.v_2_2.XJC22Mojo.generateCode(XJC22Mojo.java:66)
at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:41)
at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:28)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:505)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:328)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more

@mattrpav
Copy link
Collaborator Author

mattrpav commented Jul 27, 2016

To recreate:

mvn generate-sources

To work around:

Edit pom.xml and set jaxb.xew.plugin = 1.2
mvn generate-sources

Sample project:
jaxb2-xew-bug.zip

@dmak
Copy link

dmak commented Sep 23, 2016

Question to jaxb2-basics team: Why FieldUtils.getPossibleTypes():204 uses outline model and not the code model to retrieve types? Also I think that to implement such simple thing as equals() or hashCode() one don't need to collect all possible types: there is one and only one type.

@highsource
Copy link
Owner

@dmak I can't say exactly anymore, but I think you can't retrieve this information from the rendered code model. I think you'd only get "lowes common denominator" there instead of individual possible type. Generally, I prefer not to infer anything from the rendered code model as it is, well, a rendered projection of the model/outline.

@dmak
Copy link

dmak commented Sep 23, 2016

I understand your position but from other side if the class has T field, what are the other options for the type to use in equals()? Isn't it simply T tmp = getField(); if (tmp != null) { boolean result = tmp.equals(other.getField()); }?

@mattrpav
Copy link
Collaborator Author

Closing this issue.. fixed on the xew side. Project works with xew 1.11 (and possibly earlier. Bug marked fixed in xew 1.8)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants