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 15:33:47 UTC

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

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 f13d16f  Fix https://issues.apache.org/jira/browse/DAEMON-399
f13d16f is described below

commit f13d16ff3af61bee27a2dd22b8c5fac3569207ff
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jun 11 16:33:30 2019 +0100

    Fix https://issues.apache.org/jira/browse/DAEMON-399
    
    Remove code that removed quotes from configured JVM options. If the
    quotes are there then then are there for a reason and should be
    retained.
---
 src/changes/changes.xml             |   4 ++
 src/native/windows/include/apxwin.h |   6 --
 src/native/windows/src/javajni.c    |   4 --
 src/native/windows/src/utils.c      | 106 ------------------------------------
 4 files changed, 4 insertions(+), 116 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5382f32..f0c4ccb 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -113,6 +113,10 @@
         Options text areas. This prevents settings after the first blank line
         from being lost when saved to the registry.
       </action>
+      <action issue="DAEMON-399" type="fix" dev="markt">
+        Procrun. Remove the code that removed quotes from configured Java and
+        Java 9 Options.
+      </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/include/apxwin.h b/src/native/windows/include/apxwin.h
index 717f645..cbd4ac9 100644
--- a/src/native/windows/include/apxwin.h
+++ b/src/native/windows/include/apxwin.h
@@ -130,12 +130,6 @@ LPWSTR  apxMultiSzCombine(APXHANDLE hPool, LPCWSTR lpStrA, LPCWSTR lpStrB,
 LPAPXMULTISZ    apxMultiSzStrdup(LPCTSTR szSrc);
 LPTSTR          apxMultiSzStrcat(LPAPXMULTISZ lpmSz, LPCTSTR szSrc);
 LPCTSTR         apxMultiSzGet(LPAPXMULTISZ lpmSz);
-/** Remove the specified character from the string
- * Replacement is done in-place.
- */
-LPTSTR          apxStrCharRemove(LPTSTR szString, TCHAR chSkip);
-DWORD           apxStrUnQuoteInplaceA(LPSTR szString);
-DWORD           apxStrUnQuoteInplaceW(LPWSTR szString);
 
 BOOL            apxUltohex(ULONG n, LPTSTR lpBuff, DWORD dwBuffLength);
 BOOL            apxUptohex(ULONG_PTR n, LPTSTR lpBuff, DWORD dwBuffLength);
diff --git a/src/native/windows/src/javajni.c b/src/native/windows/src/javajni.c
index 119689d..e1e8c45 100644
--- a/src/native/windows/src/javajni.c
+++ b/src/native/windows/src/javajni.c
@@ -469,22 +469,18 @@ static DWORD __apxMultiSzToJvmOptions(APXHANDLE hPool,
     if (lpString)
         AplCopyMemory(p, lpString, l + 1);
     for (i = 0; i < n; i++) {
-        DWORD qr = apxStrUnQuoteInplaceA(p);
         (*lppArray)[i].optionString = p;
         while (*p)
             p++;
         p++;
-        p += qr;
     }
     if (lpString9)
         AplCopyMemory(p, lpString9, l9 + 1);
     for (i = n; i < (n + n9); i++) {
-        DWORD qr = apxStrUnQuoteInplaceA(p);
         (*lppArray)[i].optionString = p;
         while (*p)
             p++;
         p++;
-        p += qr;
     }
 
     return nTotal;
diff --git a/src/native/windows/src/utils.c b/src/native/windows/src/utils.c
index b1d81f8..c42de27 100644
--- a/src/native/windows/src/utils.c
+++ b/src/native/windows/src/utils.c
@@ -299,60 +299,6 @@ apxMultiSzToArrayW(APXHANDLE hPool, LPCWSTR lpString, LPWSTR **lppArray)
 
 #define QSTR_DATA(q)    ((char *)(q) + sizeof(APXMULTISZ))
 
-LPTSTR apxStrCharRemove(LPTSTR szString, TCHAR chSkip)
-{
-  LPTSTR p = szString;
-  LPTSTR q = szString;
-  if (IS_EMPTY_STRING(szString))
-    return szString;
-  while (*p) {
-    if(*p != chSkip)
-      *q++ = *p;
-    ++p;
-  }
-  *q = TEXT('\0');
-
-  return szString;
-}
-
-DWORD apxStrCharRemoveA(LPSTR szString, CHAR chSkip)
-{
-  LPSTR p = szString;
-  LPSTR q = szString;
-  DWORD c = 0;
-  if (IS_EMPTY_STRING(szString))
-    return c;
-  while (*p) {
-    if(*p != chSkip)
-      *q++ = *p;
-    else
-        ++c;
-    ++p;
-  }
-  *q = '\0';
-
-  return c;
-}
-
-DWORD apxStrCharRemoveW(LPWSTR szString, WCHAR chSkip)
-{
-  LPWSTR p = szString;
-  LPWSTR q = szString;
-  DWORD  c = 0;
-  if (IS_EMPTY_STRING(szString))
-    return c;
-  while (*p) {
-    if(*p != chSkip)
-      *q++ = *p;
-    else
-        ++c;
-    ++p;
-  }
-  *q = L'\0';
-
-  return c;
-}
-
 void
 apxStrCharReplaceA(LPSTR szString, CHAR chReplace, CHAR chReplaceWith)
 {
@@ -568,58 +514,6 @@ void apxStrQuoteInplaceW(LPWSTR szString)
     }
 }
 
-DWORD apxStrUnQuoteInplaceA(LPSTR szString)
-{
-    LPSTR p = szString;
-    BOOL needsQuote = FALSE;
-    BOOL inQuote = FALSE;
-    while (*p) {
-        if (*p == '"') {
-            if (inQuote)
-                break;
-            else
-                inQuote = TRUE;
-        }
-        else if (*p == ' ') {
-            if (inQuote) {
-                needsQuote = TRUE;
-                break;
-            }
-        }
-        ++p;
-    }
-    if (!needsQuote)
-        return apxStrCharRemoveA(szString, '"');
-    else
-        return 0;
-}
-
-DWORD apxStrUnQuoteInplaceW(LPWSTR szString)
-{
-    LPWSTR p = szString;
-    BOOL needsQuote = FALSE;
-    BOOL inQuote = FALSE;
-    while (*p) {
-        if (*p == L'"') {
-            if (inQuote)
-                break;
-            else
-                inQuote = TRUE;
-        }
-        else if (*p == L' ') {
-            if (inQuote) {
-                needsQuote = TRUE;
-                break;
-            }
-        }
-        ++p;
-    }
-    if (!needsQuote)
-        return apxStrCharRemoveW(szString, L'"');
-    else
-        return 0;
-}
-
 LPWSTR
 apxMszToCRLFW(APXHANDLE hPool, LPCWSTR szStr)
 {