Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2031240 | 1.4.0 | Jean-Christophe Collet | P4 | Closed | Fixed | beta |
Name: mc57594 Date: 01/13/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Here is a program that demonstrantes the problem.
Please compile it.
--------
import java.net.URL;
import java.net.URLConnection;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.IOException;
class Test {
public static void main(String[] args) throws Exception {
URL url = new URL(args[0]);
URLConnection conn = url.openConnection();
InputStream inputStream = conn.getInputStream();
System.out.println("Content-Length: " + conn.getContentLength());
File fileOut = new File(args[1]);
OutputStream outputStream = new FileOutputStream(fileOut);
try {
byte[] buf = new byte[1024 * 8];
int n;
int total = 0;
while ((n = inputStream.read(buf)) != -1) {
outputStream.write(buf, 0, n);
total += n;
System.out.println("total: " + total);
}
System.out.println("loop out");
System.exit(0);
} catch (IOException e) {
outputStream.close();
fileOut.delete();
throw e;
}
}
}
--------
The synopsis is as follows.
You have to specify a host on which WU-FTPD 2.6 is running
(there is no problem with WU-FTPD 2.5).
java Test url output_file
Here is the result when I executed.
--------
D:\naozo\test\java\resolver\test>c:\jdk1.2.2\bin\java Test ftp://futaba/test.tif
tt.tif
Content-Length: 68586
total: 1460
total: 2920
total: 4380
total: 5840
total: 7300
total: 8760
total: 10808
total: 12428
total: 14476
total: 16524
total: 17520
total: 18980
total: 20440
total: 21900
total: 23360
total: 24820
total: 26280
total: 27740
total: 29200
total: 30660
total: 32708
total: 34328
total: 36376
total: 38424
total: 39420
total: 40880
total: 42928
total: 44976
total: 47024
total: 48180
total: 50228
total: 51848
total: 53896
total: 55944
total: 56940
total: 58400
total: 59860
total: 61908
total: 63528
total: 64240
total: 65700
total: 67748
^C
D:\naozo\test\java\resolver\test>
--------
When reading the last data, the program hangs.
I found a description as follows in
ftp://ftp.wu-ftpd.org/pub/wu-ftpd/CHANGES/
o Corrections for RFC compliance can break some clients. If possible, the
broken client should be updated, but a compile-time option has been
added. See the config.h.noac for more information on this.
=======================================
rom: "YOSHIOKA, Naozo" <###@###.###>
To: "chamness" <###@###.###>
Cc: "YOSHIOKA, Naozo" <###@###.###>
Subject: Re: (Review ID: 99847) When reading with URLConnection from WU-FTPD 2.6, the program hangs.
Date: Thu, 13 Jan 2000 14:56:06 +0900
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
>This problem is supposedly fixed in the
>newer version of java (jdk1.3 or kestrel-beta).
>Can you test with that version and let me know
>your results?
I downloaded Windows JavaTM 2 Runtime Environment, Standard Edition, v.1.3 Beta
Internationalized version of Java 2 Runtime Environment
from http://developer.java.sun.com/developer/earlyAccess/j2sdk13/
then tested it.
Here is the result.
--------
D:\naozo\test\java\resolver\test>"c:\Program Files\JavaSoft\JRE\1.3\bin\java" -version
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
D:\naozo\test\java\resolver\test>"c:\Program Files\JavaSoft\JRE\1.3\bin\java" Test ftp://futaba/test.tif aa.tif
Content-Length: 68586
total: 1460
total: 2920
total: 4380
total: 5840
total: 7300
total: 8760
total: 10808
total: 12428
total: 14476
total: 16524
total: 17520
total: 18980
total: 20440
total: 21900
total: 23360
total: 24820
total: 26280
total: 27740
total: 29200
total: 30660
total: 32120
total: 33580
total: 35040
total: 37088
total: 38708
total: 40756
total: 42804
total: 43800
total: 45260
total: 46720
total: 48180
total: 49640
total: 51100
total: 52560
total: 54020
total: 55480
total: 56940
total: 58400
total: 59860
total: 61908
total: 62780
total: 64828
total: 65700
total: 67748
<---- I pressed Ctrl-C here.
D:\naozo\test\java\resolver\test>
--------
So the problem has not been fixed yet.
If you modify
--------
ftp.closeServer();
super.close();
--------
in sun/net/ftp/FtpInputStream.java to
--------
super.close();
ftp.closeServer();
--------
it will work though I don't know whether it's the best way
(Actually when I extracted necessary sources from JDK1.2.2,
compiled them, set up CLASSPATH, then tested using JDK1.7.7,
it worked.)
Naozo
(Review ID: 99847)
======================================================================
- backported by
-
JDK-2031240 When reading with URLConnection from WU-FTPD 2.6, the program hangs.
-
- Closed
-
- duplicates
-
JDK-4191848 When closing an input stream obtained from an ftp URL connection, program hangs
-
- Closed
-