From 5f2323418bba8396bb3d49e0e7f6f6c80d7fb7d7 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 8 Nov 2011 12:47:28 +1100 Subject: [PATCH] cleanups after the merge --- .../org/eclipse/jetty/embedded/LikeJettyXml.java | 2 -- .../jetty/client/AbstractHttpConnection.java | 2 ++ .../jetty/client/AsyncHttpConnection.java | 16 ++++++++-------- .../eclipse/jetty/client/HttpDestination.java | 1 + .../org/eclipse/jetty/client/HttpExchange.java | 3 ++- .../client/HttpsViaBrokenHttpProxyTest.java | 15 ++++++++++++--- .../jetty/util/ssl/SslContextFactory.java | 2 +- .../eclipse/jetty/util/log/StdErrLogTest.java | 3 +-- 8 files changed, 27 insertions(+), 17 deletions(-) diff --git a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java index c82d8dbab00..840f765117d 100644 --- a/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java +++ b/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java @@ -13,8 +13,6 @@ package org.eclipse.jetty.embedded; -import static org.junit.Assert.assertTrue; - import java.io.IOException; import java.lang.management.ManagementFactory; import java.util.concurrent.CountDownLatch; diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index 6a835d2a4eb..306fa2805ec 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -96,6 +96,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen public boolean send(HttpExchange ex) throws IOException { + LOG.debug("Send {} on {}",ex,this); synchronized (this) { if (_exchange != null) @@ -346,6 +347,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen if (exchange!=null) { exchange.setStatus(HttpExchange.STATUS_EXCEPTED); + exchange.getEventListener().onException(new EofException("early EOF")); } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java index e4fdcee5b4c..444e2dca151 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java @@ -48,19 +48,19 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async // While we are making progress and have not changed connection while (progress && connection==this) { - LOG.debug("open={} more={} buffering={} progress={}",_endp.isOpen(),_parser.isMoreInBuffer(),_endp.isBufferingInput(),progress); + LOG.debug("while open={} more={} buffering={} progress={}",_endp.isOpen(),_parser.isMoreInBuffer(),_endp.isBufferingInput(),progress); progress=false; HttpExchange exchange=_exchange; - LOG.debug("exchange {}",exchange); + LOG.debug("exchange {} on {}",exchange,this); try { // Should we commit the request? if (!_generator.isCommitted() && exchange!=null && exchange.getStatus() == HttpExchange.STATUS_WAITING_FOR_COMMIT) { - LOG.debug("commit"); + LOG.debug("commit {}",exchange); progress=true; commitRequest(); } @@ -83,7 +83,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async if (_requestContentChunk==null) { - LOG.debug("complete"); + LOG.debug("complete {}",exchange); progress=true; _generator.complete(); } @@ -101,7 +101,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async // Signal request completion if (_generator.isComplete() && !_requestComplete) { - LOG.debug("requestComplete"); + LOG.debug("requestComplete {}",exchange); progress=true; _requestComplete = true; exchange.getEventListener().onRequestComplete(); @@ -121,7 +121,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async // Has any IO been done by the endpoint itself since last loop if (_asyncEndp.hasProgressed()) { - LOG.debug("hasProgressed"); + LOG.debug("hasProgressed {}",exchange); progress=true; } } @@ -162,8 +162,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async } finally { - LOG.debug("{} {} progress={}",_generator, _parser,progress); - LOG.debug("{}",_endp); + LOG.debug("finally {} on {} progress={} {}",exchange,this,progress,_endp); boolean complete = failed || _generator.isComplete() && _parser.isComplete(); @@ -227,6 +226,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async { _parser.returnBuffers(); _generator.returnBuffers(); + LOG.debug("unhandle {} on {}",_exchange,_endp); } return connection; diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java index 27980233adb..38d8bfbb49c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java @@ -428,6 +428,7 @@ public class HttpDestination implements Dumpable synchronized (this) { _connections.remove(connection); + System.err.println("Q "+_queue); if (!_queue.isEmpty()) startConnection = true; } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java index d17d2202295..256387f3c3f 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java @@ -196,7 +196,7 @@ public class HttpExchange if (newStatus==STATUS_SENDING_REQUEST) _sent=_lastStateChange; } - + // State machine: from which old status you can go into which new status switch (oldStatus) { @@ -357,6 +357,7 @@ public class HttpExchange if (!set) throw new IllegalStateException(toState(oldStatus) + " => " + toState(newStatus)); + LOG.debug("setStatus {} {}",newStatus,this); } catch (IOException x) { diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsViaBrokenHttpProxyTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsViaBrokenHttpProxyTest.java index ffeccf8db7c..ce3b1b49d35 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsViaBrokenHttpProxyTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsViaBrokenHttpProxyTest.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.server.HttpConnection; +import org.eclipse.jetty.server.AbstractHttpConnection; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ConnectHandler; @@ -68,7 +68,16 @@ public class HttpsViaBrokenHttpProxyTest @Test public void httpsViaProxyThatClosesConnectionOnConnectRequestTest() throws Exception { - sendRequestThroughProxy(new ContentExchange(), "close", 9); + sendRequestThroughProxy(new ContentExchange() + { + + @Override + protected void onException(Throwable x) + { + + } + + }, "close", 9); } @Test @@ -110,7 +119,7 @@ public class HttpsViaBrokenHttpProxyTest { if (serverAddress.contains("close")) { - HttpConnection.getCurrentConnection().getEndPoint().close(); + AbstractHttpConnection.getCurrentConnection().getEndPoint().close(); } else if (serverAddress.contains("error500")) { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java index 4e7865172ed..d4f16f39869 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java @@ -1378,7 +1378,7 @@ public class SslContextFactory extends AbstractLifeCycle /** Set the trust store resource. * @param resource the trust store resource to set */ - public void setTrustStore(Resource resource) + public void setTrustStoreResource(Resource resource) { checkNotStarted(); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java index 14ccc84fc37..c3bb5518eaa 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java @@ -13,8 +13,7 @@ package org.eclipse.jetty.util.log; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.*; import java.io.ByteArrayOutputStream; import java.io.PrintStream;