aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-08-28 11:15:48 (EDT)
committerThomas Becker2013-08-28 11:15:48 (EDT)
commitac156b9111d6250ecabcca0e24ef782f4d86def6 (patch)
treec1d1be380943454b1892c2b062d76c24804c8418
parentaf1abb7af636f76f9472699bebe0859947aef84e (diff)
downloadorg.eclipse.jetty.project-ac156b9111d6250ecabcca0e24ef782f4d86def6.zip
org.eclipse.jetty.project-ac156b9111d6250ecabcca0e24ef782f4d86def6.tar.gz
org.eclipse.jetty.project-ac156b9111d6250ecabcca0e24ef782f4d86def6.tar.bz2
415780 fix StreamAlreadyCommittedException in spdy build
-rw-r--r--jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDY.java3
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDYTest.java21
2 files changed, 15 insertions, 9 deletions
diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDY.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDY.java
index f7e8c87..f05107c 100644
--- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDY.java
+++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDY.java
@@ -18,7 +18,6 @@
package org.eclipse.jetty.spdy.server.http;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Queue;
import java.util.Set;
@@ -133,7 +132,7 @@ public class HttpTransportOverSPDY implements HttpTransport
StreamException exception = new StreamException(stream.getId(), StreamStatus.PROTOCOL_ERROR,
"Stream already committed!");
callback.failed(exception);
- LOG.warn("Committed response twice.", exception);
+ LOG.debug("Committed response twice.", exception);
return;
}
sendReply(info, !hasContent ? callback : new Callback.Adapter()
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDYTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDYTest.java
index cb603ee..07b7bb1 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDYTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/http/HttpTransportOverSPDYTest.java
@@ -21,6 +21,8 @@ package org.eclipse.jetty.spdy.server.http;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.http.HttpGenerator;
import org.eclipse.jetty.http.HttpStatus;
@@ -37,8 +39,6 @@ import org.eclipse.jetty.spdy.http.HTTPSPDYHeader;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Fields;
-import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.StdErrLog;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -251,22 +251,29 @@ public class HttpTransportOverSPDYTest
}
@Test
- public void testVerifyThatAStreamIsNotCommittedTwice() throws IOException
+ public void testVerifyThatAStreamIsNotCommittedTwice() throws IOException, InterruptedException
{
- ((StdErrLog)Log.getLogger(HttpTransportOverSPDY.class)).setHideStacks(true);
+ final CountDownLatch failedCalledLatch = new CountDownLatch(1);
ByteBuffer content = createRandomByteBuffer();
boolean lastContent = false;
- httpTransportOverSPDY.send(responseInfo,content,lastContent, callback);
+ httpTransportOverSPDY.send(responseInfo, content, lastContent, callback);
ArgumentCaptor<ReplyInfo> replyInfoCaptor = ArgumentCaptor.forClass(ReplyInfo.class);
verify(stream, times(1)).reply(replyInfoCaptor.capture(), any(Callback.class));
assertThat("ReplyInfo close is false", replyInfoCaptor.getValue().isClose(), is(false));
- httpTransportOverSPDY.send(HttpGenerator.RESPONSE_500_INFO, null,true, new Callback.Adapter());
+ httpTransportOverSPDY.send(HttpGenerator.RESPONSE_500_INFO, null, true, new Callback.Adapter()
+ {
+ @Override
+ public void failed(Throwable x)
+ {
+ failedCalledLatch.countDown();
+ }
+ });
verify(stream, times(1)).data(any(DataInfo.class), any(Callback.class));
- ((StdErrLog)Log.getLogger(HttpTransportOverSPDY.class)).setHideStacks(false);
+ assertThat("callback.failed has been called", failedCalledLatch.await(5, TimeUnit.SECONDS), is(true));
}
private ByteBuffer createRandomByteBuffer()