Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 52947 invoked from network); 16 Aug 2007 01:49:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Aug 2007 01:49:42 -0000 Received: (qmail 16763 invoked by uid 500); 16 Aug 2007 01:49:37 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 16741 invoked by uid 500); 16 Aug 2007 01:49:37 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 16732 invoked by uid 99); 16 Aug 2007 01:49:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2007 18:49:37 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of smallsmallorgan@gmail.com designates 64.233.166.183 as permitted sender) Received: from [64.233.166.183] (HELO py-out-1112.google.com) (64.233.166.183) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Aug 2007 01:49:36 +0000 Received: by py-out-1112.google.com with SMTP id u77so183625pyb for ; Wed, 15 Aug 2007 18:49:14 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=KXjPQvoj0xea6XVCnse9yfm9qUjBHJbtYUd9NAhK87HhkbdzwEY7ZTX9JzwXXLOD2Xd9al0pXLDzRIHl85CUD6aNJg/SV92iEvJJzjF/C9Yf1QaMceIv1O9xMxtQxhzH+RLDHRMZAwi6pHQXaZQ1YDFs7xftL0Hcohe57AUMyRI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=CgBBvz9f3Xw0pG+R4qi85DZ3y88RGFArWnik4cZNMvNjTcAAssEj6D0v+A1rYaeqqPC1rY9e0y4Et1CAFWTKihu9/2rNcXBfd5lZeTSbAJnb9U0LYx5fp1kVrlBWShfF7oFE4oBDigkePgcasIlifERaoDUHQ2VrnH/REYDsL/4= Received: by 10.65.156.2 with SMTP id i2mr2075789qbo.1187228954502; Wed, 15 Aug 2007 18:49:14 -0700 (PDT) Received: by 10.65.156.7 with HTTP; Wed, 15 Aug 2007 18:49:14 -0700 (PDT) Message-ID: <473c46620708151849j336a4782t45475d6c5c9cd3ef@mail.gmail.com> Date: Thu, 16 Aug 2007 09:49:14 +0800 From: "Spark Shen" To: dev@harmony.apache.org 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) In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_54824_12812141.1187228954456" References: <473c46620708150016l1b648e13m511e4071915eb82f@mail.gmail.com> <473c46620708150101s61d8b3aclf287a427e85ae02d@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_54824_12812141.1187228954456 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 : > > 2007/8/15, Spark Shen : > > > > RI will print out 'res = class java.beans.Statement$1', with on > exception > > information. > > > > 2007/8/15, Yang Paulex : > > > > > > 2007/8/15, Spark Shen : > > > > > > > > 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 ------=_Part_54824_12812141.1187228954456--