Skip to content

Commit

Permalink
Fix possible StackOverflowError in Jakarta provider (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
greek1979 committed Jan 30, 2022
1 parent 921d3bc commit ae253ab
Showing 1 changed file with 15 additions and 5 deletions.
Expand Up @@ -817,17 +817,22 @@ public List<JsonValue> subList(int fromIndex, int toIndex) {

@Override
public int hashCode() {
return arr.hashCode();
return arr != null ? arr.hashCode() : 0;
}

@Override
public boolean equals(Object obj) {
if (obj == null) {
return this.arr == null;
} else if (obj instanceof JsonArrayProxy) {
return this.arr.equals(((JsonArrayProxy) obj).arr);
}
return arr.equals(obj);
}

@Override
public String toString() {
return arr.toString();
return arr != null ? arr.toString() : null;
}
}

Expand Down Expand Up @@ -1017,17 +1022,22 @@ public int size() {

@Override
public int hashCode() {
return obj.hashCode();
return obj != null ? obj.hashCode() : 0;
}

@Override
public boolean equals(Object obj) {
return obj.equals(obj);
if (obj == null) {
return this.obj == null;
} else if (obj instanceof JsonObjectProxy) {
return this.obj.equals(((JsonObjectProxy) obj).obj);
}
return this.obj.equals(obj);
}

@Override
public String toString() {
return obj.toString();
return obj != null ? obj.toString() : null;
}
}
}

0 comments on commit ae253ab

Please sign in to comment.