From 31831476f1ba34ac45c27ea4944de133ee8721c5 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 26 Dec 2013 15:49:31 -0700 Subject: [PATCH] Removing ${switch logic from Module in favor of using properties --- .../java/org/eclipse/jetty/start/Module.java | 47 +++---------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java index 2dbcbc242d4..bc1359772ab 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java @@ -292,52 +292,12 @@ public class Module { try (BufferedReader buf = new BufferedReader(reader)) { - String line; String sectionType = ""; - String switchProperty = null; - String caseTag = null; - String caseTagColon = null; - boolean switched = false; + String line; while ((line = buf.readLine()) != null) { line = line.trim(); - if (caseTag != null) - { - if ("}".equals(line)) - { - if (!switched) - { - StartLog.warn("WARN: No matching case in %s for ${switch %s=%s ...}",basehome.toShortForm(file),switchProperty,caseTag); - } - caseTag = null; - caseTagColon = null; - switchProperty = null; - continue; - } - - if (switched) - { - continue; - } - - if (!line.startsWith(caseTagColon) && !line.startsWith("*:")) - { - continue; - } - - switched = true; - line = line.substring(line.indexOf(':') + 1).trim(); - } - else if (line.startsWith("${switch ")) - { - switched = false; - switchProperty = line.substring(9).trim(); - caseTag = System.getProperty(switchProperty); - caseTagColon = caseTag + ":"; - continue; - } - Matcher sectionMatcher = section.matcher(line); if (sectionMatcher.matches()) @@ -358,6 +318,9 @@ public class Module { switch (sectionType) { + case "": + // ignore (this would be entries before first section) + break; case "DEPEND": parentNames.add(line); break; @@ -376,6 +339,8 @@ public class Module case "INI-TEMPLATE": initialise.add(line); break; + default: + throw new IOException("Unrecognized Module section: [" + sectionType + "]"); } } }