julianhyde / sqlline

Shell for issuing SQL to relational databases via JDBC
BSD 3-Clause "New" or "Revised" License
618 stars 146 forks source link

StringIndexOutOfBoundsException for wrong input arguments #462

Closed snuyanzin closed 2 years ago

snuyanzin commented 2 years ago

to reproduce

bin/sqlline --
#or
bin/sqlline --any-wrong-argument

it fails with

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at java.base/java.lang.StringLatin1.charAt(Unknown Source)
    at java.base/java.lang.String.charAt(Unknown Source)
    at sqlline.SqlLine.split(SqlLine.java:1400)
    at sqlline.SqlLine.split(SqlLine.java:1340)
    at sqlline.SqlLine.initArgs(SqlLine.java:349)
    at sqlline.SqlLine.begin(SqlLine.java:570)
    at sqlline.SqlLine.start(SqlLine.java:269)
    at sqlline.SqlLine.main(SqlLine.java:208)

In fact should behave more user friendly than failing with StringIndexOutOfBoundsException

snuyanzin commented 2 years ago

merged as https://github.com/julianhyde/sqlline/commit/bf37172efc0725c5c8c08e6135506f860b2feab5