You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Duncan Eley (JIRA)" <ji...@apache.org> on 2009/01/09 11:07:00 UTC

[jira] Created: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
-----------------------------------------------------------------------------------------------------

                 Key: LANG-477
                 URL: https://issues.apache.org/jira/browse/LANG-477
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.4
            Reporter: Duncan Eley


When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.

Example that will cause error:

private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
    static {
        formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
    }
    
    public static void main(String[] args) {
        ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
        String formattedPattern = mf.format(new String[] {"great"});
        System.out.println(formattedPattern);
    }
}

The following change starting at line 421 on the 2.4 release seems to fix the problem:

CURRENT (Broken):
if (escapingOn && c[start] == QUOTE) {
        return appendTo == null ? null : appendTo.append(QUOTE);
}

WORKING:
if (escapingOn && c[start] == QUOTE) {
        next(pos);
        return appendTo == null ? null : appendTo.append(QUOTE);
}

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


[jira] Updated: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Duncan Eley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Eley updated LANG-477:
-----------------------------

    Attachment: DummyFormat.java

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }

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


[jira] Updated: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Duncan Eley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Eley updated LANG-477:
-----------------------------

    Attachment: DummyFormatFactory.java

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }

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


[jira] Commented: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Roshan Ail (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761797#action_12761797 ] 

Roshan Ail commented on LANG-477:
---------------------------------

Any chance of this being put into an interim release.
We ran into this in production. I spent a lot of time debugging it before finding out where it went into the loop.
This is a serious bug. It would be helpful to everybody if this was released as version 2.5 or something and pushed to the central maven repo.
I can then update our poms to pull this in.

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>            Assignee: Niall Pemberton
>             Fix For: 3.0
>
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> {code:title=ExtendedMessageFormatTest.java|borderStyle=solid}
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> {code}
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> {code:title=ExtendedMessageFormat.java|borderStyle=solid}
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> {code}

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


[jira] Updated: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Duncan Eley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Eley updated LANG-477:
-----------------------------

    Description: 
When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.

Example that will cause error:

{code:title=ExtendedMessageFormatTest.java|borderStyle=solid}

private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
    static {
        formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
    }
    
    public static void main(String[] args) {
        ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
        String formattedPattern = mf.format(new String[] {"great"});
        System.out.println(formattedPattern);
    }
}

{code}

The following change starting at line 421 on the 2.4 release seems to fix the problem:

{code:title=ExtendedMessageFormat.java|borderStyle=solid}
CURRENT (Broken):
if (escapingOn && c[start] == QUOTE) {
        return appendTo == null ? null : appendTo.append(QUOTE);
}

WORKING:
if (escapingOn && c[start] == QUOTE) {
        next(pos);
        return appendTo == null ? null : appendTo.append(QUOTE);
}
{code}

  was:
When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.

Example that will cause error:

private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
    static {
        formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
    }
    
    public static void main(String[] args) {
        ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
        String formattedPattern = mf.format(new String[] {"great"});
        System.out.println(formattedPattern);
    }
}

The following change starting at line 421 on the 2.4 release seems to fix the problem:

CURRENT (Broken):
if (escapingOn && c[start] == QUOTE) {
        return appendTo == null ? null : appendTo.append(QUOTE);
}

WORKING:
if (escapingOn && c[start] == QUOTE) {
        next(pos);
        return appendTo == null ? null : appendTo.append(QUOTE);
}


> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> {code:title=ExtendedMessageFormatTest.java|borderStyle=solid}
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> {code}
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> {code:title=ExtendedMessageFormat.java|borderStyle=solid}
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> {code}

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


[jira] Updated: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Duncan Eley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Eley updated LANG-477:
-----------------------------

    Attachment: ExtendedMessageFormatTest.java

Test case

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>         Attachments: ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }

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


[jira] Updated: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Duncan Eley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Eley updated LANG-477:
-----------------------------

    Comment: was deleted

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> {code:title=ExtendedMessageFormatTest.java|borderStyle=solid}
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> {code}
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> {code:title=ExtendedMessageFormat.java|borderStyle=solid}
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> {code}

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


[jira] Updated: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-477:
---------------------------------

    Fix Version/s:     (was: 3.0)
                   2.5

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.text.*
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>            Assignee: Niall Pemberton
>             Fix For: 2.5
>
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> {code:title=ExtendedMessageFormatTest.java|borderStyle=solid}
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> {code}
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> {code:title=ExtendedMessageFormat.java|borderStyle=solid}
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> {code}

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


[jira] Resolved: (LANG-477) ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved LANG-477.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0
         Assignee: Niall Pemberton

Thanks for reporting this and working out the problem - fixed:

http://svn.apache.org/viewvc?view=rev&revision=733169

> ExtendedMessageFormat: OutOfMemory with custom format registry and a pattern containing single quotes
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-477
>                 URL: https://issues.apache.org/jira/browse/LANG-477
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Duncan Eley
>            Assignee: Niall Pemberton
>             Fix For: 3.0
>
>         Attachments: DummyFormat.java, DummyFormatFactory.java, ExtendedMessageFormatTest.java
>
>
> When using ExtendedMessageFormat with a custom format registry and a pattern conatining single quotes, an OutOfMemoryError will occur.
> Example that will cause error:
> {code:title=ExtendedMessageFormatTest.java|borderStyle=solid}
> private static Map<String, Object> formatRegistry = new HashMap<String, Object>();    
>     static {
>         formatRegistry.put(DummyFormatFactory.DUMMY_FORMAT, new DummyFormatFactory());
>     }
>     
>     public static void main(String[] args) {
>         ExtendedMessageFormat mf = new ExtendedMessageFormat("it''s a {dummy} 'test'!", formatRegistry);
>         String formattedPattern = mf.format(new String[] {"great"});
>         System.out.println(formattedPattern);
>     }
> }
> {code}
> The following change starting at line 421 on the 2.4 release seems to fix the problem:
> {code:title=ExtendedMessageFormat.java|borderStyle=solid}
> CURRENT (Broken):
> if (escapingOn && c[start] == QUOTE) {
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> WORKING:
> if (escapingOn && c[start] == QUOTE) {
>         next(pos);
>         return appendTo == null ? null : appendTo.append(QUOTE);
> }
> {code}

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