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 a metadata is required but can't be found. This error typically occurs
25: * when a raster is being read but the file doesn't contains enough information for
26: * constructing the raster's coordinate system.
27: *
28: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/coverageio/src/main/java/org/geotools/coverage/io/MissingMetadataException.java $
29: * @version $Id: MissingMetadataException.java 25699 2007-05-31 15:55:07Z desruisseaux $
30: * @author Martin Desruisseaux
31: *
32: * @since 2.2
33: */
34: public class MissingMetadataException extends MetadataException {
35: /**
36: * Serial number for interoperability with different versions.
37: */
38: private static final long serialVersionUID = -5215286265847774754L;
39:
40: /**
41: * Constructs an exception with the specified message. This exception is
42: * usually raised because no value was defined 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 MissingMetadataException(final String message,
51: final MetadataBuilder.Key key, final String alias) {
52: super((message != null) ? message : Errors.format(
53: (alias != null) ? ErrorKeys.UNDEFINED_PROPERTY_$1
54: : ErrorKeys.UNDEFINED_PROPERTY, alias), key,
55: alias);
56: }
57: }
|