Example usage for java.security KeyStore equals

List of usage examples for java.security KeyStore equals

Introduction

In this page you can find the example usage for java.security KeyStore equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:view.CertificateManagementDialog.java

private void btnAcceptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAcceptActionPerformed
    Properties properties = new Properties();
    String configFile = "aCCinaPDF.cfg";
    try {/*from   www  .ja v a2s  . c o m*/
        properties.load(new FileInputStream(configFile));
    } catch (IOException ex) {
        Logger.getLogger(CertificateManagementDialog.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (rbUseDefaultKeystore.isSelected()) {
        if (!CCInstance.getInstance().getKeystore().equals(CCInstance.getInstance().getDefaultKeystore())) {
            CCInstance.getInstance().setKeystore(CCInstance.getInstance().getDefaultKeystore());
            Settings.getSettings().setKeystorePath(null);
            properties.remove("keystore");
        }
    } else {
        if (null == lastOpened) {
            lastOpened = new File(tfCustomKeystore.getText());
        }
        try {
            KeyStore ks = isValidKeystore(lastOpened, false);
            if (!ks.equals(CCInstance.getInstance().getKeystore())) {
                CCInstance.getInstance().setKeystore(ks);
                String keystorePath = lastOpened.getAbsolutePath();
                Settings.getSettings().setKeystorePath(keystorePath);
                properties.setProperty("keystore", keystorePath);
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, Bundle.getBundle().getString("selectValidKeystore"), "",
                    JOptionPane.INFORMATION_MESSAGE);
            return;
        }
    }

    try {
        FileOutputStream fileOut = new FileOutputStream(configFile);
        properties.store(fileOut, "Settings");
        fileOut.close();
    } catch (IOException ex) {
        JOptionPane.showMessageDialog(this, Bundle.getBundle().getString("errorSavingConfigFile"), "",
                JOptionPane.ERROR_MESSAGE);
    }

    this.dispose();
}