Skip to content

Commit 3f3f814

Browse files
committed
Minor fix to keep Exception deserializer working with latest JDK 9 EA
1 parent fc41d63 commit 3f3f814

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/std/StackTraceElementDeserializer.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ public StackTraceElement deserialize(JsonParser p, DeserializationContext ctxt)
2424
String className = "", methodName = "", fileName = "";
2525
// Java 9 adds couple more things
2626
String moduleName = null, moduleVersion = null;
27+
String classLoaderName = null;
2728
int lineNumber = -1;
2829

2930
while ((t = p.nextValue()) != JsonToken.END_OBJECT) {
3031
String propName = p.getCurrentName();
3132
// TODO: with Java 8, convert to switch
3233
if ("className".equals(propName)) {
3334
className = p.getText();
35+
} else if ("classLoaderName".equals(propName)) {
36+
classLoaderName = p.getText();
3437
} else if ("fileName".equals(propName)) {
3538
fileName = p.getText();
3639
} else if ("lineNumber".equals(propName)) {
@@ -53,7 +56,7 @@ public StackTraceElement deserialize(JsonParser p, DeserializationContext ctxt)
5356
}
5457
}
5558
return constructValue(ctxt, className, methodName, fileName, lineNumber,
56-
moduleName, moduleVersion);
59+
moduleName, moduleVersion, classLoaderName);
5760
} else if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
5861
p.nextToken();
5962
final StackTraceElement value = deserialize(p, ctxt);
@@ -65,14 +68,22 @@ public StackTraceElement deserialize(JsonParser p, DeserializationContext ctxt)
6568
return (StackTraceElement) ctxt.handleUnexpectedToken(_valueClass, p);
6669
}
6770

71+
@Deprecated // since 2.9
72+
protected StackTraceElement constructValue(DeserializationContext ctxt,
73+
String className, String methodName, String fileName, int lineNumber,
74+
String moduleName, String moduleVersion) {
75+
return constructValue(ctxt, className, methodName, fileName, lineNumber,
76+
moduleName, moduleVersion, null);
77+
}
78+
6879
/**
6980
* Overridable factory method used for constructing {@link StackTraceElement}s.
7081
*
7182
* @since 2.8
7283
*/
7384
protected StackTraceElement constructValue(DeserializationContext ctxt,
7485
String className, String methodName, String fileName, int lineNumber,
75-
String moduleName, String moduleVersion)
86+
String moduleName, String moduleVersion, String classLoaderName)
7687
{
7788
// 21-May-2016, tatu: With Java 9, need to use different constructor, probably
7889
// via different module, and throw exception here if extra args passed

0 commit comments

Comments
 (0)