Permalink
Browse files

[JENKINS-38157] When a NoStaplerConstructorException is thrown, inclu…

…de details in the exception message so it has a better chance of being diagnosed.
  • Loading branch information...
jglick committed Sep 13, 2016
1 parent 4197762 commit 4efc5a96233f61c9e2c5a03e30cd78586f850e17
@@ -254,10 +254,14 @@ public T instantiate(Map<String,?> arguments) throws Exception {
arguments = Collections.singletonMap(rp.getName(),arguments.get(ANONYMOUS_KEY));
}

Object[] args = buildArguments(arguments, constructor.getGenericParameterTypes(), constructorParamNames, true);
T o = constructor.newInstance(args);
injectSetters(o, arguments);
return o;
try {
Object[] args = buildArguments(arguments, constructor.getGenericParameterTypes(), constructorParamNames, true);
T o = constructor.newInstance(args);
injectSetters(o, arguments);
return o;
} catch (Exception x) {
throw new IllegalArgumentException("Could not instantiate " + arguments + " for " + this + ": " + x, x);
}
}

// adapted from RequestImpl

0 comments on commit 4efc5a9

Please sign in to comment.