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

[Windows] jshell tool: Wrong character in /env class-path command crashes jshell

    Details

    • Subcomponent:
    • Introduced In Build:
      b158
    • Introduced In Version:
      9
    • Resolved In Build:
      b36
    • CPU:
      x86_64
    • OS:
      windows

      Description

      FULL PRODUCT VERSION :
      java version "10-ea"
      Java(TM) SE Runtime Environment (build 10-ea+32)
      Java HotSpot(TM) 64-Bit Server VM (build 10-ea+32, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.15063]

      A DESCRIPTION OF THE PROBLEM :
      When passing a unexpected character to the /env class-path command within the jshell, the jshell crashes

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      jshell> /env -class-path ?

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The same as in JDK 9:

      jshell> /env class-path ?
      | Unexpected arguments at end of command: [class-path, ?] -- class-path ?
      ACTUAL -
      The exception reported

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      jshell> /env -class-path ?
      Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <?> at index 0: ?
              at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
              at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
              at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
              at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
              at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
              at java.base/java.nio.file.Paths.get(Paths.java:84)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.toPathResolvingUserHome(JShellTool.java:1250)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool$OptionParserBase.lambda$validPaths$0(JShellTool.java:372)
              at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
              at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
              at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
              at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
              at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
              at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:511)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool$OptionParserBase.lambda$validPaths$3(JShellTool.java:375)
              at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
              at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1492)
              at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
              at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
              at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
              at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:511)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool$OptionParserBase.validPaths(JShellTool.java:379)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool$OptionParserBase.parse(JShellTool.java:414)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool$OptionParserBase.parse(JShellTool.java:350)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.parseCommandLineLikeFlags(JShellTool.java:2873)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.cmdEnv(JShellTool.java:2841)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.lambda$new$42(JShellTool.java:1650)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processCommand(JShellTool.java:1221)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1147)
              at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:919)
              at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.run(JShellToolBuilder.java:239)
              at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:119)

      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              jlahoda Jan Lahoda
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: