bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #36335] NPE on syntax error


From: Charles H. Turner
Subject: [Bug-kawa] [bug #36335] NPE on syntax error
Date: Sun, 29 Apr 2012 11:17:42 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0

URL:
  <http://savannah.gnu.org/bugs/?36335>

                 Summary: NPE on syntax error
                 Project: Kawa
            Submitted by: charlest
            Submitted on: Sun 29 Apr 2012 11:17:42 AM GMT
                Category: Scheme language
                Severity: 3 - Normal
              Item Group: Run-time exception
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

The following should output a syntax error rather than a NPE:

#|kawa:1|# (zero? (define-simple-class))
java.lang.NullPointerException
       at kawa.standard.define_class.rewriteForm(define_class.java:122)
...

Jamison investigated this on the mailing lists:

"The cause is that define_class#rewriteForm() does this:

   Declaration decl = null;
   Object form_cdr = form.getCdr(); // form is the list (define-simple-class),
so form_cdr is ()
   if (form_cdr instanceof Pair)    // and () is not a pair, so we skip
directly to line 122
     {
       ...
     }
   ClassExp oexp = (ClassExp) decl.getValue(); // here, where decl is still
null, triggering the NPE


So that if statement should probably have an else clause, something like

   else
   {
     return tr.syntaxError(this.getName() + ": missing class name");
   }

or maybe "else if (form_cdr == EmptyList.emptyList) { ... } else {...}"
so other bad syntax like "(define-simple-class . 42)" can have a different
error message."

Just needs to be patched. I'll do this eventually, putting it on Savannah so
that it's not forgotten.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36335>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]