diff options
author | sa282w <sa282w@att.com> | 2018-07-25 13:25:43 -0400 |
---|---|---|
committer | sa282w <sa282w@att.com> | 2018-07-30 11:49:36 -0400 |
commit | aa9b320ff93511280cf51b03d38fb9254af6b530 (patch) | |
tree | 434819201ead235fad2e7fb663b0480695156db4 /ecomp-portal-BE-os/src/main/java | |
parent | fe3a67c11b65d7989a6ef648c3f34eee8abe7394 (diff) |
JUnits for coverage
Issue-ID: PORTAL-273
JUnits for sonar coverage
Change-Id: Icb88d8563164281d29877bbc2de9c8f1f780aa0c
Signed-off-by: sa282w <sa282w@att.com>
Diffstat (limited to 'ecomp-portal-BE-os/src/main/java')
-rw-r--r-- | ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java index 34515705..b5ccfc02 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/portal/service/UserServiceImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -128,7 +128,9 @@ public class UserServiceImpl implements UserService { logger.error(EELFLoggerDelegate.errorLogger, "getUserByUserId failed", e); } finally { try { + if(in!=null) { in.close(); + } con.disconnect(); } catch (IOException e) { logger.error(EELFLoggerDelegate.errorLogger, "getUserByUserId 2 failed", e); @@ -185,8 +187,9 @@ public class UserServiceImpl implements UserService { in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); String inputLine; - while ((inputLine = in.readLine()) != null) + while ((inputLine = in.readLine()) != null) { response.append(inputLine); + } JSONObject jObject = new JSONObject(response.toString()); // json JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object for (int i = 0; i < jsonUsers.length(); i++) { @@ -220,8 +223,10 @@ public class UserServiceImpl implements UserService { logger.error(EELFLoggerDelegate.errorLogger, "getUserByFirstLastName failed", e); } finally { try { + if(in!=null) { in.close(); con.disconnect(); + } } catch (IOException e) { logger.error(EELFLoggerDelegate.errorLogger, "getUserByFirstLastName 2 failed", e); } |