/** * Performs a deep copy on <i>other</i>. */ public ThriftSecurityException(ThriftSecurityException other) { if (other.isSetUser()) { this.user = other.user; } if (other.isSetCode()) { this.code = other.code; } }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new java.lang.IllegalArgumentException(); } switch (field) { case USER: return isSetUser(); case CODE: return isSetCode(); } throw new java.lang.IllegalStateException(); }
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); hashCode = hashCode * 8191 + ((isSetCode()) ? 131071 : 524287); if (isSetCode()) hashCode = hashCode * 8191 + code.getValue(); return hashCode; }
@Override public int compareTo(ThriftSecurityException other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); if (lastComparison != 0) { return lastComparison; } if (isSetUser()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); if (lastComparison != 0) { return lastComparison; } } lastComparison = java.lang.Boolean.valueOf(isSetCode()).compareTo(other.isSetCode()); if (lastComparison != 0) { return lastComparison; } if (isSetCode()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, other.code); if (lastComparison != 0) { return lastComparison; } } return 0; }
public boolean equals(ThriftSecurityException that) { if (that == null) return false; if (this == that) return true; boolean this_present_user = true && this.isSetUser(); boolean that_present_user = true && that.isSetUser(); if (this_present_user || that_present_user) { if (!(this_present_user && that_present_user)) return false; if (!this.user.equals(that.user)) return false; } boolean this_present_code = true && this.isSetCode(); boolean that_present_code = true && that.isSetCode(); if (this_present_code || that_present_code) { if (!(this_present_code && that_present_code)) return false; if (!this.code.equals(that.code)) return false; } return true; }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, ThriftSecurityException struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetUser()) { optionals.set(0); } if (struct.isSetCode()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetUser()) { oprot.writeString(struct.user); } if (struct.isSetCode()) { oprot.writeI32(struct.code.getValue()); } }
/** * Inspects the {@link ThriftSecurityException} and throws a {@link ThriftTableOperationException} * if the {@link SecurityErrorCode} on the {@link ThriftSecurityException} was * {code}TABLE_DOESNT_EXIST{code}. If the {@link ThriftSecurityException} is thrown because a * table doesn't exist anymore, clients will likely see an {@link AccumuloSecurityException} * instead of a {@link TableNotFoundException} as expected. If the {@link ThriftSecurityException} * has a different {@link SecurityErrorCode}, this method does nothing and expects the caller to * properly handle the original exception. * * @param e * A caught ThriftSecurityException * @param tableId * Table ID being operated on, or null * @param tableName * Table name being operated on, or null * @param op * The TableOperation the Master was attempting to perform * @throws ThriftTableOperationException * Thrown if {@code e} was thrown because {@link SecurityErrorCode#TABLE_DOESNT_EXIST} */ private void throwIfTableMissingSecurityException(ThriftSecurityException e, Table.ID tableId, String tableName, TableOperation op) throws ThriftTableOperationException { // ACCUMULO-3135 Table can be deleted after we get table ID but before we can check permission if (e.isSetCode() && e.getCode() == SecurityErrorCode.TABLE_DOESNT_EXIST) { throw new ThriftTableOperationException(tableId.canonicalID(), tableName, op, TableOperationExceptionType.NOTFOUND, "Table no longer exists"); } }