You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/02/02 13:29:24 UTC

[29/50] commons-numbers git commit: Use more specific exception type.

Use more specific exception type.


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/393cf663
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/393cf663
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/393cf663

Branch: refs/heads/feature__NUMBERS-51__field
Commit: 393cf6636de3bac72d09c60b900b2b124fa40e18
Parents: 2d1f767
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Thu Feb 1 12:19:49 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Thu Feb 1 12:19:49 2018 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/commons/numbers/complex/Complex.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/393cf663/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
index 99888f2..be58584 100644
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
@@ -1175,7 +1175,7 @@ public class Complex implements Serializable  {
     public List<Complex> nthRoot(int n) {
 
         if (n <= 0) {
-            throw new RuntimeException("cannot compute nth root for null or negative n: {0}");
+            throw new IllegalArgumentException("cannot compute nth root for null or negative n: {0}");
         }
 
         final List<Complex> result = new ArrayList<Complex>();
@@ -1257,7 +1257,7 @@ public class Complex implements Serializable  {
      */
     private static void checkNotNull(Object o) {
         if (o == null) {
-            throw new RuntimeException("Null Argument to Complex Method");
+            throw new IllegalArgumentException("Null Argument to Complex Method");
         }
     }
 
@@ -1268,7 +1268,7 @@ public class Complex implements Serializable  {
      */
     private static void checkNotNegative(double arg) {
         if (arg <= 0) {
-            throw new RuntimeException("Complex: Non-positive argument");
+            throw new IllegalArgumentException("Complex: Non-positive argument");
         }
     }