bugKawa - Bugs: bug #4291, java.lang.NullPointerException...

 
 

bug #4291: java.lang.NullPointerException when loading SSAX.scm in kawa-1.7

Submitter:  None
Submitted:  Sun 13 Jul 2003 04:03:03 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 23 Mar 2005 06:53:29 AM UTC, comment #3: 

I have reduced the testcase to this:

OK:

 (letrec
  ((consumer (lambda (fragment foll-fragment seed) seed))
   (test
    (lambda (str expected-result)
     (let
      ((result
         (lambda (port) (list port consumer (quote ())))))
      (write result)
      ))))
  (test "abcd" (quote ("abcd" "" "]" "")))
 )
 
FAILS:
 
  (letrec
  ((consumer (lambda (fragment foll-fragment seed) seed))
   (test
    (lambda (str expected-result)
     (let
      ((result
         (lambda (port) (list port consumer (quote ())))))
      (write result)
      ))))
  (test "abcd" (quote ("abcd" "" "]" "")))
  (test "abcd" (quote ("abcd" "" "]" "" "]" "")))
 )
 

Jim White <jimwhite>
Thu 17 Jul 2003 04:24:22 AM UTC, comment #2: 

To debug this I need a complete testcase (with instructions).
It would be very helpful if you could come up with a minimal testcase, that I can include in the testcase, though that is sometimes difficult until the bug is identified.
But at least if you can at least strip away irrelevant classes and methods that would help.

Per Bothner <bothner>
Group administrator
Sun 13 Jul 2003 04:09:51 AM UTC, comment #1: 

The exception only occurs with more than one "test".  If there is just one, then it compiles OK.

It has something to do with this code at gnu.expr.LambdaExp(935):

   LambdaExp owner = this;
   while (owner.heapFrame == null)
      owner = owner.outerLambda();
   closureEnvType = (ClassType) owner.heapFrame.getType();

Which might need to look something like this:

   LambdaExp owner = this;
   while (owner.heapFrame == null) {
      owner = owner.outerLambda();
      if (owner == null) {
         // Do something about the heap frame situation.
      }
   }
   closureEnvType = (ClassType) owner.heapFrame.getType();

But I don't know enough about Kawa compilation to understand if this where the fix goes or if this is just symptomatic.  It has something to do with the closure situation with siblings and let forms but that's all Greek to me.

Jim White <jimwhite>
Sun 13 Jul 2003 04:03:03 AM UTC, original submission:  

hello,

when loading SSAX.scm, I am getting the following:

java.lang.NullPointerException
        at gnu.expr.LambdaExp.allocChildClasses(LambdaExp.java:936)
        at gnu.expr.LambdaExp.compileAsMethod(LambdaExp.java:1352)
        at gnu.expr.LambdaExp.compileChildMethods(LambdaExp.java:1256)
        at gnu.expr.Compilation.addClass(Compilation.java:1521)
        at gnu.expr.Compilation.compile(Compilation.java:799)
        at gnu.expr.ModuleExp.evalToClass(ModuleExp.java:54)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:166)
        at kawa.Shell.run(Shell.java:232)
        at kawa.standard.load.loadSource(load.java:162)
        at kawa.standard.load.loadSource(load.java:131)
        at kawa.standard.load.apply(load.java:233)
        at kawa.standard.load.apply2(load.java:201)
        at kawa.standard.load.apply1(load.java:191)
        at gnu.mapping.Procedure1.applyN(Procedure1.java:49)
        at gnu.mapping.Procedure.apply(Procedure.java:102)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:258)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:188)
        at kawa.Shell.run(Shell.java:232)
        at kawa.standard.load.loadSource(load.java:162)
        at kawa.standard.load.loadSource(load.java:131)
        at kawa.standard.load.apply(load.java:233)
        at kawa.Shell.runFile(Shell.java:295)
        at kawa.repl.processArgs(repl.java:231)
        at kawa.repl.main(repl.java:593)

the problem happens in this form:

; a few lines of validation code
(run-test (letrec
  ((consumer (lambda (fragment foll-fragment seed)
     (cons* (if (equal? foll-fragment (string #\newline))
" NL" foll-fragment) fragment seed)))
   (test (lambda (str expected-result)
   (newline) (display "body: ") (write str)
   (newline) (display "Result: ")
   (let ((result
   (reverse
     (call-with-input-string (unesc-string str)
       (lambda (port) (ssax:read-cdata-body port consumer '()))
       ))))
     (write result)
     (assert (equal? result expected-result)))))
   )
  (test "]]>" '())
  (test "abcd]]>" '("abcd" ""))
  (test "abcd]]]>" '("abcd" "" "]" ""))
  (test "abcd]]]]>" '("abcd" "" "]" "" "]" ""))
  (test "abcd]]]]]>" '("abcd" "" "]" "" "]" "" "]" ""))
  (test "abcd]]]a]]>" '("abcd" "" "]" "" "]]" "" "a" ""))
  (test "abc%r%ndef%n]]>" '("abc" " NL" "def" " NL"))
  (test "%r%n%r%n]]>" '("" " NL" "" " NL"))
  (test "%r%n%r%na]]>" '("" " NL" "" " NL" "a" ""))
  (test "%r%r%r%na]]>" '("" " NL" "" " NL" "" " NL" "a" ""))
  (test "abc&!!!]]>" '("abc" "&" "" "" "!!!" ""))
  (test "abc]]&gt;&gt&amp;]]]&gt;and]]>"
    '("abc" "" "]]" "" "" ">" "" "&" "gt" "" "" "&" "amp" "" ";" "" "]" ""
      "]]" "" "" ">" "and" ""))
))


I can mail my version of the SSAX library, to reproduce the example. (295K)

Should I run kawa using debugging options, to help sort out what happens?

thanks,

Stan.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code