NPE protection in dump

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2740 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-02-03 22:17:22 +00:00
parent cdf2490336
commit 40ebdcf23e
3 changed files with 8 additions and 3 deletions

View File

@ -133,7 +133,7 @@ public class LikeJettyXml
server.setStopAtShutdown(true); server.setStopAtShutdown(true);
server.setSendServerVersion(true); server.setSendServerVersion(true);
server.start(); server.start();
server.join(); server.join();

View File

@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.io.ConnectedEndPoint; import org.eclipse.jetty.io.ConnectedEndPoint;
import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.component.Dumpable;
@ -299,7 +300,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
public void dump(Appendable out, String indent) throws IOException public void dump(Appendable out, String indent) throws IOException
{ {
out.append(String.valueOf(this)).append("\n"); out.append(String.valueOf(this)).append("\n");
AggregateLifeCycle.dump(out,indent,Arrays.asList(_selectSet)); AggregateLifeCycle.dump(out,indent,TypeUtil.asList(_selectSet));
} }

View File

@ -306,7 +306,11 @@ public class SelectChannelConnector extends AbstractNIOConnector
public void dump(Appendable out, String indent) throws IOException public void dump(Appendable out, String indent) throws IOException
{ {
out.append(String.valueOf(this)).append("\n"); out.append(String.valueOf(this)).append("\n");
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{_acceptChannel,_acceptChannel.isOpen()?"OPEN":"CLOSED",_manager})); ServerSocketChannel channel=_acceptChannel;
if (channel==null)
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{null,"CLOSED",_manager}));
else
AggregateLifeCycle.dump(out,indent,Arrays.asList(new Object[]{_acceptChannel,_acceptChannel.isOpen()?"OPEN":"CLOSED",_manager}));
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */