Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-578

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.4
    • 2.5
    • lang.text.*
    • 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            oterrien Olivier TERRIEN
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: