Skip to content
Snippets Groups Projects
Commit fe308746 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

fix: Replace deprecated Reflections API method call

parent 8a9ab943
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@
package no.nibio.vips.model.factory;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
......@@ -143,7 +145,7 @@ public class ModelFactory {
for(Class<? extends Model> subType : subTypes)
{
try {
Model model = subType.newInstance();
Model model = subType.getDeclaredConstructor().newInstance();
if(models.get(model.getModelId().toString()) == null)
{
models.put(model.getModelId().toString(), model);
......@@ -158,7 +160,8 @@ public class ModelFactory {
throw new DuplicateModelIdException(message);
}
//System.out.println("Model " + model.getModelName() + " with id=" + model.getModelId().toString() + " was found");
} catch ( InstantiationException | IllegalAccessException | DuplicateModelIdException | NoClassDefFoundError ex) {
} catch (InstantiationException | IllegalAccessException | DuplicateModelIdException | NoClassDefFoundError | NoSuchMethodException |
InvocationTargetException ex) {
Logger.getLogger(ModelFactory.class.getName()).log(Level.SEVERE, null, ex);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment