-
Bug
-
Resolution: Fixed
-
P4
-
1.0.2
-
1.2beta4
-
sparc
-
solaris_2.5
-
Not verified
Whoops - shouldn't have closed this one... -brown
Name: saf@russia Date: 09/06/96
This bug was found by St.Petersburg Java SQE team (by Stanislav Avzan).
The java.io.PipedInputStream.connect method does not work with already
connected streams according to the Java language specification.
The Java Language specification
(Version 1.0 - August 1, 1996)
says the following (please see item 22.5.3):
"22.5.3 public void connect(PipedOutputStream src) throws IOException
The connect method causes this piped input stream to be connected to
the piped output stream src. If this object is already connected to some
other piped output stream, an IOException is thrown.
If src is an unconnected piped output stream and snk is an unconnected
piped input stream, they may be connected by either the call:
snk.connect(src)
or the call:
src.connect(snk)
The two calls have the same effect. "
So this method should throw IOException
if this object is already connected.
But in fact it does not.
Here is the minimized test demonstrating the bug:
----- test2.java ---------------------------------------
import java.io.*;
public class test2 {
public static void main( String[] argv ) {
PipedOutputStream os = new PipedOutputStream();
PipedOutputStream os2 = new PipedOutputStream();
PipedInputStream is = new PipedInputStream();
try {
is.connect(os);
} catch(Throwable e) {
System.out.println("Test failed: unexpected <"+e+"> thrown");
}
try {
is.connect(os2);
System.out.println("Test failed: IOException expected");
} catch(IOException e) {
System.out.println("Test passed: IOException thrown");
} catch(Throwable e) {
System.out.println("Test failed: unexpected <"+e+"> thrown");
}
}
}
----- The output of the test: -------------------------
$JAVA test2
Test failed: IOException expected
-------------------------------------------------------
Workaround:
None
======================================================================
The applied fix is not complete. The following simple test is still failing:
--------------------- Test.java -------------------------------
import java.io.*;
public class Test {
public static void main( String[] argv ) {
PipedInputStream i = new PipedInputStream(); //step create input stream
try {
PipedOutputStream o = new PipedOutputStream(i);
PipedOutputStream o2 = new PipedOutputStream(i);
System.out.println("Test failed: IOException not thrown" );
}
catch(IOException e) //step test IOException is thrown
{ System.out.println("Test passed: OKAY" );
}
}
}
-----------------------------------------------------------------
###@###.### 1998-01-21
Name: saf@russia Date: 09/06/96
This bug was found by St.Petersburg Java SQE team (by Stanislav Avzan).
The java.io.PipedInputStream.connect method does not work with already
connected streams according to the Java language specification.
The Java Language specification
(Version 1.0 - August 1, 1996)
says the following (please see item 22.5.3):
"22.5.3 public void connect(PipedOutputStream src) throws IOException
The connect method causes this piped input stream to be connected to
the piped output stream src. If this object is already connected to some
other piped output stream, an IOException is thrown.
If src is an unconnected piped output stream and snk is an unconnected
piped input stream, they may be connected by either the call:
snk.connect(src)
or the call:
src.connect(snk)
The two calls have the same effect. "
So this method should throw IOException
if this object is already connected.
But in fact it does not.
Here is the minimized test demonstrating the bug:
----- test2.java ---------------------------------------
import java.io.*;
public class test2 {
public static void main( String[] argv ) {
PipedOutputStream os = new PipedOutputStream();
PipedOutputStream os2 = new PipedOutputStream();
PipedInputStream is = new PipedInputStream();
try {
is.connect(os);
} catch(Throwable e) {
System.out.println("Test failed: unexpected <"+e+"> thrown");
}
try {
is.connect(os2);
System.out.println("Test failed: IOException expected");
} catch(IOException e) {
System.out.println("Test passed: IOException thrown");
} catch(Throwable e) {
System.out.println("Test failed: unexpected <"+e+"> thrown");
}
}
}
----- The output of the test: -------------------------
$JAVA test2
Test failed: IOException expected
-------------------------------------------------------
Workaround:
None
======================================================================
The applied fix is not complete. The following simple test is still failing:
--------------------- Test.java -------------------------------
import java.io.*;
public class Test {
public static void main( String[] argv ) {
PipedInputStream i = new PipedInputStream(); //step create input stream
try {
PipedOutputStream o = new PipedOutputStream(i);
PipedOutputStream o2 = new PipedOutputStream(i);
System.out.println("Test failed: IOException not thrown" );
}
catch(IOException e) //step test IOException is thrown
{ System.out.println("Test passed: OKAY" );
}
}
}
-----------------------------------------------------------------
###@###.### 1998-01-21