Using checkArgument instead of throwing an IllegalArgException directly

This commit is contained in:
Andrew Phillips 2013-01-24 01:54:46 -05:00
parent 93e2f24c62
commit 66bab1342c
1 changed files with 3 additions and 3 deletions

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.reflect; package org.jclouds.reflect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate; import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.tryFind; import static com.google.common.collect.Iterables.tryFind;
@ -242,9 +243,8 @@ public class Reflection2 {
&& Objects.equal(toClasses(input.getParameters()), key.parameterTypes); && Objects.equal(toClasses(input.getParameters()), key.parameterTypes);
} }
}); });
if (method.isPresent()) checkArgument(method.isPresent(), "no such method %s in: %s", key.toString(), methods);
return method.get(); return method.get();
throw new IllegalArgumentException("no such method " + key.toString() + "in: " + methods);
} }
}); });