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 f3c454bda5..e0f0852787 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 @@ -17,6 +17,7 @@ import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.ws.rs.*; import javax.ws.rs.core.Response; +import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; @@ -42,8 +43,10 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem for (EnrollmentCertificate enrollmentCertificate : enrollmentCertificates) { certificate = new org.wso2.carbon.certificate.mgt.core.bean.Certificate(); certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); - certificate.setSerial(enrollmentCertificate.getSerial()); - certificate.setCertificate(certificateService.pemToX509Certificate(enrollmentCertificate.getPem())); + X509Certificate x509Certificate = certificateService + .pemToX509Certificate(enrollmentCertificate.getPem()); + certificate.setSerial(x509Certificate.getSerialNumber().toString()); + certificate.setCertificate(x509Certificate); certificates.add(certificate); } certificateService.saveCertificate(certificates); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java index bb8759e685..3934ceedf1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -231,8 +231,8 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { policyDeleted = false; } } - if(policyDeleted) { - for(int i : policyIds) { + if (policyDeleted) { + for (int i : policyIds) { Policy policy = pap.getPolicy(i); pap.deletePolicy(policy); } @@ -244,13 +244,16 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } if (policyDeleted) { - return Response.status(Response.Status.OK).entity("Policies have been successfully deleted").build(); + return Response.status(Response.Status.OK).entity("Policies have been successfully " + + "deleted").build(); } else { //TODO:Check of this logic is correct - String ModifiedInvalidPolicyIds = invalidPolicyIds.substring(0, invalidPolicyIds.length()-1); - return Response.status(Response.Status.BAD_REQUEST).entity( - new ErrorResponse.ErrorResponseBuilder().setMessage("Policies with the policy ID " + - ModifiedInvalidPolicyIds + " doesn't exist").build()).build(); + String modifiedInvalidPolicyIds = + invalidPolicyIds.substring(0, invalidPolicyIds.length() - 1); + return Response.status(Response.Status.BAD_REQUEST). + entity(new ErrorResponse.ErrorResponseBuilder(). + setMessage("Policies with the policy ID " + modifiedInvalidPolicyIds + + " doesn't exist").build()).build(); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs index 4d0f953422..46e213d374 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs @@ -51,14 +51,6 @@
- - -