-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
11
-
x86_64
-
generic
A DESCRIPTION OF THE PROBLEM :
The expression:
new URI("http", "localhost", "a bug", null)
attempts to create a URI containing a space. The space is converted to "%20". However, since the third argument is invalid (it must start with a slash), an exception is thrown. Now the problem is, that JShell displays the exception using java.io.PrintStream::printf. Because "%20b" has a special meaning in a "format", an extra argument is expected. And since there isn't any available, an exception is thrown and JShell crashes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In jshell, enter:
new URI("http", "localhost", "a bug", null)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An exception is printed (because the third constructor argument must start with a slash)
ACTUAL -
JShell crashes with the following:
| Exception java.net.URISyntaxException: Relative path in absolute URI: http://localhostaException in thread "main" java.util.MissingFormatArgumentException: Format specifier '%20d'
at java.base/java.util.Formatter.format(Formatter.java:2672)
at java.base/java.io.PrintStream.format(PrintStream.java:1053)
at java.base/java.io.PrintStream.printf(PrintStream.java:949)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.error(JShellTool.java:728)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.errormsg(JShellTool.java:867)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.displayEvalException(JShellTool.java:3451)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.displayException(JShellTool.java:3425)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.displayException(JShellTool.java:3418)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.handleEvent(JShellTool.java:3582)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processSource(JShellTool.java:3550)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processSourceCatchingReset(JShellTool.java:1301)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processInput(JShellTool.java:1203)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1176)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:975)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:254)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120)
FREQUENCY : always
The expression:
new URI("http", "localhost", "a bug", null)
attempts to create a URI containing a space. The space is converted to "%20". However, since the third argument is invalid (it must start with a slash), an exception is thrown. Now the problem is, that JShell displays the exception using java.io.PrintStream::printf. Because "%20b" has a special meaning in a "format", an extra argument is expected. And since there isn't any available, an exception is thrown and JShell crashes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In jshell, enter:
new URI("http", "localhost", "a bug", null)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An exception is printed (because the third constructor argument must start with a slash)
ACTUAL -
JShell crashes with the following:
| Exception java.net.URISyntaxException: Relative path in absolute URI: http://localhostaException in thread "main" java.util.MissingFormatArgumentException: Format specifier '%20d'
at java.base/java.util.Formatter.format(Formatter.java:2672)
at java.base/java.io.PrintStream.format(PrintStream.java:1053)
at java.base/java.io.PrintStream.printf(PrintStream.java:949)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.error(JShellTool.java:728)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.errormsg(JShellTool.java:867)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.displayEvalException(JShellTool.java:3451)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.displayException(JShellTool.java:3425)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.displayException(JShellTool.java:3418)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.handleEvent(JShellTool.java:3582)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processSource(JShellTool.java:3550)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processSourceCatchingReset(JShellTool.java:1301)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processInput(JShellTool.java:1203)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1176)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:975)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:254)
at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120)
FREQUENCY : always
- duplicates
-
JDK-8210959 JShell fails and exits when statement throws an exception whose message contains a '%'.
-
- Closed
-