Skip to content

Commit

Permalink
Update release notes wrt #2482
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 1, 2020
1 parent 566b607 commit effe1c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
8 changes: 8 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ Ivo Studens ([email protected])
* Contributed #1585: Invoke ServiceLoader.load() inside of a privileged block
when loading modules using `ObjectMapper.findModules()`
(2.8.9)
* Contributed fix for #2482: `JSONMappingException` `Location` column number
is one line Behind the actual location
(2.10.3)

Javy Luo (AnywnYu@github)
* Reported #1595: `JsonIgnoreProperties.allowSetters` is not working in Jackson 2.8
Expand Down Expand Up @@ -1023,6 +1026,11 @@ Greg Arakelian (arakelian@github)
of empty string
(2.10.2)
Kamal Aslam (aslamkam@github)
* Reported #2482: `JSONMappingException` `Location` column number is one line
Behind the actual location
(2.10.3)
Tobias Preuss (johnjohndoe@github)
* Reported #2599: NoClassDefFoundError at DeserializationContext.<init> on Android 4.1.2
and Jackson 2.10.0
Expand Down
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Project: jackson-databind

2.10.3 (not yet released)

#2482: `JSONMappingException` `Location` column number is one line Behind the actual
location
(reported by Kamal A, fixed by Ivo S)
#2599: NoClassDefFoundError at DeserializationContext.<init> on Android 4.1.2
and Jackson 2.10.0
(reported by Tobias P)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public JsonMappingException(Closeable processor, String msg) {
public JsonMappingException(Closeable processor, String msg, Throwable problem) {
super(msg, problem);
_processor = processor;
// 31-Jan-2020: [databind#2482] Retain original location
if (problem instanceof JsonProcessingException) {
_location = ((JsonProcessingException) problem).getLocation();
} else if (processor instanceof JsonParser) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

public class BasicExceptionTest extends BaseMapTest
{
final ObjectMapper MAPPER = new ObjectMapper();
final JsonFactory JSON_F = MAPPER.getFactory();
private final ObjectMapper MAPPER = newJsonMapper();
private final JsonFactory JSON_F = MAPPER.getFactory();

public void testBadDefinition() throws Exception
{
Expand Down Expand Up @@ -117,39 +117,26 @@ public void testUnrecognizedProperty() throws Exception
public void testLocationAddition() throws Exception
{
String problemJson = "{\n\t\"userList\" : [\n\t{\n\t user : \"1\"\n\t},\n\t{\n\t \"user\" : \"2\"\n\t}\n\t]\n}";
String expectedLocation = "line: 4, column: 4";
try {
MAPPER.readValue(problemJson, Users.class);
fail("Should not pass");
} catch (JsonMappingException e) {
} catch (JsonMappingException e) { // becomes "generic" due to wrapping for passing path info
String msg = e.getMessage();
String[] str = msg.split(" at \\[");
if (str.length != 2) {
fail("Should only get one 'at [' marker, got "+(str.length-1)+", source: "+msg);
}
if (! str[1].contains(expectedLocation)) {
fail("Reported location should be \"" + expectedLocation + "\", but was: " + str[1]);
}
JsonLocation loc = e.getLocation();
// String expectedLocation = "line: 4, column: 4";
assertEquals(4, loc.getLineNr());
assertEquals(4, loc.getColumnNr());
}
}

private static class User {
public String user = null;
static class User {
public String user;
}

private static class Users {
private ArrayList<User> users = new ArrayList<User>();

public ArrayList<User> getUser() {
return users;
}

public void addUser(User user) {
this.users.add(user);
}

public void setUserList(ArrayList<User> user) {
this.users = user;
}
static class Users {
public ArrayList<User> userList;
}
}

0 comments on commit effe1c3

Please sign in to comment.