Skip to content

Commit

Permalink
Merge pull request #195 from publishing-systems/master
Browse files Browse the repository at this point in the history
Java 1.6 compatibility.
  • Loading branch information
stleary committed Feb 13, 2016
2 parents ba2585f + 60349ec commit 07a0f60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions JSONArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ of this software and associated documentation files (the "Software"), to deal
* </ul>
*
* @author JSON.org
* @version 2015-10-29
* @version 2016-02-08
*/
public class JSONArray implements Iterable<Object> {

Expand Down Expand Up @@ -593,7 +593,9 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, int index, E defaultValue)
return myE;
}
return Enum.valueOf(clazz, val.toString());
} catch (IllegalArgumentException | NullPointerException e) {
} catch (IllegalArgumentException e) {
return defaultValue;
} catch (NullPointerException e) {
return defaultValue;
}
}
Expand Down
6 changes: 4 additions & 2 deletions JSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ of this software and associated documentation files (the "Software"), to deal
* </ul>
*
* @author JSON.org
* @version 2015-01-30
* @version 2016-02-08
*/
public class JSONObject {
/**
Expand Down Expand Up @@ -901,7 +901,9 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, String key, E defaultValue)
return myE;
}
return Enum.valueOf(clazz, val.toString());
} catch (IllegalArgumentException | NullPointerException e) {
} catch (IllegalArgumentException e) {
return defaultValue;
} catch (NullPointerException e) {
return defaultValue;
}
}
Expand Down

0 comments on commit 07a0f60

Please sign in to comment.