db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject 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
Date Fri, 16 Sep 2011 17:07:21 GMT
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() );



Mime
View raw message