From 76b57cddf3d0a4d0b2881e8343b7bee2a505d714 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Sun, 2 Oct 2011 19:41:48 +0000 Subject: [PATCH] Removed unused exception. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1178234 13f79535-47bb-0310-9956-ffa450edef68 --- .../math/MathConfigurationException.java | 94 ------------------- .../math/MathConfigurationExceptionTest.java | 46 --------- .../commons/math/MathExceptionTest.java | 8 +- 3 files changed, 5 insertions(+), 143 deletions(-) delete mode 100644 src/main/java/org/apache/commons/math/MathConfigurationException.java delete mode 100644 src/test/java/org/apache/commons/math/MathConfigurationExceptionTest.java diff --git a/src/main/java/org/apache/commons/math/MathConfigurationException.java b/src/main/java/org/apache/commons/math/MathConfigurationException.java deleted file mode 100644 index 1f60d0534..000000000 --- a/src/main/java/org/apache/commons/math/MathConfigurationException.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math; - -import java.io.Serializable; - -import org.apache.commons.math.exception.util.DummyLocalizable; -import org.apache.commons.math.exception.util.Localizable; - -/** - * Signals a configuration problem with any of the factory methods. - * @version $Id$ - */ -public class MathConfigurationException extends MathException implements Serializable{ - - /** Serializable version identifier */ - private static final long serialVersionUID = 5261476508226103366L; - - /** - * Default constructor. - */ - public MathConfigurationException() { - super(); - } - - /** - * Constructs an exception with specified formatted detail message. - * Message formatting is delegated to {@link java.text.MessageFormat}. - * @param pattern format specifier - * @param arguments format arguments - * @since 1.2 - */ - public MathConfigurationException(String pattern, Object ... arguments) { - this(new DummyLocalizable(pattern), arguments); - } - - /** - * Constructs an exception with specified formatted detail message. - * Message formatting is delegated to {@link java.text.MessageFormat}. - * @param pattern format specifier - * @param arguments format arguments - * @since 2.2 - */ - public MathConfigurationException(Localizable pattern, Object ... arguments) { - super(pattern, arguments); - } - - /** - * Create an exception with a given root cause. - * @param cause the exception or error that caused this exception to be thrown - */ - public MathConfigurationException(Throwable cause) { - super(cause); - } - - /** - * Constructs an exception with specified formatted detail message and root cause. - * Message formatting is delegated to {@link java.text.MessageFormat}. - * @param cause the exception or error that caused this exception to be thrown - * @param pattern format specifier - * @param arguments format arguments - * @since 1.2 - */ - public MathConfigurationException(Throwable cause, String pattern, Object ... arguments) { - this(cause, new DummyLocalizable(pattern), arguments); - } - - /** - * Constructs an exception with specified formatted detail message and root cause. - * Message formatting is delegated to {@link java.text.MessageFormat}. - * @param cause the exception or error that caused this exception to be thrown - * @param pattern format specifier - * @param arguments format arguments - * @since 2.2 - */ - public MathConfigurationException(Throwable cause, Localizable pattern, Object ... arguments) { - super(cause, pattern, arguments); - } - -} diff --git a/src/test/java/org/apache/commons/math/MathConfigurationExceptionTest.java b/src/test/java/org/apache/commons/math/MathConfigurationExceptionTest.java deleted file mode 100644 index 08928f57a..000000000 --- a/src/test/java/org/apache/commons/math/MathConfigurationExceptionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math; - - -import java.util.Locale; - -import org.junit.Assert; -import org.junit.Test; - -/** - * @version $Id$ - */ -public class MathConfigurationExceptionTest { - - @Test - public void testConstructor(){ - MathConfigurationException ex = new MathConfigurationException(); - Assert.assertNull(ex.getCause()); - Assert.assertEquals("", ex.getMessage()); - Assert.assertEquals("", ex.getMessage(Locale.FRENCH)); - } - - @Test - public void testConstructorCause(){ - String inMsg = "inner message"; - Exception cause = new Exception(inMsg); - MathConfigurationException ex = new MathConfigurationException(cause); - Assert.assertEquals(cause, ex.getCause()); - } -} diff --git a/src/test/java/org/apache/commons/math/MathExceptionTest.java b/src/test/java/org/apache/commons/math/MathExceptionTest.java index b2032ce68..26f129c02 100644 --- a/src/test/java/org/apache/commons/math/MathExceptionTest.java +++ b/src/test/java/org/apache/commons/math/MathExceptionTest.java @@ -23,8 +23,10 @@ import java.io.PrintStream; import java.io.PrintWriter; import java.util.Locale; +import org.apache.commons.math.exception.MathIllegalStateException; import org.apache.commons.math.exception.util.DummyLocalizable; import org.apache.commons.math.exception.util.Localizable; +import org.apache.commons.math.exception.util.LocalizedFormats; import org.junit.Assert; import org.junit.Test; @@ -56,7 +58,7 @@ public class MathExceptionTest { public void testPrintStackTrace() { Localizable outMsg = new DummyLocalizable("outer message"); Localizable inMsg = new DummyLocalizable("inner message"); - MathException cause = new MathConfigurationException(inMsg); + MathIllegalStateException cause = new MathIllegalStateException(LocalizedFormats.SIMPLE_MESSAGE, inMsg); MathException ex = new MathException(cause, outMsg); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); @@ -64,7 +66,7 @@ public class MathExceptionTest { String stack = baos.toString(); String outerMsg = "org.apache.commons.math.MathException: outer message"; String innerMsg = "Caused by: " + - "org.apache.commons.math.MathConfigurationException: inner message"; + "org.apache.commons.math.exception.MathIllegalStateException: inner message"; Assert.assertTrue(stack.startsWith(outerMsg)); Assert.assertTrue(stack.indexOf(innerMsg) > 0); @@ -82,7 +84,7 @@ public class MathExceptionTest { public void testSerialization() { Localizable outMsg = new DummyLocalizable("outer message"); Localizable inMsg = new DummyLocalizable("inner message"); - MathException cause = new MathConfigurationException(inMsg); + MathIllegalStateException cause = new MathIllegalStateException(LocalizedFormats.SIMPLE_MESSAGE, inMsg); MathException ex = new MathException(cause, outMsg); MathException image = (MathException) TestUtils.serializeAndRecover(ex);