Skip to content

Commit

Permalink
[misc] indentation correction
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 29, 2021
1 parent f122575 commit 6d68f76
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import java.util.concurrent.FutureTask;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.ReentrantLock;
import javax.sql.rowset.serial.SerialException;
import org.mariadb.jdbc.LocalInfileInterceptor;
import org.mariadb.jdbc.MariaDbConnection;
import org.mariadb.jdbc.MariaDbStatement;
Expand Down Expand Up @@ -102,8 +103,6 @@
import org.mariadb.jdbc.internal.util.pool.GlobalStateInfo;
import org.mariadb.jdbc.internal.util.scheduler.SchedulerServiceProviderHolder;

import javax.sql.rowset.serial.SerialException;

public class AbstractQueryProtocol extends AbstractConnectProtocol implements Protocol {

private static final Logger logger = LoggerFactory.getLogger(AbstractQueryProtocol.class);
Expand Down Expand Up @@ -2022,14 +2021,14 @@ public SQLException handleIoException(Exception initialException) {
mustReconnect = true;
} else {
return new SQLNonTransientConnectionException(
initialException.getMessage() + getTraces(),
UNDEFINED_SQLSTATE.getSqlState(),
initialException);
initialException.getMessage() + getTraces(),
UNDEFINED_SQLSTATE.getSqlState(),
initialException);
}
} else if (initialException instanceof NotSerializableException) {
return new SerialException(
"Parameter cannot be serialized: " + initialException.getMessage());
} else {
"Parameter cannot be serialized: " + initialException.getMessage());
} else {
maxSizeError = writer.exceedMaxLength();
if (maxSizeError) {
mustReconnect = true;
Expand Down
15 changes: 5 additions & 10 deletions src/test/java/org/mariadb/jdbc/DatatypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@
import java.sql.*;
import java.util.ArrayList;
import java.util.List;

import javax.sql.rowset.serial.SerialException;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import javax.sql.rowset.serial.SerialException;

public class DatatypeTest extends BaseTest {

private ResultSet resultSet;
Expand Down Expand Up @@ -1199,10 +1197,8 @@ private void checkAllDataType(ResultSet rs, int index, long expectedValue) throw
assertEquals(String.valueOf(expectedValue), rs.getString(index));
}

/**
* Inner object are not serializable
*/
private class NonSerializableObject {
/** Inner object are not serializable */
private class NonSerializableObject {
private static final long serialVersionUID = -6552319171850636836L;
private List<Object> objects = new ArrayList<>();

Expand All @@ -1217,14 +1213,13 @@ public List<Object> getObjects() {

@Test
public void setNonSerializableObject() throws SQLException {
PreparedStatement ps =
sharedConnection.prepareStatement("insert into objtest values (?,?)");
PreparedStatement ps = sharedConnection.prepareStatement("insert into objtest values (?,?)");
ps.setObject(1, 0);
ps.setObject(2, new NonSerializableObject());
try {
ps.execute();
fail();
} catch (SQLSyntaxErrorException sqle) {
} catch (SQLSyntaxErrorException sqle) {
assertTrue(sqle.getCause().getCause() instanceof SerialException);
}
// ensure connection still up
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/mariadb/jdbc/MariaDbPoolDataSourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ public void ensureUsingPool() throws Exception {
public void ensureClosed() throws Throwable {
Assume.assumeTrue(
System.getenv("MAXSCALE_TEST_DISABLE") == null
&& System.getenv("SKYSQL_HA") == null
&& System.getenv("SKYSQL") == null);
&& System.getenv("SKYSQL_HA") == null
&& System.getenv("SKYSQL") == null);
Thread.sleep(500); // ensure that previous close are effective
int initialConnection = getCurrentConnections();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ public void testTimeUtcNow() throws SQLException {

@Test
public void testTimeOffsetNowUseServer() throws SQLException {
Assume.assumeTrue(System.getenv("AURORA") == null && System.getenv("SKYSQL_HA") == null);
Assume.assumeTrue(
System.getenv("AURORA") == null
&& System.getenv("SKYSQL_HA") == null
&& System.getenv("SKYSQL") == null);
try (Connection connection =
setConnection("&useLegacyDatetimeCode=false&serverTimezone=+5:00")) {
setSessionTimeZone(connection, "+5:00");
Expand All @@ -393,7 +396,9 @@ public void testTimeOffsetNowUseServer() throws SQLException {
assertTrue(rs.next());
Timestamp nowServer = rs.getTimestamp(1);
long timeDifference = currentTimeParis.getTime() - nowServer.getTime();
assertTrue(timeDifference < 1000); // must have less than one second difference
assertTrue(
"Error, timeDifference too important : " + timeDifference,
timeDifference < 1000); // must have less than one second difference
}
}

Expand Down

0 comments on commit 6d68f76

Please sign in to comment.