Skip to content

Commit 07a0f60

Browse files
committed
Merge pull request #195 from publishing-systems/master
Java 1.6 compatibility.
2 parents ba2585f + 60349ec commit 07a0f60

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

JSONArray.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ of this software and associated documentation files (the "Software"), to deal
7676
* </ul>
7777
*
7878
* @author JSON.org
79-
* @version 2015-10-29
79+
* @version 2016-02-08
8080
*/
8181
public class JSONArray implements Iterable<Object> {
8282

@@ -593,7 +593,9 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, int index, E defaultValue)
593593
return myE;
594594
}
595595
return Enum.valueOf(clazz, val.toString());
596-
} catch (IllegalArgumentException | NullPointerException e) {
596+
} catch (IllegalArgumentException e) {
597+
return defaultValue;
598+
} catch (NullPointerException e) {
597599
return defaultValue;
598600
}
599601
}

JSONObject.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ of this software and associated documentation files (the "Software"), to deal
9393
* </ul>
9494
*
9595
* @author JSON.org
96-
* @version 2015-01-30
96+
* @version 2016-02-08
9797
*/
9898
public class JSONObject {
9999
/**
@@ -901,7 +901,9 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, String key, E defaultValue)
901901
return myE;
902902
}
903903
return Enum.valueOf(clazz, val.toString());
904-
} catch (IllegalArgumentException | NullPointerException e) {
904+
} catch (IllegalArgumentException e) {
905+
return defaultValue;
906+
} catch (NullPointerException e) {
905907
return defaultValue;
906908
}
907909
}

0 commit comments

Comments
 (0)