-
-
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
b55b04f
commit 513ab6e
Showing
4 changed files
with
76 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -599,7 +599,11 @@ Joshua Jones | |
Ivo Studens ([email protected]) | ||
* Contributed #1585: Invoke ServiceLoader.load() inside of a privileged block | ||
when loading modules using `ObjectMapper.findModules()` | ||
(2.8.9) | ||
(2.8.9) | ||
|
||
Marco Catania ([email protected]) | ||
* Contributed #1597: Escape JSONP breaking characters | ||
(2.8.9) | ||
|
||
Connor Kuhn (ckuhn@github) | ||
* Contributed #1341: FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY | ||
|
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
37 changes: 37 additions & 0 deletions
37
src/test/java/com/fasterxml/jackson/databind/util/JSONPObjectTest.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,37 @@ | ||
package com.fasterxml.jackson.databind.util; | ||
|
||
import java.io.IOException; | ||
|
||
import com.fasterxml.jackson.databind.BaseMapTest; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
public class JSONPObjectTest extends BaseMapTest { | ||
|
||
private final String CALLBACK = "callback"; | ||
private final ObjectMapper MAPPER = new ObjectMapper(); | ||
|
||
/** | ||
* Unit tests for checking that JSONP breaking characters U+2028 and U+2029 are escaped when creating a {@link JSONPObject}. | ||
*/ | ||
|
||
public void testU2028Escaped() throws IOException { | ||
String containsU2028 = String.format("This string contains %c char", '\u2028'); | ||
JSONPObject jsonpObject = new JSONPObject(CALLBACK, containsU2028); | ||
String valueAsString = MAPPER.writeValueAsString(jsonpObject); | ||
assertFalse(valueAsString.contains("\u2028")); | ||
} | ||
|
||
public void testU2029Escaped() throws IOException { | ||
String containsU2029 = String.format("This string contains %c char", '\u2029'); | ||
JSONPObject jsonpObject = new JSONPObject(CALLBACK, containsU2029); | ||
String valueAsString = MAPPER.writeValueAsString(jsonpObject); | ||
assertFalse(valueAsString.contains("\u2029")); | ||
} | ||
|
||
public void testU2030NotEscaped() throws IOException { | ||
String containsU2030 = String.format("This string contains %c char", '\u2030'); | ||
JSONPObject jsonpObject = new JSONPObject(CALLBACK, containsU2030); | ||
String valueAsString = MAPPER.writeValueAsString(jsonpObject); | ||
assertTrue(valueAsString.contains("\u2030")); | ||
} | ||
} |
513ab6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cowtowncoder many thanks!