src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/TranslatedException.java
equal
deleted
inserted
replaced
47 @Override |
47 @Override |
48 public Throwable fillInStackTrace() { |
48 public Throwable fillInStackTrace() { |
49 return this; |
49 return this; |
50 } |
50 } |
51 |
51 |
52 @Override |
52 private static Throwable create(String className, String message) { |
53 public String toString() { |
53 // Try create with reflection first. |
54 return getMessage(); |
54 try { |
55 } |
55 Class<?> cls = Class.forName(className); |
|
56 if (message == null) { |
|
57 return (Throwable) cls.getConstructor().newInstance(); |
|
58 } |
|
59 cls.getDeclaredConstructor(String.class); |
|
60 return (Throwable) cls.getConstructor(String.class).newInstance(message); |
|
61 } catch (Throwable ignore) { |
|
62 } |
56 |
63 |
57 private static TranslatedException create(String className, String message) { |
|
58 if (className.equals(TranslatedException.class.getName())) { |
64 if (className.equals(TranslatedException.class.getName())) { |
59 // Chop the class name when boxing another TranslatedException |
65 // Chop the class name when boxing another TranslatedException |
60 return new TranslatedException(message); |
66 return new TranslatedException(message); |
61 } |
67 } |
|
68 |
62 if (message == null) { |
69 if (message == null) { |
63 return new TranslatedException(className); |
70 return new TranslatedException(className); |
64 } |
71 } |
65 return new TranslatedException(className + ": " + message); |
72 return new TranslatedException(className + ": " + message); |
66 } |
73 } |
145 String exceptionClassName = parts[i++]; |
152 String exceptionClassName = parts[i++]; |
146 String exceptionMessage = parts[i++]; |
153 String exceptionMessage = parts[i++]; |
147 Throwable throwable = create(exceptionClassName, exceptionMessage); |
154 Throwable throwable = create(exceptionClassName, exceptionMessage); |
148 int stackTraceDepth = Integer.parseInt(parts[i++]); |
155 int stackTraceDepth = Integer.parseInt(parts[i++]); |
149 |
156 |
150 StackTraceElement[] suffix = parent == null ? new StackTraceElement[0] : getStackTraceSuffix(); |
157 StackTraceElement[] suffix = getStackTraceSuffix(); |
151 StackTraceElement[] stackTrace = new StackTraceElement[stackTraceDepth + suffix.length]; |
158 StackTraceElement[] stackTrace = new StackTraceElement[stackTraceDepth + suffix.length]; |
152 for (int j = 0; j < stackTraceDepth; j++) { |
159 for (int j = 0; j < stackTraceDepth; j++) { |
153 String className = parts[i++]; |
160 String className = parts[i++]; |
154 String methodName = parts[i++]; |
161 String methodName = parts[i++]; |
155 String fileName = parts[i++]; |
162 String fileName = parts[i++]; |