This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
broken (field x 'length) testcase
- From: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- To: kawa at sources dot redhat dot com
- Date: Tue, 9 Dec 2003 13:54:14 +0100
- Subject: broken (field x 'length) testcase
Hi,
I came across the following bug in kawa-1.7:
(define (cmp-bytes b1 ;expected value
b2 ;value from DB
field
)
(write (list b1 b2))(newline)
(let ((l1 (field b1 'length)))
;;(write l1)
(values)))
(cmp-bytes (Base64:decode "ABCD") (Base64:decode "ABCD") "CRI")
([B@19ffac2 [B@7db7d)
Invalid parameter, was: null
java.lang.ClassCastException
at atInteractiveLevel.cmpBytes(Unknown Source)
at atInteractiveLevel.apply3(Unknown Source)
at gnu.expr.ModuleBody.applyN(ModuleBody.java:175)
at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:105)
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.Shell.run(Shell.java:180)
at kawa.Shell.run(Shell.java:167)
at kawa.Shell.run(Shell.java:154)
at kawa.repl.main(repl.java:609)
;this works: no extra argument
(define (cmp-bytes b1 :: <byte[]> ;expected value
b2 :: <byte[]> ;value from DB
) <void>
(write (list b1 b2))(newline)
(let* ((l1 (field b1 'length)))
;;(write l1)
(values)))
;(cmp-bytes (Base64:decode "ABCD") (Base64:decode "ABCD"))
; this breaks as well, with same error
(define (cmp-bytes b1 :: <byte[]> ;expected value
b2 :: <byte[]> ;value from DB
field
) <void>
(write (list b1 b2))(newline)
(let* ((l1 ((primitive-array-length <byte[]>) b1)))
;; note inadvertant error here: ^^
;;(write l1)
(values)))
Weird -- I would have sworn that I'd have used `field' somewhere in my code.
This works, despite the extra argument:
(define (cmp-bytes b1 :: <byte[]> ;expected value
b2 :: <byte[]> ;value from DB
field
) <void>
(write (list b1 b2))(newline)
(let* ((l1 ((primitive-array-length <byte>) b1)))
(write l1)
(values)))
so maybe an extra [] is also field's error cause in the Kawa sources (but that would still not explain the working case with only two arguments)?
Regards,
Jorg Hohle.