Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8179

SQL JDBC - DriverImpl loadParams doesn't support keys with no values in the connection string

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: None
    • Component/s: SolrJ
    • Labels:
      None

      Description

      DBVisualizer and SquirrelSQL when trying to use JDBC with no username/password and the JDBC driver causes an exception.

      DriverManager.getConnection("jdbc:solr://" + zkHost + "?collection=collection1&username=&password=");
      
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
      	at org.apache.solr.client.solrj.io.sql.DriverImpl.loadParams(DriverImpl.java:141)
      	... 46 more
      

      The loadParams method doesn't support keys with no values.

      1. SOLR-8179.patch
        15 kB
        Kevin Risden
      2. SOLR-8179.patch
        14 kB
        Kevin Risden

        Issue Links

          Activity

          Hide
          risdenk Kevin Risden added a comment -

          This patch addresses a few issues with DriverImpl to remove the manual processing of the connection string. There is a new test file that tests for some exception cases.

          Show
          risdenk Kevin Risden added a comment - This patch addresses a few issues with DriverImpl to remove the manual processing of the connection string. There is a new test file that tests for some exception cases.
          Hide
          joel.bernstein Joel Bernstein added a comment -

          Thanks for the patch Kevin Risden! Looks good. I should have some time this week to get this committed.

          Show
          joel.bernstein Joel Bernstein added a comment - Thanks for the patch Kevin Risden ! Looks good. I should have some time this week to get this committed.
          Hide
          joel.bernstein Joel Bernstein added a comment - - edited

          Kevin Risden, reviewed this closely today. Found a couple small things and one possible blocker. The blocker is that we need to be able to support the zk Quorum and chroot. There's no existing tests for this but I believe the existing parsing technique would work for this. Here is the string we need to support for the zkHost:

          zoo1:9983,zoo2:9983,zoo3:9983/foo/bar

          I suspect this will break the URI.

          Any thoughts on this?

          Show
          joel.bernstein Joel Bernstein added a comment - - edited Kevin Risden , reviewed this closely today. Found a couple small things and one possible blocker. The blocker is that we need to be able to support the zk Quorum and chroot. There's no existing tests for this but I believe the existing parsing technique would work for this. Here is the string we need to support for the zkHost: zoo1:9983,zoo2:9983,zoo3:9983/foo/bar I suspect this will break the URI. Any thoughts on this?
          Hide
          risdenk Kevin Risden added a comment -

          Good question. I'll look into it and see if I can add a test for this.

          Show
          risdenk Kevin Risden added a comment - Good question. I'll look into it and see if I can add a test for this.
          Hide
          risdenk Kevin Risden added a comment -

          URI handles the ZK connection string jdbc:solr://zoo1:9983,zoo2:9983,zoo3:9983/foo/bar?collection=collection1 just fine. Currently trying to find a way to test this. I get a unknownhost exception with the fake zoo* hostnames.

          Show
          risdenk Kevin Risden added a comment - URI handles the ZK connection string jdbc:solr://zoo1:9983,zoo2:9983,zoo3:9983/foo/bar?collection=collection1 just fine. Currently trying to find a way to test this. I get a unknownhost exception with the fake zoo* hostnames.
          Hide
          risdenk Kevin Risden added a comment -

          Moved URL processing into separate method and added tests for different ZK connection strings.

          Show
          risdenk Kevin Risden added a comment - Moved URL processing into separate method and added tests for different ZK connection strings.
          Hide
          joel.bernstein Joel Bernstein added a comment -

          So it looks like I need to apply the latest patch on top of the original patch.

          Show
          joel.bernstein Joel Bernstein added a comment - So it looks like I need to apply the latest patch on top of the original patch.
          Hide
          joel.bernstein Joel Bernstein added a comment -

          Ok, that's good news.

          Show
          joel.bernstein Joel Bernstein added a comment - Ok, that's good news.
          Hide
          risdenk Kevin Risden added a comment -

          Shouldn't have to unless I messed up the patch. The new patch should be all inclusive of the changes made.

          Show
          risdenk Kevin Risden added a comment - Shouldn't have to unless I messed up the patch. The new patch should be all inclusive of the changes made.
          Hide
          joel.bernstein Joel Bernstein added a comment -

          Ok got it, I was misreading the patch.

          Show
          joel.bernstein Joel Bernstein added a comment - Ok got it, I was misreading the patch.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1716198 from Joel Bernstein in branch 'dev/trunk'
          [ https://svn.apache.org/r1716198 ]

          SOLR-8179: SQL JDBC - DriverImpl loadParams doesn't support keys with no values in the connection string

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1716198 from Joel Bernstein in branch 'dev/trunk' [ https://svn.apache.org/r1716198 ] SOLR-8179 : SQL JDBC - DriverImpl loadParams doesn't support keys with no values in the connection string
          Hide
          joel.bernstein Joel Bernstein added a comment -

          Thanks Kevin, this is a big improvement!

          Show
          joel.bernstein Joel Bernstein added a comment - Thanks Kevin, this is a big improvement!

            People

            • Assignee:
              joel.bernstein Joel Bernstein
              Reporter:
              risdenk Kevin Risden
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development