[Schmitzm-commits] r169 - trunk/src/skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jun 30 10:03:29 CEST 2009


Author: alfonx
Date: 2009-06-30 10:03:29 +0200 (Tue, 30 Jun 2009)
New Revision: 169

Modified:
   trunk/src/skrueger/geotools/StyledFS.java
Log:
* Better handling of Exceptions while reading an SLD

Modified: trunk/src/skrueger/geotools/StyledFS.java
===================================================================
--- trunk/src/skrueger/geotools/StyledFS.java	2009-06-28 17:57:38 UTC (rev 168)
+++ trunk/src/skrueger/geotools/StyledFS.java	2009-06-30 08:03:29 UTC (rev 169)
@@ -15,6 +15,7 @@
 import org.apache.log4j.Logger;
 import org.geotools.data.FeatureSource;
 import org.geotools.feature.AttributeType;
+import org.geotools.gui.swing.ExceptionMonitor;
 import org.geotools.styling.Style;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
@@ -76,9 +77,10 @@
 			} catch (FileNotFoundException e) {
 				LOGGER
 						.debug("The SLD file passed was empty. Leaving the Style untouched. (We are in the constructor.. so its null");
+			} catch (Exception e) {
+				LOGGER.warn("Reading SLD failed: " + sldFile, e);
 			}
 		}
-
 		title = new Translation();
 		title.fromOneLine(sldFile.getName());
 
@@ -164,9 +166,7 @@
 	 * nicht in der Legende auftauchen sollen. Meines Wissens hat keiner bisher
 	 * die Funktion genutzt.
 	 * 
-//	public boolean isHideInLegend() {
-//		return false;
-//	}
+	 * // public boolean isHideInLegend() { // return false; // }
 	 */
 
 	public void setDesc(Translation dec) {
@@ -197,14 +197,15 @@
 	 */
 	public Map<Integer, AttributeMetaData> getAttributeMetaDataMap() {
 		if (map == null) {
-			
+
 			map = new HashMap<Integer, AttributeMetaData>();
-			
+
 			// Leaving out the first one, it will be the_geom
 			for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) {
 				AttributeType att = fs.getSchema().getAttributeType(i);
-				
-				AttributeMetaData attMetaData = new AttributeMetaData(i, att.getLocalName());
+
+				AttributeMetaData attMetaData = new AttributeMetaData(i, att
+						.getLocalName());
 				map.put(i, attMetaData);
 			}
 		}
@@ -213,10 +214,11 @@
 
 	/**
 	 * @return The {@link File} where the SLD was loaded from or
-	 *         <code>null</code> if there didn't exist a {@link File}. (It
-	 *         could be a WFS or a PostGIS
+	 *         <code>null</code> if there didn't exist a {@link File}. (It could
+	 *         be a WFS or a PostGIS
 	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
 	 */
 	public File getSldFile() {
 		return sldFile;



More information about the Schmitzm-commits mailing list