Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebc13d6

Browse files
committed
Updating to work with java 1.6
1 parent 7d28955 commit ebc13d6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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
@@ -3283,7 +3283,13 @@ public <T> T fromJson(Class<T> clazz) {
32833283
}
32843284
}
32853285
return obj;
3286-
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
3286+
} catch (NoSuchMethodException e) {
3287+
throw new JSONException(e);
3288+
} catch (InstantiationException e) {
3289+
throw new JSONException(e);
3290+
} catch (IllegalAccessException e) {
3291+
throw new JSONException(e);
3292+
} catch (InvocationTargetException e) {
32873293
throw new JSONException(e);
32883294
}
32893295
}
@@ -3331,7 +3337,13 @@ private <T> Collection<T> fromJsonArray(JSONArray jsonArray, Class<?> collection
33313337
}
33323338
}
33333339
return collection;
3334-
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
3340+
} catch (NoSuchMethodException e) {
3341+
throw new JSONException(e);
3342+
} catch (InstantiationException e) {
3343+
throw new JSONException(e);
3344+
} catch (IllegalAccessException e) {
3345+
throw new JSONException(e);
3346+
} catch (InvocationTargetException e) {
33353347
throw new JSONException(e);
33363348
}
33373349
}

0 commit comments

Comments
 (0)