Removed unused exception.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1178234 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2011-10-02 19:41:48 +00:00
parent 2059461aff
commit 76b57cddf3
3 changed files with 5 additions and 143 deletions

View File

@ -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);
}
}

View File

@ -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());
}
}

View File

@ -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);