You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ruth Cao (JIRA)" <ji...@apache.org> on 2007/06/18 09:03:51 UTC

[jira] Created: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it

[classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it
------------------------------------------------------------------------------------------------

                 Key: HARMONY-4205
                 URL: https://issues.apache.org/jira/browse/HARMONY-4205
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Windows XP / Linux
            Reporter: Ruth Cao


The following test case shows the bug:

 public void test_registerDriver_MultiTimes() throws SQLException {
        int register_count = 10;
        int deregister_count = 1;

        Driver dummy = new DummyDriver();
        DriverManager.registerDriver(new BadDummyDriver());
        for (int i = 0; i < register_count; i++) {
            DriverManager.registerDriver(dummy);
        }
        DriverManager.registerDriver(new BadDummyDriver());
        for (int i = 0; i < deregister_count; i++) {
            DriverManager.deregisterDriver(dummy);
        }
        Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
        assertNotNull(d);
    }
    
    private static class BadDummyDriver extends DummyDriver {
        public boolean acceptsURL(String url) {
            return false;
        }
    }

    private static class DummyDriver implements Driver {

        String goodurl = "jdbc:dummy_protocol:dummy_subname";

        public boolean acceptsURL(String url) {
            return url.equals(goodurl);
        }

        public Connection connect(String url, Properties info) {
            return null;
        }

        public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
            return null;
        }

        public int getMajorVersion() {
            return 0;
        }

        public int getMinorVersion() {
            return 0;
        }

        public boolean jdbcCompliant() {
            return true;
        }

    }

It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. 

I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it

Posted by "Ruth Cao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruth Cao updated HARMONY-4205:
------------------------------

    Attachment: Harmony-4205.diff

May somebody pls try this?

> [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4205
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4205
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP / Linux
>            Reporter: Ruth Cao
>         Attachments: Harmony-4205.diff
>
>
> The following test case shows the bug:
>  public void test_registerDriver_MultiTimes() throws SQLException {
>         int register_count = 10;
>         int deregister_count = 1;
>         Driver dummy = new DummyDriver();
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < register_count; i++) {
>             DriverManager.registerDriver(dummy);
>         }
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < deregister_count; i++) {
>             DriverManager.deregisterDriver(dummy);
>         }
>         Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
>         assertNotNull(d);
>     }
>     
>     private static class BadDummyDriver extends DummyDriver {
>         public boolean acceptsURL(String url) {
>             return false;
>         }
>     }
>     private static class DummyDriver implements Driver {
>         String goodurl = "jdbc:dummy_protocol:dummy_subname";
>         public boolean acceptsURL(String url) {
>             return url.equals(goodurl);
>         }
>         public Connection connect(String url, Properties info) {
>             return null;
>         }
>         public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
>             return null;
>         }
>         public int getMajorVersion() {
>             return 0;
>         }
>         public int getMinorVersion() {
>             return 0;
>         }
>         public boolean jdbcCompliant() {
>             return true;
>         }
>     }
> It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. 
> I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu reassigned HARMONY-4205:
--------------------------------

    Assignee: Tony Wu

> [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4205
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4205
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP / Linux
>            Reporter: Ruth Cao
>            Assignee: Tony Wu
>         Attachments: Harmony-4205.diff
>
>
> The following test case shows the bug:
>  public void test_registerDriver_MultiTimes() throws SQLException {
>         int register_count = 10;
>         int deregister_count = 1;
>         Driver dummy = new DummyDriver();
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < register_count; i++) {
>             DriverManager.registerDriver(dummy);
>         }
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < deregister_count; i++) {
>             DriverManager.deregisterDriver(dummy);
>         }
>         Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
>         assertNotNull(d);
>     }
>     
>     private static class BadDummyDriver extends DummyDriver {
>         public boolean acceptsURL(String url) {
>             return false;
>         }
>     }
>     private static class DummyDriver implements Driver {
>         String goodurl = "jdbc:dummy_protocol:dummy_subname";
>         public boolean acceptsURL(String url) {
>             return url.equals(goodurl);
>         }
>         public Connection connect(String url, Properties info) {
>             return null;
>         }
>         public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
>             return null;
>         }
>         public int getMajorVersion() {
>             return 0;
>         }
>         public int getMinorVersion() {
>             return 0;
>         }
>         public boolean jdbcCompliant() {
>             return true;
>         }
>     }
> It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. 
> I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it

Posted by "Ruth Cao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruth Cao closed HARMONY-4205.
-----------------------------


Thanks, Tony. The fix looks fine.

> [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4205
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4205
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP / Linux
>            Reporter: Ruth Cao
>            Assignee: Tony Wu
>         Attachments: Harmony-4205.diff
>
>
> The following test case shows the bug:
>  public void test_registerDriver_MultiTimes() throws SQLException {
>         int register_count = 10;
>         int deregister_count = 1;
>         Driver dummy = new DummyDriver();
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < register_count; i++) {
>             DriverManager.registerDriver(dummy);
>         }
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < deregister_count; i++) {
>             DriverManager.deregisterDriver(dummy);
>         }
>         Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
>         assertNotNull(d);
>     }
>     
>     private static class BadDummyDriver extends DummyDriver {
>         public boolean acceptsURL(String url) {
>             return false;
>         }
>     }
>     private static class DummyDriver implements Driver {
>         String goodurl = "jdbc:dummy_protocol:dummy_subname";
>         public boolean acceptsURL(String url) {
>             return url.equals(goodurl);
>         }
>         public Connection connect(String url, Properties info) {
>             return null;
>         }
>         public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
>             return null;
>         }
>         public int getMajorVersion() {
>             return 0;
>         }
>         public int getMinorVersion() {
>             return 0;
>         }
>         public boolean jdbcCompliant() {
>             return true;
>         }
>     }
> It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. 
> I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it

Posted by "Ruth Cao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruth Cao updated HARMONY-4205:
------------------------------

    Patch Info: [Patch Available]

> [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4205
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4205
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP / Linux
>            Reporter: Ruth Cao
>         Attachments: Harmony-4205.diff
>
>
> The following test case shows the bug:
>  public void test_registerDriver_MultiTimes() throws SQLException {
>         int register_count = 10;
>         int deregister_count = 1;
>         Driver dummy = new DummyDriver();
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < register_count; i++) {
>             DriverManager.registerDriver(dummy);
>         }
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < deregister_count; i++) {
>             DriverManager.deregisterDriver(dummy);
>         }
>         Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
>         assertNotNull(d);
>     }
>     
>     private static class BadDummyDriver extends DummyDriver {
>         public boolean acceptsURL(String url) {
>             return false;
>         }
>     }
>     private static class DummyDriver implements Driver {
>         String goodurl = "jdbc:dummy_protocol:dummy_subname";
>         public boolean acceptsURL(String url) {
>             return url.equals(goodurl);
>         }
>         public Connection connect(String url, Properties info) {
>             return null;
>         }
>         public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
>             return null;
>         }
>         public int getMajorVersion() {
>             return 0;
>         }
>         public int getMinorVersion() {
>             return 0;
>         }
>         public boolean jdbcCompliant() {
>             return true;
>         }
>     }
> It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. 
> I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-4205) [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu resolved HARMONY-4205.
------------------------------

    Resolution: Fixed

Patch applied at r548559 , please verify. Thanks.

> [classlib][sql] java.sql.DriverManager cannot deregister a driver as many times a registering it
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4205
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4205
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP / Linux
>            Reporter: Ruth Cao
>            Assignee: Tony Wu
>         Attachments: Harmony-4205.diff
>
>
> The following test case shows the bug:
>  public void test_registerDriver_MultiTimes() throws SQLException {
>         int register_count = 10;
>         int deregister_count = 1;
>         Driver dummy = new DummyDriver();
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < register_count; i++) {
>             DriverManager.registerDriver(dummy);
>         }
>         DriverManager.registerDriver(new BadDummyDriver());
>         for (int i = 0; i < deregister_count; i++) {
>             DriverManager.deregisterDriver(dummy);
>         }
>         Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
>         assertNotNull(d);
>     }
>     
>     private static class BadDummyDriver extends DummyDriver {
>         public boolean acceptsURL(String url) {
>             return false;
>         }
>     }
>     private static class DummyDriver implements Driver {
>         String goodurl = "jdbc:dummy_protocol:dummy_subname";
>         public boolean acceptsURL(String url) {
>             return url.equals(goodurl);
>         }
>         public Connection connect(String url, Properties info) {
>             return null;
>         }
>         public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
>             return null;
>         }
>         public int getMajorVersion() {
>             return 0;
>         }
>         public int getMinorVersion() {
>             return 0;
>         }
>         public boolean jdbcCompliant() {
>             return true;
>         }
>     }
> It seems that this happens due to Harmony uses HashSet as the data structure to store the driver list, which does not allow duplications. 
> I'll create a patch for this soon, thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.