-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'FasterXML:2.16' into 2.16
- Loading branch information
Showing
22 changed files
with
268 additions
and
53 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
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
33 changes: 33 additions & 0 deletions
33
csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicCSVDataSerTest.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,33 @@ | ||
package com.fasterxml.jackson.dataformat.csv.ser.dos; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.core.StreamWriteConstraints; | ||
|
||
import com.fasterxml.jackson.databind.DatabindException; | ||
import com.fasterxml.jackson.dataformat.csv.CsvMapper; | ||
import com.fasterxml.jackson.dataformat.csv.ModuleTestBase; | ||
|
||
/** | ||
* Simple unit tests to verify that we fail gracefully if you attempt to serialize | ||
* data that is cyclic (eg a list that contains itself). | ||
*/ | ||
public class CyclicCSVDataSerTest extends ModuleTestBase | ||
{ | ||
private final CsvMapper MAPPER = mapperForCsv(); | ||
|
||
public void testListWithSelfReference() throws Exception { | ||
List<Object> list = new ArrayList<>(); | ||
list.add(list); | ||
try { | ||
MAPPER.writeValueAsString(list); | ||
fail("expected DatabindException"); | ||
} catch (DatabindException e) { | ||
String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", | ||
StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); | ||
assertTrue("DatabindException message is as expected?", | ||
e.getMessage().startsWith(exceptionPrefix)); | ||
} | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...s/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicPropsDataSerTest.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,33 @@ | ||
package com.fasterxml.jackson.dataformat.javaprop.dos; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.core.StreamWriteConstraints; | ||
|
||
import com.fasterxml.jackson.databind.DatabindException; | ||
import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper; | ||
import com.fasterxml.jackson.dataformat.javaprop.ModuleTestBase; | ||
|
||
/** | ||
* Simple unit tests to verify that we fail gracefully if you attempt to serialize | ||
* data that is cyclic (eg a list that contains itself). | ||
*/ | ||
public class CyclicPropsDataSerTest extends ModuleTestBase | ||
{ | ||
private final JavaPropsMapper MAPPER = newPropertiesMapper(); | ||
|
||
public void testListWithSelfReference() throws Exception { | ||
List<Object> list = new ArrayList<>(); | ||
list.add(list); | ||
try { | ||
MAPPER.writeValueAsString(list); | ||
fail("expected DatabindException"); | ||
} catch (DatabindException e) { | ||
String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", | ||
StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); | ||
assertTrue("JsonMappingException message is as expected?", | ||
e.getMessage().startsWith(exceptionPrefix)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.