From 6e57f9a1bada3577e81997a209304db0911e12c4 Mon Sep 17 00:00:00 2001 From: Phil Steitz Date: Mon, 6 Dec 2004 05:49:44 +0000 Subject: [PATCH] Removed JDK 1.4 dependent code. PR# 32538. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141513 13f79535-47bb-0310-9956-ffa450edef68 --- .../math/linear/InvalidMatrixException.java | 22 +++------------- .../math/linear/MatrixIndexException.java | 24 +++-------------- .../linear/InvalidMatrixExceptionTest.java | 26 +------------------ .../math/linear/MatrixIndexExceptionTest.java | 26 +------------------ .../stat/data/CertifiedDataAbstractTest.java | 11 ++++---- 5 files changed, 14 insertions(+), 95 deletions(-) diff --git a/src/java/org/apache/commons/math/linear/InvalidMatrixException.java b/src/java/org/apache/commons/math/linear/InvalidMatrixException.java index 4ec293446..b540f00d2 100644 --- a/src/java/org/apache/commons/math/linear/InvalidMatrixException.java +++ b/src/java/org/apache/commons/math/linear/InvalidMatrixException.java @@ -20,7 +20,7 @@ package org.apache.commons.math.linear; * Thrown when a system attempts an operation on a matrix, and * that matrix does not satisfy the preconditions for the * aforementioned operation. - * @version $Revision: 1.7 $ $Date: 2004/07/11 18:43:44 $ + * @version $Revision: 1.8 $ $Date: 2004/12/06 05:49:44 $ */ public class InvalidMatrixException extends RuntimeException { @@ -31,7 +31,7 @@ public class InvalidMatrixException extends RuntimeException { * Default constructor. */ public InvalidMatrixException() { - this(null, null); + this(null); } /** @@ -39,23 +39,7 @@ public class InvalidMatrixException extends RuntimeException { * @param message descriptive error message. */ public InvalidMatrixException(String message) { - this(message, null); + super(message); } - /** - * Construct an exception with the given message and root cause. - * @param message descriptive error message. - * @param cause root cause. - */ - public InvalidMatrixException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Create an exception with a given root cause. - * @param throwable caught exception causing this problem - */ - public InvalidMatrixException(Throwable throwable) { - this(null, throwable); - } } diff --git a/src/java/org/apache/commons/math/linear/MatrixIndexException.java b/src/java/org/apache/commons/math/linear/MatrixIndexException.java index 8c3d6ac8a..48027ec8d 100644 --- a/src/java/org/apache/commons/math/linear/MatrixIndexException.java +++ b/src/java/org/apache/commons/math/linear/MatrixIndexException.java @@ -19,7 +19,7 @@ package org.apache.commons.math.linear; /** * Thrown when an operation addresses a matrix coordinate (row,col) * which is outside of the dimensions of a matrix. - * @version $Revision: 1.7 $ $Date: 2004/07/11 18:43:44 $ + * @version $Revision: 1.8 $ $Date: 2004/12/06 05:49:44 $ */ public class MatrixIndexException extends RuntimeException { @@ -30,31 +30,15 @@ public class MatrixIndexException extends RuntimeException { * Default constructor. */ public MatrixIndexException() { - this(null, null); - } - - /** - * Construct an exception with the given message. - * @param message descriptive error message. - */ - public MatrixIndexException(String message) { - this(message, null); + this(null); } /** * Construct an exception with the given message and root cause. * @param message descriptive error message. - * @param cause root cause. */ - public MatrixIndexException(String message, Throwable cause) { - super(message, cause); + public MatrixIndexException(String message) { + super(message); } - /** - * Create an exception with a given root cause. - * @param throwable caught exception causing this problem - */ - public MatrixIndexException(Throwable throwable) { - this(null, throwable); - } } diff --git a/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java b/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java index e3685c794..690ee1d1f 100644 --- a/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java +++ b/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java @@ -19,7 +19,7 @@ package org.apache.commons.math.linear; import junit.framework.TestCase; /** - * @version $Revision: 1.1 $ $Date: 2004/04/27 16:51:52 $ + * @version $Revision: 1.2 $ $Date: 2004/12/06 05:49:44 $ */ public class InvalidMatrixExceptionTest extends TestCase { /** @@ -27,7 +27,6 @@ public class InvalidMatrixExceptionTest extends TestCase { */ public void testConstructor(){ InvalidMatrixException ex = new InvalidMatrixException(); - assertNull(ex.getCause()); assertNull(ex.getMessage()); } @@ -37,29 +36,6 @@ public class InvalidMatrixExceptionTest extends TestCase { public void testConstructorMessage(){ String msg = "message"; InvalidMatrixException ex = new InvalidMatrixException(msg); - assertNull(ex.getCause()); assertEquals(msg, ex.getMessage()); } - - /** - * - */ - public void testConstructorMessageCause(){ - String outMsg = "outer message"; - String inMsg = "inner message"; - Exception cause = new Exception(inMsg); - InvalidMatrixException ex = new InvalidMatrixException(outMsg, cause); - assertEquals(outMsg, ex.getMessage()); - assertEquals(cause, ex.getCause()); - } - - /** - * - */ - public void testConstructorCause(){ - String inMsg = "inner message"; - Exception cause = new Exception(inMsg); - InvalidMatrixException ex = new InvalidMatrixException(cause); - assertEquals(cause, ex.getCause()); - } } diff --git a/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java b/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java index 60ec0941d..8173d982f 100644 --- a/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java +++ b/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java @@ -19,7 +19,7 @@ package org.apache.commons.math.linear; import junit.framework.TestCase; /** - * @version $Revision: 1.1 $ $Date: 2004/04/27 16:51:52 $ + * @version $Revision: 1.2 $ $Date: 2004/12/06 05:49:44 $ */ public class MatrixIndexExceptionTest extends TestCase { /** @@ -27,7 +27,6 @@ public class MatrixIndexExceptionTest extends TestCase { */ public void testConstructor(){ MatrixIndexException ex = new MatrixIndexException(); - assertNull(ex.getCause()); assertNull(ex.getMessage()); } @@ -37,29 +36,6 @@ public class MatrixIndexExceptionTest extends TestCase { public void testConstructorMessage(){ String msg = "message"; MatrixIndexException ex = new MatrixIndexException(msg); - assertNull(ex.getCause()); assertEquals(msg, ex.getMessage()); } - - /** - * - */ - public void testConstructorMessageCause(){ - String outMsg = "outer message"; - String inMsg = "inner message"; - Exception cause = new Exception(inMsg); - MatrixIndexException ex = new MatrixIndexException(outMsg, cause); - assertEquals(outMsg, ex.getMessage()); - assertEquals(cause, ex.getCause()); - } - - /** - * - */ - public void testConstructorCause(){ - String inMsg = "inner message"; - Exception cause = new Exception(inMsg); - MatrixIndexException ex = new MatrixIndexException(cause); - assertEquals(cause, ex.getCause()); - } } diff --git a/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java b/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java index ba09b8ede..264bc8324 100644 --- a/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java +++ b/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java @@ -16,10 +16,10 @@ package org.apache.commons.math.stat.data; -import java.beans.Expression; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.lang.reflect.Method; import java.net.URL; import java.util.HashMap; import java.util.Iterator; @@ -32,7 +32,7 @@ import org.apache.commons.math.stat.descriptive.SummaryStatistics; import junit.framework.TestCase; /** - * @version $Revision: 1.7 $ $Date: 2004/10/08 05:08:19 $ + * @version $Revision: 1.8 $ $Date: 2004/12/06 05:49:44 $ */ public abstract class CertifiedDataAbstractTest extends TestCase { @@ -134,9 +134,8 @@ public abstract class CertifiedDataAbstractTest extends TestCase { protected Object getProperty(Object bean, String name) throws Exception{ // Get the value of prop - String prop = "get" + name.substring(0,1).toUpperCase() + name.substring(1); - Expression expr = new Expression(bean, prop, new Object[0]); - expr.execute(); - return expr.getValue(); + String prop = "get" + name.substring(0,1).toUpperCase() + name.substring(1); + Method meth = bean.getClass().getMethod(prop, new Class[0]); + return meth.invoke(bean, new Object[0]); } }