java.io.EOFException

Appcelerator JIRA | Marco Cota | 3 years ago
  1. 0

    h3. Issue When receiving Gzipped responses on Android this are being incorrectly handled as http errors by the titanium SDK even when the response code is 200 or 201. This is only happening when the response have an empty body. h3. Logs Gzip Response {code} [INFO] : Gzip Enabled [WARN] : IdleConnectionHandler: Removing a connection that never existed! [ERROR] : TiHttpClient: (TiHttpClient-23) [360048,1780592] HTTP Error (java.io.EOFException): java.io.EOFException [ERROR] : TiHttpClient: java.io.EOFException [ERROR] : TiHttpClient: at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:202) [ERROR] : TiHttpClient: at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:98) [ERROR] : TiHttpClient: at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81) [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:268) [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:217) [ERROR] : TiHttpClient: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657) [ERROR] : TiHttpClient: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637) [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1287) [ERROR] : TiHttpClient: at java.lang.Thread.run(Thread.java:841) [INFO] : XHR RESPONSE Error >>> Response: [INFO] : XHR RESPONSE Error >>> Status: 200 Type: POST Headers: Date:Thu, 09 Jan 2014 16:01:28 GMT [INFO] : Server:Apache [INFO] : Content-Encoding:gzip [INFO] : Content-Length:0 [INFO] : Keep-Alive:timeout=10, max=30 [INFO] : Connection:Keep-Alive [INFO] : Content-Type:image/png [DEBUG] : HTTPClient: The persistent handle is disposed. {code} Non Gzip Response {code} [INFO] : Gzip Disabled [INFO] : XHR RESPONSE Load >>> Response: "null" [INFO] : XHR RESPONSE Load >>> Status: 200 Type: POST Headers: Date:Thu, 09 Jan 2014 16:00:45 GMT [INFO] : Server:Apache [INFO] : Content-Length:0 [INFO] : Vary:Accept-Encoding [INFO] : Keep-Alive:timeout=10, max=30 [INFO] : Connection:Keep-Alive [INFO] : Content-Type:image/png; charset: UTF-8 [DEBUG] : HTTPClient: The persistent handle is disposed. {code} h3. Steps to Reproduce 1. Run the test case 2. Click on Non Gzip Button 3. Receive a load response from the xhr 4. Click Gzip Button 5. Receive an error response from the xhr The php server return the same body empty response with the difference of the gzip encoding header h3. Sample Code {code} var win = Ti.UI.createWindow(); var bt1 = Ti.UI.createButton({ title:'NonGZIP', width:80, left:10, gzip:false, bottom:10 }); var bt2 = Ti.UI.createButton({ title:'GZIP', width:80, right:10, gzip:true, bottom:10 }); bt1.addEventListener('click',doRequest); bt2.addEventListener('click',doRequest); win.add(bt1); win.add(bt2); win.open(); function doRequest(e){ var xhr = Ti.Network.createHTTPClient(); xhr.onload = function(e){ Titanium.API.info('XHR RESPONSE Load >>> Response: "'+this.responseText+'"'); Titanium.API.info('XHR RESPONSE Load >>> Status: '+this.status+' Type: '+ this.connectionType+' Headers: '+ this.allResponseHeaders); }; xhr.onerror = function(e){ Titanium.API.info('XHR RESPONSE Error >>> Response: '+this.responseText); Titanium.API.info('XHR RESPONSE Error >>> Status: '+this.status+' Type: '+ this.connectionType+' Headers: '+ this.allResponseHeaders); }; try { xhr.open('POST','http://demo.cotaman.com/gzip.php'); xhr.setRequestHeader('User-Agent', Ti.userAgent); xhr.setRequestHeader('x-cmk-agent', 'M3 v' + Ti.App.version); if(e.source.gzip){ xhr.setRequestHeader('Accept-Encoding', 'gzip,deflate'); Ti.API.info('Gzip Enabled'); }else{ Ti.API.info('Gzip Disabled'); } var imageFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'image.jpg'); if(imageFile.exists()) { xhr.send({ media: imageFile.read(), test: 'pic_' }); } } catch(e) { currentAction = null; Ti.API.info('ERROR : '+e.message); } }; {code} Sample App at https://www.dropbox.com/s/dhd9czzl5u488ft/testcase.zip

    Appcelerator JIRA | 3 years ago | Marco Cota
    java.io.EOFException
  2. 0

    h3. Issue When receiving Gzipped responses on Android this are being incorrectly handled as http errors by the titanium SDK even when the response code is 200 or 201. This is only happening when the response have an empty body. h3. Logs Gzip Response {code} [INFO] : Gzip Enabled [WARN] : IdleConnectionHandler: Removing a connection that never existed! [ERROR] : TiHttpClient: (TiHttpClient-23) [360048,1780592] HTTP Error (java.io.EOFException): java.io.EOFException [ERROR] : TiHttpClient: java.io.EOFException [ERROR] : TiHttpClient: at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:202) [ERROR] : TiHttpClient: at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:98) [ERROR] : TiHttpClient: at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81) [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:268) [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:217) [ERROR] : TiHttpClient: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657) [ERROR] : TiHttpClient: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637) [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1287) [ERROR] : TiHttpClient: at java.lang.Thread.run(Thread.java:841) [INFO] : XHR RESPONSE Error >>> Response: [INFO] : XHR RESPONSE Error >>> Status: 200 Type: POST Headers: Date:Thu, 09 Jan 2014 16:01:28 GMT [INFO] : Server:Apache [INFO] : Content-Encoding:gzip [INFO] : Content-Length:0 [INFO] : Keep-Alive:timeout=10, max=30 [INFO] : Connection:Keep-Alive [INFO] : Content-Type:image/png [DEBUG] : HTTPClient: The persistent handle is disposed. {code} Non Gzip Response {code} [INFO] : Gzip Disabled [INFO] : XHR RESPONSE Load >>> Response: "null" [INFO] : XHR RESPONSE Load >>> Status: 200 Type: POST Headers: Date:Thu, 09 Jan 2014 16:00:45 GMT [INFO] : Server:Apache [INFO] : Content-Length:0 [INFO] : Vary:Accept-Encoding [INFO] : Keep-Alive:timeout=10, max=30 [INFO] : Connection:Keep-Alive [INFO] : Content-Type:image/png; charset: UTF-8 [DEBUG] : HTTPClient: The persistent handle is disposed. {code} h3. Steps to Reproduce 1. Run the test case 2. Click on Non Gzip Button 3. Receive a load response from the xhr 4. Click Gzip Button 5. Receive an error response from the xhr The php server return the same body empty response with the difference of the gzip encoding header h3. Sample Code {code} var win = Ti.UI.createWindow(); var bt1 = Ti.UI.createButton({ title:'NonGZIP', width:80, left:10, gzip:false, bottom:10 }); var bt2 = Ti.UI.createButton({ title:'GZIP', width:80, right:10, gzip:true, bottom:10 }); bt1.addEventListener('click',doRequest); bt2.addEventListener('click',doRequest); win.add(bt1); win.add(bt2); win.open(); function doRequest(e){ var xhr = Ti.Network.createHTTPClient(); xhr.onload = function(e){ Titanium.API.info('XHR RESPONSE Load >>> Response: "'+this.responseText+'"'); Titanium.API.info('XHR RESPONSE Load >>> Status: '+this.status+' Type: '+ this.connectionType+' Headers: '+ this.allResponseHeaders); }; xhr.onerror = function(e){ Titanium.API.info('XHR RESPONSE Error >>> Response: '+this.responseText); Titanium.API.info('XHR RESPONSE Error >>> Status: '+this.status+' Type: '+ this.connectionType+' Headers: '+ this.allResponseHeaders); }; try { xhr.open('POST','http://demo.cotaman.com/gzip.php'); xhr.setRequestHeader('User-Agent', Ti.userAgent); xhr.setRequestHeader('x-cmk-agent', 'M3 v' + Ti.App.version); if(e.source.gzip){ xhr.setRequestHeader('Accept-Encoding', 'gzip,deflate'); Ti.API.info('Gzip Enabled'); }else{ Ti.API.info('Gzip Disabled'); } var imageFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'image.jpg'); if(imageFile.exists()) { xhr.send({ media: imageFile.read(), test: 'pic_' }); } } catch(e) { currentAction = null; Ti.API.info('ERROR : '+e.message); } }; {code} Sample App at https://www.dropbox.com/s/dhd9czzl5u488ft/testcase.zip

    Appcelerator JIRA | 3 years ago | Marco Cota
    java.io.EOFException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    4 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.EOFException

      No message provided

      at java.util.zip.GZIPInputStream.readFully()
    2. Java RT
      GZIPInputStream.<init>
      1. java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:202)
      2. java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:98)
      3. java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
      3 frames
    3. ti.modules.titanium
      TiHTTPClient$LocalResponseHandler.handleResponse
      1. ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:268)
      2. ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:217)
      2 frames
    4. Apache HttpClient
      AbstractHttpClient.execute
      1. org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
      2. org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)
      2 frames
    5. ti.modules.titanium
      TiHTTPClient$ClientRunnable.run
      1. ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1287)
      1 frame
    6. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:841)
      1 frame