public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Ito Kazumitsu <kaz@maczuka.gcd.org>
To: kawa@sourceware.org
Subject: kawa 1.14: java.io.PrintWriter prints everything as "true"
Date: Tue, 08 Oct 2013 04:19:00 -0000	[thread overview]
Message-ID: <20131008.131857.433844808.kaz@maczuka.gcd.org> (raw)

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)

             reply	other threads:[~2013-10-08  4:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08  4:19 Ito Kazumitsu [this message]
2013-10-08  7:05 ` Per Bothner
2013-10-09  1:51   ` Ito Kazumitsu
2013-10-09  5:56     ` Per Bothner
2013-10-13  7:03       ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131008.131857.433844808.kaz@maczuka.gcd.org \
    --to=kaz@maczuka.gcd.org \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).