[armedbear-cvs] r12363 - branches/0.18.x/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Mon Jan 11 20:37:31 UTC 2010
Author: ehuelsmann
Date: Mon Jan 11 15:37:22 2010
New Revision: 12363
Log:
Backport r12350 upto 12355 and 12359:
fixes to recently added functionality.
Modified:
branches/0.18.x/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java
Modified: branches/0.18.x/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java
==============================================================================
--- branches/0.18.x/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java (original)
+++ branches/0.18.x/abcl/src/org/armedbear/lisp/WrongNumberOfArgumentsException.java Mon Jan 11 15:37:22 2010
@@ -37,15 +37,30 @@
public final class WrongNumberOfArgumentsException extends ProgramError
{
- private final Operator operator;
+ private Operator operator;
+ private int expectedArgs;
+ private String message;
- public WrongNumberOfArgumentsException(Operator operator)
+ public WrongNumberOfArgumentsException(Operator operator) {
+ this(operator, -1);
+ }
- {
+ public WrongNumberOfArgumentsException(Operator operator, int expectedArgs) {
// This is really just an ordinary PROGRAM-ERROR, broken out into its
// own Java class as a convenience for the implementation.
super(StandardClass.PROGRAM_ERROR);
this.operator = operator;
+ this.expectedArgs = expectedArgs;
+ setFormatControl(getMessage());
+ setFormatArguments(NIL);
+ }
+
+ public WrongNumberOfArgumentsException(String message) {
+ super(StandardClass.PROGRAM_ERROR);
+ if(message == null) {
+ throw new NullPointerException("message can not be null");
+ }
+ this.message = message;
setFormatControl(getMessage());
setFormatArguments(NIL);
}
@@ -53,6 +68,9 @@
@Override
public String getMessage()
{
+ if(message != null) {
+ return message;
+ }
FastStringBuffer sb =
new FastStringBuffer("Wrong number of arguments");
LispObject lambdaName = operator.getLambdaName();
@@ -60,7 +78,12 @@
sb.append(" for ");
sb.append(operator.getLambdaName().writeToString());
}
+ if(expectedArgs >= 0) {
+ sb.append("; ");
+ sb.append(expectedArgs);
+ sb.append(" expected");
+ }
sb.append('.');
- return sb.toString();
+ return message = sb.toString();
}
}
More information about the armedbear-cvs
mailing list