[Schmitzm-commits] r979 - in trunk: src/schmitzm/jfree src_junit/schmitzm/jfree
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 17 14:46:05 CEST 2010
Author: alfonx
Date: 2010-08-17 14:46:04 +0200 (Tue, 17 Aug 2010)
New Revision: 979
Added:
trunk/src_junit/schmitzm/jfree/JFreeChartUtilTest.java
Modified:
trunk/src/schmitzm/jfree/JFreeChartUtil.java
Log:
allow createDefaultStroke Float[] to handle null and added tests
Modified: trunk/src/schmitzm/jfree/JFreeChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/JFreeChartUtil.java 2010-08-12 16:07:09 UTC (rev 978)
+++ trunk/src/schmitzm/jfree/JFreeChartUtil.java 2010-08-17 12:46:04 UTC (rev 979)
@@ -975,9 +975,12 @@
* @return
*/
public static Stroke createDefaultStroke(float lineWidth, Float[] dashAttr) {
- float[] floats = new float[dashAttr.length];
- for (int i=0; i<floats.length; i++)
- floats[i] = dashAttr[i];
+ float[] floats = null;
+ if (dashAttr != null) {
+ floats = new float[dashAttr.length];
+ for (int i=0; i<floats.length; i++)
+ floats[i] = dashAttr[i];
+ }
return createDefaultStroke(lineWidth, floats);
}
Added: trunk/src_junit/schmitzm/jfree/JFreeChartUtilTest.java
===================================================================
--- trunk/src_junit/schmitzm/jfree/JFreeChartUtilTest.java 2010-08-12 16:07:09 UTC (rev 978)
+++ trunk/src_junit/schmitzm/jfree/JFreeChartUtilTest.java 2010-08-17 12:46:04 UTC (rev 979)
@@ -0,0 +1,20 @@
+package schmitzm.jfree;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class JFreeChartUtilTest {
+
+
+ @Test
+ public void testCreateDefaultStrokeFloatFloatArray() {
+ JFreeChartUtil.createDefaultStroke(2f, (float[])null);
+ }
+
+ @Test
+ public void testCreateDefaultStrokeFloatFloatArray2() {
+ JFreeChartUtil.createDefaultStroke(2f, (Float[])null);
+ }
+
+}
Property changes on: trunk/src_junit/schmitzm/jfree/JFreeChartUtilTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id URL
Name: svn:eol-style
+ native
More information about the Schmitzm-commits
mailing list