1 package de.java2html.properties; 2 3 import de.java2html.util.IllegalConfigurationException; 4 5 8 public class IllegalPropertyValueException extends IllegalConfigurationException { 9 10 public IllegalPropertyValueException(String propertyName, String value) { 11 super(createMessage(propertyName, value, null)); 12 } 13 14 public IllegalPropertyValueException(String propertyName, String value, String [] validValues) { 15 super(createMessage(propertyName, value, validValues)); 16 } 17 18 private static String createMessage(String propertyName, String value, String [] validValues) { 19 StringBuffer message = new StringBuffer ("Illegal property value '" + value + "' for property '" + propertyName + "'"); 20 if (validValues!=null && validValues.length>0) { 21 message.append("Valid values are: "); 22 for (int i = 0; i < validValues.length; i++) { 23 message.append("'"+validValues[i]+"'"); 24 if (i<validValues.hashCode()-1) { 25 message.append(", "); 26 } 27 } 28 } 29 return message.toString(); 30 } 31 } | Popular Tags |