You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2011/09/16 19:07:21 UTC

svn commit: r1171672 - in /db/derby/code/trunk/java: engine/org/apache/derby/diag/StatementDuration.java testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java

Author: kahatlen
Date: Fri Sep 16 17:07:21 2011
New Revision: 1171672

URL: http://svn.apache.org/viewvc?rev=1171672&view=rev
Log:
DERBY-5414: SysDiagVTIMappingTest.test_5391() failed: java.text.ParseException: Unparseable date: "Thu Sep 15 14:00:16 CEST 2011"

Always parse values returned by Date.toString() in US locale.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/diag/StatementDuration.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/diag/StatementDuration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/diag/StatementDuration.java?rev=1171672&r1=1171671&r2=1171672&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/diag/StatementDuration.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/diag/StatementDuration.java Fri Sep 16 17:07:21 2011
@@ -36,6 +36,7 @@ import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
+import java.util.Locale;
 import org.apache.derby.vti.VTITemplate;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
@@ -253,9 +254,12 @@ public class StatementDuration extends V
         else
         {
             //
-            // From 10.7 onward, the logged timestamp was formatted by Date.toString().
+            // From 10.7 onward, the logged timestamp was formatted by
+            // Date.toString(), which is always formatted using the pattern
+            // specified below, and always in US locale.
             //
-            SimpleDateFormat    sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy" );
+            SimpleDateFormat sdf =
+                new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
 
             try {
                 return new Timestamp( sdf.parse( trimmed ).getTime() );

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java?rev=1171672&r1=1171671&r2=1171672&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java Fri Sep 16 17:07:21 2011
@@ -36,6 +36,7 @@ import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
+import java.util.Locale;
 import java.util.Properties;
 
 public final class SysDiagVTIMappingTest extends BaseJDBCTestCase {
@@ -740,7 +741,8 @@ public final class SysDiagVTIMappingTest
 
         String  timestampString = rs.getString( 1 ).trim();
 
-        SimpleDateFormat    sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy" );
+        SimpleDateFormat sdf =
+            new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
         Timestamp   timestamp = new Timestamp( sdf.parse( timestampString ).getTime() );
 
         println( timestamp.toString() );