modules/jretools/src/main/java/org/apache/harmony/jretools/toolutils/KeyStoreLoaderSaver.java [142:190]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static void saveStore(KeyStore keyStore, String storePath,
            char[] storePass, boolean isVerbose)
            throws KeyStoreException, NoSuchAlgorithmException,
            CertificateException, IOException {
        // TODO: store not only to a file?

        // if the program should output additional information, do it
        if (isVerbose) {
            System.out.println("[Saving " + storePath + "]");
        }

        // if the path to the store is not set, use the default value
        if (storePath == null) {
            storePath = KeytoolParameters.defaultKeystorePath;
        }

        
        File ksFile = null;
        URI uri = null;
        try {
            uri = new URI(storePath);
            ksFile = new File(uri);
        } catch (URISyntaxException e) {
            ksFile = new File(storePath);
        } catch (IllegalArgumentException e) {
            ksFile = new File(storePath);
        }
        
        // the file will be created if and only if one with the same name
        // doesn't exist
        ksFile.createNewFile();
        BufferedOutputStream bos = new BufferedOutputStream(
                new FileOutputStream(ksFile));
        try {
            keyStore.store(bos, storePass);
        } catch (NoSuchAlgorithmException e) {
            throw new NoSuchAlgorithmException(
                    "Failed to find the algorithm to check the keystore integrity",
                    e);
        } catch (CertificateException e) {
            throw new CertificateException(
                    "Failed to save a certificate to the keystore. ", e);
        } catch (IOException e) {
            throw (IOException) new IOException("Failed to save the keystore. ")
                    .initCause(e);
        } finally {
            bos.close();
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/jdktools/src/main/java/org/apache/harmony/tools/toolutils/KeyStoreLoaderSaver.java [142:190]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static void saveStore(KeyStore keyStore, String storePath,
            char[] storePass, boolean isVerbose)
            throws KeyStoreException, NoSuchAlgorithmException,
            CertificateException, IOException {
        // TODO: store not only to a file?

        // if the program should output additional information, do it
        if (isVerbose) {
            System.out.println("[Saving " + storePath + "]");
        }

        // if the path to the store is not set, use the default value
        if (storePath == null) {
            storePath = KeytoolParameters.defaultKeystorePath;
        }

        
        File ksFile = null;
        URI uri = null;
        try {
            uri = new URI(storePath);
            ksFile = new File(uri);
        } catch (URISyntaxException e) {
            ksFile = new File(storePath);
        } catch (IllegalArgumentException e) {
            ksFile = new File(storePath);
        }
        
        // the file will be created if and only if one with the same name
        // doesn't exist
        ksFile.createNewFile();
        BufferedOutputStream bos = new BufferedOutputStream(
                new FileOutputStream(ksFile));
        try {
            keyStore.store(bos, storePass);
        } catch (NoSuchAlgorithmException e) {
            throw new NoSuchAlgorithmException(
                    "Failed to find the algorithm to check the keystore integrity",
                    e);
        } catch (CertificateException e) {
            throw new CertificateException(
                    "Failed to save a certificate to the keystore. ", e);
        } catch (IOException e) {
            throw (IOException) new IOException("Failed to save the keystore. ")
                    .initCause(e);
        } finally {
            bos.close();
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



