fix invalid parameter check -- only problem could be that it is null, not, not instanceof Class

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1177393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Brosius 2011-09-29 18:37:26 +00:00
parent 2ad95ff46e
commit db21443715
1 changed files with 2 additions and 3 deletions

View File

@ -105,10 +105,9 @@ public class InstantiateTransformer<T> implements Transformer<Class<? extends T>
*/ */
public T transform(Class<? extends T> input) { public T transform(Class<? extends T> input) {
try { try {
if (input instanceof Class == false) { if (input == null) {
throw new FunctorException( throw new FunctorException(
"InstantiateTransformer: Input object was not an instanceof Class, it was a " "InstantiateTransformer: Input object was not an instanceof Class, it was a null object");
+ (input == null ? "null object" : input.getClass().getName()));
} }
Constructor<? extends T> con = input.getConstructor(iParamTypes); Constructor<? extends T> con = input.getConstructor(iParamTypes);
return con.newInstance(iArgs); return con.newInstance(iArgs);