You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Spiegl (JIRA)" <de...@myfaces.apache.org> on 2007/12/18 14:26:43 UTC

[jira] Created: (TRINIDAD-873) JavaScriptError in Core.js _formatErrorString

JavaScriptError in Core.js _formatErrorString
---------------------------------------------

                 Key: TRINIDAD-873
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-873
             Project: MyFaces Trinidad
          Issue Type: Bug
    Affects Versions: 1.0.5-core
            Reporter: Thomas Spiegl
            Assignee: Matthias Weßendorf


currValue in defined in function _formatErrorString line 2807 may be a function (eg. removeDuplicates)
currValue.replace will then cause a JavaScript error

adding a typeof fixes the problem

    // if the token has no value or !typeof string, replace it with the empty string
    if (!currValue || !(typeof currValue == "string"))
    {
      currValue = "";
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TRINIDAD-873) JavaScriptError in Core.js _formatErrorString

Posted by "Thomas Spiegl (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Spiegl updated TRINIDAD-873:
-----------------------------------

    Status: Patch Available  (was: Open)

> JavaScriptError in Core.js _formatErrorString
> ---------------------------------------------
>
>                 Key: TRINIDAD-873
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-873
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 1.0.5-core
>            Reporter: Thomas Spiegl
>            Assignee: Matthias Weßendorf
>
> currValue in defined in function _formatErrorString line 2807 may be a function (eg. removeDuplicates)
> currValue.replace will then cause a JavaScript error
> adding a typeof fixes the problem
>     // if the token has no value or !typeof string, replace it with the empty string
>     if (!currValue || !(typeof currValue == "string"))
>     {
>       currValue = "";
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (TRINIDAD-873) JavaScriptError in Core.js _formatErrorString

Posted by Thomas Spiegl <th...@gmail.com>.
no objections here.

Regards,
Thomas

On Tue, Apr 8, 2008 at 10:44 PM, Gabrielle Crawford
<ga...@oracle.com> wrote:
> Hi people,
>
>  I will be committing this patch tomorrow unless there are objections.
>
>  Thanks,
>
>  Gabrielle
>
>
>
>  Yee-wah Lee wrote:
>
> > Hi all,
> >
> > I would like to modify the code slightly from this patch. Basically, move
> the check for typeof down, so that it only affects the code which does
> String.replace(). For details, see TRINIDAD-1036.
> >
> > I didn't see a test scenario for TRINIDAD-873, so if anyone familiar with
> the above can i) email me their test case or ii) verify the proposed
> changes, please let me know.
> >
> > Thanks,
> > Yee-Wah
> > ====================================
> > Original:
> > function _formatErrorString()
> > {
> > ..
> >  for (var currToken in tokens)
> >  {
> >   var currValue = tokens[currToken];
> >
> >   // if the token has no value, replace it with the empty string
> >   if (!currValue)
> >   {
> >     currValue = "";
> >   }
> >
> >   // TRINIDAD-829:
> >   // we replace '{' and '}' to ensure, that tokens containing values
> >   // like {3} aren't parsed more than once...
> >   currValue = currValue.replace("{","{'");
> >   currValue = currValue.replace("}","'}");
> > }
> > -------------------------------------------------
> > With TRINIDAD-873 patch:
> > function _formatErrorString( )
> > {
> >  ..
> >  for (var currToken in tokens)
> >  {
> >   var currValue = tokens[currToken];
> >
> > +    // if the token has no value
> > +    // or !typeof string, replace it with the empty string (see
> TRINIDAD-873)
> > +    if (!currValue || !(typeof currValue == "string"))
> >   {
> >     currValue = "";
> >   }
> >
> >   // TRINIDAD-829:
> >   // we replace '{' and '}' to ensure, that tokens containing values
> >   // like {3} aren't parsed more than once...
> >   currValue = currValue.replace("{","{'");
> >   currValue = currValue.replace("}","'}");
> > }
> > -------------------------------------------------
> > With TRINIDAD-1036 patch:
> > function _formatErrorString( )
> > {
> >  ..
> >  for (var currToken in tokens)
> >  {
> >   var currValue = tokens[currToken];
> >
> >   // if the token has no value
> > +    if (!currValue)
> >   {
> >      currValue = "";
> >   }
> >
> >   // TRINIDAD-829:
> >   // we replace '{' and '}' to ensure, that tokens containing values
> >   // like {3} aren't parsed more than once...
> > +    // Only do this if it is typeof string (see TRINIDAD-873)
> > +    if (typeof currValue == "string")
> > +    {
> >       currValue = currValue.replace("{","{'");
> >       currValue = currValue.replace("}","'}");
> > +    }
> >
> >
> >
> > Matthias Weßendorf (JIRA) wrote:
> >
> > >     [
> https://issues.apache.org/jira/browse/TRINIDAD-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
> > >
> > > Matthias Weßendorf updated TRINIDAD-873:
> > > ----------------------------------------
> > >
> > >       Resolution: Fixed
> > >    Fix Version/s: 1.2.5-core
> > >                   1.0.5-core
> > >           Status: Resolved  (was: Patch Available)
> > >
> > > applied the patch to both trunks;
> > >
> > >
> > >
> > > > JavaScriptError in Core.js _formatErrorString
> > > > ---------------------------------------------
> > > >
> > > >                Key: TRINIDAD-873
> > > >                URL: https://issues.apache.org/jira/browse/TRINIDAD-873
> > > >            Project: MyFaces Trinidad
> > > >         Issue Type: Bug
> > > >   Affects Versions: 1.0.5-core
> > > >           Reporter: Thomas Spiegl
> > > >           Assignee: Matthias Weßendorf
> > > >            Fix For: 1.0.5-core, 1.2.5-core
> > > >
> > > >        Attachments: Core.js.patch
> > > >
> > > >
> > > > currValue in defined in function _formatErrorString line 2807 may be a
> function (eg. removeDuplicates)
> > > > currValue.replace will then cause a JavaScript error
> > > > adding a typeof fixes the problem
> > > >    // if the token has no value or !typeof string, replace it with the
> empty string
> > > >    if (!currValue || !(typeof currValue == "string"))
> > > >    {
> > > >      currValue = "";
> > > >    }
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>



-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [jira] Updated: (TRINIDAD-873) JavaScriptError in Core.js _formatErrorString

Posted by Gabrielle Crawford <ga...@oracle.com>.
Hi people,

I will be committing this patch tomorrow unless there are objections.

Thanks,

Gabrielle

Yee-wah Lee wrote:
> Hi all,
>
> I would like to modify the code slightly from this patch. Basically, 
> move the check for typeof down, so that it only affects the code which 
> does String.replace(). For details, see TRINIDAD-1036.
>
> I didn't see a test scenario for TRINIDAD-873, so if anyone familiar 
> with the above can i) email me their test case or ii) verify the 
> proposed changes, please let me know.
>
> Thanks,
> Yee-Wah
> ====================================
> Original:
> function _formatErrorString()
> {
> ..
>  for (var currToken in tokens)
>  {
>    var currValue = tokens[currToken];
>
>    // if the token has no value, replace it with the empty string
>    if (!currValue)
>    {
>      currValue = "";
>    }
>
>    // TRINIDAD-829:
>    // we replace '{' and '}' to ensure, that tokens containing values
>    // like {3} aren't parsed more than once...
>    currValue = currValue.replace("{","{'");
>    currValue = currValue.replace("}","'}");
> }
> -------------------------------------------------
> With TRINIDAD-873 patch:
> function _formatErrorString( )
> {
>   ..
>  for (var currToken in tokens)
>  {
>    var currValue = tokens[currToken];
>
> +    // if the token has no value
> +    // or !typeof string, replace it with the empty string (see 
> TRINIDAD-873)
> +    if (!currValue || !(typeof currValue == "string"))
>    {
>      currValue = "";
>    }
>
>    // TRINIDAD-829:
>    // we replace '{' and '}' to ensure, that tokens containing values
>    // like {3} aren't parsed more than once...
>    currValue = currValue.replace("{","{'");
>    currValue = currValue.replace("}","'}");
> }
> -------------------------------------------------
> With TRINIDAD-1036 patch:
> function _formatErrorString( )
> {
>   ..
>  for (var currToken in tokens)
>  {
>    var currValue = tokens[currToken];
>
>    // if the token has no value
> +    if (!currValue)
>    {
>       currValue = "";
>    }
>
>    // TRINIDAD-829:
>    // we replace '{' and '}' to ensure, that tokens containing values
>    // like {3} aren't parsed more than once...
> +    // Only do this if it is typeof string (see TRINIDAD-873)
> +    if (typeof currValue == "string")
> +    {
>        currValue = currValue.replace("{","{'");
>        currValue = currValue.replace("}","'}");
> +    }
>
>
>
> Matthias Weßendorf (JIRA) wrote:
>>      [ 
>> https://issues.apache.org/jira/browse/TRINIDAD-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 
>> ]
>>
>> Matthias Weßendorf updated TRINIDAD-873:
>> ----------------------------------------
>>
>>        Resolution: Fixed
>>     Fix Version/s: 1.2.5-core
>>                    1.0.5-core
>>            Status: Resolved  (was: Patch Available)
>>
>> applied the patch to both trunks;
>>
>>  
>>> JavaScriptError in Core.js _formatErrorString
>>> ---------------------------------------------
>>>
>>>                 Key: TRINIDAD-873
>>>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-873
>>>             Project: MyFaces Trinidad
>>>          Issue Type: Bug
>>>    Affects Versions: 1.0.5-core
>>>            Reporter: Thomas Spiegl
>>>            Assignee: Matthias Weßendorf
>>>             Fix For: 1.0.5-core, 1.2.5-core
>>>
>>>         Attachments: Core.js.patch
>>>
>>>
>>> currValue in defined in function _formatErrorString line 2807 may be 
>>> a function (eg. removeDuplicates)
>>> currValue.replace will then cause a JavaScript error
>>> adding a typeof fixes the problem
>>>     // if the token has no value or !typeof string, replace it with 
>>> the empty string
>>>     if (!currValue || !(typeof currValue == "string"))
>>>     {
>>>       currValue = "";
>>>     }
>>>     
>>
>>   
>

Re: [jira] Updated: (TRINIDAD-873) JavaScriptError in Core.js _formatErrorString

Posted by Yee-wah Lee <ye...@oracle.com>.
Hi all,

I would like to modify the code slightly from this patch. Basically, 
move the check for typeof down, so that it only affects the code which 
does String.replace(). For details, see TRINIDAD-1036.

I didn't see a test scenario for TRINIDAD-873, so if anyone familiar 
with the above can i) email me their test case or ii) verify the 
proposed changes, please let me know.

Thanks,
Yee-Wah
====================================
Original:
function _formatErrorString()
{
..
  for (var currToken in tokens)
  {
    var currValue = tokens[currToken];

    // if the token has no value, replace it with the empty string
    if (!currValue)
    {
      currValue = "";
    }

    // TRINIDAD-829:
    // we replace '{' and '}' to ensure, that tokens containing values
    // like {3} aren't parsed more than once...
    currValue = currValue.replace("{","{'");
    currValue = currValue.replace("}","'}");
}
-------------------------------------------------
With TRINIDAD-873 patch:
function _formatErrorString( )
{
   ..
  for (var currToken in tokens)
  {
    var currValue = tokens[currToken];

+    // if the token has no value
+    // or !typeof string, replace it with the empty string (see 
TRINIDAD-873)
+    if (!currValue || !(typeof currValue == "string"))
    {
      currValue = "";
    }

    // TRINIDAD-829:
    // we replace '{' and '}' to ensure, that tokens containing values
    // like {3} aren't parsed more than once...
    currValue = currValue.replace("{","{'");
    currValue = currValue.replace("}","'}");
}
-------------------------------------------------
With TRINIDAD-1036 patch:
function _formatErrorString( )
{
   ..
  for (var currToken in tokens)
  {
    var currValue = tokens[currToken];

    // if the token has no value
+    if (!currValue)
    {
       currValue = "";
    }

    // TRINIDAD-829:
    // we replace '{' and '}' to ensure, that tokens containing values
    // like {3} aren't parsed more than once...
+    // Only do this if it is typeof string (see TRINIDAD-873)
+    if (typeof currValue == "string")
+    {
        currValue = currValue.replace("{","{'");
        currValue = currValue.replace("}","'}");
+    }



Matthias Weßendorf (JIRA) wrote:
>      [ https://issues.apache.org/jira/browse/TRINIDAD-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Matthias Weßendorf updated TRINIDAD-873:
> ----------------------------------------
>
>        Resolution: Fixed
>     Fix Version/s: 1.2.5-core
>                    1.0.5-core
>            Status: Resolved  (was: Patch Available)
>
> applied the patch to both trunks;
>
>   
>> JavaScriptError in Core.js _formatErrorString
>> ---------------------------------------------
>>
>>                 Key: TRINIDAD-873
>>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-873
>>             Project: MyFaces Trinidad
>>          Issue Type: Bug
>>    Affects Versions: 1.0.5-core
>>            Reporter: Thomas Spiegl
>>            Assignee: Matthias Weßendorf
>>             Fix For: 1.0.5-core, 1.2.5-core
>>
>>         Attachments: Core.js.patch
>>
>>
>> currValue in defined in function _formatErrorString line 2807 may be a function (eg. removeDuplicates)
>> currValue.replace will then cause a JavaScript error
>> adding a typeof fixes the problem
>>     // if the token has no value or !typeof string, replace it with the empty string
>>     if (!currValue || !(typeof currValue == "string"))
>>     {
>>       currValue = "";
>>     }
>>     
>
>   


[jira] Updated: (TRINIDAD-873) JavaScriptError in Core.js _formatErrorString

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias Weßendorf updated TRINIDAD-873:
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.5-core
                   1.0.5-core
           Status: Resolved  (was: Patch Available)

applied the patch to both trunks;

> JavaScriptError in Core.js _formatErrorString
> ---------------------------------------------
>
>                 Key: TRINIDAD-873
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-873
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 1.0.5-core
>            Reporter: Thomas Spiegl
>            Assignee: Matthias Weßendorf
>             Fix For: 1.0.5-core, 1.2.5-core
>
>         Attachments: Core.js.patch
>
>
> currValue in defined in function _formatErrorString line 2807 may be a function (eg. removeDuplicates)
> currValue.replace will then cause a JavaScript error
> adding a typeof fixes the problem
>     // if the token has no value or !typeof string, replace it with the empty string
>     if (!currValue || !(typeof currValue == "string"))
>     {
>       currValue = "";
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.