summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src
diff options
context:
space:
mode:
authoraz2497 <avi.ziv@amdocs.com>2017-08-10 17:49:40 +0300
committeraz2497 <avi.ziv@amdocs.com>2017-08-10 18:47:32 +0300
commit644017cb3edd5b7a077a634ffd5daf2fee6bc088 (patch)
treed371219cede1734d6909568325345ef196be677b /openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src
parent7f7925e39cf2f428061d161bc4ffe67cad80c76e (diff)
[SDC] OnBoard with enabled tests and features
Change-Id: I4c1bbf6e1c854cf97a3561c736f83da44b58b7c0 Signed-off-by: az2497 <avi.ziv@amdocs.com> [SDC] OnBoard with enabled tests and features. Change-Id: Icd52f039aee4dd393a1404d530bb9fdd0b20e604 Signed-off-by: az2497 <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java25
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java22
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java2
3 files changed, 26 insertions, 23 deletions
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 e8a6c7e7db..d399469745 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
@@ -54,9 +54,10 @@ import javax.ws.rs.ext.ExceptionMapper;
public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
private static final String ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE =
"errorCodesToResponseStatusMapping.json";
- private static Map<String, String> errorCodeToResponseStatus = JsonUtil
- .json2Object(FileUtils.getFileInputStream(ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE),
- Map.class);
+ @SuppressWarnings("unchecked")
+ private static Map<String, String> errorCodeToResponseStatus =
+ JsonUtil.json2Object(FileUtils
+ .getFileInputStream(ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE), Map.class);
private static Logger logger = (Logger) LoggerFactory.getLogger(DefaultExceptionMapper.class);
@Override
@@ -74,11 +75,6 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
response = transform(exception);
}
- try {
- writeStackTraceToFile(exception);
- } catch (IOException ex) {
- ex.printStackTrace();
- }
List<Object> contentTypes = new ArrayList<>();
contentTypes.add(MediaType.APPLICATION_JSON);
response.getMetadata().put("Content-Type", contentTypes);
@@ -169,17 +165,4 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
private Object toEntity(Response.Status status, ErrorCode code) {
return new ErrorCodeAndMessage(status, code);
}
-
- private void writeStackTraceToFile(Exception exception) throws IOException {
- File file = new File("stack_trace.txt");
- if (!file.exists()) {
- file.createNewFile();
- }
- OutputStream outputStream = new FileOutputStream(file);
- PrintWriter printWriter = new PrintWriter(file);
- exception.printStackTrace(printWriter);
- printWriter.close();
- outputStream.close();
- }
-
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java
index 6573485db7..91f2656f16 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java
@@ -20,6 +20,15 @@
package org.openecomp.sdcrests.mapping;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerServiceName;
+
/**
* Base class for all mapping classes. Mapping classes will perform data mapping from source object
* to target object Base class provides following<br> <ol> <li>provides life cycle of
@@ -93,8 +102,19 @@ public abstract class MappingBase<S, T> {
try {
object = clazz.newInstance();
- } catch (InstantiationException | IllegalAccessException exception) {
+ } catch (InstantiationException | IllegalAccessException exception ) {
//TODO: what what?
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(
+ LoggerConstants.TARGET_ENTITY,
+ LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(),
+ exception.getMessage(), exception.getMessage());
+
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder())
+ .withMessage(exception.getMessage())
+ .withId(exception.getMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
+
+
}
return object;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java
index 22ce0a4e45..ea69249944 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/wrappers/GenericCollectionWrapper.java
@@ -27,7 +27,7 @@ import java.util.List;
public class GenericCollectionWrapper<T> implements Serializable {
private static final long serialVersionUID = 1L;
- private List<T> results;
+ private transient List<T> results;
private int listCount;
public GenericCollectionWrapper() {