commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@t-online.de>
Subject Re: svn commit: r354018 - /jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
Date Mon, 05 Dec 2005 20:57:26 GMT
Is it possible that this change broke a unit test? I get now the
following failures in TestDataConfiguration:

Testsuite: org.apache.commons.configuration.TestDataConfiguration
Tests run: 34, Failures: 3, Errors: 0, Time elapsed: 1,832 sec

Testcase:
testGetColor(org.apache.commons.configuration.TestDataConfiguration):   
FAILED
color expected:<java.awt.Color[r=255,g=0,b=0]> but
was:<java.awt.Color[r=255,g=240,b=0]>
junit.framework.AssertionFailedError: color
expected:<java.awt.Color[r=255,g=0,b=0]> but
was:<java.awt.Color[r=255,g=240,b=0]>
    at
org.apache.commons.configuration.TestDataConfiguration.testGetColor(TestDataConfiguration.java:1169)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


Testcase:
testGetColorArray(org.apache.commons.configuration.TestDataConfiguration):   
FAILED
[position 0] expected:<java.awt.Color[r=255,g=0,b=0]> but
was:<java.awt.Color[r=255,g=240,b=0]>
junit.framework.AssertionFailedError: [position 0]
expected:<java.awt.Color[r=255,g=0,b=0]> but
was:<java.awt.Color[r=255,g=240,b=0]>
    at junitx.framework.ArrayAssert.assertEquals(ArrayAssert.java:103)
    at junitx.framework.ArrayAssert.assertEquals(ArrayAssert.java:113)
    at
org.apache.commons.configuration.TestDataConfiguration.testGetColorArray(TestDataConfiguration.java:1197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


Testcase:
testGetColorList(org.apache.commons.configuration.TestDataConfiguration):   
FAILED
expecting <java.awt.Color[r=255,g=0,b=0]> in
<java.awt.Color[r=255,g=240,b=0], java.awt.Color[r=0,g=0,b=0]>
junit.framework.AssertionFailedError: expecting
<java.awt.Color[r=255,g=0,b=0]> in <java.awt.Color[r=255,g=240,b=0],
java.awt.Color[r=0,g=0,b=0]>
    at junitx.framework.ListAssert.failNotContains(ListAssert.java:133)
    at junitx.framework.ListAssert.assertContains(ListAssert.java:118)
    at junitx.framework.ListAssert.assertEquals(ListAssert.java:91)
    at junitx.framework.ListAssert.assertEquals(ListAssert.java:78)
    at
org.apache.commons.configuration.TestDataConfiguration.testGetColorList(TestDataConfiguration.java:1232)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Can you please check again?
Thanks
Oliver

ebourg@apache.org wrote:

>Author: ebourg
>Date: Mon Dec  5 00:23:00 2005
>New Revision: 354018
>
>URL: http://svn.apache.org/viewcvs?rev=354018&view=rev
>Log:
>Reduced the usage of 'magic numbers' for checkstyle
>
>Modified:
>    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
>
>Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
>URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java?rev=354018&r1=354017&r2=354018&view=diff
>==============================================================================
>--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
(original)
>+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
Mon Dec  5 00:23:00 2005
>@@ -538,18 +538,20 @@
>                     color = color.substring(1);
>                 }
> 
>-                int red = Integer.parseInt(color.substring(0, 2), 16);
>-                int green = Integer.parseInt(color.substring(2, 4), 16);
>-                int blue = Integer.parseInt(color.substring(4, 6), 16);
>+                int[] components = new int[3];
>+                for (int i = 0; i < components.length; i++) {
>+                    components[i] = Integer.parseInt(color.substring(i, i + 2), HEX_RADIX);
>+                }
>+
>                 int alpha = 255;
> 
>                 // parse the transparency
>                 if (color.length() >= 8)
>                 {
>-                    alpha = Integer.parseInt(color.substring(6, 8), 16);
>+                    alpha = Integer.parseInt(color.substring(6, 8), HEX_RADIX);
>                 }
> 
>-                return new Color(red, green, blue, alpha);
>+                return new Color(components[0], components[1], components[2], alpha);
>             }
>             catch (Exception e)
>             {
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message