opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java
@@ -64,11 +64,6 @@ @Override public boolean execute() { FileInputStream fis = null; GZIPOutputStream gzip = null; boolean inputStreamOpen = false; boolean outputStreamOpen = false; try { if(!originalFile.exists()) @@ -77,24 +72,17 @@ return false; } fis = new FileInputStream(originalFile); inputStreamOpen = true; try (FileInputStream fis = new FileInputStream(originalFile); FileOutputStream fos = new FileOutputStream(newFile); gzip = new GZIPOutputStream(fos); outputStreamOpen = true; GZIPOutputStream gzip = new GZIPOutputStream(fos);) { byte[] buf = new byte[8192]; int n; while((n = fis.read(buf)) != -1) { gzip.write(buf, 0, n); } gzip.close(); outputStreamOpen = false; fis.close(); inputStreamOpen = false; } if(deleteOriginal && !originalFile.delete()) { @@ -106,34 +94,7 @@ } catch(IOException ioe) { logger.traceException(ioe); if (inputStreamOpen) { try { fis.close(); } catch (Exception fe) { logger.traceException(fe); // Cannot do much. Ignore. } } if (outputStreamOpen) { try { gzip.close(); } catch (Exception ge) { logger.traceException(ge); // Cannot do much. Ignore. } } return false; } } } opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java
@@ -61,11 +61,6 @@ @Override public boolean execute() { FileInputStream fis = null; ZipOutputStream zip = null; boolean inputStreamOpen = false; boolean outputStreamOpen = false; try { if(!originalFile.exists()) @@ -74,27 +69,20 @@ return false; } fis = new FileInputStream(originalFile); inputStreamOpen = true; try (FileInputStream fis = new FileInputStream(originalFile); FileOutputStream fos = new FileOutputStream(newFile); zip = new ZipOutputStream(fos); outputStreamOpen = true; ZipOutputStream zip = new ZipOutputStream(fos)) { ZipEntry zipEntry = new ZipEntry(originalFile.getName()); zip.putNextEntry(zipEntry); byte[] buf = new byte[8192]; int n; while((n = fis.read(buf)) != -1) { zip.write(buf, 0, n); } zip.close(); outputStreamOpen = false; fis.close(); inputStreamOpen = false; } if(deleteOriginal && !originalFile.delete()) { @@ -106,34 +94,7 @@ } catch(IOException ioe) { logger.traceException(ioe); if (inputStreamOpen) { try { fis.close(); } catch (Exception fe) { logger.traceException(fe); // Cannot do much. Ignore. } } if (outputStreamOpen) { try { zip.close(); } catch (Exception ze) { logger.traceException(ze); // Cannot do much. Ignore. } } return false; } } }