From 66bab1342cf4d2d9e2d77ea9d9373c135fc1e519 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 24 Jan 2013 01:54:46 -0500 Subject: [PATCH] Using checkArgument instead of throwing an IllegalArgException directly --- core/src/main/java/org/jclouds/reflect/Reflection2.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/jclouds/reflect/Reflection2.java b/core/src/main/java/org/jclouds/reflect/Reflection2.java index 86a306ebe4..47cfd33da9 100644 --- a/core/src/main/java/org/jclouds/reflect/Reflection2.java +++ b/core/src/main/java/org/jclouds/reflect/Reflection2.java @@ -18,6 +18,7 @@ */ 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.Throwables.propagate; import static com.google.common.collect.Iterables.tryFind; @@ -242,9 +243,8 @@ public class Reflection2 { && Objects.equal(toClasses(input.getParameters()), key.parameterTypes); } }); - if (method.isPresent()) - return method.get(); - throw new IllegalArgumentException("no such method " + key.toString() + "in: " + methods); + checkArgument(method.isPresent(), "no such method %s in: %s", key.toString(), methods); + return method.get(); } });