Test: fixed regression test 005.jdbc to avoid Java 21 deprecation warnings.
authorBo Peng <pengbo@sraoss.co.jp>
Fri, 15 Mar 2024 04:54:59 +0000 (13:54 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Fri, 15 Mar 2024 04:58:40 +0000 (13:58 +0900)
Replace Runtime.exec(String) with Runtime.exec(String[]) to avoid Java 21 deprecation warnings.
Patch is created by Vladimir Petko and modified by Bo Peng.

src/test/regression/tests/005.jdbc/PgpoolTest.java
src/test/regression/tests/005.jdbc/RunTest.java

index cdf8fcf8a1efd85ca599c0a51cf8b64aeec2f454..89e7e5c941373e3bdc122a3cae614b58f97a938e 100644 (file)
@@ -52,11 +52,14 @@ public abstract class PgpoolTest {
 
     public void check() {
        try {
-           String command_line = "diff -u expected/" + getTestName() + " result/" +
-               getTestName();
            Process proc;
 
-           proc = Runtime.getRuntime().exec(command_line);
+           proc = Runtime.getRuntime().exec(new String[]
+               "diff",
+               "-u",
+               "expected/" + getTestName(),
+               "result/" + getTestName()
+           });
            proc.waitFor();
            System.out.print(getTestName() + ": ");
            if (proc.exitValue() == 0)
index 1ee4aceeebcc3c70b96673a4de749fa77082919d..f3b9e66c4cac6a1e6980f513a6267197efdb1549 100644 (file)
@@ -23,10 +23,11 @@ public class RunTest {
            String dbname = prop.getProperty("pgpooltest.dbname");
 
            // setup database
-           String command_line = "psql -f prepare.sql";
-           command_line = command_line + " -h " + host + " -p " + port +
-               " -U " + user + " " + dbname;
-           Process proc = Runtime.getRuntime().exec(command_line);
+           Process proc = Runtime.getRuntime().exec(new String[]{
+               "psql", "-f", "prepare.sql",
+               "-h", host, "-p", port,
+               "-U", user, dbname
+           });
            proc.waitFor();
 
            StringTokenizer tokenizer = new StringTokenizer(tests, " ");