Skip to content

Commit f155632

Browse files
committed
Updating to work with java 1.6
1 parent 19a559b commit f155632

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/json/JSONObject.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,7 +3500,7 @@ else if (!rawType.isPrimitive() && !rawType.isEnum() && value instanceof JSONObj
35003500
*/
35013501
private Map<?, ?> convertToMap(JSONObject jsonMap, Type keyType, Type valueType, Class<?> mapType) throws JSONException {
35023502
try {
3503-
InstanceCreator<?> creator = collectionMapping.getOrDefault(mapType, new InstanceCreator<Map>() {
3503+
InstanceCreator<?> creator = collectionMapping.get(mapType) != null ? collectionMapping.get(mapType) : new InstanceCreator<Map>() {
35043504
public Map create() {
35053505
return new HashMap();
35063506
}
@@ -3526,7 +3526,7 @@ public Map create() {
35263526
/**
35273527
* Converts a String to an Enum value.
35283528
*/
3529-
private <E extends Enum<E>> E stringToEnum(Class<?> enumClass, String value) throws JSONException {
3529+
private <E extends Enum<E>> E stringToEnum(Class<E> enumClass, String value) throws JSONException {
35303530
try {
35313531
@SuppressWarnings("unchecked")
35323532
Method valueOfMethod = enumClass.getMethod("valueOf", String.class);
@@ -3543,7 +3543,7 @@ private <E extends Enum<E>> E stringToEnum(Class<?> enumClass, String value) thr
35433543
@SuppressWarnings("unchecked")
35443544
private <T> Collection<T> fromJsonArray(JSONArray jsonArray, Class<?> collectionType, Type elementType) throws JSONException {
35453545
try {
3546-
InstanceCreator<?> creator = collectionMapping.getOrDefault(collectionType, new InstanceCreator<List>() {
3546+
InstanceCreator<?> creator = collectionMapping.get(collectionType) != null ? collectionMapping.get(collectionType) : new InstanceCreator<List>() {
35473547
public List create() {
35483548
return new ArrayList();
35493549
}

0 commit comments

Comments
 (0)