|
10 | 10 | import com.google.common.base.Charsets;
|
11 | 11 | import com.google.common.base.Function;
|
12 | 12 | import com.google.common.collect.*;
|
| 13 | +import com.google.common.collect.ImmutableMap.Builder; |
13 | 14 | import com.google.common.io.CharStreams;
|
14 | 15 |
|
15 | 16 | import javax.servlet.MultipartConfigElement;
|
@@ -159,11 +160,14 @@ public Map<String, Collection<String>> queryStrings() {
|
159 | 160 | return queryStrings;
|
160 | 161 |
|
161 | 162 | MultiMap<String> params = new MultiMap<String>();
|
162 |
| - |
163 |
| - UrlEncoded.decodeTo(super.getQueryString(), params, "UTF-8", maxFormKeys); |
164 |
| - |
165 |
| - queryStrings = NullToEmptyMap.safeWrapper(params, getSafeParameter()); |
166 |
| - |
| 163 | + String originQueryString = super.getQueryString(); |
| 164 | + |
| 165 | + if(queryStrings != null){ |
| 166 | + |
| 167 | + UrlEncoded.decodeTo(originQueryString, params, "UTF-8", maxFormKeys); |
| 168 | + |
| 169 | + queryStrings = NullToEmptyMap.safeWrapper(params, getSafeParameter()); |
| 170 | + } |
167 | 171 | return queryStrings;
|
168 | 172 |
|
169 | 173 | }
|
@@ -250,11 +254,16 @@ private void parsePostUrlEncoded() throws IOException {
|
250 | 254 | UrlEncoded.decodeTo(super.getInputStream(), params, "UTF-8", maxFormContentSize, maxFormKeys);
|
251 | 255 |
|
252 | 256 | forms = NullToEmptyMap.safeWrapper(params, getSafeParameter());
|
253 |
| - |
254 |
| - this.params = ImmutableMap.<String, Collection<String>>builder() |
255 |
| - .putAll(queryStrings) |
256 |
| - .putAll(forms) |
257 |
| - .build(); |
| 257 | + |
| 258 | + Builder<String, Collection<String>> builder = ImmutableMap.<String, Collection<String>>builder(); |
| 259 | + |
| 260 | + if(queryStrings != null) |
| 261 | + builder.putAll(queryStrings); |
| 262 | + |
| 263 | + if(forms != null) |
| 264 | + builder.putAll(forms); |
| 265 | + |
| 266 | + this.params = builder.build(); |
258 | 267 |
|
259 | 268 | }
|
260 | 269 |
|
|
0 commit comments