Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Handle IllegalArgumentException from Properties.load #428

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

jglick
Copy link
Member

@jglick jglick commented Jan 27, 2023

Observed a plugin build failure

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:3.37:test-hpl (default-test-hpl) on project the-plugin-name: Execution default-test-hpl of goal org.jenkins-ci.tools:maven-hpi-plugin:3.37:test-hpl failed: Malformed \uxxxx encoding.
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:375)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at …
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test-hpl of goal org.jenkins-ci.tools:maven-hpi-plugin:3.37:test-hpl failed: Malformed \uxxxx encoding.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:148)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
	... 12 common frames omitted
Caused by: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
	at java.base/java.util.Properties.loadConvert(Properties.java:678)
	at java.base/java.util.Properties.load0(Properties.java:454)
	at java.base/java.util.Properties.load(Properties.java:407)
	at org.jenkinsci.maven.plugins.hpi.PluginWorkspaceMapImpl.loadMap(PluginWorkspaceMapImpl.java:38)
	at org.jenkinsci.maven.plugins.hpi.PluginWorkspaceMapImpl.write(PluginWorkspaceMapImpl.java:61)
	at org.jenkinsci.maven.plugins.hpi.TestHplMojo.computeHplFile(TestHplMojo.java:37)
	at org.jenkinsci.maven.plugins.hpi.HplMojo.execute(HplMojo.java:69)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	... 13 common frames omitted

Seems my ~/.jenkins-hpl-map had been corrupted recently and contained long stretches of \u0000. This ought to have been handled more gracefully:

pluginWorkspaceMap.write(project.getArtifact().getId(), theHpl);
} catch (IOException x) {
getLog().error(x);

(Root cause was probably lack of atomic write. Using mvnd with multithreading, though TestHplMojo is not marked threadSafe either, so I suspect the problem was caused by a recent interrupted build.)

@jglick jglick merged commit 4afc673 into jenkinsci:master Jan 27, 2023
@jglick jglick deleted the IllegalArgumentException branch January 27, 2023 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants