Permalink
Browse files

Merge pull request #13 from jglick/JENKINS-38157

[JENKINS-38157] Better diagnostics
  • Loading branch information...
jglick committed Sep 21, 2016
2 parents 4197762 + 81a7836 commit ad2ff9a7db4ff03e1533503b6ee1fee6b0a0c5c4
@@ -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
@@ -100,7 +100,7 @@ public void instantiate() throws Exception {
try {
instantiate(I.class, map("value", 99));
fail();
} catch (ClassCastException x) {
} catch (Exception x) {
String message = x.getMessage();
assertTrue(message, message.contains(I.class.getName()));
assertTrue(message, message.contains("value"));

0 comments on commit ad2ff9a

Please sign in to comment.