diff options
author | Ed Merks | 2021-12-17 04:53:28 +0000 |
---|---|---|
committer | Ed Merks | 2021-12-17 04:53:28 +0000 |
commit | db771a19e5ecd2ff82165b940873314f7b17f5b2 (patch) | |
tree | e496efdf1e33503589ed6b41eaca0647f1b2f662 | |
parent | 1ad602b0235d314a94d7faa3e7a4bc63c5cc44be (diff) | |
download | org.eclipse.oomph-db771a19e5ecd2ff82165b940873314f7b17f5b2.tar.gz org.eclipse.oomph-db771a19e5ecd2ff82165b940873314f7b17f5b2.tar.xz org.eclipse.oomph-db771a19e5ecd2ff82165b940873314f7b17f5b2.zip |
[577848] Avoid generating inappropriate GTK_IM_MODULE env for Linux
desktop links
Ensure this compiles for Java 8.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=577848
2 files changed, 16 insertions, 3 deletions
diff --git a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/FreeDesktopSupport.java b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/FreeDesktopSupport.java index 24e96d283..67135c364 100644 --- a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/FreeDesktopSupport.java +++ b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/FreeDesktopSupport.java @@ -11,6 +11,7 @@ package org.eclipse.oomph.setup.internal.installer; import org.eclipse.oomph.util.IOUtil; +import org.eclipse.oomph.util.StringUtil; import org.eclipse.osgi.util.NLS; @@ -63,9 +64,9 @@ public class FreeDesktopSupport implements DesktopSupport try // to find a better choice see Bug 517671 xim produces flickering { Process process = Runtime.getRuntime().exec("im-config -l"); - for (String s : new String(process.getInputStream().readAllBytes()).trim().split("\\s+")) + for (String s : IOUtil.readUTF8(process.getInputStream()).trim().split("\\s+")) { - if (!IM_MODULE_XIM.equals(s) && !s.isBlank()) + if (!IM_MODULE_XIM.equals(s) && !StringUtil.isEmpty(s.trim())) { module = s; break; @@ -77,7 +78,7 @@ public class FreeDesktopSupport implements DesktopSupport // no luck then... } } - if (module != null && !module.isBlank()) + if (module != null && !StringUtil.isEmpty(module.trim())) { desktopFile.append("env GTK_IM_MODULE="); desktopFile.append(module); diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java index e08137fd6..7b577e632 100644 --- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java +++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java @@ -829,6 +829,18 @@ public final class IOUtil public static String readUTF8(File file) throws Exception { InputStream inputStream = new FileInputStream(file); + try + { + return readUTF8(inputStream); + } + finally + { + close(inputStream); + } + } + + public static String readUTF8(InputStream inputStream) throws Exception + { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try |