diff --git a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java index 57b32d55..49fc33a4 100644 --- a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java @@ -64,6 +64,7 @@ import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.ResultHeader; import de.schildbach.pte.dto.StationDepartures; import de.schildbach.pte.dto.Stop; +import de.schildbach.pte.exception.InvalidDataException; import de.schildbach.pte.exception.ParserException; import de.schildbach.pte.exception.ProtocolException; import de.schildbach.pte.exception.SessionExpiredException; @@ -1552,11 +1553,11 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider if (year == 0) return false; if (year < 1900 || year > 2100) - throw new IllegalArgumentException("invalid year: " + year); + throw new InvalidDataException("invalid year: " + year); if (month < 0 || month > 11) - throw new IllegalArgumentException("invalid month: " + month); + throw new InvalidDataException("invalid month: " + month); if (day < 1 || day > 31) - throw new IllegalArgumentException("invalid day: " + day); + throw new InvalidDataException("invalid day: " + day); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); diff --git a/enabler/src/de/schildbach/pte/exception/InvalidDataException.java b/enabler/src/de/schildbach/pte/exception/InvalidDataException.java new file mode 100644 index 00000000..32142cc4 --- /dev/null +++ b/enabler/src/de/schildbach/pte/exception/InvalidDataException.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012 the original author or authors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package de.schildbach.pte.exception; + +/** + * @author Andreas Schildbach + */ +public class InvalidDataException extends ParserException +{ + public InvalidDataException() + { + super(); + } + + public InvalidDataException(final String message) + { + super(message); + } + + public InvalidDataException(final String message, final Throwable cause) + { + super(message); + super.initCause(cause); + } + + public InvalidDataException(final Throwable cause) + { + super(cause == null ? null : cause.toString()); + super.initCause(cause); + } +}