public static SnappyException newSnappyException(String sqlState, Throwable t, String serverInfo, Object... args) { SnappyExceptionData payload = new SnappyExceptionData(getMessageUtil() .getCompleteMessage(sqlState, args), getSeverityFromIdentifier(sqlState)) .setSqlState(getSQLStateFromIdentifier(sqlState)); SnappyException se = new SnappyException(payload, serverInfo); if (t != null) { if (t instanceof SnappyException) { SnappyException next = (SnappyException)t; se.addToNextExceptions(next.getExceptionData()); if (next.getNextExceptions() != null) { se.getNextExceptions().addAll(next.getNextExceptions()); } } se.initCause(t); } return se; }
public void setFieldValue(_Fields field, Object value) { switch (field) { case EXCEPTION_DATA: if (value == null) { unsetExceptionData(); } else { setExceptionData((SnappyExceptionData)value); } break; case SERVER_INFO: if (value == null) { unsetServerInfo(); } else { setServerInfo((String)value); } break; case NEXT_EXCEPTIONS: if (value == null) { unsetNextExceptions(); } else { setNextExceptions((List<SnappyExceptionData>)value); } break; } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof SnappyException) return this.equals((SnappyException)that); return false; }
public Object getFieldValue(_Fields field) { switch (field) { case EXCEPTION_DATA: return getExceptionData(); case SERVER_INFO: return getServerInfo(); case NEXT_EXCEPTIONS: return getNextExceptions(); } throw new IllegalStateException(); }
public SnappyException deepCopy() { return new SnappyException(this); }
@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 SnappyException(); struct.error.read(iprot); struct.setErrorIsSet(true); } } }
public static SQLException newSQLException(SnappyException se) { SnappyExceptionData payload = se.getExceptionData(); List<SnappyExceptionData> nextList = se.getNextExceptions(); SQLException sqle = newSQLException(payload, se.getCause(), se.getServerInfo()); sqle.setStackTrace(se.getStackTrace());
SnappyException newSnappyExceptionForConnectionClose(HostConnection source, Set<HostAddress> failedServers, boolean createNewConnection, Throwable cause) { // if cause is a node failure exception then return it if (cause instanceof SnappyException) { SnappyException se = (SnappyException)cause; SnappyExceptionData seData = se.getExceptionData(); if (SQLState.GFXD_NODE_SHUTDOWN_PREFIX.equals(seData.getSqlState()) || SQLState.DATA_CONTAINER_CLOSED.equals(seData.getSqlState())) { if (createNewConnection) { tryCreateNewConnection(source, failedServers, cause); } return se; } } return ThriftExceptionUtil.newSnappyException( SQLState.NO_CURRENT_CONNECTION, cause, source != null ? source.hostAddr.toString() : null); }
final void setSourceConnection(RowSet rs) throws SnappyException { final HostConnection source = this.currentHostConnection; rs.setConnId(source.connId); rs.setToken(source.token); rs.setSource(source.hostAddr); // initialize finalizers for LOBs in the rows, if any final List<Row> rows = rs.rows; if (rows != null && rows.size() > 0) { // create LOBs for each row, if any try { for (Row row : rows) { row.initializeLobs(this); } } catch (SQLException sqle) { SnappyExceptionData data = new SnappyExceptionData(sqle.getMessage(), sqle.getErrorCode()).setSqlState(sqle.getSQLState()); SnappyException se = new SnappyException(data, source.toString()); se.initCause(sqle); throw se; } } }
} while ((next = next.getNextException()) != null); SnappyException se = new SnappyException(exData, getServerInfo()); ExceptionSeverity.STATEMENT_SEVERITY) .setSqlState(SQLState.SNAPPY_SERVER_STACK_INDICATOR)); se.setNextExceptions(nextExceptions); return se;
/** * 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 SnappyException(other.error); } }
case 1: // ERROR if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.error = new SnappyException(); struct.error.read(iprot); struct.setErrorIsSet(true); } else {
se.getExceptionData().getSqlState())) { logger.warn("AUTH exception in bulkClose (continuing with other " + "close operations): " + se);
/** * 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 SnappyException(other.error); } }
@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 _list323 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.success = new ArrayList<HostAddress>(_list323.size); HostAddress _elem324; for (int _i325 = 0; _i325 < _list323.size; ++_i325) { _elem324 = new HostAddress(); _elem324.read(iprot); struct.success.add(_elem324); } } struct.setSuccessIsSet(true); } if (incoming.get(1)) { struct.error = new SnappyException(); struct.error.read(iprot); struct.setErrorIsSet(true); } } }
private XAException newXAException(SnappyException se) { XAException xae; SnappyExceptionData data = se.getExceptionData(); final String sqlState = data.getSqlState(); if (sqlState == null || sqlState.isEmpty()) { String message = data.getReason(); if (message != null) { xae = new XAException(message); xae.errorCode = data.getErrorCode(); } else { xae = new XAException(data.errorCode); } } else { xae = new XAException(XAException.XAER_RMERR); } xae.initCause(ThriftExceptionUtil.newSQLException(se)); return xae; }
public boolean equals(getAllServersWithPreferredServer_result that) { if (that == null) return false; boolean this_present_success = true && this.isSetSuccess(); boolean that_present_success = true && that.isSetSuccess(); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (!this.success.equals(that.success)) return false; } boolean this_present_error = true && this.isSetError(); boolean that_present_error = true && that.isSetError(); if (this_present_error || that_present_error) { if (!(this_present_error && that_present_error)) return false; if (!this.error.equals(that.error)) return false; } return true; }
SnappyException resultSetNotFoundException(long cursorId, String op) { SnappyExceptionData exData = new SnappyExceptionData(); exData.setReason("No result set open with ID=" + cursorId + " for operation " + op); exData.setSqlState(SQLState.LANG_RESULT_SET_NOT_OPEN.substring(0, 5)); exData.setErrorCode(ExceptionSeverity.STATEMENT_SEVERITY); return new SnappyException(exData, getServerInfo()); }
case 1: // ERROR if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.error = new SnappyException(); struct.error.read(iprot); struct.setErrorIsSet(true); } else {
NetConnection.FailoverStatus status; if ((status = NetConnection.getFailoverStatus(se .getExceptionData().getSqlState(), se.getExceptionData() .getErrorCode(), se)).isNone()) { throw se;