From 324e7fd4c6b7335c2066acf39eb57cc9667a4dc4 Mon Sep 17 00:00:00 2001 From: madhawap Date: Tue, 9 Aug 2016 11:16:37 +0530 Subject: [PATCH] changes to removeCertificate endpoint, fix for the jira EMM-1490 --- .../CertificateManagementAdminServiceImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java index d9d074c70b..71788556aa 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java @@ -122,11 +122,14 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem try { boolean status = certificateService.removeCertificate(serialNumber); if (!status) { - Response.status(Response.Status.NOT_FOUND).entity("No certificate is found with the given " + - "serial number '" + serialNumber + "'"); + return Response.status(Response.Status.NOT_FOUND).entity( + "No certificate is found with the given " + + "serial number '" + serialNumber + "'").build(); + } else { + return Response.status(Response.Status.OK).entity( + "Certificate that carries the serial number '" + + serialNumber + "' has been removed").build(); } - return Response.status(Response.Status.OK).entity("Certificate that carries the serial number '" + - serialNumber + "' has been removed").build(); } catch (CertificateManagementException e) { String msg = "Error occurred while converting PEM file to X509Certificate"; log.error(msg, e); @@ -136,3 +139,6 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem } } + +//return Response.status(Response.Status.NOT_FOUND).entity("No certificate is found with the given " + +// "serial number '" + serialNumber + "'"); \ No newline at end of file