01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2001, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.coverage.io;
18:
19: // Resources
20: import org.geotools.resources.i18n.Errors;
21: import org.geotools.resources.i18n.ErrorKeys;
22:
23: /**
24: * Thrown when one or more metadata have ambiguous values. This exception is typically
25: * thrown when a metadata is defined twice with different values. It may also be thrown
26: * if a metadata can be computed from other metadata, but their values are inconsistent.
27: *
28: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/coverageio/src/main/java/org/geotools/coverage/io/AmbiguousMetadataException.java $
29: * @version $Id: AmbiguousMetadataException.java 25699 2007-05-31 15:55:07Z desruisseaux $
30: * @author Martin Desruisseaux
31: *
32: * @since 2.2
33: */
34: public class AmbiguousMetadataException extends MetadataException {
35: /**
36: * Serial number for interoperability with different versions.
37: */
38: private static final long serialVersionUID = 9024148330467307209L;
39:
40: /**
41: * Constructs an exception with the specified message. This exception is
42: * usually raised because different values was found for the key {@code key}.
43: *
44: * @param message The message. If {@code null}, a message will be constructed from the alias.
45: * @param key The metadata key which was the cause for this exception, or {@code null} if
46: * none. This is a format neutral key, for example {@link MetadataBuilder#DATUM}.
47: * @param alias The alias used for for the key {@code key}, or {@code null} if none. This is
48: * usually the name used in the external file parsed.
49: */
50: public AmbiguousMetadataException(final String message,
51: final MetadataBuilder.Key key, final String alias) {
52: super((message != null) ? message : Errors.format(
53: ErrorKeys.INCONSISTENT_PROPERTY_$1, alias), key, alias);
54: }
55: }
|