Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
3.3.0
-
None
Description
https://mariadb.com/kb/en/about-mariadb-connector-j/ says, that minimum Java is Java8.
When using MariaDB Connector/J with Java8, the following exception is thrown:
Caused by: java.lang.NoSuchMethodError: java.lang.String.repeat(I)Ljava/lang/String;
|
at org.mariadb.jdbc.DatabaseMetaData.parseIdentifier (DatabaseMetaData.java:86)
|
at org.mariadb.jdbc.DatabaseMetaData.getImportedKeys (DatabaseMetaData.java:235)
|
at org.mariadb.jdbc.DatabaseMetaData.getImportedKeysUsingShowCreateTable (DatabaseMetaData.java:1104)
|
at org.mariadb.jdbc.DatabaseMetaData.getImportedKeys (DatabaseMetaData.java:458)
|
The reason is, that String.repeat is only available in Java11+, but not in Java8. It is used here:
https://github.com/mariadb-corporation/mariadb-connector-j/blob/13cee5a93a441a9326810de39bc30eef4c33c6e1/src/main/java/org/mariadb/jdbc/DatabaseMetaData.java#L86
One way to avoid such incompatibilities is, to use the "release" flag in maven-compiler-plugin instead of source/target. However, that requires to use e.g. a Java11 JDK for building - but thanks to the release flag, the compiled code is still java8 compatible (both binary compatible and API level compatible). But that seems to be ok, since you already use Java17 for building (according to travis.yml).
Problem seems to have been introduced with https://github.com/mariadb-corporation/mariadb-connector-j/commit/2acd4376742bcb17322cfb5d98b159c6bd6502d9#diff-6d3a1153c463711756ad718e88ae89c3f12458576e928305ae428ea10bd72b2a (CONJ-1112)