Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path processing does not work properly when running ProcessBuilder in CMD /c #877

Open
shishikura7 opened this issue Jul 11, 2022 · 1 comment

Comments

@shishikura7
Copy link

shishikura7 commented Jul 11, 2022

  • Description

When executing CMD / C from ProcessBuilder in the Webstart environment of Jdk 8u333, path processing does not work properly.
'' Will be included in the first letter.

This issue does not occur until JDK8u202.

Environment where problems occur
windows11(x86)/Windows7(32bit)
openwebstart / Oracle Javaws
jdk11 / Oracle jre8u333 / openjdk11_x86

Environment that operates normally
windows11(x86)/Windows7(32bit)
1 : IcedTea(openwebstart) / Oracle Javaws before jre8u202.
2 : Eclipse Debug (All-JDK 11/17/8 x586)


HowToReproduce:

1 tart application under JNLP
2 Test Resource


Actual Result Log

'"C:\Program Files\PostgreSQL\9.3\bin\pg_dump.exe"' is not recognized as an internal or external command,
operable program or batch file.

"C:\Program Files\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316
/c
cmd
JAVA library.path    : C:\Program Files\Eclipse Adoptium\jre-8.0.332.9-hotspot\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;c:\program files\openwebstart\jre\bin;C:\Program Files\Java\jre1.8.0_152\bin;C:\Program Files\Eclipse Adoptium\jre-8.0.332.9-hotspot\bin;C:\Program Files\OpenWebStart;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;.
JAVA class.path      : .
JAVA.home            : C:\Program Files\Eclipse Adoptium\jre-8.0.332.9-hotspot
OS名(os.version):    : 6.1
OS名(os.arch)        : x86
OS名(os.name)        : Windows 7
java.version)        : 1.8.0_332


Expected Result Log

"C:\Program Files\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316

"C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316
/c
cmd
JAVA library.path    : C:\Program Files\java\jdk1.8.0_152\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;c:\program files\openwebstart\jre\bin;C:\Program Files\Java\jre1.8.0_152\bin;C:\Program Files\Eclipse Adoptium\jre-8.0.332.9-hotspot\bin;C:\Program Files\OpenWebStart;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;.
JAVA class.path      : .
JAVA.home            : C:\Program Files\java\jdk1.8.0_152\jre
OS名(os.version):    : 6.1
OS名(os.arch)        : x86
OS名(os.name)        : Windows 7
java.version)        : 1.8.0_152

Test Source code for an executable test case

package test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
public class process_test {
public static void main(String[] args) throws Exception {
// Process BUlter TEST CODE
System.out.println("java.version) : " + System.getProperty("java.version"));
System.out.println("OS名(os.name) : " + System.getProperty("os.name"));
System.out.println("OS名(os.arch) : " + System.getProperty("os.arch"));
System.out.println("OS名(os.version): : " + System.getProperty("os.version"));
System.out.println("JAVA.home : " + System.getProperty("java.home"));
System.out.println("JAVA class.path : " + System.getProperty("java.class.path"));
System.out.println("JAVA library.path : " + System.getProperty("java.library.path"));
String[] commandArr = {"cmd", "/c", ""C:\Program Files\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316"};
ProcessBuilder processBuilder = new ProcessBuilder(commandArr);
processBuilder.redirectErrorStream(true);
Process process = processBuilder.start();
for(int i=0 ; i < commandArr.length ; i++) System.out.println(commandArr[i]);
try {
BufferedReader runtime = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.forName("MS932")));
String line;
while ((line = runtime.readLine()) != null) {
System.out.println(line);
}
int result = process.exitValue();
System.out.printf("result=%d%n", result);
Thread.sleep(5000);
}catch (Exception e) {
// TODO: handle exception
}
System.exit(0);
}
}

@shishikura7
Copy link
Author

This is an additional contact.
This report was registered in Oracle's bug report on 7/11/2022.

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8290073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant