src/jdk.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp
branchJDK-8200758-branch
changeset 57455 f1290ca0fee6
parent 57323 66c1dbc008c5
--- a/src/jdk.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp	Wed Jul 03 17:46:04 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp	Sun Jul 07 19:40:48 2019 -0400
@@ -84,15 +84,30 @@
 }
 
 void JavaOptions::AppendValues(OrderedMap<TString, TString> Values) {
-    std::vector<TString> orderedKeys = Values.GetKeys();
+    if (Values.GetAllowDuplicates()) {
+        for (int i = 0; i < (int)Values.Count(); i++) {
+            TString name, value;
+
+            bool bResult = Values.GetKey(i, name);
+            bResult &= Values.GetValue(i, value);
 
-    for (std::vector<TString>::const_iterator iterator = orderedKeys.begin();
-        iterator != orderedKeys.end(); iterator++) {
-        TString name = *iterator;
-        TString value;
+            if (bResult) {
+                AppendValue(name, value);
+            }
+        }
+    } else { // In case we asked to add values from OrderedMap with allow
+        // duplicates set to false. Not used now, but should avoid possible
+        // bugs.
+        std::vector<TString> orderedKeys = Values.GetKeys();
 
-        if (Values.GetValue(name, value) == true) {
-            AppendValue(name, value);
+        for (std::vector<TString>::const_iterator iterator = orderedKeys.begin();
+            iterator != orderedKeys.end(); iterator++) {
+            TString name = *iterator;
+            TString value;
+
+            if (Values.GetValue(name, value) == true) {
+                AppendValue(name, value);
+            }
         }
     }
 }