log.error(e.getMessage(), e); if (connection != null) { try {
certificate = getCertificate(); } catch (UserStoreException | KeyStoreException | CertificateException | NoSuchAlgorithmException e) { throw new CryptoException("Error occurred while retrieving the certificate.", e); throw new CryptoException("Error occurred while creating the cipher.", e); } catch (BadPaddingException | NoSuchAlgorithmException | CertificateEncodingException | IllegalBlockSizeException e) { throw new CryptoException("Error occurred while encrypting.", e);
public String getAPISubscibedStatus() throws AppManagementException, IdentityException { Connection connection = null; PreparedStatement ps = null; ResultSet result = null; String apiNames = ""; try { connection = APIMgtDBUtil.getConnection(); String sqlQuery = "SELECT API.APP_NAME AS APP_NAME " + "FROM APM_SUBSCRIPTION SUBS, APM_APP API " + "WHERE SUBS.APP_ID = API.APP_ID "; ps = connection.prepareStatement(sqlQuery); result = ps.executeQuery(); while (result.next()) { //apiNames = apiNames + result.getString("APP_NAME"); apiNames = apiNames + AppManagerUtil.decryptToken(result.getString("APP_NAME")); } } catch (SQLException e) { handleException("Failed to get SubscribedAPI of :" , e); } catch (CryptoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } finally { APIMgtDBUtil.closeAllConnections(ps, connection, result); } return apiNames; }
private boolean isReportExist(String newName) throws RegistryException{ ReportConfigurationBean retrievedBean[]; try { retrievedBean = getSavedReports(); } catch (CryptoException e) { throw new RegistryException(e.getMessage()); } catch (TaskException e) { throw new RegistryException(e.getMessage()); } boolean returnVal = false; if (retrievedBean != null) { for (ReportConfigurationBean reportConfigurationBean : retrievedBean) { if (reportConfigurationBean.getName().equals(newName)) { returnVal = true; break; } } } return returnVal; }
handleException("Error in revoking access token: " + e.getMessage(), e); } catch (CryptoException e) { handleException("Error in revoking access token: " + e.getMessage(), e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, rs);