Closed
Bug 18857
Opened 26 years ago
Closed 25 years ago
-1, not 0, should indicate end of stream
Categories
(Core Graveyard :: Java-Implemented Plugins, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: lvv, Assigned: blackconnect)
Details
From jdk1.2 doc on InputStream.read method:
If no byte is
available because the stream is at end of file, the value -1 is
returned; otherwise, at least one byte is read and stored into b
But currently the 0 is returned on the end of stream ( which is second
parameter of the PlugletStreamListener.onDataAvailable method)
Steps to Reproduce:
1)use the following implementation for your
PlugletStreamListener.onDataAvailable method:
public void onDataAvailable(PlugletStreamInfo plugletInfo, InputStream
input,int length) {
try{
System.out.println("PlugletStreamListener.onDataAvailable");
byte[] buf = new byte[1024];
int l = input.read(buf, 0, 1024);
while (l > -1) {
l = input.read(buf, 0, 1024);
System.out.println("l is "+l);
}
System.out.println("end of reading");
} catch(Exception e) {
;
}
}
2)for the value of src attribute use any file (for convenience
small file can be used)
3)load the corresponding page to start your pluglet
Actual Results:
0 is returned on the end of stream, the cycle will not be finished
Expected Results:
On the end of the stream the -1 should be returned and cycle
should be finished.
Build Date & Platform Bug Found:
November 12, 1999; WinNT
| Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Comment 1•25 years ago
|
||
Method read(byte[], int, int) still return 0 instead od -1 at the end of stream.
This is a code of /mozilla/java/plugins/test/test.java
...[skip]...
public void onDataAvailable(PlugletStreamInfo plugletInfo, InputStream
input,int length) {
byte[] buf = new byte[10];
try{
org.mozilla.util.DebugPluglet.print("--TestStreamListener.onDataAvailable
");
org.mozilla.util.DebugPluglet.print("--length "+input.available()+"\n");
int l = input.read(buf, 0, 10);
while ( l != -1 ) {
System.out.println("tmp = "+tmp);
tmp++;
System.out.println("l = "+l);
l = input.read(buf, 0, 10);
}
} catch(Exception e) {
;
}
}
...[skip]...
This test never stop because of method read return 0 after the end of stream.
Output is:
tmp = 1
l = 10
tmp = 2
l = 10
tmp = 3
l = 10
tmp = 4
l = 10
tmp = 5
l = 10
tmp = 6
l = 10
tmp = 7
l = 10
tmp = 8
l = 10
tmp = 9
l = 10
tmp = 10
l = 10
tmp = 11
l = 7
tmp = 12
l = 0
tmp = 13
l = 0
tmp = 14
l = 0
tmp = 15
l = 0
tmp = 16
l = 0
tmp = 17
l = 0
tmp = 18
l = 0
Platform: Intel Solaris 2.7 and Mozilla PR3
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 2•25 years ago
|
||
Add my email adress to cc list
| Assignee | ||
Comment 3•25 years ago
|
||
I fixed this bug.
Fix checked in in JAVADEV_PR3_20001002 brunch
Status: REOPENED → RESOLVED
Closed: 26 years ago → 25 years ago
Resolution: --- → FIXED
Comment 4•25 years ago
|
||
This bug now reproduced with new version (1.8.8.2) of file
org_mozilla_pluglet_mozilla_PlugletInputStream.cpp
from JAVADEV_PR3_20001002 branch.
Testcase is the same (please, review my previous comments for this bug)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 5•25 years ago
|
||
bug is finally fixed.
Fix checked into JAVADEV_PR3_20001002 brunch.
(Please update classes and jni directories)
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•