今天写多线程下载时老报Http416的错误,正常的话应该返回code 206,但是这次却不正常,后来研究了一下,发现如下问题:
以下是错误log:
Server returned HTTP response code: 416 for URL: http://localhost:8080/QQ.exe
at sun.reflect.NativeConstructorAccesso
rImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccesso
rImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAcc
essorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.lyc.download.Demo$DownloadThread.run(Demo.java:97)