diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/servlets/exception/PropertyConstraintExceptionMapper.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/servlets/exception/PropertyConstraintExceptionMapper.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/exception/PropertyConstraintExceptionMapper.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/exception/PropertyConstraintExceptionMapper.java index cc90ecf00a..320839a38e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/exception/PropertyConstraintExceptionMapper.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/exception/PropertyConstraintExceptionMapper.java @@ -17,25 +17,22 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.servlets.exception; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraintException; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; - @Component @Provider -public class PropertyConstraintExceptionMapper implements ExceptionMapper<PropertyConstraintException> { +public class PropertyConstraintExceptionMapper implements ExceptionMapper<PropertyConstraintException> { private static final Logger log = Logger.getLogger(PropertyConstraintExceptionMapper.class); private final Gson gson = new GsonBuilder().setPrettyPrinting().create(); @@ -49,9 +46,6 @@ public class PropertyConstraintExceptionMapper implements ExceptionMapper<Proper public Response toResponse(PropertyConstraintException exception) { log.debug("#toResponse - An error occurred: ", exception); ResponseFormat responseFormat = componentsUtils.getResponseFormat(exception.getActionStatus(), exception.getParams()); - return Response.status(responseFormat.getStatus()) - .entity(gson.toJson(responseFormat.getRequestError())) - .build(); + return Response.status(responseFormat.getStatus()).entity(gson.toJson(responseFormat.getRequestError())).build(); } - } |