phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-2368) Call Driver.accept() in Driver.getConnection and return null if false
Date Thu, 07 Jan 2016 08:07:39 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15087048#comment-15087048
] 

James Taylor commented on PHOENIX-2368:
---------------------------------------

+1. Thanks, [~ram_krish]. One minor nit in PhoenixDriver: no need to do super.createConnection()
here, just do createConnection() instead. Also, make the createConnection() method final in
PhoenixEmbeddedDriver.
{code}
     @Override
     public Connection connect(String url, Properties info) throws SQLException {
+        if (!acceptsURL(url)) {
+          return null;
+        }
         try {
             closeLock.readLock().lock();
             checkClosed();
-            return super.connect(url, info);
+            return super.createConnection(url, info);
         } finally {
             closeLock.readLock().unlock();
         }
{code}

> Call Driver.accept() in Driver.getConnection and return null if false
> ---------------------------------------------------------------------
>
>                 Key: PHOENIX-2368
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2368
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: ramkrishna.s.vasudevan
>              Labels: SFDC, newbie
>             Fix For: 4.7.0
>
>         Attachments: PHOENIX-2368.patch, PHOENIX-2368.patch
>
>
> The driver should return "null" if it realizes it is the wrong kind of driver to connect
to the given URL.
> Your driver is throwing an exception instead of returning null.
> Here's the start of a test case:
> {code}
> public static void main(String[] args) throws Exception {
>     Class.forName(PhoenixDriver.class.getName());
>     PhoenixDriver d = (PhoenixDriver) DriverManager.getDriver("jdbc:phoenix");
>     d.close();
>     DriverManager.getConnection("any text whatever you want to put here");
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message