harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov" <alexei.zakha...@gmail.com>
Subject Re: [classlib]bug-to-bug compatibility j.u.Formatter
Date Tue, 25 Jul 2006 12:04:40 GMT
Hi Richard,

I've tried your test - it fails indeed. Strange, such an obvious
violation of the spec by RI...
+1 for filing JIRA and preserving our behavior.

Regards,

2006/7/25, Richard Liang <richard.liangyx@gmail.com>:
> Hello All,
>
> As we have further discussion about our Compatibility issues, I'd like
> to summarize this particular problems and ask for comments. Thanks a lot.
>
> If we pass a null to j.u.Formatter.Formatter(Appendable a), when we try
> to get the destination of the formatter's output by calling
> formatter.out(), RI will thrown a java.util.FormatterClosedException.
> But according to the specification,  the destination should be a
> StringBuilder.
>
> Shall we follow RI or specification?
>
> (My opinion is: Following spec, and record a "Non-bug differences from
> RI" in JIRA)
>
> The following test passes on Harmony, but fails on RI.
>    public void test_ConstructorLjava_lang_Appendable() {
>        Formatter formatter = new Formatter((Appendable) null);
>        Appendable out = formatter.out();
>        assertTrue(out instanceof StringBuilder);
>    }
>
>
> Richard Liang wrote:
> > Hello All,
> >
> > Here we think it's a bug of RI. I have addressed this issue in the
> > comments of these test cases. You may want to refer to the spec of
> > java.util.Formatter.  Do you think I shall raise a "Non-bug
> > differences from RI" in JIRA? Thanks a lot.
> >
> > <quote>
> > public Formatter(Appendable a)
> >    Constructs a new formatter with the specified destination.
> >    The locale used is the default locale for this instance of the Java
> > virtual machine.
> >    Parameters:
> >        *a - Destination for the formatted output. If a is null then a
> > StringBuilder will be created.*
> > </quote>
> >
> > Tim Ellison wrote:
> >> Richard is probably best placed to answer that question (so I've changed
> >> the subject to attract his attention ;-) )
> >>
> >> Regards,
> >> Tim
> >>
> >> Nathan Beyer wrote:
> >>
> >>> Here are the particular failures that I'm seeing. Some seem like minor
> >>> things like exception discrepancies, but others like this unexpected
> >>> exception "java.util.IllegalFormatFlagsException: Flags = '+'" seem
> >>> like
> >>> flaws.
> >>>
> >>> BTW: if you search for "test_", it will land on the failed test
> >>> methods.
> >>>
> >>> TESTROOT
> >>> tests.api.java.util.FormatterTest
> >>> test_ConstructorLjava_lang_Appendable(tests.api.java.util.FormatterTest)
> >>>
> >>> java.util.FormatterClosedException
> >>>     at java.util.Formatter.ensureOpen(Formatter.java:2315)
> >>>     at java.util.Formatter.out(Formatter.java:2226)
> >>>     at
> >>> tests.api.java.util.FormatterTest.test_ConstructorLjava_lang_Appendable(Form
> >>>
> >>> atterTest.java:183)
> >>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>     at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> >>>
> >>> )
> >>>     at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> >>>
> >>> .java:25)
> >>>     at java.lang.reflect.Method.invoke(Method.java:585)
> >>>     at junit.framework.TestCase.runTest(TestCase.java:154)
> >>>     at junit.framework.TestCase.runBare(TestCase.java:127)
> >>>     at junit.framework.TestResult$1.protect(TestResult.java:106)
> >>>     at junit.framework.TestResult.runProtected(TestResult.java:124)
> >>>     at junit.framework.TestResult.run(TestResult.java:109)
> >>>     at junit.framework.TestCase.run(TestCase.java:118)
> >>>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>>     at junit.framework.TestSuite.run(TestSuite.java:203)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3T
> >>>
> >>> estReference.java:128)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> >>>
> >>> 8)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:460)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:673)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> >>>
> >>> java:386)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> >>>
> >>> .java:196)
> >>>
> >>> test_ConstructorLjava_io_FileLjava_lang_String(tests.api.java.util.Formatter
> >>>
> >>> Test)
> >>> junit.framework.AssertionFailedError
> >>>     at junit.framework.Assert.fail(Assert.java:47)
> >>>     at junit.framework.Assert.assertTrue(Assert.java:20)
> >>>     at junit.framework.Assert.assertTrue(Assert.java:27)
> >>>     at
> >>> tests.api.java.util.FormatterTest.test_ConstructorLjava_io_FileLjava_lang_St
> >>>
> >>> ring(FormatterTest.java:465)
> >>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>     at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> >>>
> >>> )
> >>>     at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> >>>
> >>> .java:25)
> >>>     at java.lang.reflect.Method.invoke(Method.java:585)
> >>>     at junit.framework.TestCase.runTest(TestCase.java:154)
> >>>     at junit.framework.TestCase.runBare(TestCase.java:127)
> >>>     at junit.framework.TestResult$1.protect(TestResult.java:106)
> >>>     at junit.framework.TestResult.runProtected(TestResult.java:124)
> >>>     at junit.framework.TestResult.run(TestResult.java:109)
> >>>     at junit.framework.TestCase.run(TestCase.java:118)
> >>>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>>     at junit.framework.TestSuite.run(TestSuite.java:203)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3T
> >>>
> >>> estReference.java:128)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> >>>
> >>> 8)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:460)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:673)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> >>>
> >>> java:386)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> >>>
> >>> .java:196)
> >>>
> >>> test_formatLjava_lang_String$Ljava_lang_Object_Percent(tests.api.java.util.F
> >>>
> >>> ormatterTest)
> >>> java.util.IllegalFormatFlagsException: Flags = '+'
> >>>     at
> >>> java.util.Formatter$FormatSpecifier.checkText(Formatter.java:2939)
> >>>     at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2644)
> >>>     at java.util.Formatter.parse(Formatter.java:2477)
> >>>     at java.util.Formatter.format(Formatter.java:2411)
> >>>     at java.util.Formatter.format(Formatter.java:2364)
> >>>     at
> >>> tests.api.java.util.FormatterTest.test_formatLjava_lang_String$Ljava_lang_Ob
> >>>
> >>> ject_Percent(FormatterTest.java:1069)
> >>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>     at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> >>>
> >>> )
> >>>     at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> >>>
> >>> .java:25)
> >>>     at java.lang.reflect.Method.invoke(Method.java:585)
> >>>     at junit.framework.TestCase.runTest(TestCase.java:154)
> >>>     at junit.framework.TestCase.runBare(TestCase.java:127)
> >>>     at junit.framework.TestResult$1.protect(TestResult.java:106)
> >>>     at junit.framework.TestResult.runProtected(TestResult.java:124)
> >>>     at junit.framework.TestResult.run(TestResult.java:109)
> >>>     at junit.framework.TestCase.run(TestCase.java:118)
> >>>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>>     at junit.framework.TestSuite.run(TestSuite.java:203)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3T
> >>>
> >>> estReference.java:128)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> >>>
> >>> 8)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:460)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:673)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> >>>
> >>> java:386)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> >>>
> >>> .java:196)
> >>>
> >>> test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversion(tests.api.j
> >>>
> >>> ava.util.FormatterTest)
> >>> junit.framework.AssertionFailedError: should throw
> >>> FormatFlagsConversionMismatchException
> >>>     at junit.framework.Assert.fail(Assert.java:47)
> >>>     at
> >>> tests.api.java.util.FormatterTest.test_formatLjava_lang_String$Ljava_lang_Ob
> >>>
> >>> ject_GeneralConversion(FormatterTest.java:1264)
> >>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>     at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> >>>
> >>> )
> >>>     at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> >>>
> >>> .java:25)
> >>>     at java.lang.reflect.Method.invoke(Method.java:585)
> >>>     at junit.framework.TestCase.runTest(TestCase.java:154)
> >>>     at junit.framework.TestCase.runBare(TestCase.java:127)
> >>>     at junit.framework.TestResult$1.protect(TestResult.java:106)
> >>>     at junit.framework.TestResult.runProtected(TestResult.java:124)
> >>>     at junit.framework.TestResult.run(TestResult.java:109)
> >>>     at junit.framework.TestCase.run(TestCase.java:118)
> >>>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>>     at junit.framework.TestSuite.run(TestSuite.java:203)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3T
> >>>
> >>> estReference.java:128)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> >>>
> >>> 8)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:460)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:673)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> >>>
> >>> java:386)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> >>>
> >>> .java:196)
> >>>
> >>> test_formatLjava_lang_String$Ljava_lang_Object_CharacterConversion(tests.api
> >>>
> >>> .java.util.FormatterTest)
> >>> java.util.UnknownFormatConversionException: Conversion = 'C'
> >>>     at
> >>> java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2603)
> >>>     at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2631)
> >>>     at java.util.Formatter.parse(Formatter.java:2477)
> >>>     at java.util.Formatter.format(Formatter.java:2411)
> >>>     at java.util.Formatter.format(Formatter.java:2364)
> >>>     at
> >>> tests.api.java.util.FormatterTest.test_formatLjava_lang_String$Ljava_lang_Ob
> >>>
> >>> ject_CharacterConversion(FormatterTest.java:1335)
> >>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>     at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> >>>
> >>> )
> >>>     at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> >>>
> >>> .java:25)
> >>>     at java.lang.reflect.Method.invoke(Method.java:585)
> >>>     at junit.framework.TestCase.runTest(TestCase.java:154)
> >>>     at junit.framework.TestCase.runBare(TestCase.java:127)
> >>>     at junit.framework.TestResult$1.protect(TestResult.java:106)
> >>>     at junit.framework.TestResult.runProtected(TestResult.java:124)
> >>>     at junit.framework.TestResult.run(TestResult.java:109)
> >>>     at junit.framework.TestCase.run(TestCase.java:118)
> >>>     at junit.framework.TestSuite.runTest(TestSuite.java:208)
> >>>     at junit.framework.TestSuite.run(TestSuite.java:203)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3T
> >>>
> >>> estReference.java:128)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> >>>
> >>> 8)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:460)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> >>>
> >>> nner.java:673)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> >>>
> >>> java:386)
> >>>     at
> >>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> >>>
> >>> .java:196)
> >>>
> >>>
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Geir Magnusson Jr [mailto:geir@pobox.com]
> >>>>
> >>>> Nathan Beyer wrote:
> >>>>
> >>>>> Sure, no problem.
> >>>>>
> >>>>> While talking about this issue, I did want to bring up that the
> >>>>> FormatterTest as it stands, even before this small addendum, doesn't
> >>>>>
> >>>> pass
> >>>>
> >>>>> against the RI (Sun 5.0_7).
> >>>>>
> >>>> Would you mind if I'm lazy and ask why?
> >>>>
> >>>> geir
> >>>>
> >>>> This particular test isn't in the 'api' test
> >>>>
> >>>>> folder as defined by our suggested best practice, so this may not
be
> >>>>> important, but is this expected/known?
> >>>>>
> >>>>> -Nathan
> >>>>>
> >>>>>
> >>> ---------------------------------------------------------------------
> >>> Terms of use : http://incubator.apache.org/harmony/mailing.html
> >>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> >>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >>>
> >>>
> >>>
> >>
> >>
> >
>
> --
> Richard Liang
> China Software Development Lab, IBM
>
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Alexei Zakharov,
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message