This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
kawa 1.14: java.io.PrintWriter prints everything as "true"
- From: Ito Kazumitsu <kaz at maczuka dot gcd dot org>
- To: kawa at sourceware dot org
- Date: Tue, 08 Oct 2013 13:18:57 +0900 (JST)
- Subject: kawa 1.14: java.io.PrintWriter prints everything as "true"
- Authentication-results: sourceware.org; auth=none
I have found another case where kawa 1.14 behaves differently from kawa 1.13.
The script used for this test is attached below.
=================================================================
$ java -cp /mnt/ph/javalib/kawa-1.13.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member test.scm
1
End of List
$ java -cp /mnt/ph/javalib/kawa-1.13.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member --script test.scm
1
End of List
$ java -cp /mnt/ph/javalib/kawa-1.14.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member test.scm
1
End of List
$ java -cp /mnt/ph/javalib/kawa-1.14.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member --script test.scm
truetrue
true
=================================================================
As seen from the last case, using kawa 1.14 with the command line option
"--script", java.io.PrintWriter prints everything as "true".
The test script depends on SQLite JDBC Driver:
https://bitbucket.org/xerial/sqlite-jdbc
I could not make a simpler test script without using SQLite JDBC Driver.
But since it works fine with kawa 1.13, I am afraid there is something
wrong whith kawa 1.14.
Here is the test script:
(define driverName "org.sqlite.JDBC")
(define connectionURL "jdbc:sqlite:test.db")
(define userID "sa")
(define passwd "")
(define outenc "UTF-8")
(define wtr
(java.io.PrintWriter
(java.io.OutputStreamWriter (java.lang.System:.out) outenc)))
(java.lang.Class:forName driverName)
(define c ::java.sql.Connection
(java.sql.DriverManager:getConnection connectionURL userID passwd))
(define (show-rs rs colmax)
(let loop ((i 1))
(cond
((> i colmax)
(wtr:println))
(#t
(let ((o (java.sql.ResultSet:getObject rs i)))
(cond
((equal? o #!null)
(wtr:print "NULL"))
(#t
(wtr:print (o:toString))))
(wtr:print "\t")
(loop (+ i 1)))))))
(define (exec-sql s)
(let ((st ::java.sql.Statement (c:createStatement)))
(try-catch
(begin
(cond
((st:execute s)
(let* ((rs ::java.sql.ResultSet (st:getResultSet))
(meta ::java.sql.ResultSetMetaData (rs:getMetaData))
(colmax (meta:getColumnCount)))
(let rsloop ()
(cond
((rs:next)
(show-rs rs colmax)
(rsloop))))
(wtr:println "End of List")))
(#t
(let ((uc (st:getUpdateCount)))
(wtr:print "Update Count =")
(wtr:println uc))))
(st:close))
(e <java.lang.Exception>
(begin
(wtr:println e)))))
(wtr:flush))
(exec-sql "SELECT 1")
(c:close)