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: 5077317
Votes 10
Synopsis Produces faulty Constant Values page if constants contain angle bracket '<'
Category doclet:tbd
Reported Against 1.4.2
Release Fixed mustang(b61)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6183723
Submit Date 22-JUL-2004
Description


FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Server VM (build 1.4.2-b28, mixed mode)

java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Using javadoc with standard doclet.

A DESCRIPTION OF THE PROBLEM :
Using javadoc on sources which include constant values produce faulty "Constant Values Page" html code under specific conditions. It seems that String constants values including "<" or ">" are copied into the html page let browser interpret them partly as html tag.
For example will the constant declaration:
public static final String DEMO_STRING = "<Hello World>"
be shown in the Constant Value Page as DEMO_STRING= ""
Furthermore will the constant declaration:
public static final String DEMO_STRING = "<table>Hello World"
disturb the allignment of the page in the browser.
As it seems to me, there could be many more strange effects be generated with constants including "<" or ">".


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just declare an string constant in a class  including "<" like DEMO ="y<abs(x)" and let javadoc tool produce with the standard doclet the html pages. View  the resulting  "Constant Field Values" page , the constant value for DEMO looks like "y
The rest of the constant value is cut off.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The constant value "y<abs(x)" should be displayed in the browser.
ACTUAL -
The result in the browser is "y

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/*
 * DemoClass.java
 */
package de.prowaznik;
public class DemoClass {
   /** Test constant. */
   public static final String DEMO= "y<abs(x)";
   /** Connection URL for the JDBC Driver. */
   public static final String THIS_IS_OK= "y < abs(x)";

   public DemoClass() {
   }
}

---------- END SOURCE ----------
(Incident Review ID: 286161) 
======================================================================
Posted Date : 2005-09-14 03:58:30.0
Work Around
N/A
Evaluation
Data bug.  Raising to P3. This would cause data on the Constant Values page to
be missing, and could foul up (truncate) the rest of the page.
  xxxxx@xxxxx   2004-07-22
This bug is actually not reproducible.  It is already fixed in tiger.  However, I don't see a related regression test to prove that we properly escape characters in the constant value page.  I will check in a test.
Posted Date : 2005-09-14 03:58:30.0

Adding mustang-test keyword since we are only adding a regression test to verify this bug is already fixed.
Posted Date : 2005-10-10 01:23:14.0
Comments
  
  Include a link with my name & email   

Submitted On 18-SEP-2004
M.Le_maudit
1- If you write the following code:
 public static final String DEMO_STRING = "<Hello World>"

2- You'll read the following html documentation in the constant value page:

 public static final java.lang.String DEMO_STRING "" 

3- The generated HTML piece of code is:
 <TD ALIGN="right"><CODE>"<Hello World>"</CODE></TD>

4- To be correctly interpreted by the web browser, the generated piece of code should be:
 <TD ALIGN="right"><CODE>"&lt;Hello World&gt;"</CODE></TD>



PLEASE NOTE: JDK6 is formerly known as Project Mustang