<< Back to previous view

[JDBC-155] Mismatched parameters in get-connection throws a generic error Created: 30/Aug/17  Updated: 30/Aug/17  Resolved: 30/Aug/17

Status: Closed
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Trivial
Reporter: Gary Deer Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None
Environment:

Windows 10 and Ubuntu using mysql connection string



 Description   

Example case: The user leaves off the password since it is blank but includes it in the parameter list and gets a generic error message. See my repl interaction and stacktrace below:

user=> (sql/get-connection "mysql://localhost:3306/dbname?user=root&password=")

IllegalArgumentException Vector arg to map conj must be a pair clojure.lang.ATransientMap.conj (ATransientMap.java:37)
user=> *e
#error {
:cause "Vector arg to map conj must be a pair"
:via
[{:type java.lang.IllegalArgumentException
:message "Vector arg to map conj must be a pair"
:at [clojure.lang.ATransientMap conj "ATransientMap.java" 37]}]
:trace
[[clojure.lang.ATransientMap conj "ATransientMap.java" 37]
[clojure.lang.ATransientMap conj "ATransientMap.java" 17]
[clojure.core$conj_BANG_ invokeStatic "core.clj" 3257]
[clojure.core$conj_BANG_ invoke "core.clj" 3249]
[clojure.core.protocols$fn__6755 invokeStatic "protocols.clj" 167]
[clojure.core.protocols$fn__6755 invoke "protocols.clj" 124]
[clojure.core.protocols$fn__6710$G__6705__6719 invoke "protocols.clj" 19]
[clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 31]
[clojure.core.protocols$fn__6738 invokeStatic "protocols.clj" 75]
[clojure.core.protocols$fn__6738 invoke "protocols.clj" 75]
[clojure.core.protocols$fn__6684$G__6679__6697 invoke "protocols.clj" 13]
[clojure.core$reduce invokeStatic "core.clj" 6545]
[clojure.core$into invokeStatic "core.clj" 6610]
[clojure.core$into invoke "core.clj" 6604]
[clojure.java.jdbc$parse_properties_uri invokeStatic "jdbc.clj" 191]
[clojure.java.jdbc$parse_properties_uri invoke "jdbc.clj" 173]
[clojure.java.jdbc$get_connection invokeStatic "jdbc.clj" 285]
[clojure.java.jdbc$get_connection invoke "jdbc.clj" 217]
[clojure.java.jdbc$get_connection invokeStatic "jdbc.clj" 282]
[clojure.java.jdbc$get_connection invoke "jdbc.clj" 217]
[clojure.java.jdbc$get_connection invokeStatic "jdbc.clj" 269]
[clojure.java.jdbc$get_connection invoke "jdbc.clj" 217]
[user$eval1742 invokeStatic "form-init616569001033050422.clj" 1]
[user$eval1742 invoke "form-init616569001033050422.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 6927]
[clojure.lang.Compiler eval "Compiler.java" 6890]
[clojure.core$eval invokeStatic "core.clj" 3105]
[clojure.core$eval invoke "core.clj" 3101]
[clojure.main$repl$read_eval_print__7408$fn__7411 invoke "main.clj" 240]
[clojure.main$repl$read_eval_print__7408 invoke "main.clj" 240]
[clojure.main$repl$fn__7417 invoke "main.clj" 258]
[clojure.main$repl invokeStatic "main.clj" 258]
[clojure.main$repl doInvoke "main.clj" 174]
[clojure.lang.RestFn invoke "RestFn.java" 1523]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__648 invoke "interruptible_eval.clj" 87]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.AFn applyTo "AFn.java" 144]
[clojure.core$apply invokeStatic "core.clj" 646]
[clojure.core$with_bindings_STAR_ invokeStatic "core.clj" 1881]
[clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1881]
[clojure.lang.RestFn invoke "RestFn.java" 425]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate invokeStatic "interruptible_eval.clj" 85]
[clojure.tools.nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 55]
[clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__693$fn__696 invoke "interruptible_eval.clj" 222]
[clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__688 invoke "interruptible_eval.clj" 190]
[clojure.lang.AFn run "AFn.java" 22]
[java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1142]
[java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 617]
[java.lang.Thread run "Thread.java" 745]]}



 Comments   
Comment by Sean Corfield [ 30/Aug/17 12:19 PM ]

parse-properties-uri did not check that .split returned two values. Changed to call juxt instead of vec so password= will produce ["password" nil].

Comment by Sean Corfield [ 30/Aug/17 12:20 PM ]

In 0.7.1 release (which should be on Maven later today).

Generated at Wed Dec 13 03:07:57 CST 2017 using JIRA 4.4#649-r158309.