Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF2
-rw-r--r--native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java22
2 files changed, 5 insertions, 19 deletions
diff --git a/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF b/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
index 52b48f6b3df..1614f278e13 100644
--- a/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
+++ b/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
@@ -8,4 +8,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.cdt.serial
Automatic-Module-Name: org.eclipse.cdt.native.serial
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.cdt.core.native;bundle-version="6.0.100"
+Require-Bundle: org.eclipse.cdt.core.native;bundle-version="[6.1.0,7.0.0)"
diff --git a/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java b/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
index 80970dafe25..a305eb30cd1 100644
--- a/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
+++ b/native/org.eclipse.cdt.native.serial/src/org/eclipse/cdt/serial/SerialPort.java
@@ -19,11 +19,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@@ -258,22 +256,10 @@ public class SerialPort {
} else if (osName.startsWith("Windows")) { //$NON-NLS-1$
final WindowsRegistry registry = WindowsRegistry.getRegistry();
if (registry != null) {
- final String subKey = "HARDWARE\\DEVICEMAP\\SERIALCOMM"; //$NON-NLS-1$
-
- List<String> ports = new ArrayList<>();
- int i = 0;
- String valueName = null;
- String value = null;
- do {
- valueName = registry.getLocalMachineValueName(subKey, i++);
- if (valueName != null) {
- value = registry.getLocalMachineValue(subKey, valueName);
- if (value != null) {
- ports.add(value);
- }
- }
- } while (valueName != null && value != null);
- return ports.toArray(new String[ports.size()]);
+ return registry.getLocalMachineValues("HARDWARE\\DEVICEMAP\\SERIALCOMM").values().stream() //$NON-NLS-1$
+ .filter(String.class::isInstance) // Should only be strings here, but lets be safe
+ .map(String.class::cast) //
+ .toArray(String[]::new);
}
}
return new String[0];

Back to the top