diff options
3 files changed, 20 insertions, 16 deletions
diff --git a/src/main/java/org/onap/music/authentication/AuthUtil.java b/src/main/java/org/onap/music/authentication/AuthUtil.java index 223fa74e..ee3b77a4 100644 --- a/src/main/java/org/onap/music/authentication/AuthUtil.java +++ b/src/main/java/org/onap/music/authentication/AuthUtil.java @@ -3,6 +3,8 @@ * org.onap.music * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property + * + * Modifications Copyright (C) 2019 IBM. * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,7 +93,7 @@ public class AuthUtil { List<AAFPermission> allPermissionsList) { List<AAFPermission> list = new ArrayList<>(); for (Iterator<AAFPermission> iterator = allPermissionsList.iterator(); iterator.hasNext();) { - AAFPermission aafPermission = (AAFPermission) iterator.next(); + AAFPermission aafPermission = iterator.next(); if(aafPermission.getType().indexOf(nameSpace) == 0) { list.add(aafPermission); } @@ -166,7 +168,7 @@ public class AuthUtil { "AuthUtil requestUri :::" + requestUri); for (Iterator<AAFPermission> iterator = aafPermsFinalList.iterator(); iterator.hasNext();) { - AAFPermission aafPermission = (AAFPermission) iterator.next(); + AAFPermission aafPermission = iterator.next(); if(!isauthorized) { isauthorized = isMatchPattern(aafPermission, requestUri, httpRequest.getMethod()); } diff --git a/src/main/java/org/onap/music/main/CipherUtil.java b/src/main/java/org/onap/music/main/CipherUtil.java index 0d5b7710..53333238 100644 --- a/src/main/java/org/onap/music/main/CipherUtil.java +++ b/src/main/java/org/onap/music/main/CipherUtil.java @@ -1,9 +1,11 @@ /* * ============LICENSE_START========================================== - * org.onap.music + * org.onap.music * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property * =================================================================== + * Modification Copyright (c) 2019 IBM + * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -245,13 +247,12 @@ public class CipherUtil { public static void readAndSetKeyString() { - try { - Scanner in = new Scanner(new FileReader("/opt/app/music/etc/properties.txt")); + try (Scanner in = new Scanner(new FileReader("/opt/app/music/etc/properties.txt"))) { + StringBuilder sb = new StringBuilder(); while(in.hasNext()) { sb.append(in.next()); } - in.close(); keyString = sb.toString(); } catch (FileNotFoundException e) { logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); diff --git a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java index f0793dc2..5ae49f5d 100644 --- a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java +++ b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java @@ -3,6 +3,8 @@ * org.onap.music * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property + * + * Modifications Copyright (C) 2019 IBM. * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,6 +60,15 @@ public class JsonResponse { private String lockLease; private boolean isLockHolders=false; + /** + * Create a JSONLock Response + * Use setters to provide more information as in + * JsonLockResponse(ResultType.SUCCESS).setMessage("We did it").setLock(mylockname) + * @param status + */ + public JsonResponse(ResultType status) { + this.status = status; + } public boolean isLockHolders() { return isLockHolders; @@ -68,16 +79,6 @@ public class JsonResponse { return this; } - /** - * Create a JSONLock Response - * Use setters to provide more information as in - * JsonLockResponse(ResultType.SUCCESS).setMessage("We did it").setLock(mylockname) - * @param status - */ - public JsonResponse(ResultType status) { - this.status = status; - } - /** * * @return |