formatting

This commit is contained in:
Adrian Cole 2011-09-30 09:47:52 -07:00 committed by Jason King
parent 975768bcb2
commit 5be66b2c6f
2 changed files with 30 additions and 22 deletions

View File

@ -46,9 +46,9 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
import javax.annotation.Resource;
@ -77,7 +77,6 @@ import org.jclouds.http.HttpUtils;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ParseJson;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ParseSax.HandlerWithResult;
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnInputStream;
@ -87,6 +86,7 @@ import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.http.functions.UnwrapOnlyJsonValueInSet;
import org.jclouds.http.functions.UnwrapOnlyNestedJsonValue;
import org.jclouds.http.functions.UnwrapOnlyNestedJsonValueInSet;
import org.jclouds.http.functions.ParseSax.HandlerWithResult;
import org.jclouds.http.options.HttpRequestOptions;
import org.jclouds.http.utils.ModifyRequest;
import org.jclouds.internal.ClassMethodArgs;
@ -145,12 +145,12 @@ import com.google.common.cache.CacheLoader;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Inject;
import com.google.inject.Injector;
@ -966,10 +966,12 @@ public class RestAnnotationProcessor<T> {
// (first, however, let's make sure we have enough args on the actual method)
if (entry.getKey() >= request.getJavaMethod().getParameterAnnotations().length) {
// not known whether this happens
throw new IllegalArgumentException("Argument index "+(entry.getKey()+1)+" is out of bounds for method "+request.getJavaMethod());
throw new IllegalArgumentException("Argument index " + (entry.getKey() + 1)
+ " is out of bounds for method " + request.getJavaMethod());
}
if (request.getJavaMethod().isVarArgs() && entry.getKey() + 1 == request.getJavaMethod().getParameterTypes().length)
if (request.getJavaMethod().isVarArgs()
&& entry.getKey() + 1 == request.getJavaMethod().getParameterTypes().length)
// allow null/missing for var args
continue OUTER;

View File

@ -613,9 +613,12 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
Method method = TestPost.class.getMethod("postNonnull", String.class);
try {
HttpRequest request = factory(TestPost.class).createRequest(method);
Assert.fail("call should have failed with illegal null parameter, not permitted "+request+" to be created");
Assert
.fail("call should have failed with illegal null parameter, not permitted " + request
+ " to be created");
} catch (NullPointerException e) {
Assert.assertTrue(e.toString().indexOf("postNonnull parameter 1")>=0, "Error message should have referred to 'parameter 1': "+e);
Assert.assertTrue(e.toString().indexOf("postNonnull parameter 1") >= 0,
"Error message should have referred to 'parameter 1': " + e);
}
}
@ -623,9 +626,12 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
Method method = TestPost.class.getMethod("postNonnull", String.class);
try {
HttpRequest request = factory(TestPost.class).createRequest(method, (String) null);
Assert.fail("call should have failed with illegal null parameter, not permitted "+request+" to be created");
Assert
.fail("call should have failed with illegal null parameter, not permitted " + request
+ " to be created");
} catch (NullPointerException e) {
Assert.assertTrue(e.toString().indexOf("postNonnull parameter 1")>=0, "Error message should have referred to parameter 'parameter 1': "+e);
Assert.assertTrue(e.toString().indexOf("postNonnull parameter 1") >= 0,
"Error message should have referred to parameter 'parameter 1': " + e);
}
}