001 package hirondelle.web4jtools.util; 002 003 import hirondelle.web4j.util.Util; 004 import java.util.logging.*; 005 006 /** Ensure an item is configured as expected in <tt>web.xml</tt>. */ 007 public final class Ensure { 008 009 /** 010 * Ensure an item is configured as expected in <tt>web.xml</tt>. 011 * 012 * If the item is absent, the fact is logged at <tt>SEVERE</tt> level, and a 013 * <tt>RuntimeException</tt> is thrown. 014 */ 015 public static void isPresentInWebXml(String aParamName, String aParamValue){ 016 if ( ! Util.textHasContent(aParamValue) ) { 017 String message = "In web.xml, please specify a value for parameter named " + Util.quote(aParamName); 018 fLogger.severe(message); 019 throw new RuntimeException(message); 020 } 021 } 022 023 // PRIVATE // 024 private static final Logger fLogger = Util.getLogger(Ensure.class); 025 }