You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ad...@apache.org on 2015/04/07 03:01:02 UTC
spark git commit: [Minor] [SQL] [SPARK-6729] Minor fix for
DriverQuirks get
Repository: spark
Updated Branches:
refs/heads/master 30363ede8 -> e40ea8742
[Minor] [SQL] [SPARK-6729] Minor fix for DriverQuirks get
The function uses .substring(0, X), which will trigger OutOfBoundsException if string length is less than X. A better way to do this is to use startsWith, which won't error out in this case.
Author: Volodymyr Lyubinets <vl...@gmail.com>
Closes #5378 from vlyubin/quirks and squashes the following commits:
504e8e0 [Volodymyr Lyubinets] Minor fix for DriverQuirks get
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e40ea874
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e40ea874
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e40ea874
Branch: refs/heads/master
Commit: e40ea8742a8771ecd46b182f45b5fcd8bd6dd725
Parents: 30363ed
Author: Volodymyr Lyubinets <vl...@gmail.com>
Authored: Mon Apr 6 18:00:51 2015 -0700
Committer: Aaron Davidson <aa...@databricks.com>
Committed: Mon Apr 6 18:00:51 2015 -0700
----------------------------------------------------------------------
.../src/main/scala/org/apache/spark/sql/jdbc/DriverQuirks.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/e40ea874/sql/core/src/main/scala/org/apache/spark/sql/jdbc/DriverQuirks.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/DriverQuirks.scala b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/DriverQuirks.scala
index 1704be7..0feabc4 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/DriverQuirks.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/DriverQuirks.scala
@@ -49,9 +49,9 @@ private[sql] object DriverQuirks {
* Fetch the DriverQuirks class corresponding to a given database url.
*/
def get(url: String): DriverQuirks = {
- if (url.substring(0, 10).equals("jdbc:mysql")) {
+ if (url.startsWith("jdbc:mysql")) {
new MySQLQuirks()
- } else if (url.substring(0, 15).equals("jdbc:postgresql")) {
+ } else if (url.startsWith("jdbc:postgresql")) {
new PostgresQuirks()
} else {
new NoQuirks()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org