diff options
author | Claudio David Gasparini <claudio.gasparini@pantheon.tech> | 2020-12-01 15:28:25 +0100 |
---|---|---|
committer | Claudio David Gasparini <claudio.gasparini@pantheon.tech> | 2020-12-02 08:17:25 +0100 |
commit | b1740000e774ca633309e640f190cdcd74aa8241 (patch) | |
tree | a9d5a861b4f056c661d3742a534a9635838aa064 /cps-rest/src/main | |
parent | c8f2136670321731ec97d027d427af2ec9fd1077 (diff) |
Fix checkstyle violations for "final" keyword
Issue-ID: CPS-119
Signed-off-by: Claudio David Gasparini <claudio.gasparini@pantheon.tech>
Change-Id: I871a361937ed30047fe89ff2d2b17499cddad56c
Diffstat (limited to 'cps-rest/src/main')
3 files changed, 23 insertions, 23 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/Application.java b/cps-rest/src/main/java/org/onap/cps/Application.java index 9f6c2edce9..d8e849d53d 100644 --- a/cps-rest/src/main/java/org/onap/cps/Application.java +++ b/cps-rest/src/main/java/org/onap/cps/Application.java @@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class Application {
- public static void main(String[] args) {
+ public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
}
\ No newline at end of file diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java index 9e57408fb7..549760d2f8 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java @@ -63,7 +63,7 @@ public class CpsRestController implements CpsRestApi { * @return a ResponseEntity with the anchor name. */ @Override - public final ResponseEntity<String> createAnchor(@Valid Anchor anchor, String dataspaceName) { + public final ResponseEntity<String> createAnchor(@Valid final Anchor anchor, final String dataspaceName) { final AnchorDetails anchorDetails = modelMapper.map(anchor, AnchorDetails.class); anchorDetails.setDataspace(dataspaceName); final String anchorName = cpService.createAnchor(anchorDetails); @@ -71,7 +71,7 @@ public class CpsRestController implements CpsRestApi { } @Override - public ResponseEntity<Object> createModules(@Valid MultipartFile multipartFile, String dataspaceName) { + public ResponseEntity<Object> createModules(@Valid final MultipartFile multipartFile, final String dataspaceName) { final File fileToParse = saveToFile(multipartFile); final SchemaContext schemaContext = cpService.parseAndValidateModel(fileToParse); cpService.storeSchemaContext(schemaContext, dataspaceName); @@ -79,42 +79,43 @@ public class CpsRestController implements CpsRestApi { } @Override - public ResponseEntity<Object> createNode(@Valid MultipartFile multipartFile, String dataspaceName) { + public ResponseEntity<Object> createNode(@Valid final MultipartFile multipartFile, final String dataspaceName) { return null; } @Override - public ResponseEntity<Object> deleteAnchor(String dataspaceName, String anchorName) { + public ResponseEntity<Object> deleteAnchor(final String dataspaceName, final String anchorName) { return null; } @Override - public ResponseEntity<Object> deleteDataspace(String dataspaceName) { + public ResponseEntity<Object> deleteDataspace(final String dataspaceName) { return null; } @Override - public ResponseEntity<Object> getAnchor(String dataspaceName, String anchorName) { + public ResponseEntity<Object> getAnchor(final String dataspaceName, final String anchorName) { return null; } @Override - public ResponseEntity<Object> getAnchors(String dataspaceName) { + public ResponseEntity<Object> getAnchors(final String dataspaceName) { return null; } @Override - public ResponseEntity<Object> getModule(String dataspaceName, @Valid String namespaceName, @Valid String revision) { + public ResponseEntity<Object> getModule(final String dataspaceName, @Valid final String namespaceName, + @Valid final String revision) { return null; } @Override - public ResponseEntity<Object> getNode(String dataspaceName) { + public ResponseEntity<Object> getNode(final String dataspaceName) { return null; } @Override - public ResponseEntity<Object> getNodeByDataspaceAndAnchor(String dataspaceName, String anchorName) { + public ResponseEntity<Object> getNodeByDataspaceAndAnchor(final String dataspaceName, final String anchorName) { return null; } @@ -129,13 +130,11 @@ public class CpsRestController implements CpsRestApi { * @return a ResponseEntity. */ @PostMapping("/upload-yang-json-data-file") - public final ResponseEntity<String> uploadYangJsonDataFile( - @RequestParam("file") MultipartFile uploadedFile) { + public final ResponseEntity<String> uploadYangJsonDataFile(@RequestParam("file") final MultipartFile uploadedFile) { validateJsonStructure(uploadedFile); final int persistenceObjectId = cpService.storeJsonStructure(getJsonString(uploadedFile)); - return new ResponseEntity<String>( + return new ResponseEntity<>( "Object stored in CPS with identity: " + persistenceObjectId, HttpStatus.OK); - } /** diff --git a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java index 2b9ee51fa6..94226b78c0 100644 --- a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java @@ -40,38 +40,39 @@ public class CpsRestExceptionHandler { * @return response with response code 500. */ @ExceptionHandler - public ResponseEntity<Object> handleInternalErrorException(Exception exception) { + public ResponseEntity<Object> handleInternalErrorException(final Exception exception) { return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception); } @ExceptionHandler({CpsException.class}) - public ResponseEntity<Object> handleCpsException(CpsException exception) { + public ResponseEntity<Object> handleCpsException(final CpsException exception) { return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception.getMessage(), extractDetails(exception)); } @ExceptionHandler({CpsValidationException.class}) - public ResponseEntity<Object> handleCpsValidationException(CpsException exception) { + public ResponseEntity<Object> handleCpsValidationException(final CpsException exception) { return buildErrorResponse(HttpStatus.BAD_REQUEST, exception.getMessage(), extractDetails(exception)); } @ExceptionHandler({CpsNotFoundException.class}) - public ResponseEntity<Object> handleCpsNotFoundException(CpsException exception) { + public ResponseEntity<Object> handleCpsNotFoundException(final CpsException exception) { return buildErrorResponse(HttpStatus.NOT_FOUND, exception.getMessage(), extractDetails(exception)); } - private static ResponseEntity<Object> buildErrorResponse(HttpStatus status, Exception exception) { + private static ResponseEntity<Object> buildErrorResponse(final HttpStatus status, final Exception exception) { return buildErrorResponse(status, exception.getMessage(), ExceptionUtils.getStackTrace(exception)); } - private static ResponseEntity<Object> buildErrorResponse(HttpStatus status, String message, String details) { - ErrorMessage errorMessage = new ErrorMessage(); + private static ResponseEntity<Object> buildErrorResponse(final HttpStatus status, final String message, + final String details) { + final ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setStatus(status.toString()); errorMessage.setMessage(message); errorMessage.setDetails(details); return new ResponseEntity<>(errorMessage, status); } - private static String extractDetails(CpsException exception) { + private static String extractDetails(final CpsException exception) { return exception.getCause() == null ? exception.getDetails() : ExceptionUtils.getStackTrace(exception.getCause()); |