PDA

View Full Version : [INFOREQ]Null error (Null Pointer Exception) in Ext.data.Connection



iryndin
19 May 2011, 10:52 PM
Hi all,

found a bug in 'Ext.data.Connection'!

Sometimes request.xhr.getAllResponseHeaders() can return null and this causes errors.

See the source code snippet below:


/**
* Create the response object
* @private
* @param {Object} request
*/
createResponse : function(request) {
var xhr = request.xhr,
headers = {},
lines = xhr.getAllResponseHeaders().replace(/\r\n/g, '\n').split('\n'),
count = lines.length,
line, index, key, value, response;

evant
19 May 2011, 11:08 PM
How can I reproduce it? Does it happen on any particular browsers?

iryndin
19 May 2011, 11:11 PM
I don't know why xhr.getAllResponseHeaders() return null sometimes, but I know how to fix this.

Replace with followng:

lines = xhr.getAllResponseHeaders() ? xhr.getAllResponseHeaders().replace(/\r\n/g, '\n').split('\n') : '',

With this fix it works okay

iryndin
19 May 2011, 11:14 PM
I found this error in Firefox 3.6.17 on Ubuntu 10.10