Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6724188
Votes 0
Synopsis JEditorPane does not render HTML BODY if a META tag is included in HEAD
Category java:classes_swing
Reported Against
Release Fixed
State 1-Dispatched, bug
Priority: 4-Low
Related Bugs 4695909
Submit Date 09-JUL-2008
Description
FULL PRODUCT VERSION :
1.6.0_05

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2

A DESCRIPTION OF THE PROBLEM :
When the META tag "meta http-equiv" is included in the HEAD of some HTML, the BODY fails to get rendered. If it's removed, the BODY does get rendered.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Here's the failing HTML:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content=" customer  Exchange Server">

<style>EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; }</style></head>
<body>
<font size="2"><div class="PlainText">Your message was read on Monday, July 07, 2008 7:38:24 AM (GMT-08:00) Pacific Time (US &amp; Canada).</div></font>
</body>
</html>
Your message was read on Monday, July 07, 2008 7:38:24 AM (GMT-08:00) Pacific Time (US & Canada).

The following modified HTML works fine:

<html><head>
<meta name="Generator" content=" customer  Exchange Server">

<style>EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; }</style></head>
<body>
<font size="2"><div class="PlainText">Your message was read on Monday, July 07, 2008 7:38:24 AM (GMT-08:00) Pacific Time (US &amp; Canada).</div></font>
</body>
</html>
Your message was read on Monday, July 07, 2008 7:38:24 AM (GMT-08:00) Pacific Time (US & Canada).

Write the first HTML to a file "test_file.txt" and run the following Java application from the same directory:
---------------------------------------------------cut here-----------------------------------
import javax.swing.*;
import java.io.*;

public class chiaratest
  {
  JFrame		frame;

  JPanel		panel;

  JEditorPane	pane;

  RandomAccessFile file;

  String		text;

  byte[]		buf;

  public chiaratest(String input_parm)
    {
    frame= new JFrame();
    pane = new JEditorPane();
    pane.setContentType("text/html");

    try
      {
      file = new RandomAccessFile("test_file.txt", "r");
	buf = new byte[(int) file.length()];
	file.readFully(buf);
      text = new String(buf);
	}
    catch (Exception e)
      {
      System.out.println("e = " + e);
      System.exit(0);
      }
    pane.setText(text);
    panel = new JPanel();
    panel.add(pane);
    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
    }

  public static void main(String args[])
    {
    new chiaratest(null);
    }
  }
---------------------------------------------------cut here-----------------------------------

If you remove the first META tag and its data, the text will display.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The test application should display the following:

Your message was read on Monday, July 07, 2008 7:38:24 AM (GMT-08:00) Pacific Time (US & Canada).
ACTUAL -
Nothing was displayed

REPRODUCIBILITY :
This bug can be reproduced always.

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

public class chiaratest
  {
  JFrame		frame;

  JPanel		panel;

  JEditorPane	pane;

  RandomAccessFile file;

  String		text;

  byte[]		buf;

  public chiaratest(String input_parm)
    {
    frame= new JFrame();
    pane = new JEditorPane();
    pane.setContentType("text/html");

    try
      {
      file = new RandomAccessFile("test_file.txt", "r");
	buf = new byte[(int) file.length()];
	file.readFully(buf);
      text = new String(buf);
	}
    catch (Exception e)
      {
      System.out.println("e = " + e);
      System.exit(0);
      }
    pane.setText(text);
    panel = new JPanel();
    panel.add(pane);
    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
    }

  public static void main(String args[])
    {
    new chiaratest(null);
    }
  }

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
This problem was described in bug report #4695909 and was supposedly fixed in JDK 1.5; however, I still see the bug in JDK 1.6.0_05
Posted Date : 2008-07-09 19:02:27.0
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang