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

UnknownFormatConversionException in start.jar --debug if path has % sign #10213

Closed
joakime opened this issue Aug 2, 2023 · 1 comment · Fixed by #10214
Closed

UnknownFormatConversionException in start.jar --debug if path has % sign #10213

joakime opened this issue Aug 2, 2023 · 1 comment · Fixed by #10214
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@joakime
Copy link
Contributor

joakime commented Aug 2, 2023

Jetty version(s)
12.0.0

Java version/vendor (use: java -version)
17.0.5

OS type/version
Linux

Description
If a scanned directory for the jetty.base has a percent sign, and debug is enabled, it can result in an java.util.UnknownFormatConversionException

Example: create a base directory called foo%bar and do the following

$ mkdir foo%bar
$ cd foo%bar
$ java -jar /path/to/jetty-home-12.0.0.jar --add-modules=http,core-deploy
$ java -jar /path/to/jetty-home-12.0.0.jar --debug --list-config
 java.util.UnknownFormatConversionException: Conversion = 'b'
 	at java.base/java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2855)
 	at java.base/java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2891)
 	at java.base/java.util.Formatter.parse(Formatter.java:2747)
 	at java.base/java.util.Formatter.format(Formatter.java:2671)
 	at java.base/java.io.PrintStream.format(PrintStream.java:1209)
 	at java.base/java.io.PrintStream.printf(PrintStream.java:1105)
 	at org.eclipse.jetty.start.StartLog.outLog(StartLog.java:44)
 	at org.eclipse.jetty.start.StartLog.debug(StartLog.java:51)
 	at org.eclipse.jetty.start.PathFinder.addHit(PathFinder.java:45)
 	at org.eclipse.jetty.start.PathFinder.preVisitDirectory(PathFinder.java:82)
 	at org.eclipse.jetty.start.PathFinder.preVisitDirectory(PathFinder.java:31)
 	at java.base/java.nio.file.Files.walkFileTree(Files.java:2817)
 	at org.eclipse.jetty.start.BaseHome.getPaths(BaseHome.java:374)
 	at org.eclipse.jetty.start.StartArgs.expandModules(StartArgs.java:435)
 	at org.eclipse.jetty.start.StartArgs.expandEnvironments(StartArgs.java:216)
 	at org.eclipse.jetty.start.Main.processCommandLine(Main.java:375)
 	at org.eclipse.jetty.start.Main.main(Main.java:74)
 
 Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
        java -jar $JETTY_HOME/start.jar --help  # for more information

This is due to a bad usage of the StartLog.debug() method.

@joakime joakime added the Bug For general bugs on Jetty side label Aug 2, 2023
@joakime joakime self-assigned this Aug 2, 2023
joakime added a commit that referenced this issue Aug 2, 2023
@joakime joakime linked a pull request Aug 2, 2023 that will close this issue
joakime added a commit that referenced this issue Aug 17, 2023
@joakime
Copy link
Contributor Author

joakime commented Aug 17, 2023

Merged PR #10214

@joakime joakime closed this as completed Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant