You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "amr lotfy (JIRA)" <ji...@apache.org> on 2015/04/26 09:45:38 UTC

[jira] [Issue Comment Deleted] (IO-477) Exception on Mac only: Unexpected end of file from server

     [ https://issues.apache.org/jira/browse/IO-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

amr lotfy updated IO-477:
-------------------------
    Comment: was deleted

(was: No, I didn't try {{curl}}, if issue presisted I will try it today.)

> 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
>              Labels: osx
>
> 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)