harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r627486 - in /harmony/enhanced/classlib/trunk/modules/sql/src: main/java/java/sql/Timestamp.java test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
Date Wed, 13 Feb 2008 15:45:09 GMT
Author: tellison
Date: Wed Feb 13 07:45:06 2008
New Revision: 627486

URL: http://svn.apache.org/viewvc?rev=627486&view=rev
Log:
Apply patch HARMONY-5506 ([classlib][sql] java.sql.Timestamp.valueOf will throw IllegalArgumentException
when string parameter contains writeblank in the end)

Modified:
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java?rev=627486&r1=627485&r2=627486&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java Wed
Feb 13 07:45:06 2008
@@ -383,6 +383,9 @@
             throw new IllegalArgumentException(Messages.getString("sql.3")); //$NON-NLS-1$
         }
 
+        // omit trailing whitespaces
+        s = s.trim();
+
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
         ParsePosition pp = new ParsePosition(0);
 

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java?rev=627486&r1=627485&r2=627486&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
Wed Feb 13 07:45:06 2008
@@ -339,6 +339,11 @@
             }
         }
 
+        // Regression test for HARMONY-5506
+        String date = "1970-01-01 22:17:59.0                 ";
+        Timestamp t = Timestamp.valueOf(date);
+        assertEquals(80279000,t.getTime());
+
     } // end method testValueOfString
 
     /*



Mime
View raw message