Jetty 10.0.x #5684 disabled tests (#6081)

* Fixes for #5684
Simplified CyclicTimeoutTest#testBusy
InclusiveByteRange clears range list on errors
InclusiveByteRange is forgiving of tab separators and leading 0s

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2021-03-31 07:24:56 +11:00 committed by GitHub
parent 722f4ec2e3
commit 20fae6485c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 37 deletions

View File

@ -13,14 +13,11 @@
package org.eclipse.jetty.io;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
@ -135,27 +132,13 @@ public class CyclicTimeoutTest
}
@Test
@Disabled
public void testBusy() throws Exception
{
QueuedThreadPool pool = new QueuedThreadPool(200);
pool.start();
long testUntil = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(1500);
assertTrue(_timeout.schedule(100, TimeUnit.MILLISECONDS));
long testUntil = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(2000);
assertTrue(_timeout.schedule(500, TimeUnit.MILLISECONDS));
while (System.nanoTime() < testUntil)
{
CountDownLatch latch = new CountDownLatch(1);
pool.execute(() ->
{
_timeout.schedule(100, TimeUnit.MILLISECONDS);
latch.countDown();
});
latch.await();
}
_timeout.schedule(500, TimeUnit.MILLISECONDS);
_timeout.cancel();
assertFalse(_expired);
pool.stop();
}
}

View File

@ -159,6 +159,7 @@ public class InclusiveByteRange
int dash = t.indexOf('-');
if (dash < 0 || t.indexOf("-", dash + 1) >= 0)
{
ranges = null;
LOG.warn("Bad range format: {}", t);
break;
}
@ -172,6 +173,7 @@ public class InclusiveByteRange
{
if (last == -1)
{
ranges = null;
LOG.warn("Bad range format: {}", t);
break;
}
@ -197,6 +199,7 @@ public class InclusiveByteRange
if (last < first)
{
ranges = null;
LOG.warn("Bad range format: {}", t);
break;
}
@ -231,6 +234,7 @@ public class InclusiveByteRange
}
catch (NumberFormatException e)
{
ranges = null;
LOG.warn("Bad range format: {}", t);
LOG.trace("IGNORED", e);
}
@ -238,6 +242,7 @@ public class InclusiveByteRange
}
catch (Exception e)
{
ranges = null;
LOG.warn("Bad range format: {}", t);
LOG.trace("IGNORED", e);
}

View File

@ -17,7 +17,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -275,7 +274,6 @@ public class InclusiveByteRangeTest
}
@Test
@Disabled
public void testBadRangeSetPartiallyBad()
{
assertBadRangeList(500, "bytes=1-50,1-b,a-50");
@ -293,26 +291,12 @@ public class InclusiveByteRangeTest
assertBadRangeList(500, "bytes=");
}
@Test
@Disabled
public void testBadRangeZeroPrefixed()
{
assertBadRangeList(500, "bytes=01-050");
}
@Test
public void testBadRangeHex()
{
assertBadRangeList(500, "bytes=0F-FF");
}
@Test
@Disabled
public void testBadRangeTabWhitespace()
{
assertBadRangeList(500, "bytes=\t1\t-\t50");
}
@Test
public void testBadRangeTabDelim()
{