-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e2f76e
commit eae6759
Showing
4 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,5 +194,4 @@ protected <T> T jdkDeserialize(byte[] raw) throws IOException | |
objIn.close(); | ||
} | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/com/fasterxml/jackson/databind/interop/ExceptionSerializableTest1195.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.fasterxml.jackson.databind.interop; | ||
|
||
import java.io.*; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class ExceptionSerializableTest1195 extends BaseMapTest | ||
{ | ||
abstract static class ClassToRead { | ||
public int x; | ||
} | ||
|
||
static class ContainerClassToRead { | ||
public ClassToRead classToRead; | ||
} | ||
|
||
public void testExceptionSerializability() throws Exception | ||
{ | ||
final ObjectMapper mapper = new ObjectMapper(); | ||
try { | ||
mapper.readValue("{\"type\": \"B\"}", ClassToRead.class); | ||
fail("Should not have passed"); | ||
} catch (JsonMappingException e) { | ||
ObjectOutputStream stream = new ObjectOutputStream(new ByteArrayOutputStream()); | ||
try { | ||
stream.writeObject(e); | ||
stream.close(); | ||
} catch (Exception e2) { | ||
fail("Failed to serialize "+e.getClass().getName()+": "+e2); | ||
} | ||
} | ||
try { | ||
mapper.readValue("{\"classToRead\": {\"type\": \"B\"}}", ContainerClassToRead.class); | ||
fail("Should not have passed"); | ||
} catch (JsonMappingException e) { | ||
ObjectOutputStream stream = new ObjectOutputStream(new ByteArrayOutputStream()); | ||
try { | ||
stream.writeObject(e); | ||
stream.close(); | ||
} catch (Exception e2) { | ||
fail("Failed to serialize "+e.getClass().getName()+": "+e2); | ||
} | ||
} | ||
} | ||
} |