Upgrade to Servlet 3.1, Tomcat 8 and Jetty 9
Upgrade to latest versions of Tomcat and Jetty and to the latest Servlet API whilst will remaining compatible with Tomcat 7 and Jetty 8. Fixes gh-1832, gh-369
This commit is contained in:
@@ -20,7 +20,9 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -94,6 +96,7 @@ public class CliTester implements TestRule {
|
||||
|
||||
private <T extends OptionParsingCommand> Future<T> submitCommand(final T command,
|
||||
String... args) {
|
||||
clearUrlHandler();
|
||||
final String[] sources = getSources(args);
|
||||
return Executors.newSingleThreadExecutor().submit(new Callable<T>() {
|
||||
@Override
|
||||
@@ -112,6 +115,21 @@ public class CliTester implements TestRule {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The TomcatURLStreamHandlerFactory fails if the factory is already set, use
|
||||
* reflection to reset it.
|
||||
*/
|
||||
private void clearUrlHandler() {
|
||||
try {
|
||||
Field field = URL.class.getDeclaredField("factory");
|
||||
field.setAccessible(true);
|
||||
field.set(null, null);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected String[] getSources(String... args) {
|
||||
final String[] sources = new String[args.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user