Skip to content

Commit f0a3364

Browse files
committed
Updating to work with java 1.6
1 parent 797613c commit f0a3364

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/main/java/org/json/JSONBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ public class JSONBuilder {
4040
* <li>{@code String.class} -> Identity function</li>
4141
* </ul>
4242
*/
43-
private static final Map<Class<?>, TypeConverter<?>> classMapping = new HashMap<>();
43+
private static final Map<Class<?>, TypeConverter<?>> classMapping = new HashMap<Class<?>, TypeConverter<?>>();
4444

4545
/**
4646
* A mapping from collection interface types to suppliers that produce
4747
* instances of concrete collection implementations.
4848
*
4949
*/
50-
private static final Map<Class<?>, InstanceCreator<?>> collectionMapping = new HashMap<>();
50+
private static final Map<Class<?>, InstanceCreator<?>> collectionMapping = new HashMap<Class<?>, InstanceCreator<?>>();
5151

5252
// Static initializer block to populate default mappings
5353
static {

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,7 +3186,13 @@ public <T> T fromJson(Class<T> clazz) {
31863186
}
31873187
}
31883188
return obj;
3189-
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
3189+
} catch (NoSuchMethodException e) {
3190+
throw new JSONException(e);
3191+
} catch (InstantiationException e) {
3192+
throw new JSONException(e);
3193+
} catch (IllegalAccessException e) {
3194+
throw new JSONException(e);
3195+
} catch (InvocationTargetException e) {
31903196
throw new JSONException(e);
31913197
}
31923198
}
@@ -3234,7 +3240,13 @@ private <T> Collection<T> fromJsonArray(JSONArray jsonArray, Class<?> collection
32343240
}
32353241
}
32363242
return collection;
3237-
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
3243+
} catch (NoSuchMethodException e) {
3244+
throw new JSONException(e);
3245+
} catch (InstantiationException e) {
3246+
throw new JSONException(e);
3247+
} catch (IllegalAccessException e) {
3248+
throw new JSONException(e);
3249+
} catch (InvocationTargetException e) {
32383250
throw new JSONException(e);
32393251
}
32403252
}

0 commit comments

Comments
 (0)