Skip to content

Commit fdbec49

Browse files
committed
fixed deprecation
1 parent f154ebe commit fdbec49

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/main/java/com/cosmian/rest/kmip/objects/KmipObject.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.cosmian.rest.kmip.objects;
22

3+
import java.lang.reflect.InvocationTargetException;
4+
35
import com.cosmian.CosmianException;
46
import com.cosmian.rest.kmip.json.KmipStruct;
57
import com.cosmian.rest.kmip.json.KmipStructDeserializer;
@@ -38,9 +40,11 @@ protected static <T extends KmipObject> T fromJson(String json, Class<T> clazz)
3840
return mapper.readValue(json, clazz);
3941
} catch (JsonProcessingException e) {
4042
try {
41-
throw new CosmianException("Failed de serializing from JSON the " + clazz.newInstance().getObjectType()
43+
throw new CosmianException("Failed de serializing from JSON the "
44+
+ clazz.getDeclaredConstructor().newInstance().getObjectType()
4245
+ ": " + e.getMessage(), e);
43-
} catch (InstantiationException | IllegalAccessException e1) {
46+
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException
47+
| InvocationTargetException e1) {
4448
throw new CosmianException("Failed de serializing from JSON:" + e.getMessage(), e);
4549
}
4650
}

0 commit comments

Comments
 (0)