|
23 | 23 |
|
24 | 24 | /* |
25 | 25 | * @test |
26 | | - * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8239536 |
| 26 | + * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8239536 8210959 |
27 | 27 | * @summary Simple jshell tool tests |
28 | 28 | * @modules jdk.compiler/com.sun.tools.javac.api |
29 | 29 | * jdk.compiler/com.sun.tools.javac.main |
|
32 | 32 | * @build KullaTesting TestingInputStream |
33 | 33 | * @run testng/othervm ToolSimpleTest |
34 | 34 | */ |
35 | | -import java.util.Arrays; |
| 35 | + |
36 | 36 | import java.util.ArrayList; |
| 37 | +import java.util.Arrays; |
37 | 38 | import java.util.List; |
38 | 39 | import java.util.Locale; |
39 | 40 | import java.util.function.Consumer; |
@@ -112,6 +113,20 @@ public void testChainedThrow() { |
112 | 113 | ); |
113 | 114 | } |
114 | 115 |
|
| 116 | + @Test |
| 117 | + public void testThrowWithPercent() { |
| 118 | + test( |
| 119 | + (a) -> assertCommandCheckOutput(a, |
| 120 | + "URI u = new URI(\"http\", null, \"h\", -1, \"a\" + (char)0x04, null, null);", (s) -> |
| 121 | + assertTrue(s.contains("URISyntaxException") && !s.contains("JShellTool"), |
| 122 | + "Output: '" + s + "'")), |
| 123 | + (a) -> assertCommandCheckOutput(a, |
| 124 | + "throw new Exception(\"%z\")", (s) -> |
| 125 | + assertTrue(s.contains("java.lang.Exception") && !s.contains("UnknownFormatConversionException"), |
| 126 | + "Output: '" + s + "'")) |
| 127 | + ); |
| 128 | + } |
| 129 | + |
115 | 130 | @Test |
116 | 131 | public void oneLineOfError() { |
117 | 132 | test( |
|
0 commit comments