You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@steitz.com> on 2004/12/05 19:01:11 UTC
[math] 1.0 changes to support JDK 1.3
I just discovered that we have some JDK 1.4 dependencies in the 1.0
release code. I would like to make the following changes to allow
compilation on 1.3. Diffs showing the changes are at the bottom of this
message:
1) Eliminate the use of JDK 1.4 exception nesting in
MatrixIndexException, InvalidMatrixException (making these exceptions no
longer support nesting).
2) Eliminate use of java.beans.Expression in CertifiedDataAbstractTest
3) Move BeanTransformer and BeanTransformerTest to /experimental (they
are both in /test now).
These changes will allow compilation on 1.3, but
MathExceptionTest.testSerialization will fail because the stack traces
are not serialized. To fix this, we need to implement custom
serialization and I personally am OK with either deferring this to 1.1
or leaving as is.
If there are no objections, I will commit these changes and push forward
with the release.
-Phil
RCS file:
/home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/InvalidMatrixException.java,v
retrieving revision 1.7
diff -u -r1.7 InvalidMatrixException.java
--- src/java/org/apache/commons/math/linear/InvalidMatrixException.java
11 Jul 2004 18:43:44 -0000 1.7
+++ src/java/org/apache/commons/math/linear/InvalidMatrixException.java
5 Dec 2004 19:46:40 -0000
@@ -31,7 +31,7 @@
* Default constructor.
*/
public InvalidMatrixException() {
- this(null, null);
+ this(null);
}
/**
@@ -39,23 +39,7 @@
* @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);
- }
}
Index: src/java/org/apache/commons/math/linear/MatrixIndexException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/MatrixIndexException.java,v
retrieving revision 1.7
diff -u -r1.7 MatrixIndexException.java
--- src/java/org/apache/commons/math/linear/MatrixIndexException.java 11
Jul 2004 18:43:44 -0000 1.7
+++ src/java/org/apache/commons/math/linear/MatrixIndexException.java 5
Dec 2004 19:46:40 -0000
@@ -30,31 +30,15 @@
* 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);
- }
}
Index: src/test/org/apache/commons/math/MathExceptionTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/MathExceptionTest.java,v
retrieving revision 1.8
diff -u -r1.8 MathExceptionTest.java
--- src/test/org/apache/commons/math/MathExceptionTest.java 10 Jul 2004
22:23:14 -0000 1.8
+++ src/test/org/apache/commons/math/MathExceptionTest.java 5 Dec 2004
19:46:40 -0000
@@ -114,5 +114,10 @@
image.printStackTrace(ps2);
String stack2 = baos2.toString();
assertEquals(stack, stack2);
+ System.out.println("original: ");
+ System.out.println(stack);
+ System.out.println("image: ");
+ System.out.println(stack2);
+
}
}
Index:
src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java,v
retrieving revision 1.1
diff -u -r1.1 InvalidMatrixExceptionTest.java
---
src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java
27 Apr 2004 16:51:52 -0000 1.1
+++
src/test/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java
5 Dec 2004 19:46:40 -0000
@@ -27,7 +27,6 @@
*/
public void testConstructor(){
InvalidMatrixException ex = new InvalidMatrixException();
- assertNull(ex.getCause());
assertNull(ex.getMessage());
}
@@ -37,29 +36,6 @@
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());
}
}
Index: src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java,v
retrieving revision 1.1
diff -u -r1.1 MatrixIndexExceptionTest.java
---
src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java 27
Apr 2004 16:51:52 -0000 1.1
+++
src/test/org/apache/commons/math/linear/MatrixIndexExceptionTest.java 5
Dec 2004 19:46:40 -0000
@@ -27,7 +27,6 @@
*/
public void testConstructor(){
MatrixIndexException ex = new MatrixIndexException();
- assertNull(ex.getCause());
assertNull(ex.getMessage());
}
@@ -37,29 +36,6 @@
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());
}
}
Index:
src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java,v
retrieving revision 1.7
diff -u -r1.7 CertifiedDataAbstractTest.java
---
src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java
8 Oct 2004 05:08:19 -0000 1.7
+++
src/test/org/apache/commons/math/stat/data/CertifiedDataAbstractTest.java
5 Dec 2004 19:46:40 -0000
@@ -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.net.URL;
import java.util.HashMap;
import java.util.Iterator;
@@ -135,8 +135,10 @@
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();
+ Method meth = bean.getClass().getMethod(prop, new Class[0]);
+ return meth.invoke(bean, new Object[0]);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] 1.0 changes to support JDK 1.3
Posted by Emmanuel Bourg <sm...@lfjr.net>.
I don't think it really matters if the test cases require the JDK 1.4,
it's just important to keep the main code JDK 1.3 compatible.
Emmanuel Bourg
Al Chou wrote:
> --- Phil Steitz <ph...@steitz.com> wrote:
>
>>I just discovered that we have some JDK 1.4 dependencies in the 1.0
>>release code. I would like to make the following changes to allow
>>compilation on 1.3. Diffs showing the changes are at the bottom of this
>>message:
>>
>>1) Eliminate the use of JDK 1.4 exception nesting in
>>MatrixIndexException, InvalidMatrixException (making these exceptions no
>>longer support nesting).
>>
>>2) Eliminate use of java.beans.Expression in CertifiedDataAbstractTest
>>
>>3) Move BeanTransformer and BeanTransformerTest to /experimental (they
>>are both in /test now).
>>
>>These changes will allow compilation on 1.3, but
>>MathExceptionTest.testSerialization will fail because the stack traces
>>are not serialized. To fix this, we need to implement custom
>>serialization and I personally am OK with either deferring this to 1.1
>>or leaving as is.
>>
>>If there are no objections, I will commit these changes and push forward
>>with the release.
>>
>>-Phil
>
>
> Sounds good, Phil. Way to go!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] 1.0 changes to support JDK 1.3
Posted by Phil Steitz <ph...@steitz.com>.
Thanks, guys, and sorry I did not catch these 1.4 dependencies earlier.
-Phil
Mark R. Diggory wrote:
> Sounds fine
>
> Al Chou wrote:
>
>> --- Phil Steitz <ph...@steitz.com> wrote:
>>
>>> I just discovered that we have some JDK 1.4 dependencies in the 1.0
>>> release code. I would like to make the following changes to allow
>>> compilation on 1.3. Diffs showing the changes are at the bottom of
>>> this message:
>>>
>>> 1) Eliminate the use of JDK 1.4 exception nesting in
>>> MatrixIndexException, InvalidMatrixException (making these exceptions
>>> no longer support nesting).
>>>
>
> fine
>
>>> 2) Eliminate use of java.beans.Expression in CertifiedDataAbstractTest
>
>
> ok
>
>>>
>>> 3) Move BeanTransformer and BeanTransformerTest to /experimental
>>> (they are both in /test now).
>
>
> ok
>
>>>
>>> These changes will allow compilation on 1.3, but
>>> MathExceptionTest.testSerialization will fail because the stack
>>> traces are not serialized. To fix this, we need to implement custom
>>> serialization and I personally am OK with either deferring this to
>>> 1.1 or leaving as is.
>>>
>>> If there are no objections, I will commit these changes and push
>>> forward with the release.
>>>
>>> -Phil
>>
>>
>>
>> Sounds good, Phil. Way to go!
>>
>> Al
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] 1.0 changes to support JDK 1.3
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Sounds fine
Al Chou wrote:
> --- Phil Steitz <ph...@steitz.com> wrote:
>
>>I just discovered that we have some JDK 1.4 dependencies in the 1.0
>>release code. I would like to make the following changes to allow
>>compilation on 1.3. Diffs showing the changes are at the bottom of this
>>message:
>>
>>1) Eliminate the use of JDK 1.4 exception nesting in
>>MatrixIndexException, InvalidMatrixException (making these exceptions no
>>longer support nesting).
>>
fine
>>2) Eliminate use of java.beans.Expression in CertifiedDataAbstractTest
ok
>>
>>3) Move BeanTransformer and BeanTransformerTest to /experimental (they
>>are both in /test now).
ok
>>
>>These changes will allow compilation on 1.3, but
>>MathExceptionTest.testSerialization will fail because the stack traces
>>are not serialized. To fix this, we need to implement custom
>>serialization and I personally am OK with either deferring this to 1.1
>>or leaving as is.
>>
>>If there are no objections, I will commit these changes and push forward
>>with the release.
>>
>>-Phil
>
>
> Sounds good, Phil. Way to go!
>
> Al
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] 1.0 changes to support JDK 1.3
Posted by Al Chou <ho...@yahoo.com>.
--- Phil Steitz <ph...@steitz.com> wrote:
> I just discovered that we have some JDK 1.4 dependencies in the 1.0
> release code. I would like to make the following changes to allow
> compilation on 1.3. Diffs showing the changes are at the bottom of this
> message:
>
> 1) Eliminate the use of JDK 1.4 exception nesting in
> MatrixIndexException, InvalidMatrixException (making these exceptions no
> longer support nesting).
>
> 2) Eliminate use of java.beans.Expression in CertifiedDataAbstractTest
>
> 3) Move BeanTransformer and BeanTransformerTest to /experimental (they
> are both in /test now).
>
> These changes will allow compilation on 1.3, but
> MathExceptionTest.testSerialization will fail because the stack traces
> are not serialized. To fix this, we need to implement custom
> serialization and I personally am OK with either deferring this to 1.1
> or leaving as is.
>
> If there are no objections, I will commit these changes and push forward
> with the release.
>
> -Phil
Sounds good, Phil. Way to go!
Al
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org