fixes exception if integer parameter does not type check

Sat, 29 Aug 2020 17:28:24 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 29 Aug 2020 17:28:24 +0200
changeset 106
9c6ebf67afe9
parent 105
250c5cbb8276
child 107
b5f740a87af4

fixes exception if integer parameter does not type check

src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat Aug 29 17:13:09 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Sat Aug 29 17:28:24 2020 +0200
@@ -324,7 +324,8 @@
                 final Constructor<T> ctor = clazz.getConstructor(String.class);
                 return Optional.of(ctor.newInstance(paramValue));
             } catch (ReflectiveOperationException e) {
-                throw new RuntimeException(e);
+                // does not type check and is not convertible - treat as if the parameter was never set
+                return Optional.empty();
             }
         }
     }

mercurial