X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Fclient%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Fhttp%2FHClient.java;h=d885283490171e7630b6ab36aa98820eaf43fc6b;hb=7e966914050e66219689001ff4ab601a49eef0ac;hp=1d3d9547d35afdd4ca5e40df236728c04ad009d1;hpb=4b5a7d721d994a49057e9bfb403c7bff1b376660;p=aaf%2Fauthz.git diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java index 1d3d9547..d8852834 100644 --- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java +++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java @@ -111,13 +111,13 @@ public class HClient implements EClient { public void send() throws APIException { try { // Build URL from given URI plus current Settings - if(uri.getPath()==null) { + if (uri.getPath()==null) { throw new APIException("Invalid URL entered for HClient"); } StringBuilder pi=null; - if(pathinfo!=null) { // additional pathinfo + if (pathinfo!=null) { // additional pathinfo pi = new StringBuilder(uri.getPath()); - if(!pathinfo.startsWith("/")) { + if (!pathinfo.startsWith("/")) { pi.append('/'); } pi.append(pathinfo); @@ -133,7 +133,7 @@ public class HClient implements EClient { ); huc = getConnection(sendURI, pi); huc.setRequestMethod(meth); - if(ss!=null) { + if (ss!=null) { ss.setSecurity(huc); } if (headers != null) @@ -153,7 +153,7 @@ public class HClient implements EClient { throw new APIException(e); } finally { // ensure all these are reset after sends meth=pathinfo=null; - if(headers!=null) { + if (headers!=null) { headers.clear(); } pathinfo = query = fragment = ""; @@ -200,7 +200,7 @@ public class HClient implements EClient { huc.setReadTimeout(timeout); respCode = huc.getResponseCode(); ss.setLastResponse(respCode); - if(evalInfo(huc)) { + if (evalInfo(huc)) { return true; } else { extractError(); @@ -216,13 +216,13 @@ public class HClient implements EClient { private void extractError() { InputStream is = huc.getErrorStream(); try { - if(is==null) { + if (is==null) { is = huc.getInputStream(); } - if(is!=null) { + if (is!=null) { errContent = new StringBuilder(); int c; - while((c=is.read())>=0) { + while ((c=is.read())>=0) { errContent.append((char)c); } } @@ -274,7 +274,7 @@ public class HClient implements EClient { } public void close() { - if(huc!=null) { + if (huc!=null) { huc.disconnect(); } } @@ -382,12 +382,12 @@ public class HClient implements EClient { int read; InputStream is; OutputStream os = resp.getOutputStream(); - if(respCode==expected) { + if (respCode==expected) { is = huc.getInputStream(); // reuse Buffers Pooled pbuff = Rcli.buffPool.get(); try { - while((read=is.read(pbuff.content))>=0) { + while ((read=is.read(pbuff.content))>=0) { os.write(pbuff.content,0,read); } } finally { @@ -396,14 +396,14 @@ public class HClient implements EClient { return true; } else { is = huc.getErrorStream(); - if(is==null) { + if (is==null) { is = huc.getInputStream(); } - if(is!=null) { + if (is!=null) { errContent = new StringBuilder(); Pooled pbuff = Rcli.buffPool.get(); try { - while((read=is.read(pbuff.content))>=0) { + while ((read=is.read(pbuff.content))>=0) { os.write(pbuff.content,0,read); } } finally {