diff --git a/JSONArray.java b/JSONArray.java index a3df9758a..f29085bdc 100644 --- a/JSONArray.java +++ b/JSONArray.java @@ -76,7 +76,7 @@ of this software and associated documentation files (the "Software"), to deal * * * @author JSON.org - * @version 2015-10-29 + * @version 2016-02-08 */ public class JSONArray implements Iterable { @@ -593,7 +593,9 @@ public > E optEnum(Class 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; } } diff --git a/JSONObject.java b/JSONObject.java index 27be3ec18..1ce25401f 100644 --- a/JSONObject.java +++ b/JSONObject.java @@ -93,7 +93,7 @@ of this software and associated documentation files (the "Software"), to deal * * * @author JSON.org - * @version 2015-01-30 + * @version 2016-02-08 */ public class JSONObject { /** @@ -901,7 +901,9 @@ public > E optEnum(Class 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; } }