From da5dfcd1a354807d13849c7f4ead535ccfa722fa Mon Sep 17 00:00:00 2001 From: avigaffa Date: Sun, 31 Dec 2017 15:07:39 +0200 Subject: Fixing sonar Exception Handling Change-Id: I04eb047973a3f5c07dd9dc410cb13af974e8ded1 Issue-ID: SDC-810 Signed-off-by: avigaffa Signed-off-by: vempo --- .../org/openecomp/core/utilities/file/FileUtils.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java') diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java index 786def961a..e70ad923a2 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2017 European Support Limited + * * 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 - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ package org.openecomp.core.utilities.file; @@ -189,7 +185,7 @@ public class FileUtils { return IOUtils.toByteArray(input); } catch (IOException exception) { throw new RuntimeException( - "error will convertion input stream to byte array:" + exception.getMessage()); + "error while converting input stream to byte array", exception); } } @@ -203,7 +199,7 @@ public class FileUtils { if (!fileName.contains(".")) { return fileName; } - return fileName.substring(0, fileName.lastIndexOf(".")); + return fileName.substring(0, fileName.lastIndexOf('.')); } public static String getFileExtension(String filename) { @@ -264,7 +260,7 @@ public class FileUtils { */ YML("yml"); - private String displayName; + private final String displayName; FileExtension(String displayName) { this.displayName = displayName; -- cgit 1.2.3-korg