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/09/14 00:20:46 UTC
[commons-geometry] 13/14: Unchecked exceptions should not appear in
the "throws" clause.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit df6704fabf32d0455863df4ed2e41f9fb884ef37
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Fri Sep 14 02:16:24 2018 +0200
Unchecked exceptions should not appear in the "throws" clause.
---
.../geometry/core/internal/SimpleTupleFormat.java | 20 ++++++++++----------
.../geometry/enclosing/WelzlEncloser3DTest.java | 2 +-
.../commons/geometry/euclidean/oned/Point1D.java | 2 +-
.../commons/geometry/euclidean/oned/Vector1D.java | 10 +++++-----
.../commons/geometry/euclidean/threed/Line.java | 2 +-
.../commons/geometry/euclidean/threed/Plane.java | 4 ++--
.../commons/geometry/euclidean/threed/Point3D.java | 2 +-
.../commons/geometry/euclidean/threed/Rotation.java | 4 ++--
.../commons/geometry/euclidean/threed/SubLine.java | 2 +-
.../commons/geometry/euclidean/threed/Vector3D.java | 16 ++++++++--------
.../commons/geometry/euclidean/twod/NestedLoops.java | 4 ++--
.../commons/geometry/euclidean/twod/Point2D.java | 2 +-
.../commons/geometry/euclidean/twod/Vector2D.java | 14 +++++++-------
.../geometry/euclidean/twod/hull/ConvexHull2D.java | 2 +-
.../commons/geometry/spherical/oned/S1Point.java | 2 +-
.../geometry/spherical/twod/EdgesBuilder.java | 2 +-
.../commons/geometry/spherical/twod/S2Point.java | 2 +-
.../spherical/twod/SphericalPolygonsSet.java | 4 ++--
18 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java
index 4cca8cc..b2ecfc5 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java
@@ -168,7 +168,7 @@ public class SimpleTupleFormat {
* @return object returned by {@code fn}
* @throws IllegalArgumentException if the input string format is invalid
*/
- public <T> T parse(String str, DoubleFunction1N<T> fn) throws IllegalArgumentException {
+ public <T> T parse(String str, DoubleFunction1N<T> fn) {
final ParsePosition pos = new ParsePosition(0);
readPrefix(str, pos);
@@ -187,7 +187,7 @@ public class SimpleTupleFormat {
* @return object returned by {@code fn}
* @throws IllegalArgumentException if the input string format is invalid
*/
- public <T> T parse(String str, DoubleFunction2N<T> fn) throws IllegalArgumentException {
+ public <T> T parse(String str, DoubleFunction2N<T> fn) {
final ParsePosition pos = new ParsePosition(0);
readPrefix(str, pos);
@@ -207,7 +207,7 @@ public class SimpleTupleFormat {
* @return object returned by {@code fn}
* @throws IllegalArgumentException if the input string format is invalid
*/
- public <T> T parse(String str, DoubleFunction3N<T> fn) throws IllegalArgumentException {
+ public <T> T parse(String str, DoubleFunction3N<T> fn) {
final ParsePosition pos = new ParsePosition(0);
readPrefix(str, pos);
@@ -228,7 +228,7 @@ public class SimpleTupleFormat {
* @throws IllegalArgumentException if the configured prefix is not null and is not found at the current
* parsing position, ignoring preceding whitespace
*/
- private void readPrefix(String str, ParsePosition pos) throws IllegalArgumentException {
+ private void readPrefix(String str, ParsePosition pos) {
if (prefix != null) {
consumeWhitespace(str, pos);
readSequence(str, prefix, pos);
@@ -243,7 +243,7 @@ public class SimpleTupleFormat {
* @throws IllegalArgumentException if the configured prefix is not null and is not found at the current
* parsing position, ignoring preceding whitespace
*/
- private double readTupleValue(String str, ParsePosition pos) throws IllegalArgumentException {
+ private double readTupleValue(String str, ParsePosition pos) {
final int startIdx = pos.getIndex();
int endIdx = str.indexOf(separator, startIdx);
@@ -281,7 +281,7 @@ public class SimpleTupleFormat {
* @throws IllegalArgumentException if the configured suffix is not null and is not found at the current
* parsing position, ignoring preceding whitespace
*/
- private void readSuffix(String str, ParsePosition pos) throws IllegalArgumentException {
+ private void readSuffix(String str, ParsePosition pos) {
if (suffix != null) {
consumeWhitespace(str, pos);
readSequence(str, suffix, pos);
@@ -294,7 +294,7 @@ public class SimpleTupleFormat {
* @param pos the current parsing position
* @throws IllegalArgumentException if extra non-whitespace content is found past the current parsing position
*/
- private void endParse(String str, ParsePosition pos) throws IllegalArgumentException {
+ private void endParse(String str, ParsePosition pos) {
consumeWhitespace(str, pos);
if (pos.getIndex() != str.length()) {
fail("unexpected content", str, pos);
@@ -359,7 +359,7 @@ public class SimpleTupleFormat {
* @throws IllegalArgumentException if {@code str} does not contain the characters from
* {@code seq} at position {@code pos}
*/
- private void readSequence(String str, String seq, ParsePosition pos) throws IllegalArgumentException {
+ private void readSequence(String str, String seq, ParsePosition pos) {
if (!matchSequence(str, seq, pos)) {
final int idx = pos.getIndex();
final String actualSeq = str.substring(idx, Math.min(str.length(), idx + seq.length()));
@@ -375,7 +375,7 @@ public class SimpleTupleFormat {
* @param pos the current parse position
* @throws IllegalArgumentException the exception signaling a parse failure
*/
- private void fail(String msg, String str, ParsePosition pos) throws IllegalArgumentException {
+ private void fail(String msg, String str, ParsePosition pos) {
fail(msg, str, pos, null);
}
@@ -387,7 +387,7 @@ public class SimpleTupleFormat {
* @param cause the original cause of the error
* @throws IllegalArgumentException the exception signaling a parse failure
*/
- private void fail(String msg, String str, ParsePosition pos, Throwable cause) throws IllegalArgumentException {
+ private void fail(String msg, String str, ParsePosition pos, Throwable cause) {
final String fullMsg = String.format("Failed to parse string \"%s\" at index %d: %s", str, pos.getIndex(), msg);
throw new TupleParseException(fullMsg, cause);
diff --git a/commons-geometry-enclosing/src/test/java/org/apache/commons/geometry/enclosing/WelzlEncloser3DTest.java b/commons-geometry-enclosing/src/test/java/org/apache/commons/geometry/enclosing/WelzlEncloser3DTest.java
index 8d5e3d2..a9b1dc1 100644
--- a/commons-geometry-enclosing/src/test/java/org/apache/commons/geometry/enclosing/WelzlEncloser3DTest.java
+++ b/commons-geometry-enclosing/src/test/java/org/apache/commons/geometry/enclosing/WelzlEncloser3DTest.java
@@ -100,7 +100,7 @@ public class WelzlEncloser3DTest {
}
@Test
- public void testLargeSamples() throws IOException {
+ public void testLargeSamples() {
final UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A,
0x35ddecfc78131e1dl);
final UnitSphereSampler sr = new UnitSphereSampler(3, random);
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java
index eec4b79..4f0fec1 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java
@@ -157,7 +157,7 @@ public final class Point1D extends Cartesian1D implements EuclideanPoint<Point1D
* @return point instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static Point1D parse(String str) throws IllegalArgumentException {
+ public static Point1D parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, Point1D::new);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
index df40670..10fabed 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
@@ -159,7 +159,7 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
/** {@inheritDoc} */
@Override
- public Vector1D normalize() throws IllegalStateException {
+ public Vector1D normalize() {
final double x = getX();
if (x > 0.0) {
return ONE;
@@ -210,7 +210,7 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
* <p>For the one-dimensional case, this method simply returns the current instance.</p>
*/
@Override
- public Vector1D project(final Vector1D base) throws IllegalStateException {
+ public Vector1D project(final Vector1D base) {
if (base.getX() == 0) {
throw new ZeroNormException(ZeroNormException.INVALID_BASE);
}
@@ -221,7 +221,7 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
* <p>For the one-dimensional case, this method simply returns the zero vector.</p>
*/
@Override
- public Vector1D reject(final Vector1D base) throws IllegalStateException {
+ public Vector1D reject(final Vector1D base) {
if (base.getX() == 0) {
throw new ZeroNormException(ZeroNormException.INVALID_BASE);
}
@@ -233,7 +233,7 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
* the same sign and {@code pi} if they are opposite.</p>
*/
@Override
- public double angle(final Vector1D v) throws IllegalStateException {
+ public double angle(final Vector1D v) {
final double sig1 = Math.signum(getX());
final double sig2 = Math.signum(v.getX());
@@ -309,7 +309,7 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
* @return vector instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static Vector1D parse(String str) throws IllegalArgumentException {
+ public static Vector1D parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, Vector1D::new);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java
index e7b4f38..5df7374 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Line.java
@@ -69,7 +69,7 @@ public class Line implements Embedding<Point3D, Point1D> {
* @param p2 second point belonging to the line (this can be any point, different from p1)
* @exception IllegalArgumentException if the points are equal
*/
- public void reset(final Point3D p1, final Point3D p2) throws IllegalArgumentException {
+ public void reset(final Point3D p1, final Point3D p2) {
final Vector3D delta = p2.subtract(p1);
final double norm2 = delta.getNormSq();
if (norm2 == 0.0) {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
index 639b4ae..bc3c040 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
@@ -116,7 +116,7 @@ public class Plane implements Hyperplane<Point3D>, Embedding<Point3D, Point2D> {
* @param normal normal direction to the plane
* @exception IllegalArgumentException if the normal norm is too small
*/
- public void reset(final Point3D p, final Vector3D normal) throws IllegalArgumentException {
+ public void reset(final Point3D p, final Vector3D normal) {
setNormal(normal);
originOffset = -p.asVector().dotProduct(w);
setFrame();
@@ -140,7 +140,7 @@ public class Plane implements Hyperplane<Point3D>, Embedding<Point3D, Point2D> {
* @param normal normal direction to the plane (will be copied)
* @exception IllegalArgumentException if the normal norm is too close to zero
*/
- private void setNormal(final Vector3D normal) throws IllegalArgumentException {
+ private void setNormal(final Vector3D normal) {
final double norm = normal.getNorm();
if (norm < 1.0e-10) {
throw new IllegalArgumentException("Norm is zero");
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java
index 8e15230..3958326 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java
@@ -192,7 +192,7 @@ public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D
* @return point instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static Point3D parse(String str) throws IllegalArgumentException {
+ public static Point3D parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, Point3D::new);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java
index 272d5c0..f696f37 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Rotation.java
@@ -163,7 +163,7 @@ public class Rotation implements Serializable {
* @deprecated as of 3.6, replaced with {@link #Rotation(Vector3D, double, RotationConvention)}
*/
@Deprecated
- public Rotation(Vector3D axis, double angle) throws IllegalArgumentException {
+ public Rotation(Vector3D axis, double angle) {
this(axis, angle, RotationConvention.VECTOR_OPERATOR);
}
@@ -327,7 +327,7 @@ public class Rotation implements Serializable {
* @param v desired image of u by the rotation
* @exception IllegalArgumentException if the norm of one of the vectors is zero
*/
- public Rotation(Vector3D u, Vector3D v) throws IllegalArgumentException {
+ public Rotation(Vector3D u, Vector3D v) {
double normProduct = u.getNorm() * v.getNorm();
if (normProduct == 0) {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubLine.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubLine.java
index d390536..b1721ab 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubLine.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubLine.java
@@ -58,7 +58,7 @@ public class SubLine {
* @param segment single segment forming the sub-line
* @exception IllegalArgumentException if the segment endpoints are equal
*/
- public SubLine(final Segment segment) throws IllegalArgumentException {
+ public SubLine(final Segment segment) {
this(segment.getLine(),
buildIntervalSet(segment.getStart(), segment.getEnd(), segment.getLine().getTolerance()));
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
index fd52558..75b797a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
@@ -188,7 +188,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
/** {@inheritDoc} */
@Override
- public Vector3D normalize() throws IllegalStateException {
+ public Vector3D normalize() {
return scalarMultiply(1.0 / getNonZeroNorm());
}
@@ -207,7 +207,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
* @return a new normalized vector orthogonal to the instance
* @exception IllegalStateException if the norm of the instance is zero
*/
- public Vector3D orthogonal() throws IllegalStateException {
+ public Vector3D orthogonal() {
double threshold = 0.6 * getNonZeroNorm();
final double x = getX();
@@ -233,7 +233,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
* other.</p>
*/
@Override
- public double angle(Vector3D v) throws IllegalStateException {
+ public double angle(Vector3D v) {
double normProduct = getNonZeroNorm() * v.getNonZeroNorm();
double dot = dotProduct(v);
@@ -322,13 +322,13 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
/** {@inheritDoc} */
@Override
- public Vector3D project(Vector3D base) throws IllegalStateException {
+ public Vector3D project(Vector3D base) {
return getComponent(base, false);
}
/** {@inheritDoc} */
@Override
- public Vector3D reject(Vector3D base) throws IllegalStateException {
+ public Vector3D reject(Vector3D base) {
return getComponent(base, true);
}
@@ -386,7 +386,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
* @return the non-zero norm value
* @throws IllegalStateException if the norm is zero
*/
- private double getNonZeroNorm() throws IllegalStateException {
+ private double getNonZeroNorm() {
final double n = getNorm();
if (n == 0) {
throw new ZeroNormException();
@@ -406,7 +406,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
* depending on the value of {@code reject}.
* @throws IllegalStateException if {@code base} has a zero norm
*/
- private Vector3D getComponent(Vector3D base, boolean reject) throws IllegalStateException {
+ private Vector3D getComponent(Vector3D base, boolean reject) {
final double aDotB = dotProduct(base);
final double baseMagSq = base.getNormSq();
@@ -466,7 +466,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
* @return vector instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static Vector3D parse(String str) throws IllegalArgumentException {
+ public static Vector3D parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, Vector3D::new);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/NestedLoops.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/NestedLoops.java
index a8ec823..4ee2a7c 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/NestedLoops.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/NestedLoops.java
@@ -116,7 +116,7 @@ class NestedLoops {
* @exception IllegalArgumentException if an outline has crossing
* boundary loops or open boundary loops
*/
- public void add(final Point2D[] bLoop) throws IllegalArgumentException {
+ public void add(final Point2D[] bLoop) {
add(new NestedLoops(bLoop, tolerance));
}
@@ -125,7 +125,7 @@ class NestedLoops {
* @exception IllegalArgumentException if an outline has boundary
* loops that cross each other
*/
- private void add(final NestedLoops node) throws IllegalArgumentException {
+ private void add(final NestedLoops node) {
// check if we can go deeper in the tree
for (final NestedLoops child : surrounded) {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java
index e7a89cb..fb6e23d 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java
@@ -175,7 +175,7 @@ public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D
* @return point instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static Point2D parse(String str) throws IllegalArgumentException {
+ public static Point2D parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, Point2D::new);
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
index fec9764..95313ae 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
@@ -171,7 +171,7 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
/** {@inheritDoc} */
@Override
- public Vector2D normalize() throws IllegalStateException {
+ public Vector2D normalize() {
return scalarMultiply(1.0 / getNonZeroNorm());
}
@@ -213,13 +213,13 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
/** {@inheritDoc} */
@Override
- public Vector2D project(Vector2D base) throws IllegalStateException {
+ public Vector2D project(Vector2D base) {
return getComponent(base, false);
}
/** {@inheritDoc} */
@Override
- public Vector2D reject(Vector2D base) throws IllegalStateException {
+ public Vector2D reject(Vector2D base) {
return getComponent(base, true);
}
@@ -231,7 +231,7 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
* other.</p>
*/
@Override
- public double angle(Vector2D v) throws IllegalStateException {
+ public double angle(Vector2D v) {
double normProduct = getNonZeroNorm() * v.getNonZeroNorm();
double dot = dotProduct(v);
@@ -332,7 +332,7 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
* @return the non-zero norm value
* @throws IllegalStateException if the norm is zero
*/
- private double getNonZeroNorm() throws IllegalStateException {
+ private double getNonZeroNorm() {
final double n = getNorm();
if (n == 0) {
throw new ZeroNormException();
@@ -352,7 +352,7 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
* depending on the value of {@code reject}.
* @throws IllegalStateException if {@code base} has a zero norm
*/
- private Vector2D getComponent(Vector2D base, boolean reject) throws IllegalStateException {
+ private Vector2D getComponent(Vector2D base, boolean reject) {
final double aDotB = dotProduct(base);
final double baseMagSq = base.getNormSq();
@@ -408,7 +408,7 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
* @return vector instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static Vector2D parse(String str) throws IllegalArgumentException {
+ public static Vector2D parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, Vector2D::new);
}
diff --git a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
index 242de67..9f594fc 100644
--- a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/euclidean/twod/hull/ConvexHull2D.java
@@ -154,7 +154,7 @@ public class ConvexHull2D implements ConvexHull<Point2D>, Serializable {
/** {@inheritDoc} */
@Override
- public Region<Point2D> createRegion() throws IllegalStateException {
+ public Region<Point2D> createRegion() {
if (vertices.length < 3) {
throw new IllegalStateException("Region generation requires at least 3 vertices but found only " + vertices.length);
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java
index 1d6615f..d12dc9b 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java
@@ -171,7 +171,7 @@ public final class S1Point implements Point<S1Point>, Serializable {
* @return point instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static S1Point parse(String str) throws IllegalArgumentException {
+ public static S1Point parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, S1Point::new);
}
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java
index b44ee95..08b2df6 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/EdgesBuilder.java
@@ -155,7 +155,7 @@ class EdgesBuilder implements BSPTreeVisitor<S2Point> {
* @return boundary edges
* @exception IllegalStateException if there is not a single other edge
*/
- public List<Edge> getEdges() throws IllegalStateException {
+ public List<Edge> getEdges() {
// connect the edges
for (final Edge previous : edgeToNode.keySet()) {
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java
index cd78701..ddac14d 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java
@@ -222,7 +222,7 @@ public final class S2Point implements Point<S2Point>, Serializable {
* @return point instance represented by the string
* @throws IllegalArgumentException if the given string has an invalid format
*/
- public static S2Point parse(String str) throws IllegalArgumentException {
+ public static S2Point parse(String str) {
return SimpleTupleFormat.getDefault().parse(str, S2Point::of);
}
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java
index d16ef8b..2f45169 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SphericalPolygonsSet.java
@@ -314,7 +314,7 @@ public class SphericalPolygonsSet extends AbstractRegion<S2Point, S1Point> {
* a clean non-ambiguous boundary
*/
@Override
- protected void computeGeometricalProperties() throws IllegalStateException {
+ protected void computeGeometricalProperties() {
final BSPTree<S2Point> tree = getTree(true);
@@ -366,7 +366,7 @@ public class SphericalPolygonsSet extends AbstractRegion<S2Point, S1Point> {
* @see Vertex
* @see Edge
*/
- public List<Vertex> getBoundaryLoops() throws IllegalStateException {
+ public List<Vertex> getBoundaryLoops() {
if (loops == null) {
if (getTree(false).getCut() == null) {