langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java
changeset 46926 25ac5da6502e
parent 46185 f4c981fc7818
equal deleted inserted replaced
46925:c538fe357ff9 46926:25ac5da6502e
   572                             : "";
   572                             : "";
   573                 } catch (ResolutionException ex) {
   573                 } catch (ResolutionException ex) {
   574                     DeclarationSnippet sn = (DeclarationSnippet) state.maps.getSnippetDeadOrAlive(ex.id());
   574                     DeclarationSnippet sn = (DeclarationSnippet) state.maps.getSnippetDeadOrAlive(ex.id());
   575                     exception = new UnresolvedReferenceException(sn, translateExceptionStack(ex));
   575                     exception = new UnresolvedReferenceException(sn, translateExceptionStack(ex));
   576                 } catch (UserException ex) {
   576                 } catch (UserException ex) {
   577                     exception = new EvalException(translateExceptionMessage(ex),
   577                     exception = new EvalException(ex.getMessage(),
   578                             ex.causeExceptionClass(),
   578                             ex.causeExceptionClass(),
   579                             translateExceptionStack(ex));
   579                             translateExceptionStack(ex));
   580                 } catch (RunException ex) {
   580                 } catch (RunException ex) {
   581                     // StopException - no-op
   581                     // StopException - no-op
   582                 } catch (InternalException ex) {
   582                 } catch (InternalException ex) {
   780             }
   780             }
   781         }
   781         }
   782         return elems;
   782         return elems;
   783     }
   783     }
   784 
   784 
   785     private String translateExceptionMessage(Exception ex) {
       
   786         String msg = ex.getMessage();
       
   787         return msg.equals("<none>")
       
   788                 ? null
       
   789                 : msg;
       
   790     }
       
   791 
       
   792     private boolean isWrap(StackTraceElement ste) {
   785     private boolean isWrap(StackTraceElement ste) {
   793         return PREFIX_PATTERN.matcher(ste.getClassName()).find();
   786         return PREFIX_PATTERN.matcher(ste.getClassName()).find();
   794     }
   787     }
   795 
   788 
   796     private DiagList modifierDiagnostics(ModifiersTree modtree,
   789     private DiagList modifierDiagnostics(ModifiersTree modtree,