private <T> T _validateArgument(T arg, TableOperation op, Validator<T> validator) throws ThriftTableOperationException { try { return validator.validate(arg); } catch (IllegalArgumentException e) { String why = e.getMessage(); // Information provided by a client should generate a user-level exception, not a system-level // warning. log.debug(why); throw new ThriftTableOperationException(null, String.valueOf(arg), op, TableOperationExceptionType.INVALID_NAME, why); } }
private Table.ID validateTableIdArgument(ByteBuffer tableIdArg, TableOperation op, Validator<Table.ID> userValidator) throws ThriftTableOperationException { Table.ID tableId = tableIdArg == null ? null : ByteBufferUtil.toTableId(tableIdArg); try { return VALID_ID.and(userValidator).validate(tableId); } catch (IllegalArgumentException e) { String why = e.getMessage(); // Information provided by a client should generate a user-level exception, not a system-level // warning. log.debug(why); throw new ThriftTableOperationException(tableId.canonicalID(), null, op, TableOperationExceptionType.INVALID_NAME, why); } }
private <T> T _validateArgument(T arg, TableOperation op, Validator<T> validator) throws ThriftTableOperationException { try { return validator.validate(arg); } catch (IllegalArgumentException e) { String why = e.getMessage(); // Information provided by a client should generate a user-level exception, not a system-level // warning. log.debug(why); throw new ThriftTableOperationException(null, String.valueOf(arg), op, TableOperationExceptionType.INVALID_NAME, why); } } }
private String validateTableIdArgument(ByteBuffer tableIdArg, TableOperation op, Validator<String> userValidator) throws ThriftTableOperationException { String tableId = tableIdArg == null ? null : ByteBufferUtil.toString(tableIdArg); try { return VALID_ID.and(userValidator).validate(tableId); } catch (IllegalArgumentException e) { String why = e.getMessage(); // Information provided by a client should generate a user-level exception, not a system-level // warning. log.debug(why); throw new ThriftTableOperationException(tableId, null, op, TableOperationExceptionType.INVALID_NAME, why); } }