HTTP Header parse failed

morino at infocity.co.jp morino at infocity.co.jp
Wed Sep 9 05:26:57 EDT 2009


Maybe rare case...?
If HTTP header's value is empty, thrown out exception.
for example,
HTTP header is "EXT: " that ending by one or more blanks, and no value.

the following stacktrace is actually thrown
--------
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1938) [na:1.6.0_12]
	at 
org.jboss.netty.handler.codec.http.HttpMessageDecoder.splitHeader(HttpMessageDecoder.java:593) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:420) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:173) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:78) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:454) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:427) 
[netty-3.1.3.GA.jar:na]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:345) 
[netty-3.1.3.GA.jar:na]
	at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:332) 
[netty-3.1.3.GA.jar:na]
	at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:323) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:275) 
[netty-3.1.3.GA.jar:na]
	at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:196) 
[netty-3.1.3.GA.jar:na]
	at 
org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) 
[netty-3.1.3.GA.jar:na]
	at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
[na:1.6.0_12]
	at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
[na:1.6.0_12]
	at java.lang.Thread.run(Thread.java:619) [na:1.6.0_12]
--------
Could you fix it if possible...? 



More information about the netty-users mailing list