public void close() throws IOException { // write the account StringBuilder sb = new StringBuilder(50); sb.append(PROPKEY_ACCOUNT).append("=").append(numProcessed).append("\n"); sb.append(PROPKEY_ACCOUNT_REVOKED).append("=").append(numProcessedRevoked).append("\n"); IoUtil.save(new File(caDir, FILENAME_OVERVIEW), sb.toString().getBytes()); closeCurrentCsvFile(); IoUtil.closeStream(certsManifestOs); }
private Exception exportCert(final CertStoreType certstore, final File processLogFile) { final File entriesDir = new File(baseDir, OcspDbEntryType.CERT.dirName()); entriesDir.mkdirs(); FileOutputStream certsFileOs = null; try { certsFileOs = new FileOutputStream( new File(baseDir, OcspDbEntryType.CERT.dirName() + ".mf"), true); exportCert0(certstore, processLogFile, certsFileOs); return null; } catch (Exception ex) { // delete the temporary files deleteTmpFiles(baseDir, "tmp-certs-"); System.err.println("\nexporting table CERT and CRAW has been cancelled due to error,\n" + "please continue with the option '--resume'"); LOG.error("Exception", ex); return ex; } finally { IoUtil.closeStream(certsFileOs); } } // method exportCert
private Exception exportEntries(final CaDbEntryType type, final CertStoreType certstore, final File processLogFile, final Long idProcessedInLastProcess) { String tablesText = (CaDbEntryType.CERT == type) ? "tables CERT and CRAW" : "table " + type.tableName(); File dir = new File(baseDir, type.dirName()); dir.mkdirs(); FileOutputStream entriesFileOs = null; try { entriesFileOs = new FileOutputStream( new File(baseDir, type.dirName() + ".mf"), true); exportEntries(type, certstore, processLogFile, entriesFileOs, idProcessedInLastProcess); return null; } catch (Exception ex) { // delete the temporary files deleteTmpFiles(baseDir, "tmp-"); System.err.println("\nexporting " + tablesText + " has been cancelled due to error,\n" + "please continue with the option '--resume'"); LOG.error("Exception", ex); return ex; } finally { if (entriesFileOs != null) { IoUtil.closeStream(entriesFileOs); } } }