Robert Chilton's experience inspired me to make the handling of errors and

warnings in ACIP->Tibetan conversion much more configurable.  You can
now choose from short or long error messages, for one thing.  You can change
the severity of almost all warnings.  Each error and warning has an error code.
Errors and warnings are better tested.

The converter GUI has a new checkbox for short messages; the converter
CLI has a new mandatory option for short messages.

I also fixed a bug whereby certain errors were not being appended to the
'errors' StringBuffer.
This commit is contained in:
dchandler 2004-04-24 17:49:16 +00:00
parent cc5d096918
commit e2d42f36eb
22 changed files with 1106 additions and 506 deletions

View file

@ -10,7 +10,7 @@ License for the specific terms governing rights and limitations under the
License.
The Initial Developer of this software is the Tibetan and Himalayan Digital
Library (THDL). Portions created by the THDL are Copyright 2001 THDL.
Library (THDL). Portions created by the THDL are Copyright 2001, 2004 THDL.
All Rights Reserved.
Contributor(s): ______________________________________.
@ -45,50 +45,57 @@ package org.thdl.util;
*/
public final class ThdlLazyException extends Error {
/**
* the wrapped exception
*/
private Throwable wrappedException = null;
/**
* the wrapped exception
*/
private Throwable wrappedException = null;
/**
* Constructor for ThdlLazyException.
*/
public ThdlLazyException() {
super();
}
/**
* Constructor for ThdlLazyException.
*/
public ThdlLazyException() {
super();
}
/**
* Constructor for ThdlLazyException.
* @param descrip description
*/
public ThdlLazyException(String descrip) {
super(descrip);
}
/**
* Constructor for ThdlLazyException.
* @param descrip description
*/
public ThdlLazyException(String descrip) {
super(descrip);
}
/**
* Constructor for ThdlLazyException.
* @param descrip description
* @param realException the exception the user should actually care about
*/
public ThdlLazyException(String descrip, Throwable realException) {
super(descrip);
wrappedException = realException;
}
/**
* Constructor for ThdlLazyException.
* @param descrip description
* @param realException the exception the user should actually care about
*/
public ThdlLazyException(String descrip, Throwable realException) {
super(descrip);
wrappedException = realException;
}
/**
* Constructor for ThdlLazyException.
* @param realException the exception the user should actually care about
*/
public ThdlLazyException(Throwable realException) {
super();
wrappedException = realException;
}
/**
* Constructor for ThdlLazyException.
* @param realException the exception the user should actually care about
*/
public ThdlLazyException(Throwable realException) {
super();
wrappedException = realException;
}
/**
* Returns the wrapped exception, the one about which you should actually
* be concerned.
*/
public Throwable getRealException() {
return wrappedException;
}
/**
* Returns the wrapped exception, the one about which you should actually
* be concerned.
*/
public Throwable getRealException() {
return wrappedException;
}
public String toString() {
return "ThdlLazyException [" + super.toString() + "] wrapping " + ((getRealException() == null) ? "nothing" : getRealException().toString());
}
public String getMessage() {
return "ThdlLazyException [" + super.getMessage() + "] wrapping " + ((getRealException() == null) ? "nothing" : getRealException().getMessage());
}
}

View file

@ -87,7 +87,8 @@ public class ThdlLazyExceptionTest extends TestCase {
public void testThdlLazyExceptionString() {
String msg = "foo";
ThdlLazyException e = new ThdlLazyException(msg);
assertTrue(msg.equals(e.getMessage()));
assertTrue("Oops: " + e.getMessage(),
"ThdlLazyException [foo] wrapping nothing".equals(e.getMessage()));
assertTrue(null == e.getRealException());
}
@ -98,7 +99,8 @@ public class ThdlLazyExceptionTest extends TestCase {
String msg = "foo";
IOException ioe = new IOException("bah");
ThdlLazyException e = new ThdlLazyException(msg, ioe);
assertTrue(msg.equals(e.getMessage()));
assertTrue("oops: " + e.getMessage(),
"ThdlLazyException [foo] wrapping bah".equals(e.getMessage()));
assertTrue(ioe.equals(e.getRealException()));
assertTrue("bah".equals(e.getRealException().getMessage()));
}