Skip to content

Commit

Permalink
Merge pull request #13 from jglick/JENKINS-38157
Browse files Browse the repository at this point in the history
[JENKINS-38157] Better diagnostics
  • Loading branch information
jglick committed Sep 21, 2016
2 parents 4197762 + 81a7836 commit ad2ff9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -100,7 +100,7 @@ private <T> T instantiate(Class<T> type, Map<String, Object> args) throws Except
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"));
Expand Down

0 comments on commit ad2ff9a

Please sign in to comment.