Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8140331

jshell tool: Persistent jshell configuration is causing spurious failure in ErrorTranslationTest

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • None

      I got this failure on a test run:

      [TestNG] Running:
        jdk/jshell/ErrorTranslationTest.java

      test ErrorTranslationTest.testWarnings(): failure
      java.lang.AssertionError: Expected start-up message '| Welcome to' Got: | Error:
      | package java.anyutil does not exist
      | Error:
      | package java.anyutil.concurrent does not exist
      | Welcome to JShell -- Version 1.9.0-internal
      | Type /help for help
       expected [true] but found [false]
      at org.testng.Assert.fail(Assert.java:94)
      at org.testng.Assert.failNotEquals(Assert.java:494)
      at org.testng.Assert.assertTrue(Assert.java:42)
      at ReplToolTesting.lambda$null$4(ReplToolTesting.java:175)
      at ReplToolTesting.assertCommandCheckOutput(ReplToolTesting.java:359)
      at ReplToolTesting.lambda$test$5(ReplToolTesting.java:174)
      at ReplToolTesting$PromptedCommandOutputStream.write(ReplToolTesting.java:633)
      at ReplToolTesting$PromptedCommandOutputStream.write(ReplToolTesting.java:649)
      at java.io.PrintStream.write(PrintStream.java:480)
      at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
      at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:294)
      at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:298)
      at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
      at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
      at jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2336)
      at jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2277)
      at jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:153)
      at jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:447)
      at jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:266)
      at jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:245)
      at ReplToolTesting.testRaw(ReplToolTesting.java:211)
      at ReplToolTesting.test(ReplToolTesting.java:179)
      at ReplToolTesting.test(ReplToolTesting.java:167)
      at ReplToolTesting.test(ReplToolTesting.java:163)
      at ReplToolTesting.test(ReplToolTesting.java:159)
      at ErrorTranslationTest.testWarnings(ErrorTranslationTest.java:73)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:520)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      at org.testng.TestNG.run(TestNG.java:1057)
      at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:163)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:520)
      at com.sun.javatest.regtest.agent.MainActionHelper$SameVMRunnable.run(MainActionHelper.java:218)
      at java.lang.Thread.run(Thread.java:747)

      ===============================================
      jdk/jshell/ErrorTranslationTest.java
      Total tests run: 1, Failures: 1, Skips: 0
      ===============================================





      The failure seems to point at the fact that the test is picking up my persistent jshell configuration, which contains the following entry:

      <entry key="STARTUP" value="&#10;import java.anyutil.*;&#10;import java.io.*;&#10;import java.math.*;&#10;import java.net.*;&#10;import java.anyutil.concurrent.*;&#10;import java.util.prefs.*;&#10;import java.util.regex.*;&#10;void printf(String format, Object... args) { System.out.printf(format, args); }&#10;"/>

            jlahoda Jan Lahoda
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: