public Object getFieldValue(_Fields field) { switch (field) { case REASON: return getReason(); case SQL_STATE: return getSqlState(); case SEVERITY: return Integer.valueOf(getSeverity()); } throw new IllegalStateException(); }
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 void setFieldValue(_Fields field, Object value) { switch (field) { case REASON: if (value == null) { unsetReason(); } else { setReason((String)value); } break; case SQL_STATE: if (value == null) { unsetSqlState(); } else { setSqlState((String)value); } break; case SEVERITY: if (value == null) { unsetSeverity(); } else { setSeverity((Integer)value); } break; } }
private GFXDExceptionData gfxdWarning(SQLWarning warnings) throws SQLException { GFXDExceptionData warningData = new GFXDExceptionData( warnings.getMessage(), warnings.getSQLState(), warnings.getErrorCode()); ArrayList<GFXDExceptionData> nextWarnings = null; SQLWarning next = warnings.getNextWarning(); if (next != null) { nextWarnings = new ArrayList<GFXDExceptionData>(); do { nextWarnings.add(new GFXDExceptionData(next.getMessage(), next .getSQLState(), next.getErrorCode())); } while ((next = next.getNextWarning()) != null); } //GFXDExceptionData sqlw = new GFXDExceptionData(warningData); //sqlw.setNextWarnings(nextWarnings); if (nextWarnings != null) { warningData.setReason(warningData.getReason() + nextWarnings.toString()); } return warningData; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, GFXDException struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.exceptionData = new GFXDExceptionData(); struct.exceptionData.read(iprot); struct.setExceptionDataIsSet(true); struct.serverInfo = iprot.readString(); struct.setServerInfoIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list255 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.nextExceptions = new ArrayList<GFXDExceptionData>(_list255.size); for (int _i256 = 0; _i256 < _list255.size; ++_i256) { GFXDExceptionData _elem257; _elem257 = new GFXDExceptionData(); _elem257.read(iprot); struct.nextExceptions.add(_elem257); } } struct.setNextExceptionsIsSet(true); } } }
public GFXDExceptionData deepCopy() { return new GFXDExceptionData(this); }
GFXDException gfxde = (GFXDException)t; GFXDExceptionData gfxdeData = gfxde.getExceptionData(); String sqlState = gfxdeData.getSqlState(); NetConnection.FailoverStatus status; if ((status = NetConnection.getFailoverStatus(sqlState, gfxdeData.getSeverity(), gfxde)).isNone()) {
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; }
gfxde.getExceptionData().getSqlState())) { SanityManager.DEBUG_PRINT("warning:" + SanityManager.TRACE_CLIENT_STMT,
private GFXDExceptionData gfxdWarning(SQLWarning warnings) throws SQLException { GFXDExceptionData warningData = new GFXDExceptionData( warnings.getMessage(), warnings.getSQLState(), warnings.getErrorCode()); ArrayList<GFXDExceptionData> nextWarnings = null; SQLWarning next = warnings.getNextWarning(); if (next != null) { nextWarnings = new ArrayList<GFXDExceptionData>(); do { nextWarnings.add(new GFXDExceptionData(next.getMessage(), next .getSQLState(), next.getErrorCode())); } while ((next = next.getNextWarning()) != null); } //GFXDExceptionData sqlw = new GFXDExceptionData(warningData); //sqlw.setNextWarnings(nextWarnings); if (nextWarnings != null) { warningData.setReason(warningData.getReason() + nextWarnings.toString()); } return warningData; }
case 1: // EXCEPTION_DATA if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.exceptionData = new GFXDExceptionData(); struct.exceptionData.read(iprot); struct.setExceptionDataIsSet(true); } else { _elem252 = new GFXDExceptionData(); _elem252.read(iprot); struct.nextExceptions.add(_elem252);
/** * Performs a deep copy on <i>other</i>. */ public GFXDException(GFXDException other) { if (other.isSetExceptionData()) { this.exceptionData = new GFXDExceptionData(other.exceptionData); } if (other.isSetServerInfo()) { this.serverInfo = other.serverInfo; } if (other.isSetNextExceptions()) { List<GFXDExceptionData> __this__nextExceptions = new ArrayList<GFXDExceptionData>(other.nextExceptions.size()); for (GFXDExceptionData other_element : other.nextExceptions) { __this__nextExceptions.add(new GFXDExceptionData(other_element)); } this.nextExceptions = __this__nextExceptions; } }
NetConnection.FailoverStatus status; if ((status = NetConnection.getFailoverStatus(gfxde .getExceptionData().getSqlState(), gfxde.getExceptionData() .getSeverity(), gfxde)).isNone()) { throw gfxde;
gfxde.getExceptionData().getSqlState())) { SanityManager.DEBUG_PRINT("warning:" + SanityManager.TRACE_CLIENT_STMT,
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()); }
public static SQLException newSQLException(GFXDExceptionData payload, Throwable cause, String serverInfo) { String message = payload.getReason(); if (serverInfo != null) { message = "(" + serverInfo + ") " + message; } return factory.getSQLException(message, payload.getSqlState(), payload.getSeverity(), null, cause); }
struct.warnings = new GFXDExceptionData(); struct.warnings.read(iprot); struct.setWarningsIsSet(true);
/** * Performs a deep copy on <i>other</i>. */ public PrepareResult(PrepareResult other) { __isset_bitfield = other.__isset_bitfield; this.statementId = other.statementId; if (other.isSetParameterMetaData()) { List<ColumnDescriptor> __this__parameterMetaData = new ArrayList<ColumnDescriptor>(other.parameterMetaData.size()); for (ColumnDescriptor other_element : other.parameterMetaData) { __this__parameterMetaData.add(new ColumnDescriptor(other_element)); } this.parameterMetaData = __this__parameterMetaData; } if (other.isSetResultSetMetaData()) { List<ColumnDescriptor> __this__resultSetMetaData = new ArrayList<ColumnDescriptor>(other.resultSetMetaData.size()); for (ColumnDescriptor other_element : other.resultSetMetaData) { __this__resultSetMetaData.add(new ColumnDescriptor(other_element)); } this.resultSetMetaData = __this__resultSetMetaData; } if (other.isSetWarnings()) { this.warnings = new GFXDExceptionData(other.warnings); } }
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()); }
public static SQLWarning newSQLWarning(GFXDExceptionData payload, Throwable cause) { return new SQLWarning(payload.getReason(), payload.getSqlState(), payload.getSeverity(), cause); }