ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1626730 - in /webservices/wss4j/branches/1_6_x-fixes/src: main/java/org/apache/ws/security/message/token/Timestamp.java main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java test/java/org/apache/ws/security/message/TimestampTest.java
Date Mon, 22 Sep 2014 11:06:46 GMT
Author: coheigea
Date: Mon Sep 22 11:06:45 2014
New Revision: 1626730

URL: http://svn.apache.org/r1626730
Log:
[WSS-513] - Fails to parse Timestamp headers in Thai locale

Modified:
    webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/token/Timestamp.java
    webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
    webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/TimestampTest.java

Modified: webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/token/Timestamp.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/token/Timestamp.java?rev=1626730&r1=1626729&r2=1626730&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/token/Timestamp.java
(original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/message/token/Timestamp.java
Mon Sep 22 11:06:45 2014
@@ -38,6 +38,7 @@ import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 import java.util.TimeZone;
 
 /**
@@ -203,7 +204,7 @@ public class Timestamp {
         if (milliseconds) {
             zulu = new XmlSchemaDateFormat();
         } else {
-            zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+            zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH);
             zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
         }
         Element elementCreated =

Modified: webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java?rev=1626730&r1=1626729&r2=1626730&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
(original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
Mon Sep 22 11:06:45 2014
@@ -25,6 +25,7 @@ import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
 import java.text.ParseException;
 import java.util.Date;
+import java.util.Locale;
 import java.util.TimeZone;
 
 /**
@@ -51,7 +52,7 @@ public class XmlSchemaDateFormat extends
      * DateFormat for Zulu (UTC) form of an XML Schema dateTime string.
      */
     private static final DateFormat DATEFORMAT_XSD_ZULU = new SimpleDateFormat(
-            "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+            "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH);
 
     static {
         DATEFORMAT_XSD_ZULU.setTimeZone(TimeZone.getTimeZone("UTC"));

Modified: webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/TimestampTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/TimestampTest.java?rev=1626730&r1=1626729&r2=1626730&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/TimestampTest.java
(original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/TimestampTest.java
Mon Sep 22 11:06:45 2014
@@ -38,6 +38,7 @@ import org.w3c.dom.Element;
 import java.text.DateFormat;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * WS-Security Test Case for Timestamps.
@@ -770,6 +771,33 @@ public class TimestampTest extends org.j
         }
     }
     
+    @org.junit.Test
+    public void testThaiLocaleVerification() throws Exception {
+        
+        Locale defaultLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("th", "TH"));
+        
+            Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+            WSSecHeader secHeader = new WSSecHeader();
+            secHeader.insertSecurityHeader(doc);
+            
+            WSSecTimestamp timestamp = new WSSecTimestamp();
+            timestamp.setTimeToLive(300);
+            Document createdDoc = timestamp.build(doc, secHeader);
+            
+            //
+            // Do some processing
+            //
+            List<WSSecurityEngineResult> wsResult = verify(createdDoc, WSSConfig.getNewInstance());
+            WSSecurityEngineResult actionResult = 
+                WSSecurityUtil.fetchActionResult(wsResult, WSConstants.TS);
+            assertTrue(actionResult != null);
+        } finally {
+            Locale.setDefault(defaultLocale);
+        }
+    }
+    
     /**
      * Verifies the soap envelope
      * 



Mime
View raw message