comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java @ 6182:95257f28bb3f

Accept null mode in to/fromValue
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 04 Jun 2013 16:02:17 +0200
parents 65f278bd4ef5
children f49749526af4
comparison
equal deleted inserted replaced
6181:65f278bd4ef5 6182:95257f28bb3f
232 public Object fromValue(List args) throws XPathFunctionException { 232 public Object fromValue(List args) throws XPathFunctionException {
233 Object mode = args.get(0); 233 Object mode = args.get(0);
234 Object locations = args.get(1); 234 Object locations = args.get(1);
235 Object from = args.get(2); 235 Object from = args.get(2);
236 236
237 if (!(mode instanceof String)){ 237 if (mode instanceof String && mode.equals("locations")) {
238 return -FAR_AWAY;
239 }
240
241 if (mode.equals("locations")) {
242 if (!(locations instanceof String)) { 238 if (!(locations instanceof String)) {
243 return -FAR_AWAY; 239 return -FAR_AWAY;
244 } 240 }
245 String loc = ((String)locations).replace(" ", ""); 241 String loc = ((String)locations).replace(" ", "");
246 String[] split = loc.split(","); 242 String[] split = loc.split(",");
281 public Object toValue(List args) throws XPathFunctionException { 277 public Object toValue(List args) throws XPathFunctionException {
282 Object mode = args.get(0); 278 Object mode = args.get(0);
283 Object locations = args.get(1); 279 Object locations = args.get(1);
284 Object to = args.get(2); 280 Object to = args.get(2);
285 281
286 if (!(mode instanceof String)){ 282 if (mode instanceof String && mode.equals("locations")) {
287 return FAR_AWAY;
288 }
289
290 if (mode.equals("locations")) {
291 if (!(locations instanceof String)) { 283 if (!(locations instanceof String)) {
292 return FAR_AWAY; 284 return FAR_AWAY;
293 } 285 }
294 try { 286 try {
295 String loc = ((String)locations).replace(" ", ""); 287 String loc = ((String)locations).replace(" ", "");

http://dive4elements.wald.intevation.org