Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
3.3.3
-
Android Studio
Kotlin
Description
During programming an android app in Android Studio I encountered following bug:
When trying to connect to my MariaDB database via JDBC-Connector I receive a PatternSyntaxException.
It occurrs under: src/main/java/org/mariadb/jdbc/Connection.java , when the following Object is created (line 31):
private static final Pattern CALLABLE_STATEMENT_PATTERN; |
Following line in my code is throwing the error:
val connection = DriverManager.getConnection(jdbcURL, username, password)
|
The error:
Caused by: java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 185 |
^(\s*\{)?\s*((\?\s*=)?(\s*/\*([^*]|\*[^/])*\*/)*\s*call(\s*/\*([^*]|\*[^/])*\*/)*\s*((((`[^`]+`)|([^`}]+))\.)?((`[^`]+`)|([^`}(]+)))\s*(\(.*\))?(\s*/\*([^*]|\*[^/])*\*/)*\s*(#.*)?)\s*(}\s*)?$
|
^
|
The syntax error occurrs at the last right curly brace of the string ('}').
As you can read in the android documentation (https://developer.android.com/reference/java/util/regex/Pattern.html#behavior-starting-from-api-level-10-android-2.3), android does not support literal right braces which are not escaped.
So you need to somehow escape this right curly brace ('}') otherwise a database connection between android and MariaDB is impossible.