You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2019/06/11 10:57:56 UTC

[commons-daemon] branch master updated: Fix https://issues.apache.org/jira/browse/DAEMON-394

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git


The following commit(s) were added to refs/heads/master by this push:
     new 7bb2855  Fix https://issues.apache.org/jira/browse/DAEMON-394
7bb2855 is described below

commit 7bb28558affd187c60b6a4f622a07b595b51cf32
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jun 11 11:57:33 2019 +0100

    Fix https://issues.apache.org/jira/browse/DAEMON-394
    
    Ignore blank lines inserted into the Java Options and/or Java 9 Options
    text areas. This prevents settings after the first blank line from being
    lost when saved to the registry.
---
 src/changes/changes.xml        |  7 ++++++-
 src/native/windows/src/utils.c | 12 ++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2fafd97..5382f32 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -104,10 +104,15 @@
         Procrun. Change the default service user from LocalSystem to
         'NT Authority\LocalService'.
       </action>
-      <action issue="DAEMON-402" yype="fix" dev="markt" due-to="Iode Leroy">
+      <action issue="DAEMON-402" type="fix" dev="markt" due-to="Iode Leroy">
         Procrun. Avoid a crash on shutdown if multiple WM_CLOSE messages are
         received.
       </action>
+      <action issue="DAEMON-394" type="fix" dev="markt">
+        Procrun. Ignore blank lines inserted into the Java Options and/or Java 9
+        Options text areas. This prevents settings after the first blank line
+        from being lost when saved to the registry.
+      </action>
     </release>
     <release version="1.1.0" date="2017-11-15" description="Feature and bug fix release">
       <action issue="DAEMON-368" type="add" dev="ggregory">
diff --git a/src/native/windows/src/utils.c b/src/native/windows/src/utils.c
index 1e1f3cd..b1d81f8 100644
--- a/src/native/windows/src/utils.c
+++ b/src/native/windows/src/utils.c
@@ -648,17 +648,25 @@ apxCRLFToMszW(APXHANDLE hPool, LPCWSTR szStr, LPDWORD lpdwBytes)
 {
     DWORD l, c, n = 0;
     LPWSTR rv, b;
+    int eol = 0;
 
     l = lstrlenW(szStr);
     b = rv = apxPoolCalloc(hPool, (l + 2) * sizeof(WCHAR));
     for (c = 0; c < l; c++) {
         if (szStr[c] == L'\r') {
-            *b++ = '\0';
-            n++;
+        	if (eol) {
+        	    // Blank line. Ignore it. See DAEMON-394.
+        	}
+        	else {
+                *b++ = '\0';
+                n++;
+                eol = TRUE;
+        	}
         }
         else if (szStr[c] != L'\n') {
             *b++ = szStr[c];
             n++;
+            eol = FALSE;
         }
     }
     if (lpdwBytes)