Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7158257

HTML entity for apostrophe character not replaced in JLabel

    XMLWordPrintable

Details

    Description

      FULL PRODUCT VERSION :
      java version "1.7.0_03"
      Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [version 6.1.7601] 64 bit


      A DESCRIPTION OF THE PROBLEM :
      When creating a JLabel with text equals to "<html>&apos;</html>", the text displayed by this JLabel is set to "&apos;", and not to the apostrophe character.

      This bug seems to concern only the apostrophe character. All the other HTML entities we have tested are correctly escaped.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a JLabel as new JLabel("<html>&apos;</html>")
      2. Look at the text displayed

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The text displayed should be an apostrophe.
      ACTUAL -
      The text "&apos;" is shown.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class Test {
      public static void main(String[] args) {
      JFrame frame = new JFrame();
      JPanel panel = new JPanel();
      panel.add(new JLabel("<html>&quot;</html>")); // OK
      panel.add(new JLabel("<html>&apos;</html>")); // NOT OK !
      panel.add(new JLabel("<html>&amp;</html>")); // OK
      panel.add(new JLabel("<html>&lt;</html>")); // OK
      panel.add(new JLabel("<html>&gt;</html>")); // OK
      frame.add(panel);
      frame.setVisible(true);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Replace all "&apos;" sequences from HTML code by apostrophe characters before passing it to JLabel.

      Attachments

        Activity

          People

            rupashka Pavel Porvatov (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: