diff --git a/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/containerneutral/CheckContainerNeutrality.java b/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/containerneutral/CheckContainerNeutrality.java
index 9475d792e..4b2c4bfa1 100644
--- a/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/containerneutral/CheckContainerNeutrality.java
+++ b/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/containerneutral/CheckContainerNeutrality.java
@@ -8,8 +8,10 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import javax.servlet.Filter;
import javax.servlet.ServletContextListener;
@@ -90,6 +92,18 @@ import org.xml.sax.SAXException;
* Check each to insure that the class can be loaded and
* instantiated and assigned to Filter.
*
+ * ------
+ *
+ * A tag for every tag
+ *
+ * I can't find a mention of this in the spec, but Tomcat complains and refuses
+ * to load the app if there is a tag whose is
+ * not matched by a in a tag.
+ *
+ * Get sets of all tags that are specified in and
+ * tags. There should not be any names in the
+ * servlet-mappings that are not in the servlets.
+ *
* ---------------------------------------------------------------------
*
* Although this class is executed as a JUnit test, it doesn't have the usual
@@ -101,7 +115,7 @@ import org.xml.sax.SAXException;
*
* ---------------------------------------------------------------------
*
- * Since this is not executed as part of the standard Vitro unit tests, it also
+ * Since this is not executed as part of the standard Vitro unit tests, it also
* cannot use the standard logging mechanism. Log4J has not been initialized.
*
*/
@@ -166,6 +180,7 @@ public class CheckContainerNeutrality {
checkListenerClasses();
checkFilterClasses();
checkTaglibLocations();
+ checkServletNames();
if (!messages.isEmpty()) {
fail("Found these problems with '" + webXmlFile.getCanonicalPath()
@@ -234,6 +249,25 @@ public class CheckContainerNeutrality {
}
}
+ private void checkServletNames() {
+ Set servletNames = new HashSet();
+ for (Node n : findNodes("//j2ee:servlet/j2ee:servlet-name")) {
+ servletNames.add(n.getTextContent());
+ }
+
+ Set servletMappingNames = new HashSet();
+ for (Node n : findNodes("//j2ee:servlet-mapping/j2ee:servlet-name")) {
+ servletMappingNames.add(n.getTextContent());
+ }
+
+ servletMappingNames.removeAll(servletNames);
+ for (String name : servletMappingNames) {
+ messages.add("There is a tag for "
+ + name + ", but there is "
+ + "no matching tag.");
+ }
+ }
+
private String checkTaglibUri(String taglibUri, String taglibLocation) {
File taglibFile = new File(webappDir, taglibLocation);
if (!taglibFile.isFile()) {