summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--onboarding/pom.xml6
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/errors/DefaultExceptionMapper.java22
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java6
-rw-r--r--openecomp-be/lib/openecomp-common-lib/pom.xml9
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/GeneralErrorBuilder.java26
5 files changed, 37 insertions, 32 deletions
diff --git a/onboarding/pom.xml b/onboarding/pom.xml
index 28877803d7..f1c6099f21 100644
--- a/onboarding/pom.xml
+++ b/onboarding/pom.xml
@@ -138,6 +138,12 @@
<scope>test</scope>
<version>${testng.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ <version>1.3</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
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 28917b9fb7..098a89d6ff 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
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 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.sdcrests.errors;
@@ -54,7 +50,7 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
FileUtils.readViaInputStream(ERROR_CODES_TO_RESPONSE_STATUS_MAPPING_FILE,
stream -> JsonUtil.json2Object(stream, Map.class));
- private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(DefaultExceptionMapper
+ private static final Logger LOGGER = LoggerFactory.getLogger(DefaultExceptionMapper
.class);
@Override
@@ -147,11 +143,11 @@ public class DefaultExceptionMapper implements ExceptionMapper<Exception> {
}
private Response transform(Exception exception) {
- ErrorCode generalErrorCode = new GeneralErrorBuilder(exception.getMessage()).build();
- LOGGER.error(generalErrorCode.message(), exception);
+ ErrorCode errorCode = new GeneralErrorBuilder().build();
+ LOGGER.error(errorCode.message(), exception);
return Response
.status(Response.Status.INTERNAL_SERVER_ERROR)
- .entity(toEntity(Response.Status.INTERNAL_SERVER_ERROR, generalErrorCode))
+ .entity(toEntity(Response.Status.INTERNAL_SERVER_ERROR, errorCode))
.build();
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
index 4d92ee87c3..73c2a425dd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
@@ -75,10 +75,6 @@ public class OrchestrationTemplateProcessCsarHandler
} catch (CoreException e) {
LOGGER.error(e.getMessage());
response.addErrorMessageToMap(e.code().id(), e.code().message(),ErrorLevel.ERROR);
- } catch (IOException ioe) {
- LOGGER.error(ioe.getMessage());
- ErrorCode errorCode = new GeneralErrorBuilder(ioe.getMessage()).build();
- response.addErrorMessageToMap(errorCode.id(), errorCode.message(),ErrorLevel.ERROR);
}
} else {
if (!uploadFileResponse.getErrors().isEmpty()) {
@@ -91,7 +87,7 @@ public class OrchestrationTemplateProcessCsarHandler
private void processCsar(VspDetails vspDetails,
FileContentHandler fileContentHandler,
OrchestrationTemplateCandidateData candidateData,
- OrchestrationTemplateActionResponse response) throws IOException {
+ OrchestrationTemplateActionResponse response) {
response.setFileNames(new ArrayList<>(fileContentHandler.getFileList()));
Map<String, List<ErrorMessage>> errors = validateCsar(fileContentHandler);
toscaTreeManager.createTree();
diff --git a/openecomp-be/lib/openecomp-common-lib/pom.xml b/openecomp-be/lib/openecomp-common-lib/pom.xml
index 095f8be11b..96218d396e 100644
--- a/openecomp-be/lib/openecomp-common-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-common-lib/pom.xml
@@ -39,6 +39,15 @@
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>${commons.lang3.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/GeneralErrorBuilder.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/GeneralErrorBuilder.java
index 7ded61e2dc..05eae9d7e5 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/GeneralErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/GeneralErrorBuilder.java
@@ -1,41 +1,39 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 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.sdc.common.errors;
+import org.apache.commons.text.RandomStringGenerator;
+
public class GeneralErrorBuilder {
private static final String GENERAL_ERROR_REST_ID = "GENERAL_ERROR_REST_ID";
- private static final String GENERAL_ERROR_REST_MSG = "An error has occurred: %s";
+ private static final String GENERAL_ERROR_REST_MSG =
+ "An internal error has occurred. Please contact support. Error ID: %s";
private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
/**
* Instantiates a new General error builder.
- *
- * @param detailedError the detailed error
*/
- public GeneralErrorBuilder(String detailedError) {
+ public GeneralErrorBuilder() {
+ RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('A', 'Z').build();
builder.withId(GENERAL_ERROR_REST_ID);
builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(GENERAL_ERROR_REST_MSG, detailedError));
+ builder.withMessage(String.format(GENERAL_ERROR_REST_MSG, generator.generate(8)));
}
public ErrorCode build() {