From 43f12fa6277db8c18fee65b70289ec63bef6ce62 Mon Sep 17 00:00:00 2001 From: Dies Koper Date: Mon, 9 Jul 2012 13:15:32 +1000 Subject: [PATCH] prevent NPE when null is passed to @QueryParam annotated argument --- .../jclouds/rest/internal/RestAnnotationProcessor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java b/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java index 101d863ba0..e29dede0eb 100644 --- a/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java +++ b/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java @@ -1294,14 +1294,16 @@ public class RestAnnotationProcessor { for (Annotation key : entry.getValue()) { Set extractors = indexToParamExtractor.get(entry.getKey()); String paramKey = ((QueryParam) key).value(); - String paramValue; + Object paramValue; if (extractors != null && extractors.size() > 0) { ParamParser extractor = (ParamParser) extractors.iterator().next(); paramValue = injector.getInstance(extractor.value()).apply(args[entry.getKey()]); } else { - paramValue = args[entry.getKey()].toString(); + paramValue = args[entry.getKey()]; + } + if (paramValue != null) { + queryParamValues.put(paramKey, paramValue.toString()); } - queryParamValues.put(paramKey, paramValue); } }