prevent NPE when null is passed to @QueryParam annotated argument

This commit is contained in:
Dies Koper 2012-07-09 13:15:32 +10:00
parent 90df3a1e51
commit 43f12fa627
1 changed files with 5 additions and 3 deletions

View File

@ -1294,14 +1294,16 @@ public class RestAnnotationProcessor<T> {
for (Annotation key : entry.getValue()) {
Set<Annotation> 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);
}
}