SPR-7314 - RestTemplate does not handle null uri template parameters

This commit is contained in:
Arjen Poutsma
2010-06-24 09:33:06 +00:00
parent ccdd1a9efd
commit 3160ddf0e8
2 changed files with 37 additions and 2 deletions

View File

@@ -125,8 +125,9 @@ public class UriTemplate {
StringBuffer buffer = new StringBuffer();
int i = 0;
while (matcher.find()) {
String uriVariable = uriVariableValues[i++].toString();
matcher.appendReplacement(buffer, Matcher.quoteReplacement(uriVariable));
Object uriVariable = uriVariableValues[i++];
String replacement = Matcher.quoteReplacement(uriVariable != null ? uriVariable.toString() : "");
matcher.appendReplacement(buffer, replacement);
}
matcher.appendTail(buffer);
return encodeUri(buffer.toString());