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

fix: avoid crash when printing help in wiremock-standalone #2351

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

tomasbjerre
Copy link
Contributor

Supplying relocated properties to avoid crash when they are read from relocated joptsimple when using wiremock-standalone.

In Wiremock 3.0.0 and 3.0.1 if you do:

java -jar wiremock-standalone-3.0.1.jar --help

You will get:

Exception in thread "main" java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key wiremock.joptsimple.BuiltinHelpFormatter.option.header
	at java.base/java.util.ResourceBundle.getObject(ResourceBundle.java:564)
	at java.base/java.util.ResourceBundle.getString(ResourceBundle.java:521)
	at wiremock.joptsimple.internal.Messages.message(Messages.java:42)
	at wiremock.joptsimple.BuiltinHelpFormatter.message(BuiltinHelpFormatter.java:558)
	at wiremock.joptsimple.BuiltinHelpFormatter.addHeaders(BuiltinHelpFormatter.java:316)
	at wiremock.joptsimple.BuiltinHelpFormatter.addRows(BuiltinHelpFormatter.java:203)
	at wiremock.joptsimple.BuiltinHelpFormatter.format(BuiltinHelpFormatter.java:101)
	at wiremock.joptsimple.OptionParser.printHelpOn(OptionParser.java:342)
	at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.captureHelpTextIfRequested(CommandLineOptions.java:450)
	at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.<init>(CommandLineOptions.java:372)
	at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:56)
	at wiremock.Run.main(Run.java:23)

I tried adding a test case for this. Since the problem happens after relocation, I was unable to.

Submitter checklist

  • Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

@tomasbjerre tomasbjerre requested a review from a team as a code owner September 3, 2023 08:53
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Definitely +1 for merging it towards 3.0.2

@tomakehurst tomakehurst merged commit f9a9f20 into wiremock:master Sep 4, 2023
7 checks passed
@tomakehurst
Copy link
Member

Thanks!

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.

None yet

3 participants