[Schmitzm-commits] r1521 - in trunk: schmitzm-core/src/main/java/de/schmitzm/lang schmitzm-core/src/main/java/de/schmitzm/swing/event schmitzm-gt/src/main/java/de/schmitzm/geotools/styling

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Mar 19 13:15:43 CET 2011


Author: alfonx
Date: 2011-03-19 13:15:41 +0100 (Sat, 19 Mar 2011)
New Revision: 1521

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/event/PipedMouseListener.java
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-03-18 18:50:21 UTC (rev 1520)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-03-19 12:15:41 UTC (rev 1521)
@@ -50,6 +50,7 @@
 
 import net.jini.loader.pref.PreferredClassLoader;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Appender;
 import org.apache.log4j.Category;
 import org.apache.log4j.ConsoleAppender;
@@ -1612,6 +1613,8 @@
 	 */
 	public static Number parseNumberAs(final String valueString,
 			final Class<?> numClass) {
+		
+		if (StringUtils.trimToNull(valueString) == null) return null;
 
 		// everything can be parsed as a Double
 		final Double doubleValue = Double.parseDouble(valueString);

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/event/PipedMouseListener.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/event/PipedMouseListener.java	2011-03-18 18:50:21 UTC (rev 1520)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/event/PipedMouseListener.java	2011-03-19 12:15:41 UTC (rev 1521)
@@ -31,7 +31,6 @@
 
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
 
 /**
  * This class simple pipes the actions of an existing {@link MouseListener}, but allows

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java	2011-03-18 18:50:21 UTC (rev 1520)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StylingUtil.java	2011-03-19 12:15:41 UTC (rev 1521)
@@ -2569,13 +2569,18 @@
 	 *      -use-in-rgb2pct-td4493744.html
 	 */
 	static public ColorMap parseColormapToSld(URL url) throws IOException {
+
+		String readFileAsString = IOUtil.readURLasString(url);
+		return parseColormapToSld(readFileAsString);
+	}
+
+	static public ColorMap parseColormapToSld(String someTxt) {
 		String[] labels = new String[0];
 		double[] quantities = new double[0];
 		Color[] colors = new Color[0];
+		
+		for (String line : someTxt.split("\\n")) {
 
-		String readFileAsString = IOUtil.readURLasString(url);
-		for (String line : readFileAsString.split("\\n")) {
-
 			try {
 
 				Matcher matcher = GDALINFO_COLORMAP_RGBA.matcher(line);



More information about the Schmitzm-commits mailing list