- 
    Bug 
- 
    Resolution: Fixed
- 
     P3 P3
- 
    1.1.4
- 
        1.1.6
- 
        sparc
- 
        solaris_2.5
- 
        Verified
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-2018385 | 1.2.0 | John Oconner | P3 | Resolved | Fixed | 1.2beta3 | 
Name: dfC67450 Date: 12/17/97
The java.text.SimpleDateFormat.SimpleDateFormat(String pattern,
DateFormatSymbols symbols) constructor should clone second parameter
using setDateFormatSymbols() method not just store the reference.
(see source code for SimpleDateFormat.setDateFormatSymbols() method:
public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
{
this.formatData = (DateFormatSymbols)newFormatSymbols.clone();
}
)
Here is the test demonstrating the bug:
-----------------TestDF.java------------------------
import java.text.*;
import java.util.Date;
public class TestDF {
public static void main (String args[]){
DateFormatSymbols symbols = new DateFormatSymbols();
SimpleDateFormat df = new SimpleDateFormat("E hh:mm", symbols);
System.out.println(df.toLocalizedPattern());
symbols.setLocalPatternChars("abcdefghijklmonpqr"); // change value of field
System.out.println(df.toLocalizedPattern());
}
}
---------Output from the test---------------------
E hh:mm
j pp:gg
--------------------------------------------------
======================================================================
- backported by
- 
                    JDK-2018385 java.text.SimpleDateFormat ctor doesn't clone DateFormatSymbols parameter -           
- Resolved
 
-