<< Back to previous view

[JDBC-156] Incorrect connection-uri spec Created: 13/Sep/17  Updated: 13/Sep/17  Resolved: 13/Sep/17

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

Type: Defect Priority: Major
Reporter: Ikuru Kanuma Assignee: Sean Corfield
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File jdbc-156.patch    


:connection-uri needs to be a String(based on implementation + doc).

However, the spec for connection-uri is defined as (s/def ::connection-uri #(instance? java.net.URI %)) .
This causes exceptions in the following manner when the spec is instrumented.


(require '[clojure.java.jdbc :as db])
(db/get-connection {:connection-uri "jdbc:h2:./foo"})
=> #object[org.h2.jdbc.JdbcConnection 0x553dd729 "conn4: url=jdbc:h2:./foo user="]
(require '[clojure.spec.test.alpha :as check]) (require 'clojure.java.jdbc.spec)
(db/get-connection {:connection-uri "jdbc:h2:./foo"})
=> Spec error

(db/get-connection {:connection-uri "jdbc:h2:./foo"})
=> #object[org.h2.jdbc.JdbcConnection 0x553dd729 "conn4: url=jdbc:h2:./foo

Comment by Ikuru Kanuma [ 13/Sep/17 9:59 PM ]

Confirmed that the attached patch resolves the issue

Comment by Sean Corfield [ 13/Sep/17 9:59 PM ]

Good catch! Thank you! Will be in 0.7.2.

Comment by Sean Corfield [ 13/Sep/17 10:02 PM ]

I changed the spec to just string? which is more idiomatic than checking instance? java.lang.String.

Comment by Ikuru Kanuma [ 13/Sep/17 10:05 PM ]

Sounds good! Thanks for the quick response.

Generated at Wed Sep 20 20:32:43 CDT 2017 using JIRA 4.4#649-r158309.