You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2010/04/03 01:09:23 UTC
svn commit: r930425 -
/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js
Author: gcrawford
Date: Fri Apr 2 23:09:23 2010
New Revision: 930425
URL: http://svn.apache.org/viewvc?rev=930425&view=rev
Log:
TRINIDAD-1657 Client date time converter does not properly handle quote escaping
Modified:
myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js?rev=930425&r1=930424&r2=930425&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js Fri Apr 2 23:09:23 2010
@@ -79,6 +79,7 @@ function _doClumping(
var kindCount = 0;
var lastChar = void 0;
var startIndex = 0;
+ var quoteIndex = null;
for (var i = 0; i < formatLength; i++)
{
@@ -88,11 +89,17 @@ function _doClumping(
{
if (currChar == "\'")
{
+ // test strings to test escaping working properly
+ // "'one '' two '' three''' 'four '' five'" -> "one ' two ' three' four ' five
+ // "HH:mm:ss 'o''clock' z" -> "[time] o'clock [timezone]"
+ // "HH:mm:ss 'oclock' z" -> "[time] oclock [timezone]"
+ // "HH:mm:ss '' z" -> "[time] ' [timezone]"
+
inQuote = false;
// handle to single quotes in a row as escaping the quote
// by not skipping it when outputting
- if (kindCount != 1)
+ if (kindCount != 1 && startIndex != quoteIndex)
{
startIndex++;
kindCount--;
@@ -111,9 +118,21 @@ function _doClumping(
// alert("failure at " + startIndex + " with " + lastChar);
return false;
}
+
+ var nextIndex = i + 1;
+
+ if (nextIndex < formatLength)
+ {
+ var nextChar = formatPattern.charAt(nextIndex);
+
+ if (nextChar == "\'")
+ {
+ quoteIndex = nextIndex;
+ }
+ }
kindCount = 0;
- lastChar = void 0;
+ lastChar = void 0;
}
else
{