Skip to content

Commit

Permalink
Java 1.6 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
skreutzer committed Feb 9, 2016
1 parent ba2585f commit 60349ec
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 60349ec

Please sign in to comment.