comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java @ 1096:41630b457b6a

ISSUE297: Localized generated exceptionmessage gnv-artifacts/trunk@1218 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 15 Jun 2010 12:59:31 +0000
parents 499cfbbb61bc
children f953c9a559d8
comparison
equal deleted inserted replaced
1095:c961cd9a13f7 1096:41630b457b6a
4 import java.util.Collection; 4 import java.util.Collection;
5 import java.util.Date; 5 import java.util.Date;
6 import java.util.GregorianCalendar; 6 import java.util.GregorianCalendar;
7 import java.util.Iterator; 7 import java.util.Iterator;
8 import java.util.List; 8 import java.util.List;
9 import java.util.Locale;
9 10
10 import org.apache.log4j.Logger; 11 import org.apache.log4j.Logger;
11 import org.w3c.dom.Document; 12 import org.w3c.dom.Document;
12 import org.w3c.dom.Element; 13 import org.w3c.dom.Element;
13 import org.w3c.dom.Node; 14 import org.w3c.dom.Node;
37 /** 38 /**
38 * the logger, used to log exceptions and additonaly information 39 * the logger, used to log exceptions and additonaly information
39 */ 40 */
40 private static Logger log = Logger.getLogger(MinMaxState.class); 41 private static Logger log = Logger.getLogger(MinMaxState.class);
41 42
42 /** 43 /**
44 * Key to lookup the localized exceptionmessage in the ResourceFiles.
45 */
46 public static final String EXCEPTION_INVALID_MIN_MAX_INPUT =
47 "input.is.not.valid.minmax";
48
49 /**
43 * Constructor 50 * Constructor
44 */ 51 */
45 public MinMaxState() { 52 public MinMaxState() {
46 super(); 53 super();
47 } 54 }
121 if (name.equals(MAXVALUEFIELDNAME)) { 128 if (name.equals(MAXVALUEFIELDNAME)) {
122 max = value; 129 max = value;
123 } 130 }
124 131
125 if (min != null && max != null) { 132 if (min != null && max != null) {
126 if (!InputValidator.isInputValid((String) min, (String) max, type)) { 133 if (!InputValidator.isInputValid((String) min,
127 String msg = "Input is not valid for this state."; 134 (String) max,
135 type)) {
136 Locale[] serverLocales = resFactory.getLocales();
137 Locale locale = context.getMeta()
138 .getPreferredLocale(
139 serverLocales);
140 String msg = resFactory.getRessource(locale,
141 EXCEPTION_INVALID_MIN_MAX_INPUT,
142 EXCEPTION_INVALID_MIN_MAX_INPUT);
128 log.error(msg); 143 log.error(msg);
129 return feedFailure(msg); 144 return feedFailure(msg);
130 } 145 }
131 } 146 }
132 } 147 }

http://dive4elements.wald.intevation.org