From 09841d36e89fd0e52c949643c893e9e7bc891c6e Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 17 Oct 2016 06:49:28 +0000
Subject: [PATCH] Fix for OPENDJ-3273, detect the --quiet option for stop-ds and pass it down to avoid printing out the tail of the errors log.
---
opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java | 29 ++++++++---------------------
1 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
index 1282197..ced85e0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
@@ -143,13 +143,6 @@
* to be removed.
*
* @param args The command-line arguments provided to this program.
- * @param out The output stream to use for standard output, or
- * <CODE>null</CODE> if standard output is not
- * needed.
- * @param err The output stream to use for standard error, or
- * <CODE>null</CODE> if standard error is not
- * needed.
- * @param inStream The input stream to use for standard input.
*
* @return An integer value of zero if the file was deleted successfully, or
* some other value if a problem occurred.
@@ -206,7 +199,6 @@
.description(INFO_DSCORE_DESCRIPTION_LASTKNOWNGOODCFG.get())
.buildAndAddToParser(argParser);
- // Not used in this class, but required by the start-ds script (see issue #3814)
quietMode = quietArgument();
argParser.addArgument(quietMode);
@@ -276,7 +268,6 @@
// If an output file was specified and we could open the log file, open it
// and append data to it.
RandomAccessFile outputFile = null;
- long outputFileOffset = 0L;
if (logFile != null && outputFilePath.isPresent())
{
try
@@ -285,8 +276,7 @@
if (f.exists())
{
outputFile = new RandomAccessFile(f, "rw");
- outputFileOffset = outputFile.length();
- outputFile.seek(outputFileOffset);
+ outputFile.seek(outputFile.length());
}
}
catch (Exception e)
@@ -330,23 +320,20 @@
int bytesRead = logFile.read(logBuffer);
if (bytesRead > 0)
{
- if (outputFile == null)
+ if (outputFile != null)
+ {
+ outputFile.write(logBuffer, 0, bytesRead);
+ }
+ else if (!quietMode.isPresent())
{
getOutputStream().write(logBuffer, 0, bytesRead);
getOutputStream().flush();
}
- else
- {
- // Write on the file.
- // TODO
- outputFile.write(logBuffer, 0, bytesRead);
-
- }
logFileOffset += bytesRead;
}
}
}
- catch (Exception e)
+ catch (Exception ignored)
{
// We'll just ignore this.
}
@@ -362,7 +349,7 @@
try
{
Thread.sleep(10);
- } catch (InterruptedException ie) {}
+ } catch (InterruptedException ignored) {}
}
}
--
Gitblit v1.10.0