aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-sdnc-adapter/src
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-01-31 04:33:12 -0800
committerSébastien Determe <sd378r@intl.att.com>2017-02-06 12:41:19 +0000
commit7453d6716c32dde4c373753f0233f7f1b4e16a21 (patch)
tree4e14a1587594e2254657def8c16adf616175e535 /adapters/mso-sdnc-adapter/src
parentec92b1a1fd682c1af0f0b9fc92dcfd1a86f65930 (diff)
Fix FileNotFoundException in SDNC adapter
When SDNC returns HTTP 4XX code, there could be a FileNotFoundException that prevents the adpater to send back the answer to BPMN engine. Change-Id: I0f8ef5eaf95140a5d044e294f882412c8aaa4b53 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'adapters/mso-sdnc-adapter/src')
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
index 00d7c5a144..6ad9a6d1f5 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
@@ -48,7 +48,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-
import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest;
import org.openecomp.mso.adapters.sdnc.client.CallbackHeader;
import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest;
@@ -179,15 +178,16 @@ public class SDNCRestClient implements Runnable {
sdncResp.setRespCode(con.getResponseCode());
sdncResp.setRespMsg(con.getResponseMessage());
- in = new BufferedReader(new InputStreamReader(con.getInputStream()));
-
- String inputLine;
- //Not parsing the response -it contains a responseHdr section and data section
- while ((inputLine = in.readLine()) != null) {
- response.append(inputLine);
+ if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ String inputLine;
+ //Not parsing the response -it contains a responseHdr section and data section
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+ in.close();
}
- in.close();
-
+
sdncResp.setSdncRespXml(response.toString());
msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", "");
return(sdncResp);