diff --git a/pom.xml b/pom.xml
index 54cb62edd..b367969a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
mariadb-java-client
jar
mariadb-java-client
- 1.2.0
+ 1.2.1-SNAPSHOT
JDBC driver for MariaDB and MySQL
https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/
diff --git a/src/main/java/org/mariadb/jdbc/Driver.java b/src/main/java/org/mariadb/jdbc/Driver.java
index 69b875f88..9ec6b3547 100644
--- a/src/main/java/org/mariadb/jdbc/Driver.java
+++ b/src/main/java/org/mariadb/jdbc/Driver.java
@@ -92,6 +92,8 @@ public Connection connect(final String url, final Properties props) throws SQLEx
log.debug("Connecting to: " + url);
try {
JDBCUrl jdbcUrl = JDBCUrl.parse(url, props);
+ //
+ if (jdbcUrl == null) return null;
if (jdbcUrl.getHostAddresses() == null) {
log.info("MariaDB connector : missing Host address");
return null;
diff --git a/src/main/java/org/mariadb/jdbc/JDBCUrl.java b/src/main/java/org/mariadb/jdbc/JDBCUrl.java
index 439ef85fa..19d5ad502 100644
--- a/src/main/java/org/mariadb/jdbc/JDBCUrl.java
+++ b/src/main/java/org/mariadb/jdbc/JDBCUrl.java
@@ -116,7 +116,7 @@ protected JDBCUrl(String database, List addresses, Options options,
static boolean acceptsURL(String url) {
return (url != null) &&
- (url.startsWith("jdbc:mariadb://") || url.startsWith("jdbc:mysql://"));
+ (url.startsWith("jdbc:mariadb:") || url.startsWith("jdbc:mysql:"));
}
@@ -141,7 +141,7 @@ public static JDBCUrl parse(final String url, Properties prop) {
}
}
}
- throw new IllegalArgumentException("Invalid connection URL url " + url);
+ return null;
}
public void parseUrl(String url) {
diff --git a/src/main/java/org/mariadb/jdbc/Version.java b/src/main/java/org/mariadb/jdbc/Version.java
index 7b983c1af..c1cc7226f 100644
--- a/src/main/java/org/mariadb/jdbc/Version.java
+++ b/src/main/java/org/mariadb/jdbc/Version.java
@@ -1,10 +1,10 @@
package org.mariadb.jdbc;
public final class Version {
- public static final String version = "1.2.0";
+ public static final String version = "1.2.1-SNAPSHOT";
public static final int majorVersion = 1;
public static final int minorVersion = 2;
- public static final int patchVersion = 0;
- public static final String qualifier = "";
+ public static final int patchVersion = 1;
+ public static final String qualifier = "SNAPSHOT";
}
\ No newline at end of file
diff --git a/src/main/java/org/mariadb/jdbc/internal/mysql/listener/impl/MastersSlavesListener.java b/src/main/java/org/mariadb/jdbc/internal/mysql/listener/impl/MastersSlavesListener.java
index 519e6c391..2fa7cd8dd 100644
--- a/src/main/java/org/mariadb/jdbc/internal/mysql/listener/impl/MastersSlavesListener.java
+++ b/src/main/java/org/mariadb/jdbc/internal/mysql/listener/impl/MastersSlavesListener.java
@@ -333,7 +333,6 @@ public void switchReadOnlyConnection(Boolean mustBeReadOnly) throws QueryExcepti
syncConnection(this.masterProtocol, this.secondaryProtocol);
currentProtocol = this.secondaryProtocol;
- setSessionReadOnly(true);
log.trace("current connection is now secondary");
return;
@@ -612,7 +611,7 @@ public void run() {
}
public void checkIfTypeHaveChanged(SearchFilter searchFilter) throws QueryException {
- if (masterProtocol.ping()) {
+ if (masterProtocol != null && masterProtocol.ping()) {
log.trace("PingLoop master ping ok");
}
}
diff --git a/src/test/java/org/mariadb/jdbc/JdbcParserTest.java b/src/test/java/org/mariadb/jdbc/JdbcParserTest.java
index ce4ef85f2..4e15a2788 100644
--- a/src/test/java/org/mariadb/jdbc/JdbcParserTest.java
+++ b/src/test/java/org/mariadb/jdbc/JdbcParserTest.java
@@ -79,12 +79,8 @@ public void testJDBCParserSimpleIPv4basic() {
}
@Test
public void testJDBCParserSimpleIPv4basicError() {
- try {
- JDBCUrl.parse(null);
- Assert.fail();
- }catch (IllegalArgumentException e) {
- Assert.assertTrue(true);
- }
+ JDBCUrl jdbcUrl = JDBCUrl.parse(null);
+ Assert.assertTrue(jdbcUrl == null);
}
@Test
public void testJDBCParserSimpleIPv4basicwithoutDatabase() {
@@ -157,21 +153,11 @@ public void testJDBCParserParameter() {
Assert.assertTrue(new HostAddress("slave1", 3308, "slave").equals(jdbcUrl.getHostAddresses().get(2)));
}
- @Test
- public void testJDBCParserParameterError() {
- try {
- JDBCUrl.parse(null);
- Assert.fail();
- }catch (IllegalArgumentException e) {
- Assert.assertTrue(true);
- }
- }
-
@Test
public void testJDBCParserParameterErrorEqual() {
String url = "jdbc:mysql://address=(type=)(port=3306)(host=master1),address=(port=3307)(type=master)(host=master2),address=(type=slave)(host=slave1)(port=3308)/database?user=greg&password=pass";
try {
- JDBCUrl.parse(null);
+ JDBCUrl.parse(url);
Assert.fail();
}catch (IllegalArgumentException e) {
Assert.assertTrue(true);
@@ -223,4 +209,14 @@ public void testJDBCParserHAModeLoadAurora() {
Assert.assertTrue(jdbc.getHaMode().equals(UrlHAMode.AURORA));
}
+ /**
+ * CONJ-167 : Driver is throwing IllegalArgumentException instead of returning null
+ */
+ @Test
+ public void checkOtherDriverCompatibility() {
+ String url = "jdbc:h2:mem:RZM;DB_CLOSE_DELAY=-1";
+ JDBCUrl jdbc = JDBCUrl.parse(url);
+ Assert.assertTrue(jdbc == null);
+ }
+
}
diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties
deleted file mode 100644
index f02449094..000000000
--- a/src/test/resources/logging.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-handlers = java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.level = FINE
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-# Pattern works since Java 7
-java.util.logging.SimpleFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n
-org.mariadb.jdbc.level=FINE
\ No newline at end of file