Skip to content

Commit

Permalink
Remove --extraLibFolder (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Jun 14, 2024
1 parent 494ea96 commit d48037e
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 68 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ To run locally exploded web archive:
--prefix = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none
--commonLibFolder = folder for additional jar files. Default is ./lib

--extraLibFolder = folder for additional jar files to add to Jetty classloader

--logfile = redirect log messages to this file
--logThrowingLineNo = show the line no that logged the message (slow). Default is false
--logThrowingThread = show the thread that logged the message. Default is false
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/winstone/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,32 +148,11 @@ public Launcher(Map<String, String> args) throws IOException {
Logger.log(Level.FINER, RESOURCES, "Launcher.NoCommonLib");
}

File extraLibFolder = Option.EXTRA_LIB_FOLDER.get(args);
List<URL> extraJars = new ArrayList<>();
if (extraLibFolder != null && extraLibFolder.exists()) {
Logger.log(Level.WARNING, RESOURCES, "Launcher.ExtraLibFolder");
File[] children = extraLibFolder.listFiles();
if (children != null) {
for (File aChildren : children) {
if (aChildren.getName().endsWith(".jar")
|| aChildren.getName().endsWith(".zip")) {
extraJars.add(aChildren.toURI().toURL());
}
}
}
}

ClassLoader commonLibCL =
new URLClassLoader(jars.toArray(new URL[0]), getClass().getClassLoader());

Logger.log(Level.ALL, RESOURCES, "Launcher.CLClassLoader", commonLibCL.toString());

if (!extraJars.isEmpty()) {
ClassLoader extraClassLoader = new URLClassLoader(
extraJars.toArray(new URL[0]), getClass().getClassLoader());
Thread.currentThread().setContextClassLoader(extraClassLoader);
}

int qtpMaxThread = Option.QTP_MAXTHREADS.get(args);
QueuedThreadPool queuedThreadPool =
qtpMaxThread > 0 ? new QueuedThreadPool(qtpMaxThread) : new QueuedThreadPool();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/winstone/cmdline/Option.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static List<Option<?>> all(Class<?> clazz) {
public static final OString PREFIX = string("prefix", "");
public static final OFile COMMON_LIB_FOLDER = file("commonLibFolder");
public static final OFile LOGFILE = file("logfile");
public static final OFile EXTRA_LIB_FOLDER = file("extraLibFolder");
public static final OBoolean LOG_THROWING_LINE_NO = bool("logThrowingLineNo", false);
public static final OBoolean LOG_THROWING_THREAD = bool("logThrowingThread", false);
public static final OInt DEBUG = new ODebugInt("debug", 5);
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/winstone/LocalStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Launcher.EmbeddedWarFile=/embedded.war
Launcher.EmbeddedWebroot=winstoneEmbeddedWAR
Launcher.CopyingEmbeddedWarfile=Extracting embedded warfile to [#0]
Launcher.ContainerStartupError=Container startup failed
Launcher.ExtraLibFolder=You are using an extra library folder, support for which will end on or after January 1, 2023.

# Keep synchronized with jenkinsci/jenkins/war/src/main/java/executable/Main.java
Launcher.UsageInstructions.Header=[#0], (c) 2003-2006 Rick Knowles\n\
Expand All @@ -52,7 +51,6 @@ Launcher.UsageInstructions.Options=\
\ --config = load configuration properties from here. Default is ./winstone.properties\n\
\ --prefix = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none\n\
\ --commonLibFolder = folder for additional jar files. Default is ./lib\n\n\
\ --extraLibFolder = folder for additional jar files to add to Jetty classloader\n\n\
\ --logfile = redirect log messages to this file\n\
\ --logThrowingLineNo = show the line no that logged the message (slow). Default is false\n\
\ --logThrowingThread = show the thread that logged the message. Default is false\n\
Expand Down
42 changes: 0 additions & 42 deletions src/test/java/winstone/LauncherTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package winstone;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.assertEquals;

import java.net.HttpURLConnection;
Expand All @@ -11,10 +9,6 @@
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
import org.eclipse.jetty.server.ServerConnector;
import org.junit.Test;

Expand All @@ -39,40 +33,4 @@ public void mimeType() throws Exception {
assertEquals("text/xxx", response.headers().firstValue("Content-Type").get());
assertEquals("Hello", response.body());
}

@Test
public void extraLibFolderDeprecation() throws Exception {
Map<String, String> args = new HashMap<>();
args.put("warfile", "target/test-classes/test.war");
args.put("prefix", "/");
args.put("httpPort", "0");
args.put("extraLibFolder", "target/test-classes");
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("winstone");
Filter orig = logger.getFilter();
CapturingFilter filter = new CapturingFilter();
logger.setFilter(filter);
try {
winstone = new Launcher(args);
int port = ((ServerConnector) winstone.server.getConnectors()[0]).getLocalPort();
assertEquals(
"<html><body>This servlet has been accessed via GET 1001 times</body></html>\r\n",
makeRequest("http://127.0.0.2:" + port + "/CountRequestsServlet"));
assertThat(
filter.messages,
hasItem(
"You are using an extra library folder, support for which will end on or after January 1, 2023."));
} finally {
logger.setFilter(orig);
}
}

static class CapturingFilter implements Filter {
final Queue<String> messages = new ConcurrentLinkedQueue<>();

@Override
public boolean isLoggable(LogRecord record) {
messages.offer(record.getMessage());
return true;
}
}
}

0 comments on commit d48037e

Please sign in to comment.