public GFXDException deepCopy() { return new GFXDException(this); }
/** * Performs a deep copy on <i>other</i>. */ public getAllServersWithPreferredServer_result(getAllServersWithPreferredServer_result other) { if (other.isSetSuccess()) { List<HostAddress> __this__success = new ArrayList<HostAddress>(other.success.size()); for (HostAddress other_element : other.success) { __this__success.add(new HostAddress(other_element)); } this.success = __this__success; } if (other.isSetError()) { this.error = new GFXDException(other.error); } }
/** * Performs a deep copy on <i>other</i>. */ public getPreferredServer_result(getPreferredServer_result other) { if (other.isSetSuccess()) { this.success = new HostAddress(other.success); } if (other.isSetError()) { this.error = new GFXDException(other.error); } }
GFXDException resultSetNotFoundException(int cursorId, String op) { // TODO: SW: i18 string GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("No result set open with ID=" + cursorId + " for operation " + op); exData.setSqlState(SQLState.LANG_RESULT_SET_NOT_OPEN.substring(0, 5)); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); return new GFXDException(exData, getServerInfo()); }
GFXDException resultSetNotFoundException(int cursorId, String op) { // TODO: SW: i18 string GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("No result set open with ID=" + cursorId + " for operation " + op); exData.setSqlState(SQLState.LANG_RESULT_SET_NOT_OPEN.substring(0, 5)); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); return new GFXDException(exData, getServerInfo()); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, getPreferredServer_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.success = new HostAddress(); struct.success.read(iprot); struct.setSuccessIsSet(true); } if (incoming.get(1)) { struct.error = new GFXDException(); struct.error.read(iprot); struct.setErrorIsSet(true); } } }
GFXDException statementNotFoundException(int stmtId, String op, boolean isPrepared) { // TODO: SW: i18 string GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("No " + (isPrepared ? "prepared " : "") + "statement with ID=" + stmtId + " for operation " + op); exData.setSqlState(SQLState.LANG_DEAD_STATEMENT); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); return new GFXDException(exData, getServerInfo()); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, getAllServersWithPreferredServer_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list401 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.success = new ArrayList<HostAddress>(_list401.size); for (int _i402 = 0; _i402 < _list401.size; ++_i402) { HostAddress _elem403; _elem403 = new HostAddress(); _elem403.read(iprot); struct.success.add(_elem403); } } struct.setSuccessIsSet(true); } if (incoming.get(1)) { struct.error = new GFXDException(); struct.error.read(iprot); struct.setErrorIsSet(true); } } }
private GFXDException notImplementedException(String method) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("ASSERT: " + method + "() not implemented"); exData.setSqlState(SQLState.JDBC_METHOD_NOT_SUPPORTED_BY_SERVER); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); return new GFXDException(exData, getServerInfo()); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, ThriftRow struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol)prot; { org.apache.thrift.protocol.TList _list269 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); ColumnValue _elem271 = new ColumnValue(); // required for (int _i270 = 0; _i270 < _list269.size; ++_i270) { _elem271.clear(); _elem271.read(iprot); try { struct.addColumnValue(_elem271); } catch (java.sql.SQLException sqle) { throw new GFXDException(new GFXDExceptionData(sqle.getMessage(), sqle.getSQLState(), sqle.getErrorCode()), null); } } } } }
private GFXDException internalException(String message) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason(message); exData.setSqlState(SQLState.JAVA_EXCEPTION); exData.setSeverity(ExceptionSeverity.NO_APPLICABLE_SEVERITY); return new GFXDException(exData, getServerInfo()); }
GFXDException tokenMismatchException(ByteBuffer token, final String op) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason(MessageService.getTextMessage( SQLState.NET_CONNECT_AUTH_FAILED, "connection token " + ConnectionHolder.getTokenAsString(token) + " mismatch for operation " + op)); exData.setSqlState(SQLState.NET_CONNECT_AUTH_FAILED.substring(0, 5)); exData.setSeverity(ExceptionSeverity.SESSION_SEVERITY); return new GFXDException(exData, getServerInfo()); }
private GFXDException notImplementedException(String method) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("ASSERT: " + method + "() not implemented"); exData.setSqlState(SQLState.JDBC_METHOD_NOT_SUPPORTED_BY_SERVER); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); return new GFXDException(exData, getServerInfo()); }
GFXDException tokenMismatchException(ByteBuffer token, final String op) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason(MessageService.getTextMessage( SQLState.NET_CONNECT_AUTH_FAILED, "connection token " + ConnectionHolder.getTokenAsString(token) + " mismatch for operation " + op)); exData.setSqlState(SQLState.NET_CONNECT_AUTH_FAILED.substring(0, 5)); exData.setSeverity(ExceptionSeverity.SESSION_SEVERITY); return new GFXDException(exData, getServerInfo()); }
GFXDException statementNotFoundException(int stmtId, String op, boolean isPrepared) { // TODO: SW: i18 string GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("No " + (isPrepared ? "prepared " : "") + "statement with ID=" + stmtId + " for operation " + op); exData.setSqlState(SQLState.LANG_DEAD_STATEMENT); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); return new GFXDException(exData, getServerInfo()); }
private GFXDException internalException(String message) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason(message); exData.setSqlState(SQLState.JAVA_EXCEPTION); exData.setSeverity(ExceptionSeverity.NO_APPLICABLE_SEVERITY); return new GFXDException(exData, getServerInfo()); }
public GFXDException newGFXDException(String messageId, Object... args) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setSqlState(StandardException.getSQLStateFromIdentifier(messageId)); exData.setSeverity(StandardException.getSeverityFromIdentifier(messageId)); exData.setReason(MessageService.getCompleteMessage(messageId, args)); return new GFXDException(exData, getServerInfo()); }
public GFXDException newGFXDException(String messageId, Object... args) { GFXDExceptionData exData = new GFXDExceptionData(); exData.setSqlState(StandardException.getSQLStateFromIdentifier(messageId)); exData.setSeverity(StandardException.getSeverityFromIdentifier(messageId)); exData.setReason(MessageService.getCompleteMessage(messageId, args)); return new GFXDException(exData, getServerInfo()); }
public static GFXDException newGFXDException(String sqlState, Throwable t, String serverInfo, Object... args) { GFXDExceptionData payload = new GFXDExceptionData(getMessageUtil() .getCompleteMessage(sqlState, args), getSQLStateFromIdentifier(sqlState), getSeverityFromIdentifier(sqlState)); GFXDException gfxde = new GFXDException(payload, serverInfo); if (t != null) { if (t instanceof GFXDException) { GFXDException next = (GFXDException)t; gfxde.addToNextExceptions(next.getExceptionData()); if (next.getNextExceptions() != null) { gfxde.getNextExceptions().addAll(next.getNextExceptions()); } } else { gfxde.initCause(t); } } return gfxde; }
/** * Helper method Validate the connection Id. If Id not found in the map throw * the connection unavailable exception. * * @param token * @return ConnectionHolder if found in the map. * @throws GFXDException */ private ConnectionHolder getValidConnection(int connId, ByteBuffer token) throws GFXDException { ConnectionHolder connHolder = this.connectionMap.getPrimitive(connId); if (connHolder != null) { if (connHolder.equals(token)) { return connHolder; } else { throw tokenMismatchException(token, "getConnection [connId=" + connId + ']'); } } else { // TODO: SW: i18 string here GFXDExceptionData exData = new GFXDExceptionData(); exData.setReason("No connection with ID=0x" + ConnectionHolder.getTokenAsString(token)); exData.setSqlState(SQLState.NO_CURRENT_CONNECTION); exData.setSeverity(ExceptionSeverity.STATEMENT_SEVERITY); throw new GFXDException(exData, getServerInfo()); } }