Project

General

Profile

« Previous | Next » 

Revision 13964dc6

Added by Andreas Müller almost 16 years ago

TimePeriod bugfix

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java
298 298
		initStart();
299 299
		if (value == null){
300 300
			start = start.without(type);
301
			return this;
302
		}
303
		int max = 9999999;
304
		if (type.equals(DateTimeFieldType.monthOfYear())){
305
			max = 31;
306
		}
307
		if (type.equals(DateTimeFieldType.dayOfMonth())){
308
			max = 12;
309
		}
310
		if (value < 1 || value > max ){
311
			throw new IndexOutOfBoundsException("Value must be between 1 and " +  max);
301
		}else{
302
			int max = 9999999;
303
			if (type.equals(DateTimeFieldType.monthOfYear())){
304
				max = 31;
305
			}
306
			if (type.equals(DateTimeFieldType.dayOfMonth())){
307
				max = 12;
308
			}
309
			if (value < 1 || value > max ){
310
				throw new IndexOutOfBoundsException("Value must be between 1 and " +  max);
311
			}
312
			start = this.start.with(type, value);
312 313
		}
313
		start = this.start.with(type, value);
314 314
		return this;
315 315
	}
316 316

  
......
318 318
		initEnd();
319 319
		if (value == null){
320 320
			end = end.without(type);
321
		}else{
322
			int max = 9999999;
323
			if (type.equals(DateTimeFieldType.monthOfYear())){
324
				max = 31;
325
			}
326
			if (type.equals(DateTimeFieldType.dayOfMonth())){
327
				max = 12;
328
			}
329
			if ( (value < 1 || value > max) ){
330
				throw new IndexOutOfBoundsException("Value must be between 1 and " +  max);
331
			}
332
			end = this.end.with(type, value);
321 333
		}
322
		int max = 9999999;
323
		if (type.equals(DateTimeFieldType.monthOfYear())){
324
			max = 31;
325
		}
326
		if (type.equals(DateTimeFieldType.dayOfMonth())){
327
			max = 12;
328
		}
329
		if (value < 1 || value > max ){
330
			throw new IndexOutOfBoundsException("Value must be between 1 and " +  max);
331
		}
332
		end = this.end.with(type, value);
333 334
		return this;
334 335
	}
335 336
	

Also available in: Unified diff