This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: java.lang.NullPointerException when loading SSAX.scm in kawa-1.7
- From: Per Bothner <per at bothner dot com>
- To: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- Cc: kawa at sources dot redhat dot com, stan at altosw dot be
- Date: Wed, 16 Jul 2003 00:10:22 -0700
- Subject: Re: java.lang.NullPointerException when loading SSAX.scm in kawa-1.7
- References: <9F8582E37B2EE5498E76392AEDDCD3FE05705F39@G8PQD.blf01.telekom.de>
Hoehle, Joerg-Cyril wrote:
#|kawa:69|# (catch #t (lambda () (+ "abc" 1)) (lambda _ #f))
java.lang.NullPointerException
Attached is a patch so Kawa no longer fails at compile time.
However, the run-time error message is still not so good.
BTW, while running in Emacs, does anybody know how to get Java/Kawa to immediately flush current-error-port?
Invoking (newline (current-error-port)) by hand is quite annoying (and since the messages come out of sync, I already got confused a few times).
Well, the default error port should have autoflush set.
Though adding an explicit flush for 9say) SourceMessages.printAll
might be a good idea.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
Index: gnu/expr/ApplyExp.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/ApplyExp.java,v
retrieving revision 1.57
diff -u -r1.57 ApplyExp.java
--- gnu/expr/ApplyExp.java 5 Apr 2003 22:27:10 -0000 1.57
+++ gnu/expr/ApplyExp.java 16 Jul 2003 06:51:16 -0000
@@ -449,16 +449,21 @@
public static Expression inlineIfConstant(Procedure proc, ApplyExp exp)
{
- int len = exp.args.length;
+ return exp.inlineIfConstant(proc, (ExpWalker) null);
+ }
+
+ public final Expression inlineIfConstant(Procedure proc, ExpWalker walker)
+ {
+ int len = args.length;
for (int i = len; --i >= 0; )
{
- if (! (exp.args[i] instanceof QuoteExp))
- return exp;
+ if (! (args[i] instanceof QuoteExp))
+ return this;
}
Object[] vals = new Object[len];
for (int i = len; --i >= 0; )
{
- vals[i] = ((QuoteExp) (exp.args[i])).getValue();
+ vals[i] = ((QuoteExp) (args[i])).getValue();
}
try
{
@@ -466,8 +471,10 @@
}
catch (Throwable ex)
{
- // Should emit error message or warning. FIXME.
- return null;
+ if (walker.messages != null)
+ walker.messages.error('w', "call to " + proc +
+ " throws " + ex);
+ return this;
}
}
}
Index: gnu/kawa/functions/AddOp.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/functions/AddOp.java,v
retrieving revision 1.9
diff -u -r1.9 AddOp.java
--- gnu/kawa/functions/AddOp.java 14 Jul 2003 19:49:59 -0000 1.9
+++ gnu/kawa/functions/AddOp.java 16 Jul 2003 06:51:16 -0000
@@ -112,7 +112,7 @@
public Expression inline (ApplyExp exp, ExpWalker walker)
{
- Expression folded = ApplyExp.inlineIfConstant(this, exp);
+ Expression folded = exp.inlineIfConstant(this, walker);
if (folded != exp)
return folded;
Expression[] args = exp.getArgs();