Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 67202 invoked from network); 9 Dec 2007 02:23:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Dec 2007 02:23:30 -0000 Received: (qmail 33502 invoked by uid 500); 9 Dec 2007 02:23:18 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 33439 invoked by uid 500); 9 Dec 2007 02:23:18 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 33427 invoked by uid 99); 9 Dec 2007 02:23:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Dec 2007 18:23:18 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Dec 2007 02:23:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 965681A9832; Sat, 8 Dec 2007 18:23:08 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r602612 - /commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java Date: Sun, 09 Dec 2007 02:23:08 -0000 To: commits@commons.apache.org From: psteitz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071209022308.965681A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: psteitz Date: Sat Dec 8 18:23:07 2007 New Revision: 602612 URL: http://svn.apache.org/viewvc?rev=602612&view=rev Log: Clean up reflection exception handling. Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java?rev=602612&r1=602611&r2=602612&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java Sat Dec 8 18:23:07 2007 @@ -17,6 +17,7 @@ package org.apache.commons.math.stat.descriptive; import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import org.apache.commons.discovery.tools.DiscoverClass; @@ -369,9 +370,15 @@ percentileImpl.getClass().getMethod("setQuantile", new Class[] {Double.TYPE}).invoke(percentileImpl, new Object[] {new Double(p)}); - } catch (Exception ex) { // Should never happen, guarded by setter - throw new IllegalStateException( - "Percentile implementation does not support setQuantile"); + } catch (NoSuchMethodException e1) { // Setter guard should prevent + throw new IllegalArgumentException( + "Percentile implementation does not support setQuantile"); + } catch (IllegalAccessException e2) { + throw new IllegalArgumentException( + "IllegalAccessException setting quantile"); + } catch (InvocationTargetException e3) { + throw new IllegalArgumentException( + "Error setting quantile" + e3.toString()); } } return apply(percentileImpl); @@ -503,9 +510,15 @@ percentileImpl.getClass().getMethod("setQuantile", new Class[] {Double.TYPE}).invoke(percentileImpl, new Object[] {new Double(50.0d)}); - } catch (Exception ex) { + } catch (NoSuchMethodException e1) { throw new IllegalArgumentException( "Percentile implementation does not support setQuantile"); + } catch (IllegalAccessException e2) { + throw new IllegalArgumentException( + "IllegalAccessException setting quantile"); + } catch (InvocationTargetException e3) { + throw new IllegalArgumentException( + "Error setting quantile" + e3.toString()); } this.percentileImpl = percentileImpl; }