Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBONNARDEL Gregory2016-01-25 12:43:09 -0500
committerGuillaume Garzone2016-02-16 11:57:22 -0500
commit7489595992a2c9ba3bb052ec0ebd7553cf4fed2d (patch)
tree18ecdaa84df0875cc173b6a2633a68aaf740b93b
parent34aa31d6fc999395161cfee1948f04f0eb4221c1 (diff)
downloadorg.eclipse.om2m-7489595992a2c9ba3bb052ec0ebd7553cf4fed2d.tar.gz
org.eclipse.om2m-7489595992a2c9ba3bb052ec0ebd7553cf4fed2d.tar.xz
org.eclipse.om2m-7489595992a2c9ba3bb052ec0ebd7553cf4fed2d.zip
add verification: Http Location header object shall not be null before
using it. Signed-off-by: BONNARDEL Gregory <gbonnardel.ext@orange.com>
-rw-r--r--org.eclipse.om2m.comm.http/src/main/java/org/eclipse/om2m/comm/http/RestHttpClient.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.om2m.comm.http/src/main/java/org/eclipse/om2m/comm/http/RestHttpClient.java b/org.eclipse.om2m.comm.http/src/main/java/org/eclipse/om2m/comm/http/RestHttpClient.java
index 20b77f29..26d3d7cf 100644
--- a/org.eclipse.om2m.comm.http/src/main/java/org/eclipse/om2m/comm/http/RestHttpClient.java
+++ b/org.eclipse.om2m.comm.http/src/main/java/org/eclipse/om2m/comm/http/RestHttpClient.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.DeleteMethod;
@@ -113,7 +114,8 @@ public class RestHttpClient implements RestClientService {
}
}
if(statusCode==201){
- if(httpMethod.getResponseHeader("Location").getValue()!=null){
+ Header location = httpMethod.getResponseHeader("Location");
+ if((location != null) && (location.getValue()!=null)){
responseConfirm.setResourceURI(httpMethod.getResponseHeader("Location").getValue());
}
}

Back to the top