Methods Summary |
---|
void | assertIt(boolean b, java.lang.Object userMsg)
if (b)
{
return;
}
String msg = null;
if(userMsg != null)
{
msg = userMsg.toString();
}
else
{
msg = "boolean test was false";
}
toss(msg);
|
void | assertRange(long value, long min, long max, java.lang.Object userMsg)
if (value < min || value > max)
{
final String rangeString = "[" + min + ", " + max + "]";
String msg = "illegal integer value = " + value +
" must be in range " + rangeString;
if (userMsg != null)
{
msg += " ( " + userMsg.toString() + " )";
}
toss(msg);
}
|
void | assertValid(java.lang.Object object, java.lang.String name, com.sun.enterprise.admin.util.Validator validator)
final ValidatorResult result = validator.validate(object);
if (!result.isValid())
{
final String msg = "Validation failed for " + name +
": " + result.getString();
toss(msg);
}
|
private void | lowLevelAssert(java.lang.String s)
// if there is a problem in this code -- we can't do a normal assert or
// we are going to enter an infinite loop - since Assert calls us!!
String msg = localizedStrMgr.getString( "admin.util.fatal_error_in_setupexceptionconstructor", s );
throw new AssertError( msg );
|
private void | pr(java.lang.String s)
Debug.println(s);
|
void | setWantStackTrace(boolean what)
mWantStackTrace = what;
|
private void | toss(java.lang.String msg)An assertion has failed, do something with the message.
Our current implemention is to dump the stack trace
and throw an AssertError, so that the failure is obnoxious
and will be noticed.
String s = mPreamble + msg;
Throwable t = null;
/* yes -- the following is ugly. But there is NO WAY to throw the
* common superclass -- Throwable -- without making everyone on
* the call stack declare it!!
**/
if(mExceptionType == sIllegalArgument)
{
IllegalArgumentException iae = new IllegalArgumentException(s);
if(mWantStackTrace)
{
Debug.printStackTrace(iae);
}
throw iae;
}
else if(mExceptionType == sAssertError)
{
AssertError ae = new AssertError(s);
if(mWantStackTrace)
{
Debug.printStackTrace(ae);
}
throw ae;
}
else
{
lowLevelAssert("Impossible condition -- bad mExceptionType -- "
+ mExceptionType);
}
|