Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CONJ-228] handle not signed numeric values
  • Loading branch information
rusher committed Dec 4, 2015
1 parent cf73089 commit e9c756d
Show file tree
Hide file tree
Showing 9 changed files with 1,057 additions and 171 deletions.
Expand Up @@ -59,6 +59,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
import org.mariadb.jdbc.internal.protocol.Protocol;

import java.io.IOException;
import java.sql.SQLException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -174,16 +175,15 @@ public HostAddress searchByStartName(Protocol secondaryProtocol, List<HostAddres
String masterHostName = queryResult.getValueObject(0).getString();
for (int i = 0; i < loopAddress.size(); i++) {
if (loopAddress.get(i).host.startsWith(masterHostName)) {
// if (log.isTraceEnabled()) log.trace("master probably " + loopAddress.get(i));
return loopAddress.get(i);
}
}
} catch (SQLException exception) {
//eat exception because cannot happen in this getString()
} catch (IOException ioe) {
// log.trace("searchByStartName failed", ioe);
//eat exception
} catch (QueryException qe) {
if (proxy.hasToHandleFailover(qe) && setSecondaryHostFail()) {
// log.warn("SQL Secondary node [" + this.currentProtocol.getHostAddress().toString() + "] connection fail ");
addToBlacklist(currentProtocol.getHostAddress());
}
} finally {
Expand Down
Expand Up @@ -531,6 +531,8 @@ private void loadServerData() throws QueryException, IOException {
serverData.put("system_time_zone", qr.getValueObject(1).getString());
serverData.put("time_zone", qr.getValueObject(2).getString());
}
} catch (SQLException sqle) {
throw new QueryException("could not load system variables", -1, ExceptionMapper.SqlStates.CONNECTION_EXCEPTION.getSqlState(), sqle);
} finally {
if (qr != null) {
qr.close();
Expand Down
Expand Up @@ -287,7 +287,7 @@ public void setCatalog(final String database) throws QueryException {
AbstractResultPacket rs = ReadResultPacketFactory.createResultPacket(byteBuffer);
final ErrorPacket ep = (ErrorPacket) rs;
throw new QueryException("Could not select database '" + database + "' : " + ep.getMessage(),
ep.getErrorNumber(), ep.getSqlState());
ep.getErrorNumber(), ep.getSqlState());
}
this.database = database;
} catch (IOException e) {
Expand Down
Expand Up @@ -60,6 +60,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
import org.mariadb.jdbc.internal.failover.tools.SearchFilter;

import java.io.IOException;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -276,8 +277,10 @@ public boolean checkIfMaster() throws QueryException {
this.readOnly = !this.masterConnection;
return this.masterConnection;

} catch (SQLException sqle) {
throw new QueryException("could not check the 'innodb_read_only' variable status on " + this.getHostAddress()
+ " : " + sqle.getMessage(), -1, ExceptionMapper.SqlStates.CONNECTION_EXCEPTION.getSqlState(), sqle);
} catch (IOException ioe) {
//log.trace("exception during checking if master", ioe);
throw new QueryException("could not check the 'innodb_read_only' variable status on " + this.getHostAddress()
+ " : " + ioe.getMessage(), -1, ExceptionMapper.SqlStates.CONNECTION_EXCEPTION.getSqlState(), ioe);
} finally {
Expand Down

0 comments on commit e9c756d

Please sign in to comment.