Commons Lang
  1. Commons Lang
  2. LANG-578

Problem while using simple quotes in ExtendedMessageFormat when a registry is specified

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.4
    • Fix Version/s: 2.5
    • Component/s: lang.text.*
    • Labels:
      None

      Description

      This runs successfully :

      ExtendedMessageFormat templateFormat = new ExtendedMessageFormat("''{0}''");
      System.out.println(templateFormat.format(new String[] { "MESSAGE" })); 
      

      The result is 'MESSAGE'.

      This raises an error :

      Map<String, FormatFactory> formatFactory = new HashMap<String, FormatFactory>();
              formatFactory.put("formatDate", new FormatFactory() {
      
                  @SuppressWarnings("all")
                  public Format getFormat(String name, String arguments, Locale locale) {
      
                      return new SimpleDateFormat();
                  }
              });
      ExtendedMessageFormat templateFormat = new ExtendedMessageFormat("''{0}''", , formatFactory);
      System.out.println(templateFormat.format(new String[] { "MESSAGE" })); 
      

      The result is an exception (java heap space).

      way : In appendQuotedString method the code above doesn't seem to increment the index pos before returning

        Activity

        Hide
        Niall Pemberton added a comment -

        This looks liked a duplicate of LANG-477 to me which was fixed in r733169:

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

        Show
        Niall Pemberton added a comment - This looks liked a duplicate of LANG-477 to me which was fixed in r733169: http://svn.apache.org/viewvc?view=revision&revision=733169
        Hide
        Olivier TERRIEN added a comment -

        I downloaded the new version of ExtendedMessageFormat class. It runs.
        I'll use it by shadowing the ExtendedMessageFormat 2.4 by waiting the release 3.0.
        Thanks.

        Show
        Olivier TERRIEN added a comment - I downloaded the new version of ExtendedMessageFormat class. It runs. I'll use it by shadowing the ExtendedMessageFormat 2.4 by waiting the release 3.0. Thanks.

          People

          • Assignee:
            Unassigned
            Reporter:
            Olivier TERRIEN
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development