commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1178082 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/complex/ main/java/org/apache/commons/math/geometry/euclidean/threed/ test/java/org/apache/commons/math/geometry/euclidean/threed/
Date Sat, 01 Oct 2011 20:01:23 GMT
Author: luc
Date: Sat Oct  1 20:01:22 2011
New Revision: 1178082

URL: http://svn.apache.org/viewvc?rev=1178082&view=rev
Log:
Replaced deprecated exceptions.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/CardanEulerSingularityException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/NotARotationMatrixException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Rotation.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/RotationTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java?rev=1178082&r1=1178081&r2=1178082&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java
Sat Oct  1 20:01:22 2011
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.complex;
 
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -58,12 +58,12 @@ public class ComplexUtils {
      * @param r the modulus of the complex number to create
      * @param theta  the argument of the complex number to create
      * @return <code>r&middot;e<sup>i&middot;theta</sup></code>
-     * @throws IllegalArgumentException  if r is negative
+     * @throws MathIllegalArgumentException  if r is negative
      * @since 1.1
      */
     public static Complex polar2Complex(double r, double theta) {
         if (r < 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
+            throw new MathIllegalArgumentException(
                   LocalizedFormats.NEGATIVE_COMPLEX_MODULE, r);
         }
         return new Complex(r * FastMath.cos(theta), r * FastMath.sin(theta));

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/CardanEulerSingularityException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/CardanEulerSingularityException.java?rev=1178082&r1=1178081&r2=1178082&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/CardanEulerSingularityException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/CardanEulerSingularityException.java
Sat Oct  1 20:01:22 2011
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.geometry.euclidean.threed;
 
-import org.apache.commons.math.MathException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /** This class represents exceptions thrown while extractiong Cardan
@@ -27,7 +27,7 @@ import org.apache.commons.math.exception
  * @since 1.2
  */
 public class CardanEulerSingularityException
-  extends MathException {
+  extends MathIllegalStateException {
 
     /** Serializable version identifier */
     private static final long serialVersionUID = -1360952845582206770L;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/NotARotationMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/NotARotationMatrixException.java?rev=1178082&r1=1178081&r2=1178082&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/NotARotationMatrixException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/NotARotationMatrixException.java
Sat Oct  1 20:01:22 2011
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.geometry.euclidean.threed;
 
-import org.apache.commons.math.MathException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.exception.util.Localizable;
 
 /**
@@ -29,7 +29,7 @@ import org.apache.commons.math.exception
  */
 
 public class NotARotationMatrixException
-  extends MathException {
+  extends MathIllegalArgumentException {
 
     /** Serializable version identifier */
     private static final long serialVersionUID = 5647178478658937642L;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Rotation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Rotation.java?rev=1178082&r1=1178081&r2=1178082&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Rotation.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Rotation.java
Sat Oct  1 20:01:22 2011
@@ -19,7 +19,7 @@ package org.apache.commons.math.geometry
 
 import java.io.Serializable;
 
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -168,13 +168,13 @@ public class Rotation implements Seriali
    * attitude community or in the graphics community.</p>
    * @param axis axis around which to rotate
    * @param angle rotation angle.
-   * @exception ArithmeticException if the axis norm is zero
+   * @exception MathIllegalArgumentException if the axis norm is zero
    */
   public Rotation(Vector3D axis, double angle) {
 
     double norm = axis.getNorm();
     if (norm == 0) {
-      throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
+      throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
     }
 
     double halfAngle = -0.5 * angle;
@@ -308,7 +308,7 @@ public class Rotation implements Seriali
    * @param u2 second vector of the origin pair
    * @param v1 desired image of u1 by the rotation
    * @param v2 desired image of u2 by the rotation
-   * @exception IllegalArgumentException if the norm of one of the vectors is zero
+   * @exception MathIllegalArgumentException if the norm of one of the vectors is zero
    */
   public Rotation(Vector3D u1, Vector3D u2, Vector3D v1, Vector3D v2) {
 
@@ -318,7 +318,7 @@ public class Rotation implements Seriali
   double v1v1 = v1.getNormSq();
   double v2v2 = v2.getNormSq();
   if ((u1u1 == 0) || (u2u2 == 0) || (v1v1 == 0) || (v2v2 == 0)) {
-    throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
+    throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
   }
 
   // normalize v1 in order to have (v1'|v1') = (u1|u1)
@@ -401,13 +401,13 @@ public class Rotation implements Seriali
 
    * @param u origin vector
    * @param v desired image of u by the rotation
-   * @exception IllegalArgumentException if the norm of one of the vectors is zero
+   * @exception MathIllegalArgumentException if the norm of one of the vectors is zero
    */
   public Rotation(Vector3D u, Vector3D v) {
 
     double normProduct = u.getNorm() * v.getNorm();
     if (normProduct == 0) {
-        throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
+        throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
     }
 
     double dot = u.dotProduct(v);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/RotationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/RotationTest.java?rev=1178082&r1=1178081&r2=1178082&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/RotationTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/RotationTest.java
Sat Oct  1 20:01:22 2011
@@ -17,6 +17,7 @@
 
 package org.apache.commons.math.geometry.euclidean.threed;
 
+import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.util.MathUtils;
 import org.junit.Assert;
@@ -62,7 +63,7 @@ public class RotationTest {
     try {
       new Rotation(new Vector3D(0, 0, 0), 2 * FastMath.PI / 3);
       Assert.fail("an exception should have been thrown");
-    } catch (ArithmeticException e) {
+    } catch (MathIllegalArgumentException e) {
     }
 
     r = new Rotation(Vector3D.PLUS_K, 1.5 * FastMath.PI);



Mime
View raw message