amr lotfy created IO-477:
----------------------------
Summary: Exception on Mac only: Unexpected end of file from server
Key: IO-477
URL: https://issues.apache.org/jira/browse/IO-477
Project: Commons IO
Issue Type: Bug
Components: Utilities
Environment: mac os x Yosemite version 10.10.2 (14C1514)
Reporter: amr lotfy
http://stackoverflow.com/q/29853775/1356559
http://qr.ae/L6aYM
I am downloading mp3 and image files using "org.apache.commons.io.FileUtils" in
the following code successfully on windows 7:
FileUtils.copyURLToFile(new URL(urlString),myFile);
but on mac os x Yosemite version 10.10.2 (14C1514) I get this exception after
few downloads:
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:792)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:789)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1535)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
I have tried adding a timeout
FileUtils.copyURLToFile(new URL(url),myFile ,60000,60000);
or even using other methods
URLConnection conn = new URL(url).openConnection();
InputStream is = conn.getInputStream();
OutputStream outstream = new FileOutputStream(myFile);
byte[] buffer = new byte[4096];
int len;
while ((len = is.read(buffer)) > 0) {
outstream.write(buffer, 0, len);
}
outstream.close();
Update:
I tried to disable WiFi (to avoid any connectivity bugs) and used wired
ethernet but still have the same error after few downloads, any help is
appreciated.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)