You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/02/11 17:52:55 UTC

svn commit: r1567216 - /cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java

Author: sergeyb
Date: Tue Feb 11 16:52:55 2014
New Revision: 1567216

URL: http://svn.apache.org/r1567216
Log:
[CXF-5554] Minor update

Modified:
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java?rev=1567216&r1=1567215&r2=1567216&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java Tue Feb 11 16:52:55 2014
@@ -132,18 +132,17 @@ public final class OAuthUtils {
         String enc = oAuthMessage.getBodyEncoding();
         enc = enc == null ? "UTF-8" : enc;
         
-        if (params.isEmpty())  {
-            MediaType bodyMediaType = MediaType.valueOf(oAuthMessage.getBodyType());
-            if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(bodyMediaType)) {
-                InputStream stream = mc != null 
-                    ? mc.getContent(InputStream.class) : oAuthMessage.getBodyAsStream();
-                String body = FormUtils.readBody(stream, enc);
-                MultivaluedMap<String, String> map = new MetadataMap<String, String>();
-                FormUtils.populateMapFromString(map, PhaseInterceptorChain.getCurrentMessage(), body, enc, true, 
-                                                request);
-                for (String key : map.keySet()) {
-                    oAuthMessage.addParameter(key, map.getFirst(key));
-                }
+        if (params.isEmpty() 
+            && MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(
+                MediaType.valueOf(oAuthMessage.getBodyType()))) {
+            InputStream stream = mc != null 
+                ? mc.getContent(InputStream.class) : oAuthMessage.getBodyAsStream();
+            String body = FormUtils.readBody(stream, enc);
+            MultivaluedMap<String, String> map = new MetadataMap<String, String>();
+            FormUtils.populateMapFromString(map, PhaseInterceptorChain.getCurrentMessage(), body, enc, true, 
+                                            request);
+            for (String key : map.keySet()) {
+                oAuthMessage.addParameter(key, map.getFirst(key));
             }
         } else {
             // This path will most likely work only for the AuthorizationRequestService