From 8cd208ebaa33627daf05d8ffff7b28e53a7067d0 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 7 Sep 2017 08:52:41 -0400 Subject: Adjust code for Sonar issues Made non-functional updates to address static code analysis issues. Update license header with simple double-quote characters. Issue: PORTAL-72, PORTAL-90 Change-Id: Ic2c330daea07d721f0e6b350ebf03da97073f7ce Signed-off-by: Christopher Lott (cl778h) --- .../core/exception/FusionExceptionResolver.java | 23 +++++++++++++--------- .../core/exception/SessionExpiredException.java | 14 ++++++------- .../exception/UrlAccessRestrictedException.java | 14 ++++++------- .../core/exception/support/FusionException.java | 7 ++++--- .../exception/support/FusionRuntimeException.java | 17 ++++++++-------- 5 files changed, 41 insertions(+), 34 deletions(-) (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/FusionExceptionResolver.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/FusionExceptionResolver.java index e376f318..1e605176 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/FusionExceptionResolver.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/FusionExceptionResolver.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -44,25 +44,30 @@ import org.springframework.web.servlet.ModelAndView; @ControllerAdvice public class FusionExceptionResolver { + private final String error = "error"; + private final String errMsg = "errMsg"; + @ExceptionHandler(UrlAccessRestrictedException.class) public ModelAndView handleUrlAccessException(UrlAccessRestrictedException ex) { - ModelAndView model = new ModelAndView("error"); - model.addObject("errMsg", ex.getMessage()); + ModelAndView model = new ModelAndView(error); + model.addObject(errMsg, ex.getMessage()); return model; } + @ExceptionHandler(SessionExpiredException.class) public ModelAndView handleSessionException(SessionExpiredException ex) { - ModelAndView model = new ModelAndView("error"); - model.addObject("errMsg", ex.getMessage()); + ModelAndView model = new ModelAndView(error); + model.addObject(errMsg, ex.getMessage()); return model; } + @ExceptionHandler(Exception.class) public ModelAndView handleAllException(Exception ex) { - ModelAndView model = new ModelAndView("error"); - model.addObject("errMsg", ex.getMessage()); + ModelAndView model = new ModelAndView(error); + model.addObject(errMsg, ex.getMessage()); return model; } - + } \ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/SessionExpiredException.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/SessionExpiredException.java index 7d2f28ef..51521d0b 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/SessionExpiredException.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/SessionExpiredException.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -40,14 +40,14 @@ package org.onap.portalsdk.core.exception; import org.onap.portalsdk.core.exception.support.FusionRuntimeException; public class SessionExpiredException extends FusionRuntimeException { - + /** * */ private static final long serialVersionUID = 1L; - public static final String MESSAGE = "Your session has expired. Please login again."; + public static final String MESSAGE = "Your session has expired. Please login again."; - public SessionExpiredException() { - super(MESSAGE); - } + public SessionExpiredException() { + super(MESSAGE); + } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/UrlAccessRestrictedException.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/UrlAccessRestrictedException.java index 67bf87b0..46e785c6 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/UrlAccessRestrictedException.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/UrlAccessRestrictedException.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -40,14 +40,14 @@ package org.onap.portalsdk.core.exception; import org.onap.portalsdk.core.exception.support.FusionRuntimeException; public class UrlAccessRestrictedException extends FusionRuntimeException { - + /** * */ private static final long serialVersionUID = 1L; - public static final String MESSAGE = "Authorization Denied"; + public static final String MESSAGE = "Authorization Denied"; - public UrlAccessRestrictedException() { - super(MESSAGE); - } + public UrlAccessRestrictedException() { + super(MESSAGE); + } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionException.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionException.java index 012b9474..f3b27047 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionException.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionException.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -39,4 +39,5 @@ package org.onap.portalsdk.core.exception.support; import org.onap.portalsdk.core.FusionObject; -public interface FusionException extends FusionObject {} +public interface FusionException extends FusionObject { +} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionRuntimeException.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionRuntimeException.java index ea0e7a13..c5f6554b 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionRuntimeException.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/exception/support/FusionRuntimeException.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -42,12 +42,13 @@ public class FusionRuntimeException extends RuntimeException implements FusionEx * */ private static final long serialVersionUID = 1L; - public FusionRuntimeException() { - this(""); - } - public FusionRuntimeException(String message) { - super(message); - } + public FusionRuntimeException() { + this(""); + } + + public FusionRuntimeException(String message) { + super(message); + } } -- cgit 1.2.3-korg