479179 Fixed NPE from debug
This commit is contained in:
parent
27a41a4f77
commit
570c751ec8
|
@ -212,7 +212,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
public void onFillable()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} onFillable enter {}", this, _channel.getState());
|
||||
LOG.debug("{} onFillable enter {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
|
||||
|
||||
HttpConnection last=setCurrentConnection(this);
|
||||
try
|
||||
|
@ -259,7 +259,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
{
|
||||
setCurrentConnection(last);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} onFillable exit {}", this, _channel.getState());
|
||||
LOG.debug("{} onFillable exit {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,8 +272,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
boolean handled=false;
|
||||
while (_parser.inContentState())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} parseContent",this);
|
||||
int filled = fillRequestBuffer();
|
||||
boolean handle = parseRequestBuffer();
|
||||
handled|=handle;
|
||||
|
@ -300,7 +298,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
// No pretend we read -1
|
||||
_parser.atEOF();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} filled -1",this);
|
||||
LOG.debug("{} filled -1 {}",this,BufferUtil.toDetailString(_requestBuffer));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -321,7 +319,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
_parser.atEOF();
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} filled {}",this,filled);
|
||||
LOG.debug("{} filled {} {}",this,filled,BufferUtil.toDetailString(_requestBuffer));
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
@ -559,8 +557,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
super.toString(),
|
||||
_parser,
|
||||
_generator,
|
||||
_channel,
|
||||
BufferUtil.toDetailString(_requestBuffer));
|
||||
_channel);
|
||||
}
|
||||
|
||||
private class Content extends HttpInput.Content
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
||||
|
||||
|
@ -1027,38 +1028,46 @@ public class BufferUtil
|
|||
|
||||
private static void appendDebugString(StringBuilder buf,ByteBuffer buffer)
|
||||
{
|
||||
for (int i = 0; i < buffer.position(); i++)
|
||||
try
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == 16 && buffer.position() > 32)
|
||||
for (int i = 0; i < buffer.position(); i++)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.position() - 16;
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == 16 && buffer.position() > 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.position() - 16;
|
||||
}
|
||||
}
|
||||
buf.append("<<<");
|
||||
for (int i = buffer.position(); i < buffer.limit(); i++)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == buffer.position() + 16 && buffer.limit() > buffer.position() + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.limit() - 16;
|
||||
}
|
||||
}
|
||||
buf.append(">>>");
|
||||
int limit = buffer.limit();
|
||||
buffer.limit(buffer.capacity());
|
||||
for (int i = limit; i < buffer.capacity(); i++)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == limit + 16 && buffer.capacity() > limit + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.capacity() - 16;
|
||||
}
|
||||
}
|
||||
buffer.limit(limit);
|
||||
}
|
||||
buf.append("<<<");
|
||||
for (int i = buffer.position(); i < buffer.limit(); i++)
|
||||
catch(Throwable x)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == buffer.position() + 16 && buffer.limit() > buffer.position() + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.limit() - 16;
|
||||
}
|
||||
Log.getRootLogger().ignore(x);
|
||||
buf.append("!!concurrent mod!!");
|
||||
}
|
||||
buf.append(">>>");
|
||||
int limit = buffer.limit();
|
||||
buffer.limit(buffer.capacity());
|
||||
for (int i = limit; i < buffer.capacity(); i++)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == limit + 16 && buffer.capacity() > limit + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.capacity() - 16;
|
||||
}
|
||||
}
|
||||
buffer.limit(limit);
|
||||
}
|
||||
|
||||
private static void appendContentChar(StringBuilder buf, byte b)
|
||||
|
|
Loading…
Reference in New Issue