Skip to content

Commit

Permalink
Fix #1130
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 23, 2016
1 parent d64199a commit 77efe80
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project: jackson-databind
2.7.2 (not released yet)

#1129: When applying type modifiers, don't ignore container types.
#1130: NPE in `StdDateFormat` hashCode and equals
(reported by Kazuki S, kazuki43zoo@github)
#1134: Jackson 2.7 doesn't work with jdk6 due to use of `Collections.emptyIterator()`
(reported by Timur S, saladinkzn@github)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class StdDateFormat
extends DateFormat
{
/* TODO !!! 24-Nov-2009, tatu: Need to rewrite this class:
/* TODO !!! 24-Nov-2009, tatu: Should rewrite this class:
* JDK date parsing is awfully brittle, and ISO-8601 is quite
* permissive. The two don't mix, need to write a better one.
*/
Expand Down Expand Up @@ -386,7 +386,17 @@ public String toString() {
str += "(locale: "+_locale+")";
return str;
}


@Override // since 2.7[.2], as per [databind#1130]
public boolean equals(Object o) {
return (o == this);
}

@Override // since 2.7[.2], as per [databind#1130]
public int hashCode() {
return System.identityHashCode(this);
}

/*
/**********************************************************
/* Helper methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@ public void testCloneObject() throws Exception {
assertSame(df, clone);
}

public void testHashCodeEquals() throws Exception {
// for [databind#1130]
DateFormat defaultDF = StdDateFormat.instance;
defaultDF.hashCode();
assertTrue(defaultDF.equals(defaultDF));
}
}

0 comments on commit 77efe80

Please sign in to comment.