Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-01-09 05:03:14 -0500
committerUwe Stieber2015-01-09 05:03:59 -0500
commitefb1d23573e5ad4ae4305e5749b6ba71ad2a3a77 (patch)
treee15179897ebebe39325ad4cffefe56cfbe372f36
parent0f1417adb79ef17c5422dcfb07305cca579730bd (diff)
downloadorg.eclipse.tcf-efb1d23573e5ad4ae4305e5749b6ba71ad2a3a77.tar.gz
org.eclipse.tcf-efb1d23573e5ad4ae4305e5749b6ba71ad2a3a77.tar.xz
org.eclipse.tcf-efb1d23573e5ad4ae4305e5749b6ba71ad2a3a77.zip
Terminals: Fix Bug 454962 - `set` output inside local terminal on Windows is not sorted
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java
index 8e3d6159b..152b285fe 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/utils/Env.java
@@ -14,6 +14,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -114,13 +115,16 @@ public class Env {
}
// Convert into an array of strings
- Iterator<Map.Entry<String, String>> iter = env.entrySet().iterator();
+ List<String> keys = new ArrayList<String>(env.keySet());
+ // On Windows hosts, sort the environment keys
+ if (Host.isWindowsHost()) Collections.sort(keys);
+ Iterator<String> iter = keys.iterator();
List<String> strings = new ArrayList<String>(env.size());
StringBuilder buffer = null;
while (iter.hasNext()) {
- Map.Entry<String, String> entry = iter.next();
- buffer = new StringBuilder(entry.getKey());
- buffer.append('=').append(entry.getValue());
+ String key = iter.next();
+ buffer = new StringBuilder(key);
+ buffer.append('=').append(env.get(key));
strings.add(buffer.toString());
}
@@ -138,7 +142,7 @@ public class Env {
nativeEnvironmentCasePreserved = new LinkedHashMap<String, String>();
cacheNativeEnvironment(nativeEnvironmentCasePreserved);
}
- return new HashMap<String, String>(nativeEnvironmentCasePreserved);
+ return new LinkedHashMap<String, String>(nativeEnvironmentCasePreserved);
}
}

Back to the top