From 8aa954a3c7e0a26bdab0b56e8beed3268b225250 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 19 Sep 2017 12:29:24 -0400 Subject: [PATCH] @janbartel suggests applying sorting also to WebInfConfiguration.findWebInfLibJars. --- .../org/eclipse/jetty/webapp/WebInfConfiguration.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java index 8bc71ecddea..efb67e971d1 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java @@ -25,6 +25,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Set; @@ -702,7 +703,7 @@ public class WebInfConfiguration extends AbstractConfiguration * Look for jars in WEB-INF/lib * * @param context the context to find the lib jars in - * @return the list of jars as {@link Resource} + * @return the list of jars as {@link Resource}, or null * @throws Exception if unable to scan for lib jars */ protected List findWebInfLibJars(WebAppContext context) @@ -714,10 +715,13 @@ public class WebInfConfiguration extends AbstractConfiguration List jarResources = new ArrayList(); Resource web_inf_lib = web_inf.addPath("/lib"); - if (web_inf_lib.exists() && web_inf_lib.isDirectory()) + if (web_inf_lib.exists() && web_inf_lib.isDirectory()) // TODO perhaps redundant given null check from list()? { - // TODO should files be sorted? What is the interaction with Ordering? String[] files=web_inf_lib.list(); + if (files != null) + { + Arrays.sort(files); + } for (int f=0;files!=null && f