< prev index next >

src/jdk.incubator.jpackage/share/native/libapplauncher/JavaVirtualMachine.cpp

Print this page

        

@@ -82,10 +82,24 @@
 void JavaOptions::AppendValue(const TString Key) {
     AppendValue(Key, _T(""), NULL);
 }
 
 void JavaOptions::AppendValues(OrderedMap<TString, TString> Values) {
+    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);
+
+            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();
 
     for (std::vector<TString>::const_iterator iterator = orderedKeys.begin();
         iterator != orderedKeys.end(); iterator++) {
         TString name = *iterator;

@@ -93,10 +107,11 @@
 
         if (Values.GetValue(name, value) == true) {
             AppendValue(name, value);
         }
     }
+    }
 }
 
 void JavaOptions::ReplaceValue(const TString Key, TString Value) {
     for (std::list<JavaOptionItem>::iterator iterator = FItems.begin();
         iterator != FItems.end(); iterator++) {
< prev index next >