Change invalid payload exception responses to bad requests

cherry-pick-b7435168
Yohan Avishke 5 years ago
parent 8bebf2c126
commit 4a3a9b587e

@ -36,7 +36,7 @@ public class BadRequestException extends WebApplicationException {
} }
public BadRequestException(ErrorDTO errorDTO) { public BadRequestException(ErrorDTO errorDTO) {
super(Response.status(Response.Status.INTERNAL_SERVER_ERROR) super(Response.status(Response.Status.BAD_REQUEST)
.entity(errorDTO) .entity(errorDTO)
.header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON)
.build()); .build());

@ -121,7 +121,7 @@ public class AnalyticsArtifactsManagementServiceImpl
} catch (BadRequestException e) { } catch (BadRequestException e) {
String errMsg = "Failed to deploy stream due to invalid payload"; String errMsg = "Failed to deploy stream due to invalid payload";
log.error(errMsg, e); log.error(errMsg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errMsg).build();
} catch (AxisFault e) { } catch (AxisFault e) {
String errMsg = "Failed to create event definitions for tenant " + tenantDomain; String errMsg = "Failed to create event definitions for tenant " + tenantDomain;
log.error(errMsg, e); log.error(errMsg, e);
@ -194,7 +194,7 @@ public class AnalyticsArtifactsManagementServiceImpl
} catch (BadRequestException e) { } catch (BadRequestException e) {
String errMsg = "Failed to deploy receiver due to invalid payload"; String errMsg = "Failed to deploy receiver due to invalid payload";
log.error(errMsg, e); log.error(errMsg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errMsg).build();
} catch (AxisFault e) { } catch (AxisFault e) {
String errMsg = "Failed to create event definitions for tenantDomain: " + tenantDomain; String errMsg = "Failed to create event definitions for tenantDomain: " + tenantDomain;
log.error(errMsg, e); log.error(errMsg, e);
@ -267,7 +267,7 @@ public class AnalyticsArtifactsManagementServiceImpl
} catch (BadRequestException e) { } catch (BadRequestException e) {
String errMsg = "Failed to deploy publisher due to invalid payload"; String errMsg = "Failed to deploy publisher due to invalid payload";
log.error(errMsg, e); log.error(errMsg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errMsg).build();
} catch (AxisFault e) { } catch (AxisFault e) {
String errMsg = "Failed to create event definitions for tenantDomain: " + tenantDomain; String errMsg = "Failed to create event definitions for tenantDomain: " + tenantDomain;
log.error(errMsg, e); log.error(errMsg, e);
@ -300,7 +300,7 @@ public class AnalyticsArtifactsManagementServiceImpl
} catch (InvalidExecutionPlanException e) { } catch (InvalidExecutionPlanException e) {
String errMsg = "Failed to deploy siddhi script due to invalid payload"; String errMsg = "Failed to deploy siddhi script due to invalid payload";
log.error(errMsg, e); log.error(errMsg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errMsg).build();
} catch (AxisFault e) { } catch (AxisFault e) {
String errMsg = "Failed to create event definitions for tenantDomain: " + tenantDomain; String errMsg = "Failed to create event definitions for tenantDomain: " + tenantDomain;
log.error(errMsg, e); log.error(errMsg, e);

Loading…
Cancel
Save