Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
soklakov committed Jan 11, 2016
1 parent 21beada commit b465b53
Show file tree
Hide file tree
Showing 72 changed files with 899 additions and 924 deletions.
3 changes: 2 additions & 1 deletion src/com/mysql/fabric/HashShardMapping.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -44,6 +44,7 @@ public int compare(ShardIndex i1, ShardIndex i2) {
}

private static final MessageDigest md5Hasher;

static {
try {
md5Hasher = MessageDigest.getInstance("MD5");
Expand Down
4 changes: 3 additions & 1 deletion src/com/mysql/fabric/ServerGroup.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -47,6 +47,7 @@ public Set<Server> getServers() {

/**
* Find the master server for this group.
*
* @return the master server, or null if there's no master for the current group state
*/
public Server getMaster() {
Expand All @@ -60,6 +61,7 @@ public Server getMaster() {

/**
* Lookup a server in this group for the matching host:port string.
*
* @return the server, if found. null otherwise
*/
public Server getServer(String hostPortString) {
Expand Down
8 changes: 4 additions & 4 deletions src/com/mysql/fabric/jdbc/FabricMySQLConnectionProxy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -215,7 +215,7 @@ synchronized SQLException interceptException(SQLException sqlEx, Connection conn
throws FabricCommunicationException {
// we are only concerned with connection failures, skip anything else
if (sqlEx.getSQLState() != null && !(sqlEx.getSQLState().startsWith("08")
|| com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException.class.isAssignableFrom(sqlEx.getClass()))) {
|| com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException.class.isAssignableFrom(sqlEx.getClass()))) {
return null;
}

Expand Down Expand Up @@ -508,8 +508,8 @@ private void syncGroupServersToReplicationConnectionGroup(ReplicationConnectionG
currentMasterString = replConnGroup.getMasterHosts().iterator().next();
}
// check if master has changed
if (currentMasterString != null &&
(this.serverGroup.getMaster() == null || !currentMasterString.equals(this.serverGroup.getMaster().getHostPortString()))) {
if (currentMasterString != null
&& (this.serverGroup.getMaster() == null || !currentMasterString.equals(this.serverGroup.getMaster().getHostPortString()))) {
// old master is gone (there may be a new one) (closeGently=false)
try {
replConnGroup.removeMasterHost(currentMasterString, false);
Expand Down
6 changes: 3 additions & 3 deletions src/com/mysql/fabric/jdbc/FabricMySQLDriver.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -73,8 +73,8 @@ public Connection connect(String url, Properties info) throws SQLException {
parsedProps.setProperty(FABRIC_PROTOCOL_PROPERTY_KEY, "http");
if (com.mysql.jdbc.Util.isJdbc4()) {
try {
Constructor<?> jdbc4proxy = Class.forName("com.mysql.fabric.jdbc.JDBC4FabricMySQLConnectionProxy").getConstructor(
new Class[] { Properties.class });
Constructor<?> jdbc4proxy = Class.forName("com.mysql.fabric.jdbc.JDBC4FabricMySQLConnectionProxy")
.getConstructor(new Class[] { Properties.class });
return (Connection) com.mysql.jdbc.Util.handleNewInstance(jdbc4proxy, new Object[] { parsedProps }, null);
} catch (Exception e) {
throw (SQLException) new SQLException(e.getMessage()).initCause(e);
Expand Down
6 changes: 3 additions & 3 deletions src/com/mysql/fabric/proto/xmlrpc/DigestAuthentication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -59,8 +59,8 @@ public static String getChallengeHeader(String url) throws IOException {
}
} else if (400 == conn.getResponseCode()) {
// 400 usually means that auth is disabled on the Fabric node
throw new IOException("Fabric returns status 400. If authentication is disabled on the Fabric node, " +
"omit the `fabricUsername' and `fabricPassword' properties from your connection.");
throw new IOException("Fabric returns status 400. If authentication is disabled on the Fabric node, "
+ "omit the `fabricUsername' and `fabricPassword' properties from your connection.");
} else {
throw ex;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -37,8 +37,8 @@ public MySQLFabricException() {
}

public MySQLFabricException(Fault fault) {
super((String) ((Struct) fault.getValue().getValue()).getMember().get(1).getValue().getValue(), "", (Integer) ((Struct) fault.getValue().getValue())
.getMember().get(0).getValue().getValue());
super((String) ((Struct) fault.getValue().getValue()).getMember().get(1).getValue().getValue(), "",
(Integer) ((Struct) fault.getValue().getValue()).getMember().get(0).getValue().getValue());
}

public MySQLFabricException(String reason, String SQLState, int vendorCode) {
Expand Down
12 changes: 7 additions & 5 deletions src/com/mysql/jdbc/BufferRow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -267,8 +267,9 @@ private int findAndSeekToOffsetForBinaryEncoding(int index) throws SQLException
break;

default:
throw SQLError.createSQLException(Messages.getString("MysqlIO.97") + this.metadata[i].getMysqlType() + Messages.getString("MysqlIO.98")
+ (i + 1) + Messages.getString("MysqlIO.99") + this.metadata.length + Messages.getString("MysqlIO.100"),
throw SQLError.createSQLException(
Messages.getString("MysqlIO.97") + this.metadata[i].getMysqlType() + Messages.getString("MysqlIO.98") + (i + 1)
+ Messages.getString("MysqlIO.99") + this.metadata.length + Messages.getString("MysqlIO.100"),
SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
}
Expand Down Expand Up @@ -361,8 +362,9 @@ public byte[] getColumnValue(int index) throws SQLException {
return this.rowFromServer.readLenByteArray(0);

default:
throw SQLError.createSQLException(Messages.getString("MysqlIO.97") + this.metadata[index].getMysqlType() + Messages.getString("MysqlIO.98")
+ (index + 1) + Messages.getString("MysqlIO.99") + this.metadata.length + Messages.getString("MysqlIO.100"),
throw SQLError.createSQLException(
Messages.getString("MysqlIO.97") + this.metadata[index].getMysqlType() + Messages.getString("MysqlIO.98") + (index + 1)
+ Messages.getString("MysqlIO.99") + this.metadata.length + Messages.getString("MysqlIO.100"),
SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
}
Expand Down
14 changes: 8 additions & 6 deletions src/com/mysql/jdbc/CharsetMapping.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -129,8 +129,7 @@ public class CharsetMapping {

static {
// complete list of mysql character sets and their corresponding java encoding names
MysqlCharset[] charset = new MysqlCharset[] {
new MysqlCharset(MYSQL_4_0_CHARSET_NAME_usa7, 1, 0, new String[] { "US-ASCII" }, 4, 0),
MysqlCharset[] charset = new MysqlCharset[] { new MysqlCharset(MYSQL_4_0_CHARSET_NAME_usa7, 1, 0, new String[] { "US-ASCII" }, 4, 0),
new MysqlCharset(MYSQL_CHARSET_NAME_ascii, 1, 0, new String[] { "US-ASCII", "ASCII" }),

new MysqlCharset(MYSQL_CHARSET_NAME_big5, 2, 0, new String[] { "Big5" }),
Expand Down Expand Up @@ -647,10 +646,13 @@ public static String getMysqlCharsetNameForCollationIndex(Integer collationIndex

/**
* MySQL charset could map to several Java encodings.
* So here we choose the one according to next rules: <li>if there is no static mapping for this charset then return javaEncoding value as is because this
* could be a custom charset for example <li>if static mapping exists and javaEncoding equals to one of Java encoding canonical names or aliases available
* So here we choose the one according to next rules:
* <li>if there is no static mapping for this charset then return javaEncoding value as is because this
* could be a custom charset for example
* <li>if static mapping exists and javaEncoding equals to one of Java encoding canonical names or aliases available
* for this mapping then javaEncoding value as is; this is required when result should match to connection encoding, for example if connection encoding is
* Cp943 we must avoid getting SHIFT_JIS for sjis mysql charset <li>if static mapping exists and javaEncoding doesn't match any Java encoding canonical
* Cp943 we must avoid getting SHIFT_JIS for sjis mysql charset
* <li>if static mapping exists and javaEncoding doesn't match any Java encoding canonical
* names or aliases available for this mapping then return default Java encoding (the first in mapping list)
*
* @param mysqlCharsetName
Expand Down
6 changes: 3 additions & 3 deletions src/com/mysql/jdbc/Clob.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
Expand Down Expand Up @@ -233,8 +233,8 @@ public void streamClosed(WatchableOutputStream out) {

if (streamSize < this.charData.length()) {
try {
out.write(StringUtils.getBytes(this.charData, null, null, false, null, this.exceptionInterceptor), streamSize, this.charData.length()
- streamSize);
out.write(StringUtils.getBytes(this.charData, null, null, false, null, this.exceptionInterceptor), streamSize,
this.charData.length() - streamSize);
} catch (SQLException ex) {
//
}
Expand Down
Loading

0 comments on commit b465b53

Please sign in to comment.