United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4766029 : (process) Runtime.exec incorrect test for empty command

Details
Type:
Bug
Submit Date:
2002-10-21
Status:
Closed
Updated Date:
2002-11-22
Project Name:
JDK
Resolved Date:
2002-11-20
Component:
core-libs
OS:
windows_2000
Sub-Component:
java.lang
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.1
Fixed Versions:
1.4.2 (mantis)

Related Reports

Sub Tasks

Description

Name: gm110360			Date: 10/21/2002


FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
The exec(String command, String envp[], File dir) method of
the Runtime class tests for empty command using:

        if (command == "")

IMO, this test should be done using:

        if (command.length() == 0)




STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the following line of Java code:

Runtime.getRuntime().exec(new String());



EXPECTED VERSUS ACTUAL BEHAVIOR :
It should throw an IllegalArgumentException, but it throws
an IndexOutOfBoundsException instead.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.IndexOutOfBoundsException
	at java.lang.Runtime.exec(Runtime.java:547)
	at java.lang.Runtime.exec(Runtime.java:428)
	at java.lang.Runtime.exec(Runtime.java:364)
	at java.lang.Runtime.exec(Runtime.java:326)
	at CodeSnippet_3.run(CodeSnippet_3.java:3)
	at org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain1.eval
(ScrapbookMain1.java:14)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at
org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain.evalLoop
(ScrapbookMain.java:48)
	at org.eclipse.jdt.internal.debug.ui.snippeteditor.ScrapbookMain.main
(ScrapbookMain.java:29)


REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 166038) 
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis
mantis-b08

VERIFIED IN:
mantis


                                     
2004-06-14
EVALUATION

This looks like a bad check.

-- iag@sfbay 2002-10-21
                                     
2002-10-21



Hardware and Software, Engineered to Work Together