fixing issue with certificate delete

revert-70aa11f8
inosh-perera 9 years ago
parent afbfaf4c1d
commit 9661502524

@ -17,6 +17,7 @@
*/ */
package org.wso2.carbon.certificate.mgt.core.service; package org.wso2.carbon.certificate.mgt.core.service;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.bouncycastle.pkcs.PKCS10CertificationRequest; import org.bouncycastle.pkcs.PKCS10CertificationRequest;
@ -31,6 +32,7 @@ import org.wso2.carbon.certificate.mgt.core.impl.KeyStoreReader;
import org.wso2.carbon.certificate.mgt.core.util.ConfigurationUtil; import org.wso2.carbon.certificate.mgt.core.util.ConfigurationUtil;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import java.io.InputStream; import java.io.InputStream;
@ -165,11 +167,13 @@ public class CertificateManagementServiceImpl implements CertificateManagementSe
@Override @Override
public boolean removeCertificate(String serialNumber) throws CertificateManagementDAOException { public boolean removeCertificate(String serialNumber) throws CertificateManagementDAOException {
try { try {
CertificateManagementDAOFactory.openConnection(); CertificateManagementDAOFactory.beginTransaction();
CertificateDAO certificateDAO = CertificateManagementDAOFactory.getCertificateDAO(); CertificateDAO certificateDAO = CertificateManagementDAOFactory.getCertificateDAO();
return certificateDAO.removeCertificate(serialNumber); Boolean status = certificateDAO.removeCertificate(serialNumber);
} catch (SQLException e) { CertificateManagementDAOFactory.commitTransaction();
String errorMsg = "Error when opening connection"; return status;
} catch (TransactionManagementException e) {
String errorMsg = "Error when deleting";
log.error(errorMsg, e); log.error(errorMsg, e);
throw new CertificateManagementDAOException(errorMsg, e); throw new CertificateManagementDAOException(errorMsg, e);
} finally { } finally {

Loading…
Cancel
Save