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; }
public void setFieldValue(_Fields field, Object value) { switch (field) { case EXCEPTION_DATA: if (value == null) { unsetExceptionData(); } else { setExceptionData((GFXDExceptionData)value); } break; case SERVER_INFO: if (value == null) { unsetServerInfo(); } else { setServerInfo((String)value); } break; case NEXT_EXCEPTIONS: if (value == null) { unsetNextExceptions(); } else { setNextExceptions((List<GFXDExceptionData>)value); } break; } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof GFXDException) return this.equals((GFXDException)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 GFXDException deepCopy() { return new GFXDException(this); }
public static SQLException newSQLException(GFXDException gfxde) { GFXDExceptionData payload = gfxde.getExceptionData(); SQLException sqle = newSQLException(payload, gfxde.getCause(), gfxde.getServerInfo()); // since GFXDException is always a wrapper, no need to record the stack sqle.setStackTrace(gfxde.getStackTrace()); // build next exceptions List<GFXDExceptionData> nextList = gfxde.getNextExceptions(); SQLException current = sqle, next; if (nextList != null) { for (GFXDExceptionData nextData : nextList) { // check for server stack indicator if (SQLState.GFXD_SERVER_STACK_INDICATOR.equals( nextData.getSqlState())) { Throwable cause = sqle; while (cause.getCause() != null) { cause = cause.getCause(); } cause.initCause(new ServerException(nextData.getReason())); } else { next = newSQLException(nextData, null, null); current.setNextException(next); current = next; } } } return sqle; }
} while ((next = next.getNextException()) != null); GFXDException gfxde = new GFXDException(exData, getServerInfo()); SQLState.GFXD_SERVER_STACK_INDICATOR, ExceptionSeverity.STATEMENT_SEVERITY)); gfxde.setNextExceptions(nextExceptions); return gfxde;
@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); } } }
gfxde.getExceptionData().getSqlState())) { SanityManager.DEBUG_PRINT("warning:" + SanityManager.TRACE_CLIENT_STMT,
/** * 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); } }
} while ((next = next.getNextException()) != null); GFXDException gfxde = new GFXDException(exData, getServerInfo()); SQLState.GFXD_SERVER_STACK_INDICATOR, ExceptionSeverity.STATEMENT_SEVERITY)); gfxde.setNextExceptions(nextExceptions); return gfxde;
case 1: // ERROR if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.error = new GFXDException(); struct.error.read(iprot); struct.setErrorIsSet(true); } else {
gfxde.getExceptionData().getSqlState())) { SanityManager.DEBUG_PRINT("warning:" + SanityManager.TRACE_CLIENT_STMT,
/** * 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); } }
@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); } } }
GFXDExceptionData gfxdeData = gfxde.getExceptionData(); String sqlState = gfxdeData.getSqlState(); NetConnection.FailoverStatus status;
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; }
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()); }
case 1: // ERROR if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.error = new GFXDException(); struct.error.read(iprot); struct.setErrorIsSet(true); } else {
NetConnection.FailoverStatus status; if ((status = NetConnection.getFailoverStatus(gfxde .getExceptionData().getSqlState(), gfxde.getExceptionData() .getSeverity(), gfxde)).isNone()) { throw gfxde;