Reviewers: shindig.remailer_gmail.com,

Description:
Improves error handling for this case.

Please review this at http://codereview.appspot.com/207074/show

Affected files:
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java


Index: java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java
===================================================================
--- java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java (revision 909189) +++ java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java (working copy)
@@ -500,7 +500,13 @@
       case URL_ONLY:
         break;
       case URL_AND_FORM_PARAMS:
- params.addAll(sanitize(OAuth.decodeForm(base.getPostBodyAsString())));
+        try {
+ params.addAll(sanitize(OAuth.decodeForm(base.getPostBodyAsString())));
+        } catch (IllegalArgumentException e) {
+          // Occurs if OAuth.decodeForm finds an invalid URL to decode.
+ throw responseParams.oauthRequestException(OAuthError.INVALID_REQUEST,
+              "Could not decode body", e);
+        }
         break;
       case URL_AND_BODY_HASH:
         try {


Reply via email to