Skip to content

Commit 9a70eb2

Browse files
committed
Add JacksonException.initCause() convenience method
1 parent 8930d81 commit 9a70eb2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/java/com/fasterxml/jackson/core/JacksonException.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public abstract class JacksonException
1010
extends RuntimeException
1111
{
12-
private final static long serialVersionUID = 123; // eclipse complains otherwise
12+
private final static long serialVersionUID = 3L; // eclipse complains otherwise
1313

1414
protected JsonLocation _location;
1515

@@ -36,6 +36,12 @@ protected JacksonException(String msg, JsonLocation loc, Throwable rootCause) {
3636
_location = (loc == null) ? JsonLocation.NA : loc;
3737
}
3838

39+
// @since 3.0
40+
public JacksonException withCause(Throwable cause) {
41+
initCause(cause);
42+
return this;
43+
}
44+
3945
/**
4046
* Method that allows to remove context information from this exception's message.
4147
* Useful when you are parsing security-sensitive data and don't want original data excerpts

src/main/java/com/fasterxml/jackson/core/util/SimpleStreamWriteContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private final void _checkDup(DupDetector dd, String name) throws StreamWriteExce
190190
"Duplicate Object property \""+name+"\"");
191191
}
192192
}
193-
193+
194194
public boolean writeValue() {
195195
// Only limitation is with OBJECTs:
196196
if (_type == TYPE_OBJECT) {

0 commit comments

Comments
 (0)