From e400c2aa8fe74794d496b72689ec73fd337edfa8 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 5 May 2023 10:42:55 +0100 Subject: [PATCH] JAL-629 test fixes --- src/jalview/gui/Desktop.java | 6 ++- test/jalview/bin/CommandLineOperationsNG.java | 62 +++++++++++++------------ 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index cd62c9f..fb3bbc0 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -435,7 +435,11 @@ public class Desktop extends jalview.jbgui.GDesktop { if (LaunchUtils.getJavaVersion() >= 11) { - jalview.bin.Console.info( + /* + * Send this message to stderr as the warning that follows (due to + * reflection) also goes to stderr. + */ + System.err.println( "Linux platform only! You may have the following warning next: \"WARNING: An illegal reflective access operation has occurred\"\nThis is expected and cannot be avoided, sorry about that."); } try diff --git a/test/jalview/bin/CommandLineOperationsNG.java b/test/jalview/bin/CommandLineOperationsNG.java index 12072f7..049e9a8 100644 --- a/test/jalview/bin/CommandLineOperationsNG.java +++ b/test/jalview/bin/CommandLineOperationsNG.java @@ -39,6 +39,8 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import io.github.classgraph.ClassGraph; +import io.github.classgraph.ModuleRef; +import io.github.classgraph.ScanResult; import jalview.gui.JvOptionPane; public class CommandLineOperationsNG @@ -128,41 +130,38 @@ public class CommandLineOperationsNG public synchronized static String getClassPath() { - // if (scanner == null) - // { - // scanner = new ClassGraph(); - // ScanResult scan = scanner.scan(); - // classpath = scan.getClasspath(); - modules = ""; - // for (ModuleRef mr : scan.getModules()) - // { - // modules.concat(mr.getName()); - // } - java_exe = System.getProperty("java.home") + File.separator + "bin" - + File.separator + "java"; - - // } - - // while (classpath == null) - // { - // try - // { - // Thread.sleep(10); - // } catch (InterruptedException x) - // { - // - // } - // } + if (scanner == null) + { + scanner = new ClassGraph(); + ScanResult scan = scanner.scan(); + classpath = scan.getClasspath(); + modules = ""; + for (ModuleRef mr : scan.getModules()) + { + modules.concat(mr.getName()); + } + java_exe = System.getProperty("java.home") + File.separator + "bin" + + File.separator + "java"; + + } + + while (classpath == null) + { + try + { + Thread.sleep(10); + } catch (InterruptedException x) + { + + } + } return classpath; } private Worker getJalviewDesktopRunner(boolean withAwt, String cmd, int timeout) { - // Note: JAL-3065 - don't include quotes for lib/* because the arguments are - // not expanded by the shell - // String classpath = getClassPath(); - getClassPath(); + /* boolean win = System.getProperty("os.name").indexOf("Win") >= 0; String pwd = ""; try @@ -178,6 +177,11 @@ public class CommandLineOperationsNG String[] classpaths = new String[] { pwd + "/bin/main", pwd + "/j11lib/*", pwd + "/resources", pwd + "/help" }; String classpath = String.join(win ? ";" : ":", classpaths); + getClassPath(); + */ + // Note: JAL-3065 - don't include quotes for lib/* because the arguments are + // not expanded by the shell + String classpath = getClassPath(); String _cmd = java_exe + " " + (withAwt ? "-Djava.awt.headless=true" : "") + " -classpath " + classpath -- 1.7.10.2