stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ud...@apache.org
Subject [2/4] git commit: null check for authheader setter
Date Mon, 20 Oct 2014 12:20:31 GMT
null check for authheader setter


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

Branch: refs/heads/4.0.0-grouping
Commit: d6962c906daf43b37c965e3adf8ad5dfd34c33f0
Parents: b81a69b
Author: Udara Liyanage <udara@wso2.com>
Authored: Thu Oct 16 21:48:20 2014 +0530
Committer: Udara Liyanage <udara@wso2.com>
Committed: Mon Oct 20 17:28:41 2014 +0530

----------------------------------------------------------------------
 .../apache/stratos/metadata/client/rest/DefaultRestClient.java   | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d6962c90/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
b/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
index e6279d7..160ca15 100644
--- a/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
+++ b/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
@@ -22,6 +22,7 @@ package org.apache.stratos.metadata.client.rest;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.HttpResponse;
@@ -94,6 +95,9 @@ public class DefaultRestClient implements RestClient {
     }
 
     private void setAuthHeader(HttpRequestBase post) {
+        if(StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){
+            return;
+        }
         String identity = username + ":" + password;
         String encoding = new String(Base64.encodeBase64(identity.getBytes()));
         post.setHeader("Authorization", "Basic " + encoding);


Mime
View raw message