Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 13880 invoked from network); 9 Mar 2011 08:43:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Mar 2011 08:43:39 -0000 Received: (qmail 53037 invoked by uid 500); 9 Mar 2011 08:43:39 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 52958 invoked by uid 500); 9 Mar 2011 08:43:39 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 52950 invoked by uid 99); 9 Mar 2011 08:43:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Mar 2011 08:43:39 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [194.206.126.239] (HELO smtp.nordnet.fr) (194.206.126.239) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Mar 2011 08:43:29 +0000 Received: from lehrin (86.253.146.195.dynamic.adsl.abo.nordnet.fr [195.146.253.86]) by smtp.nordnet.fr (Postfix) with ESMTP id 39FE3340BB for ; Wed, 9 Mar 2011 09:43:08 +0100 (CET) Received: by lehrin (Postfix, from userid 5001) id D38F34073; Wed, 9 Mar 2011 09:43:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lehrin.spaceroots.local X-Spam-Level: Received: from lehrin.spaceroots.local (lehrin.spaceroots.local [127.0.0.1]) by lehrin (Postfix) with ESMTP id 7AD474071 for ; Wed, 9 Mar 2011 09:43:05 +0100 (CET) Message-ID: <4D773D99.9020402@free.fr> Date: Wed, 09 Mar 2011 09:43:05 +0100 From: Luc Maisonobe User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Commons Developers List Subject: Re: [math] Re: svn commit: r1078734 References: <20110307103754.1331923889EB@eris.apache.org> <4D768EE6.6050707@free.fr> <20110308212205.GS22170@dusk.harfang.homelinux.org> In-Reply-To: <20110308212205.GS22170@dusk.harfang.homelinux.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,FREEMAIL_FROM autolearn=unavailable version=3.3.1 Le 08/03/2011 22:22, Gilles Sadowski a �crit : > Hello. Hi Gilles, > >>> Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java >>> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java?rev=1078734&r1=1078733&r2=1078734&view=diff >>> ============================================================================== >>> --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java (original) >>> +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/DummyStepInterpolatorTest.java Mon Mar 7 10:37:52 2011 >>> @@ -123,7 +123,9 @@ public class DummyStepInterpolatorTest { >>> fail("an exception should have been thrown"); >>> } catch (IOException ioe) { >>> // expected behavior >>> - assertEquals(0, ioe.getMessage().length()); >>> + // XXX Why was the message supposed to be empty? >>> + // With the current code it is "org.apache.commons.math.util.Pair". >>> + // assertEquals(0, ioe.getMessage().length()); >> >> The problem here is that the exception thrown which is an IOException >> built from the empty string in the BadStepInterpolator below is not the >> IOException that is caught here. In fact the IOException caught is >> really a java.io.NotSerializableException which is built with the >> message "org.apache.commons.math.util.Pair" automatically by the >> serialization process in the JVM (at least for Oracle implementation). >> >> All exceptions must be serializable (this comes from java.lang.Throwable >> implementing the Serializable interface). This was also one reason why >> our Localizable interface had to extends Serializable, so it could be >> used as a field in our exceptions. >> >> This change added a List> field in >> MathRuntimeException. Pair is not serializable. Adding Serializable to >> the implemented interfaces in Pair does solve the problem (if also the >> change below is reverted, of course) but I don't think it would be wise >> unless we also enforce the two generic parameters of Pair to be >> serializable too. Perhaps we should use a Map >> instead ? > > No, because a key is unique (so that it won't be possible to add 2 messages > with the same pattern but different values. > I've created a "SerializablePair" (cf. revision 1079545) that seems to solve > the problem. Fine, thanks. > >> The problem also makes me think that we already had a similar bug in >> another part of the exceptions for a long time : the Object or Object[] >> parameters of the exceptions are stored and may not be Serializable too. >> This was never a problem either because the parameters are often simple >> primitive ones (int, double ...) or arrays so they were serializable. >> Perhaps we should change the signature from Object and Object[] to >> Serializable and Serializable[] ? > > I'm not fond of imposing "Serializable", as this would forbid user classes > that are not "Serializable" (or force them to make the class "Serializable" > although they don't have any use of that interface). > I think "Object" is more flexible in the sense that users who need > serialization will use "Serializable" classes and it will work... > >>> } >>> >>> } >>> @@ -137,7 +139,7 @@ public class DummyStepInterpolatorTest { >>> } >>> @Override >>> protected void doFinalize() throws MathUserException { >>> - throw new MathUserException((Localizable) null, LocalizedFormats.SIMPLE_MESSAGE, ""); >>> + throw new MathUserException(LocalizedFormats.SIMPLE_MESSAGE, null); >> >> This should not have been replaced. Null is not the smae thing as the >> empty String. Also this introduces a warning due to ambiguous signatures. > > That was a mistake, but I didn't make it because I thought that > "" == null > was true ;-}. Ok, thanks best regards, Luc > > > Best, > Gilles > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org