From 66860834629735315ce3e23b0953562a7e4ce85b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 6 Jun 2019 11:55:01 -0500 Subject: [PATCH 01/11] Issue #3743 - Using only Location based XmlConfiguration in Jetty itself Signed-off-by: Joakim Erdfelt --- .../eclipse/jetty/embedded/FileServerXml.java | 5 +- .../bindings/GlobalWebappConfigBinding.java | 2 +- .../osgi/boot/AbstractContextProvider.java | 2 +- .../serverfactory/ServerInstanceWrapper.java | 5 +- .../client/XmlBasedHttpClientProvider.java | 5 +- .../jetty/xml/ConfigurationProcessor.java | 13 ++- .../eclipse/jetty/xml/XmlConfiguration.java | 80 ++++++++++++++----- .../jetty/xml/XmlConfigurationTest.java | 10 +-- 8 files changed, 82 insertions(+), 40 deletions(-) diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FileServerXml.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FileServerXml.java index c05fe5c4cd1..641612e0e0d 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FileServerXml.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/FileServerXml.java @@ -36,9 +36,8 @@ public class FileServerXml { public static void main( String[] args ) throws Exception { - Resource fileserverXml = Resource.newSystemResource("fileserver.xml"); - XmlConfiguration configuration = new XmlConfiguration( - fileserverXml.getInputStream()); + Resource fileServerXml = Resource.newSystemResource("fileserver.xml"); + XmlConfiguration configuration = new XmlConfiguration(fileServerXml); Server server = (Server) configuration.configure(); server.start(); server.join(); diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java index d93d8c04ad4..77538a42dcf 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.java @@ -91,7 +91,7 @@ public class GlobalWebappConfigBinding implements AppLifeCycle.Binding if (globalContextSettings.exists()) { - XmlConfiguration jettyXmlConfig = new XmlConfiguration(globalContextSettings.getInputStream()); + XmlConfiguration jettyXmlConfig = new XmlConfiguration(globalContextSettings); Resource resource = Resource.newResource(app.getOriginId()); app.getDeploymentManager().scope(jettyXmlConfig,resource); jettyXmlConfig.configure(context); diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java index ad405c9e03c..d7161b91d21 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java @@ -160,7 +160,7 @@ public abstract class AbstractContextProvider extends AbstractLifeCycle implemen { Thread.currentThread().setContextClassLoader(classLoader); - XmlConfiguration xmlConfiguration = new XmlConfiguration(res.getInputStream()); + XmlConfiguration xmlConfiguration = new XmlConfiguration(res); HashMap properties = new HashMap(); //put the server instance in properties.put("Server", getServerInstanceWrapper().getServer()); diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java index 7b6d31983fb..4267464150c 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/ServerInstanceWrapper.java @@ -18,7 +18,6 @@ package org.eclipse.jetty.osgi.boot.internal.serverfactory; -import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Collection; @@ -142,10 +141,10 @@ public class ServerInstanceWrapper for (URL jettyConfiguration : jettyConfigurations) { - try(InputStream in = jettyConfiguration.openStream()) + try { // Execute a Jetty configuration file - XmlConfiguration config = new XmlConfiguration(in); + XmlConfiguration config = new XmlConfiguration(jettyConfiguration); config.getIdMap().putAll(id_map); config.getProperties().putAll(properties); diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java index e45ac4c6518..870d2602f6d 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java +++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/XmlBasedHttpClientProvider.java @@ -18,7 +18,6 @@ package org.eclipse.jetty.websocket.client; -import java.io.InputStream; import java.net.URL; import org.eclipse.jetty.client.HttpClient; @@ -36,9 +35,9 @@ class XmlBasedHttpClientProvider return null; } - try (InputStream in = resource.openStream()) + try { - XmlConfiguration configuration = new XmlConfiguration(in); + XmlConfiguration configuration = new XmlConfiguration(resource); return (HttpClient) configuration.configure(); } catch (Throwable t) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java index c67b25899dc..b775ded0b87 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java @@ -20,6 +20,8 @@ package org.eclipse.jetty.xml; import java.net.URL; +import org.eclipse.jetty.util.resource.Resource; + /** * A ConfigurationProcessor for non XmlConfiguration format files. *

@@ -31,8 +33,13 @@ import java.net.URL; */ public interface ConfigurationProcessor { - public void init(URL url, XmlParser.Node root, XmlConfiguration configuration); + /** + * @deprecated use {@link #init(Resource, XmlParser.Node, XmlConfiguration)} instead + */ + @Deprecated + void init(URL url, XmlParser.Node root, XmlConfiguration configuration); + void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration); - public Object configure( Object obj) throws Exception; - public Object configure() throws Exception; + Object configure( Object obj) throws Exception; + Object configure() throws Exception; } diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 59f66e5fa95..4316c205a4a 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -30,6 +30,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.InetAddress; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.net.UnknownHostException; import java.nio.file.Path; @@ -176,10 +177,30 @@ public class XmlConfiguration private final Map _idMap = new HashMap<>(); private final Map _propertyMap = new HashMap<>(); - private final URL _url; + private final Resource _location; private final String _dtd; private ConfigurationProcessor _processor; + /** + * Reads and parses the XML configuration file. + * + * @param resource the Resource to the XML configuration + * @throws IOException if the configuration could not be read + * @throws SAXException if the configuration could not be parsed + */ + public XmlConfiguration(Resource resource) throws SAXException, IOException + { + synchronized (__parser) + { + _location = resource; + try(InputStream inputStream = resource.getInputStream()) + { + setConfig(__parser.parse(inputStream)); + } + _dtd = __parser.getDTD(); + } + } + /** * Reads and parses the XML configuration file. * @@ -189,12 +210,19 @@ public class XmlConfiguration */ public XmlConfiguration(URL configuration) throws SAXException, IOException { - synchronized (__parser) - { - _url = configuration; - setConfig(__parser.parse(configuration.toString())); - _dtd = __parser.getDTD(); - } + this(Resource.newResource(configuration)); + } + + /** + * Reads and parses the XML configuration file. + * + * @param configuration the URI and location of the XML configuration + * @throws IOException if the configuration could not be read + * @throws SAXException if the configuration could not be parsed + */ + public XmlConfiguration(URI configuration) throws SAXException, IOException + { + this(Resource.newResource(configuration)); } /** @@ -204,7 +232,9 @@ public class XmlConfiguration * The String should start with a "<Configure ....>" element. * @throws IOException if the configuration could not be read * @throws SAXException if the configuration could not be parsed + * @deprecated use Constructor which has location information */ + @Deprecated public XmlConfiguration(String configuration) throws SAXException, IOException { configuration = "\n" @@ -212,7 +242,7 @@ public class XmlConfiguration InputSource source = new InputSource(new StringReader(configuration)); synchronized (__parser) { - _url = null; + _location = null; setConfig(__parser.parse(source)); _dtd = __parser.getDTD(); } @@ -224,13 +254,15 @@ public class XmlConfiguration * @param configuration An input stream containing a complete configuration file * @throws IOException if the configuration could not be read * @throws SAXException if the configuration could not be parsed + * @deprecated use Constructor which has location information */ + @Deprecated public XmlConfiguration(InputStream configuration) throws SAXException, IOException { InputSource source = new InputSource(configuration); synchronized (__parser) { - _url = null; + _location = null; setConfig(__parser.parse(source)); _dtd = __parser.getDTD(); } @@ -257,7 +289,7 @@ public class XmlConfiguration { throw new IllegalArgumentException("Unknown XML tag:" + config.getTag()); } - _processor.init(_url, config, this); + _processor.init(_location, config, this); } /** @@ -332,14 +364,22 @@ public class XmlConfiguration private static class JettyXmlConfiguration implements ConfigurationProcessor { - private String _url; + private String _location; XmlParser.Node _root; XmlConfiguration _configuration; + @Override + public void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration) + { + _location = resource == null ? null : resource.toString(); + _root = root; + _configuration = configuration; + } + @Override public void init(URL url, XmlParser.Node root, XmlConfiguration configuration) { - _url = url == null ? null : url.toString(); + _location = url == null ? null : url.toString(); _root = root; _configuration = configuration; } @@ -352,7 +392,7 @@ public class XmlConfiguration if (oClass != null && !oClass.isInstance(obj)) { String loaders = (oClass.getClassLoader() == obj.getClass().getClassLoader()) ? "" : "Object Class and type Class are from different loaders."; - throw new IllegalArgumentException("Object of class '" + obj.getClass().getCanonicalName() + "' is not of type '" + oClass.getCanonicalName() + "'. " + loaders + " in " + _url); + throw new IllegalArgumentException("Object of class '" + obj.getClass().getCanonicalName() + "' is not of type '" + oClass.getCanonicalName() + "'. " + loaders + " in " + _location); } String id = _root.getAttribute("id"); if (id != null) @@ -404,7 +444,7 @@ public class XmlConfiguration } catch (NoSuchMethodException x) { - throw new IllegalStateException(String.format("No constructor %s(%s,%s) in %s", oClass, arguments, namedArgMap, _url)); + throw new IllegalStateException(String.format("No constructor %s(%s,%s) in %s", oClass, arguments, namedArgMap, _location)); } } if (id != null) @@ -496,12 +536,12 @@ public class XmlConfiguration envObj(node); break; default: - throw new IllegalStateException("Unknown tag: " + tag + " in " + _url); + throw new IllegalStateException("Unknown tag: " + tag + " in " + _location); } } catch (Exception e) { - LOG.warn("Config error at " + node, e.toString() + " in " + _url); + LOG.warn("Config error at " + node, e.toString() + " in " + _location); throw e; } } @@ -677,7 +717,7 @@ public class XmlConfiguration { Object result = constructor.newInstance(args); if (constructor.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated constructor {} in {}", constructor, _url); + LOG.warn("Deprecated constructor {} in {}", constructor, _location); return result; } @@ -685,7 +725,7 @@ public class XmlConfiguration { Object result = method.invoke(obj, args); if (method.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated method {} in {}", method, _url); + LOG.warn("Deprecated method {} in {}", method, _location); return result; } @@ -693,7 +733,7 @@ public class XmlConfiguration { Object result = field.get(object); if (field.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated field {} in {}", field, _url); + LOG.warn("Deprecated field {} in {}", field, _location); return result; } @@ -701,7 +741,7 @@ public class XmlConfiguration { field.set(obj, arg); if (field.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated field {} in {}", field, _url); + LOG.warn("Deprecated field {} in {}", field, _location); } /** diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index 44758c43023..d712a2a84cf 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -18,12 +18,10 @@ package org.eclipse.jetty.xml; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; import java.net.URL; -import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -627,7 +625,7 @@ public class XmlConfigurationTest @Test public void testArgumentsGetIgnoredMissingDTD() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration(new ByteArrayInputStream(("" + + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -639,7 +637,7 @@ public class XmlConfigurationTest " arg3\n" + " " + " " + - "").getBytes(StandardCharsets.ISO_8859_1))); + ""); // XmlConfiguration xmlConfiguration = new XmlConfiguration(url); AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure(); @@ -655,7 +653,7 @@ public class XmlConfigurationTest @Test public void testSetGetIgnoredMissingDTD() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration(new ByteArrayInputStream(("" + + XmlConfiguration xmlConfiguration = new XmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -667,7 +665,7 @@ public class XmlConfigurationTest " arg3 " + " " + " " + - "").getBytes(StandardCharsets.UTF_8))); + ""); // XmlConfiguration xmlConfiguration = new XmlConfiguration(url); DefaultTestConfiguration atc = (DefaultTestConfiguration)xmlConfiguration.configure(); From a72a6ab875478f041001de3fd98580bfb72f2b22 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 6 Jun 2019 12:27:41 -0500 Subject: [PATCH 02/11] Issue #3743 - Using Location based XmlConfiguration where possible Signed-off-by: Joakim Erdfelt --- .../spring/SpringConfigurationProcessor.java | 39 +++++++++++++++++++ .../jetty/xml/ConfigurationProcessor.java | 3 +- .../eclipse/jetty/xml/XmlConfiguration.java | 15 +++++-- .../jetty/xml/XmlConfigurationTest.java | 1 - 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java index cc8a7ba7143..8b8a826305d 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java @@ -68,6 +68,45 @@ public class SpringConfigurationProcessor implements ConfigurationProcessor private DefaultListableBeanFactory _beanFactory; private String _main; + @Override + public void init(org.eclipse.jetty.util.resource.Resource jettyResource, XmlParser.Node config, XmlConfiguration configuration) + { + try + { + _configuration = configuration; + + Resource springResource; + + if (jettyResource != null) + { + springResource = new UrlResource(jettyResource.getURI()); + } + else + { + springResource = new ByteArrayResource(("" + + "" + + "" + + config).getBytes(StandardCharsets.UTF_8)); + } + + _beanFactory = new DefaultListableBeanFactory() + { + @Override + protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrapper bw, PropertyValues pvs) + { + _configuration.initializeDefaults(bw.getWrappedInstance()); + super.applyPropertyValues(beanName, mbd, bw, pvs); + } + }; + + new XmlBeanDefinitionReader(_beanFactory).loadBeanDefinitions(springResource); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + @Override public void init(URL url, XmlParser.Node config, XmlConfiguration configuration) { diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java index b775ded0b87..8f8e48a9db3 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java @@ -38,8 +38,9 @@ public interface ConfigurationProcessor */ @Deprecated void init(URL url, XmlParser.Node root, XmlConfiguration configuration); + void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration); - + Object configure( Object obj) throws Exception; Object configure() throws Exception; } diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 4316c205a4a..c0d2cfefac5 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -268,6 +268,15 @@ public class XmlConfiguration } } + private String getLocation() + { + if (_location == null) + { + return "UNKNOWN-LOCATION"; + } + return _location.toString(); + } + private void setConfig(XmlParser.Node config) { if ("Configure".equals(config.getTag())) @@ -283,7 +292,7 @@ public class XmlConfiguration break; } if (_processor == null) - throw new IllegalStateException("Unknown configuration type: " + config.getTag() + " in " + this); + throw new IllegalStateException("Unknown configuration type: " + config.getTag() + " in " + getLocation()); } else { @@ -371,7 +380,7 @@ public class XmlConfiguration @Override public void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration) { - _location = resource == null ? null : resource.toString(); + _location = resource == null ? "UNKNOWN_RESOURCE" : resource.toString(); _root = root; _configuration = configuration; } @@ -379,7 +388,7 @@ public class XmlConfiguration @Override public void init(URL url, XmlParser.Node root, XmlConfiguration configuration) { - _location = url == null ? null : url.toString(); + _location = url == null ? "UNKNOWN_URL" : url.toString(); _root = root; _configuration = configuration; } diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index d712a2a84cf..10080958cb1 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -666,7 +666,6 @@ public class XmlConfigurationTest " " + " " + ""); -// XmlConfiguration xmlConfiguration = new XmlConfiguration(url); DefaultTestConfiguration atc = (DefaultTestConfiguration)xmlConfiguration.configure(); From c065eaa3cc0aba1d36db72deacd176f40591e99b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 6 Jun 2019 14:06:23 -0500 Subject: [PATCH 03/11] Issue #3743 - Handling StringReader using try-with-resources Signed-off-by: Joakim Erdfelt --- .../org/eclipse/jetty/xml/XmlConfiguration.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index c0d2cfefac5..4883cec075d 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -237,14 +237,18 @@ public class XmlConfiguration @Deprecated public XmlConfiguration(String configuration) throws SAXException, IOException { - configuration = "\n" + configuration = "\n" + + "" + configuration; - InputSource source = new InputSource(new StringReader(configuration)); - synchronized (__parser) + try (StringReader reader = new StringReader(configuration)) { - _location = null; - setConfig(__parser.parse(source)); - _dtd = __parser.getDTD(); + InputSource source = new InputSource(reader); + synchronized (__parser) + { + _location = null; + setConfig(__parser.parse(source)); + _dtd = __parser.getDTD(); + } } } From fc97acf1ea8f2b6bf6f530518766c18d283f9ba0 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 6 Jun 2019 14:06:46 -0500 Subject: [PATCH 04/11] Issue #3743 - Updating usages of configure_9_3.dtd to use proper syntax Signed-off-by: Joakim Erdfelt --- .../async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- jetty-cdi/cdi-2/src/main/config/etc/cdi2/jetty-web-cdi2.xml | 2 +- jetty-deploy/src/test/resources/webapps/foo.xml | 2 +- .../administration/fastcgi/configuring-fastcgi.adoc | 2 +- .../asciidoc/configuring/contexts/custom-error-pages.adoc | 2 +- .../main/asciidoc/reference/jetty-xml/jetty-env-xml.adoc | 4 ++-- .../asciidoc/reference/jetty-xml/jetty-web-xml-config.adoc | 2 +- .../main/asciidoc/reference/jetty-xml/jetty-xml-config.adoc | 2 +- .../main/asciidoc/reference/jetty-xml/jetty-xml-syntax.adoc | 6 +++--- jetty-home/src/main/resources/etc/jetty-setuid.xml | 2 +- .../sessions/infinispan/remote/other_proto_marshallers.xml | 2 +- jetty-jaas/src/main/config/etc/jetty-jaas.xml | 2 +- .../home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml | 2 +- .../home/overlays/templates/root/WEB-INF/overlay.xml | 2 +- .../org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml | 2 +- .../resources/org/eclipse/jetty/xml/configureWithAttr.xml | 2 +- .../org/eclipse/jetty/xml/configureWithElements.xml | 2 +- .../resources/webapp-contexts/RFC2616/rfc2616-webapp.xml | 2 +- tests/test-quickstart/src/test/resources/test-jndi.xml | 2 +- tests/test-quickstart/src/test/resources/test-spec.xml | 2 +- .../src/main/config/demo-base/webapps/test-jaas.xml | 2 +- .../test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../src/main/config/demo-base/etc/test-realm.xml | 2 +- .../test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../src/main/templates/jetty-test-jndi-header.xml | 2 +- .../src/main/templates/plugin-context-header.xml | 2 +- .../test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml | 2 +- .../test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../src/main/templates/annotations-context-header.xml | 2 +- .../src/main/templates/plugin-context-header.xml | 2 +- .../test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml | 2 +- .../test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../test-spec-webapp/src/test/jetty-plugin-env.xml | 2 +- 34 files changed, 37 insertions(+), 37 deletions(-) diff --git a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml index c15dc38f119..119675d9420 100644 --- a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml b/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml index 494755ae787..fcc07136fc9 100644 --- a/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml +++ b/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-jaas/src/main/config/etc/jetty-jaas.xml b/jetty-jaas/src/main/config/etc/jetty-jaas.xml index 4e42594db61..0ab8d52b792 100644 --- a/jetty-jaas/src/main/config/etc/jetty-jaas.xml +++ b/jetty-jaas/src/main/config/etc/jetty-jaas.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml index 4723bf73699..c2f63fc7e6e 100644 --- a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml +++ b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + Executing jetty-web.xml for diff --git a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml index f3037a1b134..6cb0508535b 100644 --- a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml +++ b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml b/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml index 1afc8030966..ac9ea0dca15 100644 --- a/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml +++ b/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml index 8377987bc89..2e5b3aaba34 100644 --- a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml +++ b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml @@ -1,5 +1,5 @@ - + name diff --git a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml index e4fa88d41b8..313dd03e29a 100644 --- a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml +++ b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml @@ -1,5 +1,5 @@ - + name diff --git a/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml b/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml index 36e624f56db..cfb7180873d 100644 --- a/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml +++ b/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml @@ -1,5 +1,5 @@ - + /rfc2616-webapp /test-webapp-rfc2616.war diff --git a/tests/test-quickstart/src/test/resources/test-jndi.xml b/tests/test-quickstart/src/test/resources/test-jndi.xml index 5f4ab4fa2da..5d207483e3f 100644 --- a/tests/test-quickstart/src/test/resources/test-jndi.xml +++ b/tests/test-quickstart/src/test/resources/test-jndi.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-quickstart/src/test/resources/test-spec.xml b/tests/test-quickstart/src/test/resources/test-spec.xml index a136d28395f..8a90e28189a 100644 --- a/tests/test-quickstart/src/test/resources/test-spec.xml +++ b/tests/test-quickstart/src/test/resources/test-spec.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml index eb031c87a3d..356afb6bdd4 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml +++ b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml index ecd5e307bb0..856ffce469b 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml index 72c6de06d68..9971f05dc01 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml index c04f74c7894..a8c3e2e1d60 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml b/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml index bd97eb13606..8c47b334b59 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml index adebfed771b..7c14f7ec625 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 203f811885a..cd38f2e67c7 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml index e2cb8ec33c4..72d77c458ef 100644 --- a/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + /proxy diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml index ff2f6a1f969..0d22ef6ba40 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml index 36ff548a92b..bb4ef5ceed9 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml index 909ac83052e..7188833b293 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml index e360f5c202a..232818c00d8 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml index 23c4b5b9cbc..64744d574a0 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml @@ -1,5 +1,5 @@ - + From 0c238088270b918b24291df320c0fffd2e70b549 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 6 Jun 2019 17:38:54 -0500 Subject: [PATCH 05/11] Issue #3743 - Applying changes from PR feedback. Signed-off-by: Joakim Erdfelt --- .../src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 4883cec075d..f0e13f128f7 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -272,7 +272,7 @@ public class XmlConfiguration } } - private String getLocation() + private String toLocation() { if (_location == null) { @@ -296,7 +296,7 @@ public class XmlConfiguration break; } if (_processor == null) - throw new IllegalStateException("Unknown configuration type: " + config.getTag() + " in " + getLocation()); + throw new IllegalStateException("Unknown configuration type: " + config.getTag() + " in " + toLocation()); } else { From 66aa966596278eaa22a10377b23f105400192362 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 7 Jun 2019 07:03:44 -0500 Subject: [PATCH 06/11] Revert "Issue #3743 - Updating usages of configure_9_3.dtd to use proper syntax" This reverts commit fc97acf1ea8f2b6bf6f530518766c18d283f9ba0. --- .../async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- jetty-cdi/cdi-2/src/main/config/etc/cdi2/jetty-web-cdi2.xml | 2 +- jetty-deploy/src/test/resources/webapps/foo.xml | 2 +- .../administration/fastcgi/configuring-fastcgi.adoc | 2 +- .../asciidoc/configuring/contexts/custom-error-pages.adoc | 2 +- .../main/asciidoc/reference/jetty-xml/jetty-env-xml.adoc | 4 ++-- .../asciidoc/reference/jetty-xml/jetty-web-xml-config.adoc | 2 +- .../main/asciidoc/reference/jetty-xml/jetty-xml-config.adoc | 2 +- .../main/asciidoc/reference/jetty-xml/jetty-xml-syntax.adoc | 6 +++--- jetty-home/src/main/resources/etc/jetty-setuid.xml | 2 +- .../sessions/infinispan/remote/other_proto_marshallers.xml | 2 +- jetty-jaas/src/main/config/etc/jetty-jaas.xml | 2 +- .../home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml | 2 +- .../home/overlays/templates/root/WEB-INF/overlay.xml | 2 +- .../org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml | 2 +- .../resources/org/eclipse/jetty/xml/configureWithAttr.xml | 2 +- .../org/eclipse/jetty/xml/configureWithElements.xml | 2 +- .../resources/webapp-contexts/RFC2616/rfc2616-webapp.xml | 2 +- tests/test-quickstart/src/test/resources/test-jndi.xml | 2 +- tests/test-quickstart/src/test/resources/test-spec.xml | 2 +- .../src/main/config/demo-base/webapps/test-jaas.xml | 2 +- .../test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../src/main/config/demo-base/etc/test-realm.xml | 2 +- .../test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../src/main/templates/jetty-test-jndi-header.xml | 2 +- .../src/main/templates/plugin-context-header.xml | 2 +- .../test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml | 2 +- .../test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../src/main/templates/annotations-context-header.xml | 2 +- .../src/main/templates/plugin-context-header.xml | 2 +- .../test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml | 2 +- .../test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml | 2 +- .../test-spec-webapp/src/test/jetty-plugin-env.xml | 2 +- 34 files changed, 37 insertions(+), 37 deletions(-) diff --git a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 119675d9420..c15dc38f119 100644 --- a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml b/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml index fcc07136fc9..494755ae787 100644 --- a/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml +++ b/jetty-infinispan/infinispan-remote-query/src/main/config-template/modules/sessions/infinispan/remote/other_proto_marshallers.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-jaas/src/main/config/etc/jetty-jaas.xml b/jetty-jaas/src/main/config/etc/jetty-jaas.xml index 0ab8d52b792..4e42594db61 100644 --- a/jetty-jaas/src/main/config/etc/jetty-jaas.xml +++ b/jetty-jaas/src/main/config/etc/jetty-jaas.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml index c2f63fc7e6e..4723bf73699 100644 --- a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml +++ b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/myfoo=foo/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + Executing jetty-web.xml for diff --git a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml index 6cb0508535b..f3037a1b134 100644 --- a/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml +++ b/jetty-overlay-deployer/src/test/resources/home/overlays/templates/root/WEB-INF/overlay.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml b/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml index ac9ea0dca15..1afc8030966 100644 --- a/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml +++ b/jetty-rewrite/src/test/resources/org.mortbay.jetty.rewrite.handler/jetty-rewrite.xml @@ -1,5 +1,5 @@ - + diff --git a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml index 2e5b3aaba34..8377987bc89 100644 --- a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml +++ b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithAttr.xml @@ -1,5 +1,5 @@ - + name diff --git a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml index 313dd03e29a..e4fa88d41b8 100644 --- a/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml +++ b/jetty-xml/src/test/resources/org/eclipse/jetty/xml/configureWithElements.xml @@ -1,5 +1,5 @@ - + name diff --git a/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml b/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml index cfb7180873d..36e624f56db 100644 --- a/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml +++ b/tests/test-integration/src/test/resources/webapp-contexts/RFC2616/rfc2616-webapp.xml @@ -1,5 +1,5 @@ - + /rfc2616-webapp /test-webapp-rfc2616.war diff --git a/tests/test-quickstart/src/test/resources/test-jndi.xml b/tests/test-quickstart/src/test/resources/test-jndi.xml index 5d207483e3f..5f4ab4fa2da 100644 --- a/tests/test-quickstart/src/test/resources/test-jndi.xml +++ b/tests/test-quickstart/src/test/resources/test-jndi.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-quickstart/src/test/resources/test-spec.xml b/tests/test-quickstart/src/test/resources/test-spec.xml index 8a90e28189a..a136d28395f 100644 --- a/tests/test-quickstart/src/test/resources/test-spec.xml +++ b/tests/test-quickstart/src/test/resources/test-spec.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml index 356afb6bdd4..eb031c87a3d 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml +++ b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 856ffce469b..ecd5e307bb0 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jaas-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml index 9971f05dc01..72c6de06d68 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml index a8c3e2e1d60..c04f74c7894 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml b/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml index 8c47b334b59..bd97eb13606 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/templates/plugin-context-header.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml index 7c14f7ec625..adebfed771b 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-env.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml index cd38f2e67c7..203f811885a 100644 --- a/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jndi-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 72d77c458ef..e2cb8ec33c4 100644 --- a/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-proxy-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + /proxy diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml index 0d22ef6ba40..ff2f6a1f969 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/annotations-context-header.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml index bb4ef5ceed9..36ff548a92b 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/templates/plugin-context-header.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml index 7188833b293..909ac83052e 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-env.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 232818c00d8..e360f5c202a 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml index 64744d574a0..23c4b5b9cbc 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/src/test/jetty-plugin-env.xml @@ -1,5 +1,5 @@ - + From bb0c87a42a622706524bac0b4e9a0b2bf6d0c222 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 10 Jun 2019 07:56:46 -0500 Subject: [PATCH 07/11] Issue #3743 - Addressing PR review items Signed-off-by: Joakim Erdfelt --- .../spring/SpringConfigurationProcessor.java | 33 ----- .../jetty/xml/ConfigurationProcessor.java | 6 +- .../eclipse/jetty/xml/XmlConfiguration.java | 33 ++--- .../jetty/xml/XmlConfigurationTest.java | 113 +++++++++++------- 4 files changed, 89 insertions(+), 96 deletions(-) diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java index 8b8a826305d..646e1440a0a 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java @@ -19,7 +19,6 @@ package org.eclipse.jetty.spring; -import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Map; @@ -107,38 +106,6 @@ public class SpringConfigurationProcessor implements ConfigurationProcessor } } - @Override - public void init(URL url, XmlParser.Node config, XmlConfiguration configuration) - { - try - { - _configuration = configuration; - - Resource resource = url != null - ? new UrlResource(url) - : new ByteArrayResource(("" + - "" + - "" + - config).getBytes(StandardCharsets.UTF_8)); - - _beanFactory = new DefaultListableBeanFactory() - { - @Override - protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrapper bw, PropertyValues pvs) - { - _configuration.initializeDefaults(bw.getWrappedInstance()); - super.applyPropertyValues(beanName, mbd, bw, pvs); - } - }; - - new XmlBeanDefinitionReader(_beanFactory).loadBeanDefinitions(resource); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - @Override public Object configure(Object obj) throws Exception { diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java index 8f8e48a9db3..59ed6f38b0c 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java @@ -37,7 +37,11 @@ public interface ConfigurationProcessor * @deprecated use {@link #init(Resource, XmlParser.Node, XmlConfiguration)} instead */ @Deprecated - void init(URL url, XmlParser.Node root, XmlConfiguration configuration); + default void init(URL url, XmlParser.Node root, XmlConfiguration configuration) + { + // Moving back and forth between URL and File/FileSystem/Path/Resource is known to cause escaping issues. + init(Resource.newResource(url), root, configuration); + } void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration); diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index f0e13f128f7..83f0e53aa44 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -377,24 +377,25 @@ public class XmlConfiguration private static class JettyXmlConfiguration implements ConfigurationProcessor { - private String _location; + private Resource _location; XmlParser.Node _root; XmlConfiguration _configuration; @Override public void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration) { - _location = resource == null ? "UNKNOWN_RESOURCE" : resource.toString(); + _location = resource; _root = root; _configuration = configuration; } - @Override - public void init(URL url, XmlParser.Node root, XmlConfiguration configuration) + private String toLocation() { - _location = url == null ? "UNKNOWN_URL" : url.toString(); - _root = root; - _configuration = configuration; + if (_location == null) + { + return "UNKNOWN-LOCATION"; + } + return _location.toString(); } @Override @@ -405,7 +406,7 @@ public class XmlConfiguration if (oClass != null && !oClass.isInstance(obj)) { String loaders = (oClass.getClassLoader() == obj.getClass().getClassLoader()) ? "" : "Object Class and type Class are from different loaders."; - throw new IllegalArgumentException("Object of class '" + obj.getClass().getCanonicalName() + "' is not of type '" + oClass.getCanonicalName() + "'. " + loaders + " in " + _location); + throw new IllegalArgumentException("Object of class '" + obj.getClass().getCanonicalName() + "' is not of type '" + oClass.getCanonicalName() + "'. " + loaders + " in " + toLocation()); } String id = _root.getAttribute("id"); if (id != null) @@ -457,7 +458,7 @@ public class XmlConfiguration } catch (NoSuchMethodException x) { - throw new IllegalStateException(String.format("No constructor %s(%s,%s) in %s", oClass, arguments, namedArgMap, _location)); + throw new IllegalStateException(String.format("No constructor %s(%s,%s) in %s", oClass, arguments, namedArgMap, toLocation())); } } if (id != null) @@ -549,12 +550,12 @@ public class XmlConfiguration envObj(node); break; default: - throw new IllegalStateException("Unknown tag: " + tag + " in " + _location); + throw new IllegalStateException("Unknown tag: " + tag + " in " + toLocation()); } } catch (Exception e) { - LOG.warn("Config error at " + node, e.toString() + " in " + _location); + LOG.warn("Config error at " + node, e.toString() + " in " + toLocation()); throw e; } } @@ -730,7 +731,7 @@ public class XmlConfiguration { Object result = constructor.newInstance(args); if (constructor.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated constructor {} in {}", constructor, _location); + LOG.warn("Deprecated constructor {} in {}", constructor, toLocation()); return result; } @@ -738,7 +739,7 @@ public class XmlConfiguration { Object result = method.invoke(obj, args); if (method.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated method {} in {}", method, _location); + LOG.warn("Deprecated method {} in {}", method, toLocation()); return result; } @@ -746,7 +747,7 @@ public class XmlConfiguration { Object result = field.get(object); if (field.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated field {} in {}", field, _location); + LOG.warn("Deprecated field {} in {}", field, toLocation()); return result; } @@ -754,7 +755,7 @@ public class XmlConfiguration { field.set(obj, arg); if (field.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated field {} in {}", field, _location); + LOG.warn("Deprecated field {} in {}", field, toLocation()); } /** @@ -1572,7 +1573,7 @@ public class XmlConfiguration if ("Env".equals(tag)) return envObj(node); - LOG.warn("Unknown value tag: " + node, new Throwable()); + LOG.warn("Unknown value tag: " + node + " in " + toLocation(), new Throwable()); return null; } diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index 10080958cb1..5ef50a4a702 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -18,10 +18,15 @@ package org.eclipse.jetty.xml; +import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.PrintStream; +import java.io.StringReader; import java.lang.reflect.InvocationTargetException; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -29,12 +34,19 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; +import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension; +import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.StdErrLog; +import org.eclipse.jetty.util.resource.PathResource; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.xml.sax.SAXException; +import static java.nio.charset.StandardCharsets.UTF_8; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; @@ -48,8 +60,11 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +@ExtendWith(WorkDirExtension.class) public class XmlConfigurationTest { + public WorkDir workDir; + protected String[] _configure=new String [] {"org/eclipse/jetty/xml/configureWithAttr.xml","org/eclipse/jetty/xml/configureWithElements.xml"}; private static final String STRING_ARRAY_XML = "String1String2"; @@ -231,12 +246,21 @@ public class XmlConfigurationTest } } + public XmlConfiguration asXmlConfiguration(String rawXml) throws IOException, SAXException + { + Path testFile = workDir.getPathFile("raw.xml"); + try(StringReader reader = new StringReader(rawXml); + BufferedWriter writer = Files.newBufferedWriter(testFile, UTF_8)) + { + IO.copy(reader, writer); + return new XmlConfiguration(new PathResource(testFile)); + } + } @Test public void testGetClass() throws Exception { - XmlConfiguration configuration = - new XmlConfiguration(""); + XmlConfiguration configuration = asXmlConfiguration(""); TestConfiguration tc = new TestConfiguration(); configuration.configure(tc); assertEquals(TestConfiguration.class,tc.testObject); @@ -251,8 +275,7 @@ public class XmlConfigurationTest @Test public void testStringConfiguration() throws Exception { - XmlConfiguration configuration = - new XmlConfiguration("SetValue2"); + XmlConfiguration configuration = asXmlConfiguration("SetValue2"); TestConfiguration tc = new TestConfiguration(); configuration.configure(tc); assertEquals("SetValue", tc.testObject, "Set String 3"); @@ -262,8 +285,7 @@ public class XmlConfigurationTest @Test public void testMeaningfullSetException() throws Exception { - XmlConfiguration configuration = - new XmlConfiguration(""); + XmlConfiguration configuration = asXmlConfiguration(""); TestConfiguration tc = new TestConfiguration(); NoSuchMethodException e = assertThrows(NoSuchMethodException.class, () -> { @@ -276,7 +298,7 @@ public class XmlConfigurationTest @Test public void testListConstructorArg() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + STRING_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); @@ -289,7 +311,7 @@ public class XmlConfigurationTest @Test public void testTwoArgumentListConstructorArg() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + "" + STRING_ARRAY_XML + "" + "" + STRING_ARRAY_XML + "" @@ -304,7 +326,7 @@ public class XmlConfigurationTest @Test public void testListNotContainingArray() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "Some String"); TestConfiguration tc = new TestConfiguration(); @@ -316,7 +338,7 @@ public class XmlConfigurationTest @Test public void testSetConstructorArg() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + STRING_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); @@ -329,7 +351,7 @@ public class XmlConfigurationTest @Test public void testSetNotContainingArray() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "Some String"); TestConfiguration tc = new TestConfiguration(); assertThrows(IllegalArgumentException.class, ()->{ @@ -340,7 +362,7 @@ public class XmlConfigurationTest @Test public void testListSetterWithStringArray() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + STRING_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); assertThat("tc.getList() returns null as it's not configured yet",tc.getList(),is(nullValue())); @@ -351,7 +373,7 @@ public class XmlConfigurationTest @Test public void testListSetterWithPrimitiveArray() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + INT_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); assertThat("tc.getList() returns null as it's not configured yet",tc.getList(),is(nullValue())); @@ -362,7 +384,7 @@ public class XmlConfigurationTest @Test public void testNotSupportedLinkedListSetter() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + INT_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); assertThat("tc.getSet() returns null as it's not configured yet", tc.getList(), is(nullValue())); @@ -374,7 +396,7 @@ public class XmlConfigurationTest @Test public void testArrayListSetter() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + INT_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); assertThat("tc.getSet() returns null as it's not configured yet", tc.getList(), is(nullValue())); @@ -385,7 +407,7 @@ public class XmlConfigurationTest @Test public void testSetSetter() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + STRING_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); assertThat("tc.getSet() returns null as it's not configured yet", tc.getSet(), is(nullValue())); @@ -396,7 +418,7 @@ public class XmlConfigurationTest @Test public void testSetSetterWithPrimitiveArray() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + INT_ARRAY_XML + ""); TestConfiguration tc = new TestConfiguration(); assertThat("tc.getSet() returns null as it's not configured yet", tc.getSet(), is(nullValue())); @@ -407,7 +429,7 @@ public class XmlConfigurationTest @Test public void testMap() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + " " + @@ -431,7 +453,7 @@ public class XmlConfigurationTest @Test public void testConstructorNamedInjection() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -448,7 +470,7 @@ public class XmlConfigurationTest @Test public void testConstructorNamedInjectionOrdered() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -465,7 +487,7 @@ public class XmlConfigurationTest @Test public void testConstructorNamedInjectionUnOrdered() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg3 " + @@ -499,7 +521,7 @@ public class XmlConfigurationTest @Test public void testConstructorNamedInjectionUnorderedMixed() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg3 " + " arg2 " + @@ -516,7 +538,7 @@ public class XmlConfigurationTest @Test public void testNestedConstructorNamedInjection() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -544,7 +566,7 @@ public class XmlConfigurationTest @Test public void testNestedConstructorNamedInjectionOrdered() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -571,7 +593,7 @@ public class XmlConfigurationTest @Test public void testNestedConstructorNamedInjectionUnOrdered() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg3 " + @@ -598,7 +620,7 @@ public class XmlConfigurationTest @Test public void testNestedConstructorNamedInjectionOrderedMixed() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -625,7 +647,7 @@ public class XmlConfigurationTest @Test public void testArgumentsGetIgnoredMissingDTD() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -638,7 +660,6 @@ public class XmlConfigurationTest " " + " " + ""); -// XmlConfiguration xmlConfiguration = new XmlConfiguration(url); AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure(); @@ -653,7 +674,7 @@ public class XmlConfigurationTest @Test public void testSetGetIgnoredMissingDTD() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + @@ -680,7 +701,7 @@ public class XmlConfigurationTest @Test public void testNestedConstructorNamedInjectionUnorderedMixed() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg3 " + " arg2 " + @@ -745,7 +766,7 @@ public class XmlConfigurationTest @Test public void testSetBooleanTrue() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " true" + ""); @@ -757,7 +778,7 @@ public class XmlConfigurationTest @Test public void testSetBooleanFalse() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " false" + ""); @@ -770,7 +791,7 @@ public class XmlConfigurationTest @Disabled public void testSetBadBoolean() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " tru" + ""); @@ -782,7 +803,7 @@ public class XmlConfigurationTest @Test public void testSetBadInteger() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " bad" + ""); @@ -795,7 +816,7 @@ public class XmlConfigurationTest @Test public void testSetBadExtraInteger() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " 100 bas" + ""); @@ -808,7 +829,7 @@ public class XmlConfigurationTest @Test public void testSetBadFloatInteger() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " 1.5" + ""); @@ -823,7 +844,7 @@ public class XmlConfigurationTest { // No properties String defolt = "baz"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + ""); @@ -836,7 +857,7 @@ public class XmlConfigurationTest { String name = "foo"; String value = "foo"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + ""); @@ -850,7 +871,7 @@ public class XmlConfigurationTest { String name = "bar"; String value = "bar"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + ""); @@ -864,7 +885,7 @@ public class XmlConfigurationTest { String name = "bar"; String value = "bar"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + ""); @@ -878,7 +899,7 @@ public class XmlConfigurationTest { String name = "bar"; String value = "bar"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + " " + @@ -901,7 +922,7 @@ public class XmlConfigurationTest String value = "bar"; String defaultValue = "___"; String expectedValue = "_" + value + "_" + value + "_"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + " " + @@ -919,7 +940,7 @@ public class XmlConfigurationTest public void testPropertyNotFoundWithPropertyInDefaultValueNotFoundWithDefault() throws Exception { String value = "bar"; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " " + " " + @@ -942,7 +963,7 @@ public class XmlConfigurationTest for(String propName: propNames) { XmlConfiguration configuration = - new XmlConfiguration("" + + asXmlConfiguration("" + "" + " " + " " + @@ -970,7 +991,7 @@ public class XmlConfigurationTest for(String propName: propNames) { XmlConfiguration configuration = - new XmlConfiguration("" + + asXmlConfiguration("" + "" + " " + " " + @@ -991,7 +1012,7 @@ public class XmlConfigurationTest public void testDeprecated() throws Exception { Class testClass = AnnotatedTestConfiguration.class; - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " foo" + " " + From a8d008b8516dc606fcb970c4a535262d7d8b23df Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 10 Jun 2019 08:19:59 -0500 Subject: [PATCH 08/11] Issue #3743 - Making new ConfigurationProcessor interface default Signed-off-by: Joakim Erdfelt --- .../jetty/xml/ConfigurationProcessor.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java index 59ed6f38b0c..bded5d54470 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/ConfigurationProcessor.java @@ -18,6 +18,7 @@ package org.eclipse.jetty.xml; +import java.net.MalformedURLException; import java.net.URL; import org.eclipse.jetty.util.resource.Resource; @@ -37,14 +38,29 @@ public interface ConfigurationProcessor * @deprecated use {@link #init(Resource, XmlParser.Node, XmlConfiguration)} instead */ @Deprecated - default void init(URL url, XmlParser.Node root, XmlConfiguration configuration) + void init(URL url, XmlParser.Node root, XmlConfiguration configuration); + + /** + * Initialize a ConfigurationProcessor from provided Resource and XML + * + * @param resource the resource being read + * @param root the parsed XML root node for the resource + * @param configuration the configuration being used (typically for ref IDs) + */ + default void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration) { // Moving back and forth between URL and File/FileSystem/Path/Resource is known to cause escaping issues. - init(Resource.newResource(url), root, configuration); + try + { + init(resource.getURI().toURL(), root, configuration); + } + catch (MalformedURLException e) + { + throw new IllegalStateException("Unable to convert Resource to URL", e); + } } - void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration); + Object configure(Object obj) throws Exception; - Object configure( Object obj) throws Exception; Object configure() throws Exception; } From ff43fd3de433cb0cbe074c1fc03248bbc773fe14 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 10 Jun 2019 09:58:53 -0500 Subject: [PATCH 09/11] Issue #3743 - More changes from review of PR Signed-off-by: Joakim Erdfelt --- .../spring/SpringConfigurationProcessor.java | 8 ++++ .../eclipse/jetty/xml/XmlConfiguration.java | 40 +++++++++---------- .../jetty/xml/XmlConfigurationTest.java | 15 +++---- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java index 646e1440a0a..d765c12f782 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.spring; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Map; @@ -67,6 +68,13 @@ public class SpringConfigurationProcessor implements ConfigurationProcessor private DefaultListableBeanFactory _beanFactory; private String _main; + @Override + public void init(URL url, XmlParser.Node root, XmlConfiguration configuration) + { + // Moving back and forth between URL and File/FileSystem/Path/Resource is known to cause escaping issues. + init(org.eclipse.jetty.util.resource.Resource.newResource(url), root, configuration); + } + @Override public void init(org.eclipse.jetty.util.resource.Resource jettyResource, XmlParser.Node config, XmlConfiguration configuration) { diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 83f0e53aa44..4a4c1f79ff2 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -272,7 +272,8 @@ public class XmlConfiguration } } - private String toLocation() + @Override + public String toString() { if (_location == null) { @@ -296,7 +297,7 @@ public class XmlConfiguration break; } if (_processor == null) - throw new IllegalStateException("Unknown configuration type: " + config.getTag() + " in " + toLocation()); + throw new IllegalStateException("Unknown configuration type: " + config.getTag() + " in " + this); } else { @@ -377,25 +378,20 @@ public class XmlConfiguration private static class JettyXmlConfiguration implements ConfigurationProcessor { - private Resource _location; XmlParser.Node _root; XmlConfiguration _configuration; @Override - public void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration) + public void init(URL url, XmlParser.Node root, XmlConfiguration configuration) { - _location = resource; - _root = root; - _configuration = configuration; + // nobody calls this. } - private String toLocation() + @Override + public void init(Resource resource, XmlParser.Node root, XmlConfiguration configuration) { - if (_location == null) - { - return "UNKNOWN-LOCATION"; - } - return _location.toString(); + _root = root; + _configuration = configuration; } @Override @@ -406,7 +402,7 @@ public class XmlConfiguration if (oClass != null && !oClass.isInstance(obj)) { String loaders = (oClass.getClassLoader() == obj.getClass().getClassLoader()) ? "" : "Object Class and type Class are from different loaders."; - throw new IllegalArgumentException("Object of class '" + obj.getClass().getCanonicalName() + "' is not of type '" + oClass.getCanonicalName() + "'. " + loaders + " in " + toLocation()); + throw new IllegalArgumentException("Object of class '" + obj.getClass().getCanonicalName() + "' is not of type '" + oClass.getCanonicalName() + "'. " + loaders + " in " + _configuration); } String id = _root.getAttribute("id"); if (id != null) @@ -458,7 +454,7 @@ public class XmlConfiguration } catch (NoSuchMethodException x) { - throw new IllegalStateException(String.format("No constructor %s(%s,%s) in %s", oClass, arguments, namedArgMap, toLocation())); + throw new IllegalStateException(String.format("No constructor %s(%s,%s) in %s", oClass, arguments, namedArgMap, _configuration)); } } if (id != null) @@ -550,12 +546,12 @@ public class XmlConfiguration envObj(node); break; default: - throw new IllegalStateException("Unknown tag: " + tag + " in " + toLocation()); + throw new IllegalStateException("Unknown tag: " + tag + " in " + _configuration); } } catch (Exception e) { - LOG.warn("Config error at " + node, e.toString() + " in " + toLocation()); + LOG.warn("Config error at " + node, e.toString() + " in " + _configuration); throw e; } } @@ -731,7 +727,7 @@ public class XmlConfiguration { Object result = constructor.newInstance(args); if (constructor.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated constructor {} in {}", constructor, toLocation()); + LOG.warn("Deprecated constructor {} in {}", constructor, _configuration); return result; } @@ -739,7 +735,7 @@ public class XmlConfiguration { Object result = method.invoke(obj, args); if (method.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated method {} in {}", method, toLocation()); + LOG.warn("Deprecated method {} in {}", method, _configuration); return result; } @@ -747,7 +743,7 @@ public class XmlConfiguration { Object result = field.get(object); if (field.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated field {} in {}", field, toLocation()); + LOG.warn("Deprecated field {} in {}", field, _configuration); return result; } @@ -755,7 +751,7 @@ public class XmlConfiguration { field.set(obj, arg); if (field.getAnnotation(Deprecated.class) != null) - LOG.warn("Deprecated field {} in {}", field, toLocation()); + LOG.warn("Deprecated field {} in {}", field, _configuration); } /** @@ -1573,7 +1569,7 @@ public class XmlConfiguration if ("Env".equals(tag)) return envObj(node); - LOG.warn("Unknown value tag: " + node + " in " + toLocation(), new Throwable()); + LOG.warn("Unknown value tag: " + node + " in " + this, new Throwable()); return null; } diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index 5ef50a4a702..06ea4fae776 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -22,7 +22,6 @@ import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; -import java.io.StringReader; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.nio.file.Files; @@ -36,7 +35,6 @@ import java.util.stream.Collectors; import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension; -import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.StdErrLog; @@ -248,13 +246,12 @@ public class XmlConfigurationTest public XmlConfiguration asXmlConfiguration(String rawXml) throws IOException, SAXException { - Path testFile = workDir.getPathFile("raw.xml"); - try(StringReader reader = new StringReader(rawXml); - BufferedWriter writer = Files.newBufferedWriter(testFile, UTF_8)) + Path testFile = workDir.getEmptyPathDir().resolve("raw.xml"); + try(BufferedWriter writer = Files.newBufferedWriter(testFile, UTF_8)) { - IO.copy(reader, writer); - return new XmlConfiguration(new PathResource(testFile)); + writer.write(rawXml); } + return new XmlConfiguration(new PathResource(testFile)); } @Test @@ -266,7 +263,7 @@ public class XmlConfigurationTest assertEquals(TestConfiguration.class,tc.testObject); configuration = - new XmlConfiguration(""); + asXmlConfiguration(""); configuration.configure(tc); assertEquals(String.class,tc.testObject); assertEquals("String",configuration.getIdMap().get("simple")); @@ -504,7 +501,7 @@ public class XmlConfigurationTest @Test public void testConstructorNamedInjectionOrderedMixed() throws Exception { - XmlConfiguration xmlConfiguration = new XmlConfiguration("" + + XmlConfiguration xmlConfiguration = asXmlConfiguration("" + "" + " arg1 " + " arg2 " + From 59ce0ea0e3eb58a59e2fa0ddf8cfce97a8f02f5f Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 10 Jun 2019 10:12:39 -0500 Subject: [PATCH 10/11] Issue #3743 - Cleanup requested from PR Signed-off-by: Joakim Erdfelt --- .../org/eclipse/jetty/xml/XmlConfiguration.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index 4a4c1f79ff2..0d766138d2a 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -30,7 +30,6 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.InetAddress; import java.net.MalformedURLException; -import java.net.URI; import java.net.URL; import java.net.UnknownHostException; import java.nio.file.Path; @@ -207,24 +206,14 @@ public class XmlConfiguration * @param configuration the URL of the XML configuration * @throws IOException if the configuration could not be read * @throws SAXException if the configuration could not be parsed + * @deprecated use {@link XmlConfiguration(Resource)} instead due to escaping issues */ + @Deprecated public XmlConfiguration(URL configuration) throws SAXException, IOException { this(Resource.newResource(configuration)); } - /** - * Reads and parses the XML configuration file. - * - * @param configuration the URI and location of the XML configuration - * @throws IOException if the configuration could not be read - * @throws SAXException if the configuration could not be parsed - */ - public XmlConfiguration(URI configuration) throws SAXException, IOException - { - this(Resource.newResource(configuration)); - } - /** * Reads and parses the XML configuration string. * @@ -1569,7 +1558,7 @@ public class XmlConfiguration if ("Env".equals(tag)) return envObj(node); - LOG.warn("Unknown value tag: " + node + " in " + this, new Throwable()); + LOG.warn("Unknown value tag: " + node + " in " + _configuration, new Throwable()); return null; } From 8b2728e4d5e85d7cd2e90045f3aeea9d86dd8e2e Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 10 Jun 2019 08:10:34 -0500 Subject: [PATCH 11/11] Fixing release-jetty.sh --- scripts/release-jetty.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/scripts/release-jetty.sh b/scripts/release-jetty.sh index eeddd4ab3dd..57ae4c9afbd 100755 --- a/scripts/release-jetty.sh +++ b/scripts/release-jetty.sh @@ -69,8 +69,6 @@ VER_CURRENT=`sed -e "s/xmlns/ignore/" pom.xml | xmllint --xpath "/project/versio echo "Current pom.xml Version: ${VER_CURRENT}" read -e -p "Release Version ? " VER_RELEASE read -e -p "Next Dev Version ? " VER_NEXT -# VER_RELEASE=9.3.5.v20151012 -# VER_NEXT=9.3.6-SNAPSHOT TAG_NAME="jetty-$VER_RELEASE" # Ensure tag doesn't exist (yet) @@ -89,9 +87,12 @@ if [ ! -d "$ALT_DEPLOY_DIR" ] ; then fi # DEPLOY_OPTS="-Dmaven.test.failure.ignore=true" -DEPLOY_OPTS="-Dtest=None" +DEPLOY_OPTS="-DskipTests -Dtest=None" # DEPLOY_OPTS="$DEPLOY_OPTS -DaltDeploymentRepository=intarget::default::file://$ALT_DEPLOY_DIR/" +# Uncomment for Java 1.7 +export MAVEN_OPTS="-Xmx1g -XX:MaxPermSize=128m" + echo "" echo "-----------------------------------------------" echo " Release Plan Review" @@ -103,6 +104,7 @@ echo "Current Version : $VER_CURRENT" echo "Release Version : $VER_RELEASE" echo "Next Dev Version : $VER_NEXT" echo "Tag name : $TAG_NAME" +echo "MAVEN_OPTS : $MAVEN_OPTS" echo "Maven Deploy Opts: $DEPLOY_OPTS" reportMavenTestFailures() { @@ -130,13 +132,20 @@ echo "" if proceedyn "Are you sure you want to release using above? (y/N)" n; then echo "" if proceedyn "Update VERSION.txt for $VER_RELEASE? (Y/n)" y; then + # Uncomment alternate JVM for jetty 9.2 builds + # JAVA_HOME_ORIG=$JAVA_HOME + # PATH_ORIG=$PATH + # JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home + # PATH=$JAVA_HOME/bin:$PATH mvn -N -Pupdate-version generate-resources cp VERSION.txt VERSION.txt.backup cat VERSION.txt.backup | sed -e "s/$VER_CURRENT/$VER_RELEASE/" > VERSION.txt rm VERSION.txt.backup + # JAVA_HOME=$JAVA_HOME_ORIG + # PATH=$PATH_ORIG echo "VERIFY the following files (in a different console window) before continuing." echo " VERSION.txt - top section" - echo " target/vers-tag.txt - for the tag commit message" + echo " target/version-tag.txt - for the tag commit message" fi # This is equivalent to 'mvn release:prepare' @@ -151,8 +160,8 @@ if proceedyn "Are you sure you want to release using above? (y/N)" n; then fi if proceedyn "Create Tag $TAG_NAME? (Y/n)" y; then echo "TODO: Sign tags with GIT_USER_EMAIL=$GIT_USER_EMAIL" - echo "Using target/vers-tag.txt as tag text" - git tag --file=target/vers-tag.txt $TAG_NAME + echo "Using target/version-tag.txt as tag text" + git tag --file=target/version-tag.txt $TAG_NAME fi # This is equivalent to 'mvn release:perform' @@ -170,9 +179,10 @@ if proceedyn "Are you sure you want to release using above? (y/N)" n; then echo "" >> VERSION.txt cat VERSION.txt.backup >> VERSION.txt echo "Update project.versions for $VER_NEXT" - mvn org.codehaus.mojo:versions-maven-plugin:2.1:set \ + mvn org.codehaus.mojo:versions-maven-plugin:2.7:set \ -DoldVersion="$VER_RELEASE" \ - -DnewVersion="$VER_NEXT" + -DnewVersion="$VER_NEXT" \ + -DprocessAllModules=true echo "Commit $VER_NEXT" if proceedyn "Commit updates in working directory for $VER_NEXT? (Y/n)" y; then git commit -a -m "Updating to version $VER_NEXT"