You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2006/03/07 14:15:39 UTC

[jira] Resolved: (HARMONY-178) java.text.DateFormat$Field's contructor may replace predefined consts with new value in cache

     [ http://issues.apache.org/jira/browse/HARMONY-178?page=all ]
     
Tim Ellison resolved HARMONY-178:
---------------------------------

    Resolution: Fixed

Paulex,

Thanks for the patches.  I added a copyright statement to the test and updated the test suite.

Applied to TEXT module java.text.DateFormat at repo revision 383878.

Please check that the patch was applied as you expected.


> java.text.DateFormat$Field's contructor may replace predefined consts with new value in cache
> ---------------------------------------------------------------------------------------------
>
>          Key: HARMONY-178
>          URL: http://issues.apache.org/jira/browse/HARMONY-178
>      Project: Harmony
>         Type: Bug
>     Reporter: Paulex Yang
>     Assignee: Tim Ellison
>  Attachments: java.text.DateFormat.patch, java.text.DateFormatFieldTest.patch
>
> DataFormat$Field will cache some constants to be searched by method ofCalendarField(int), but the predefined consts should not be replaced.
> the testcases is as below:
> import java.text.DateFormat;
> import java.util.Calendar;
> import junit.framework.TestCase;
> public class DataFormatFieldTest extends TestCase{
> 	public void test_Constructor2() {
> 		MyField field = new MyField("day of month", Calendar.ERA);
> 		DateFormat.Field realField = DateFormat.Field
> 				.ofCalendarField(Calendar.ERA);
> 		assertSame("Modified calendar field with the same field number",
> 				DateFormat.Field.ERA, realField);
> 	}
> 	static class MyField extends DateFormat.Field {
> 		protected MyField(String fieldName, int calendarField) {
> 			super(fieldName, calendarField);
> 		}
> 		protected String getName() {
> 			return super.getName();
> 		}
> 	}
> }
> Run on RI 5.0, test case passes.
> Run on Harmony, test case fail with message:
> junit.framework.AssertionFailedError: Modified calendar field with the same field number expected same:<java.text.DateFormat$Field(era)> was not:<DataFormatFieldTest$MyField(day of month)>
> 	............

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Resolved: (HARMONY-178) java.text.DateFormat$Field's contructor may replace predefined consts with new value in cache

Posted by Paulex Yang <pa...@gmail.com>.
It is fine, thank you, Tim.

Tim Ellison (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/HARMONY-178?page=all ]
>      
> Tim Ellison resolved HARMONY-178:
> ---------------------------------
>
>     Resolution: Fixed
>
> Paulex,
>
> Thanks for the patches.  I added a copyright statement to the test and updated the test suite.
>
> Applied to TEXT module java.text.DateFormat at repo revision 383878.
>
> Please check that the patch was applied as you expected.
>
>
>   
>> java.text.DateFormat$Field's contructor may replace predefined consts with new value in cache
>> ---------------------------------------------------------------------------------------------
>>
>>          Key: HARMONY-178
>>          URL: http://issues.apache.org/jira/browse/HARMONY-178
>>      Project: Harmony
>>         Type: Bug
>>     Reporter: Paulex Yang
>>     Assignee: Tim Ellison
>>  Attachments: java.text.DateFormat.patch, java.text.DateFormatFieldTest.patch
>>
>> DataFormat$Field will cache some constants to be searched by method ofCalendarField(int), but the predefined consts should not be replaced.
>> the testcases is as below:
>> import java.text.DateFormat;
>> import java.util.Calendar;
>> import junit.framework.TestCase;
>> public class DataFormatFieldTest extends TestCase{
>> 	public void test_Constructor2() {
>> 		MyField field = new MyField("day of month", Calendar.ERA);
>> 		DateFormat.Field realField = DateFormat.Field
>> 				.ofCalendarField(Calendar.ERA);
>> 		assertSame("Modified calendar field with the same field number",
>> 				DateFormat.Field.ERA, realField);
>> 	}
>> 	static class MyField extends DateFormat.Field {
>> 		protected MyField(String fieldName, int calendarField) {
>> 			super(fieldName, calendarField);
>> 		}
>> 		protected String getName() {
>> 			return super.getName();
>> 		}
>> 	}
>> }
>> Run on RI 5.0, test case passes.
>> Run on Harmony, test case fail with message:
>> junit.framework.AssertionFailedError: Modified calendar field with the same field number expected same:<java.text.DateFormat$Field(era)> was not:<DataFormatFieldTest$MyField(day of month)>
>> 	............
>>     
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM