aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup44
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java19
2 files changed, 52 insertions, 11 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup
new file mode 100644
index 0000000000..aaf3383c42
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>openecomp-sdc-common-rest</artifactId>
+ <name>openecomp-sdc-common-rest</name>
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-common-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>${hibernate.validator.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+ <!-- Swagger -->
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-core</artifactId>
+ <version>${swagger.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java
index af77268599..e8a6c7e7db 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java
@@ -22,8 +22,6 @@ package org.openecomp.sdcrests.errors;
import org.codehaus.jackson.map.JsonMappingException;
import org.hibernate.validator.internal.engine.path.PathImpl;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
@@ -34,10 +32,10 @@ import org.openecomp.sdc.common.errors.ErrorCodeAndMessage;
import org.openecomp.sdc.common.errors.GeneralErrorBuilder;
import org.openecomp.sdc.common.errors.JsonMappingErrorBuilder;
import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -50,8 +48,8 @@ import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Path;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
private static final String ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE =
@@ -78,8 +76,8 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
try {
writeStackTraceToFile(exception);
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (IOException ex) {
+ ex.printStackTrace();
}
List<Object> contentTypes = new ArrayList<>();
contentTypes.add(MediaType.APPLICATION_JSON);
@@ -174,15 +172,14 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
private void writeStackTraceToFile(Exception exception) throws IOException {
File file = new File("stack_trace.txt");
- OutputStream outputStream = new FileOutputStream(file);
-
- if(!file.exists()){
+ if (!file.exists()) {
file.createNewFile();
}
-
+ OutputStream outputStream = new FileOutputStream(file);
PrintWriter printWriter = new PrintWriter(file);
exception.printStackTrace(printWriter);
printWriter.close();
+ outputStream.close();
}
}