harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spark Shen" <smallsmallor...@gmail.com>
Subject Re: [classlib][beans] Another non-bug difference? (was [JIRA 1568] [classlib][beans] XMLDecoder(3 params).getExceptionListener() returns object on RI and 'null' on Harmony)
Date Thu, 16 Aug 2007 01:49:14 GMT
If delaying inputStream parsing to readObject method. Then a boolean
variable is needed to guarantee that parsing is done only once.  The
potential drawback is that, original implementation is instinctive thread
safe regarding to inputStream parsing, while using boolean we may need extra
efforts to guarantee thread safety or just give it up.2007/8/15, Yang Paulex
<paulex.yang@gmail.com>:
>
> 2007/8/15, Spark Shen <smallsmallorgan@gmail.com>:
> >
> > RI will print out 'res = class java.beans.Statement$1', with on
> exception
> > information.
> >
> > 2007/8/15, Yang Paulex <paulex.yang@gmail.com>:
> > >
> > > 2007/8/15, Spark Shen <smallsmallorgan@gmail.com>:
> > > >
> > > > Hi, all
> > > > Seems JIRA 1568 needs further attention.
> > > >
> > > > Even fixed 1568, harmony still prints some shocking stack trace. The
> > > test
> > > > case[1] given by 1568 will reveal this. Although this can be viewed
> as
> > a
> > > > non-bug difference, print such shocking error message when
> > constructing
> > > a
> > > > XMLDecoder may not be so elegant.
> > > > I have two alternatives to amend this behavior:
> > > >
> > > > 1. simplify the error message printed out by
> DefaultExceptionListener,
> > > as
> > > > the patch given below:
> > > > Index: beans/src/main/java/java/beans/XMLDecoder.java
> > > > ===================================================================
> > > > --- beans/src/main/java/java/beans/XMLDecoder.java    (revision
> > 566039)
> > > > +++ beans/src/main/java/java/beans/XMLDecoder.java    (working copy)
> > > > @@ -45,9 +45,10 @@
> > > >
> > > >      private static class DefaultExceptionListener implements
> > > > ExceptionListener {
> > > >
> > > > +        @SuppressWarnings("nls")
> > > >          public void exceptionThrown(Exception e) {
> > > > -            e.printStackTrace();
> > > > -            System.err.println("Continue..."); //$NON-NLS-1$
> > > > +            System.err.println(e.getClass().getCanonicalName() + ":
> "
> > > > +e.getMessage());
> > > > +            System.err.println("Continue...");
> > > >          }
> > > >      }
> > > >
> > > >
> > > >
> > > > 2. Delay inputStream parsing, moving it from constructor to other
> > place
> > > > like
> > > > readObject.
> > > >
> > > > Or any other suggestions?
> > >
> > >
> > > What's RI's behavior here?
> > >
> > > [1] test case given by
> > https://issues.apache.org/jira/browse/HARMONY-1568
> > > > import java.beans.*;
> > > > import java.io.ByteArrayInputStream;
>
>
> I think we can just follow RI here. Any drawbacks?
>
> > >
> > > > public class test {
> > > >    public static void main(String[] args) {
> > > >        System.out.println("res = " + new XMLDecoder(new
> > > > ByteArrayInputStream(new byte[] {1, 2}), new Double(1),
> > > > null).getExceptionListener());
> > > >     }
> > > > }
> > > >
> > > > --
> > > > Spark Shen
> > > > China Software Development Lab, IBM
> > > >
> > >
> > >
> > >
> > > --
> > > Paulex Yang
> > > China Software Development laboratory
> > > IBM
> > >
> >
> >
> >
> > --
> > Spark Shen
> > China Software Development Lab, IBM
> >
>
>
>
> --
> Paulex Yang
> China Software Development laboratory
> IBM
>



-- 
Spark Shen
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message