public GFXDExceptionData deepCopy() { return new GFXDExceptionData(this); }
/** * 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; } }
@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); } } } } }
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()); }
/** * Performs a deep copy on <i>other</i>. */ public UpdateResult(UpdateResult other) { __isset_bitfield = other.__isset_bitfield; this.updateCount = other.updateCount; if (other.isSetBatchUpdateCounts()) { List<Integer> __this__batchUpdateCounts = new ArrayList<Integer>(other.batchUpdateCounts); this.batchUpdateCounts = __this__batchUpdateCounts; } if (other.isSetGeneratedKeys()) { this.generatedKeys = new RowSet(other.generatedKeys); } if (other.isSetWarnings()) { this.warnings = new GFXDExceptionData(other.warnings); } }
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; }
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; }
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()); }
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()); }
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()); } }