You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by di...@apache.org on 2013/09/28 07:30:12 UTC

[2/2] git commit: knox-163, job submission through knox-webchat results in NullPointerException

knox-163, job submission through knox-webchat results in NullPointerException


Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/b728b48a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/b728b48a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/b728b48a

Branch: refs/heads/master
Commit: b728b48a79e5b249a86773209ec4160a254becfa
Parents: 75c829e
Author: Dilli Dorai Arumugam <da...@hortonworks.com>
Authored: Fri Sep 27 10:51:28 2013 -0700
Committer: Dilli Dorai Arumugam <da...@hortonworks.com>
Committed: Fri Sep 27 22:27:54 2013 -0700

----------------------------------------------------------------------
 ...entityAsserterHttpServletRequestWrapper.java | 36 +++++++++++---------
 1 file changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/b728b48a/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java b/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
index c41d109..6e8d153 100644
--- a/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
+++ b/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
@@ -99,16 +99,7 @@ public class IdentityAsserterHttpServletRequestWrapper extends HttpServletReques
       else {
         params = parseQueryString(qString);
       }
-    }
-    ArrayList<String> al = new ArrayList<String>();
-    al.add(username);
-    String[] a = {""};
-    
-    if ("true".equals(System.getProperty(GatewayConfig.HADOOP_KERBEROS_SECURED))) {
-      params.put(DOAS_PRINCIPAL_PARAM, al.toArray(a));
-    } else {
-      params.put(PRINCIPAL_PARAM, al.toArray(a));
-    }
+    }  
     return params;
   }
 
@@ -120,13 +111,26 @@ public class IdentityAsserterHttpServletRequestWrapper extends HttpServletReques
   public String getQueryString() {
     String q = null;
     Map<String, String[]> params = getParams();
-    if (params != null) {
-      String encoding = getCharacterEncoding();
-      if( encoding == null ) {
-        encoding = Charset.defaultCharset().name();
-      }
-      q = urlEncode( params, encoding );
+
+    if (params == null) {
+      params = new HashMap<String, String[]>();
+    }
+    
+    ArrayList<String> al = new ArrayList<String>();
+    al.add(username);
+    String[] a = { "" };
+
+    if ("true".equals(System.getProperty(GatewayConfig.HADOOP_KERBEROS_SECURED))) {
+      params.put(DOAS_PRINCIPAL_PARAM, al.toArray(a));
+    } else {
+      params.put(PRINCIPAL_PARAM, al.toArray(a));
+    }
+    
+    String encoding = getCharacterEncoding();
+    if (encoding == null) {
+      encoding = Charset.defaultCharset().name();
     }
+    q = urlEncode(params, encoding);
     return q;
   }