Bug 15504 - JSP positiveGetValues test relies on order preserved in Hashtable
Summary: JSP positiveGetValues test relies on order preserved in Hashtable
Status: NEW
Alias: None
Product: Watchdog
Classification: Unclassified
Component: Client (show other bugs)
Version: 4 (Servlet 2.3 / JSP 1.2)
Hardware: All other
: P3 normal (vote)
Target Milestone: ---
Assignee: Ryan Lubke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-18 20:52 UTC by Scott Johnson
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Johnson 2002-12-18 20:52:21 UTC
The JSP positiveGetValues test relies on an enumeration returning values in a 
specific order.  The values are compared to strings in the Golden File to 
determine whether the test passes or fails.  The relevant section of the test 
jsp is:


 javax.servlet.jsp.tagext.TagSupport ts = new 
javax.servlet.jsp.tagext.TagSupport();

    ts.setValue("Color1","red");
    ts.setValue("Color2","green");
%>
<!-- Returns only keys names -->
<%

    java.util.Enumeration e = ts.getValues();
    while (e.hasMoreElements()) {
        String v = (String)e.nextElement();
        out.println(v);
    }
%>                      


The problem here is that the javax.servlet.jsp.tagext.TagSupport class uses a 
Hashtable to hold the keys and values (set via the setValues() method).  
Hashtable is not guaranteed to preserve ordering.  Therefore, when the 
enumeration is used to retreive the values and print out the keys, the order in 
which they will be returned is unpredictable.  Comparing the keys to the 
strings in the goldenfile, which are in a fixed order, is not a valid test.
We have found that this test fails on HP, but passes on other platforms.