} catch (DataValidationFailedException e) { LOG.warn("{}: Store Tx {}: Data validation failed for path {}.", logContext, cohort.getIdentifier(), e.getPath(), e);
@Override public final ListenableFuture<Boolean> canCommit() { try { store.validate(modification); LOG.debug("Store Transaction: {} can be committed", getTransaction().getIdentifier()); return CAN_COMMIT_FUTURE; } catch (ConflictingModificationAppliedException e) { LOG.warn("Store Tx: {} Conflicting modification for {}.", getTransaction().getIdentifier(), e.getPath()); warnDebugContext(getTransaction()); return Futures.immediateFailedFuture(new OptimisticLockFailedException("Optimistic lock failed.", e)); } catch (DataValidationFailedException e) { LOG.warn("Store Tx: {} Data Precondition failed for {}.", getTransaction().getIdentifier(), e.getPath(), e); warnDebugContext(getTransaction()); // For debugging purposes, allow dumping of the modification. Coupled with the above // precondition log, it should allow us to understand what went on. LOG.trace("Store Tx: {} modifications: {} tree: {}", modification, store); return Futures.immediateFailedFuture(new TransactionCommitFailedException("Data did not pass validation.", e)); } catch (Exception e) { LOG.warn("Unexpected failure in validation phase", e); return Futures.immediateFailedFuture(e); } }
@SuppressWarnings("checkstyle:IllegalCatch") @Override public final ListenableFuture<Boolean> canCommit() { if (operationError != null) { return Futures.immediateFailedFuture(operationError); } try { store.validate(modification); LOG.debug("Store Transaction: {} can be committed", getTransaction().getIdentifier()); return CAN_COMMIT_FUTURE; } catch (ConflictingModificationAppliedException e) { LOG.warn("Store Tx: {} Conflicting modification for {}.", getTransaction().getIdentifier(), e.getPath()); warnDebugContext(getTransaction()); return Futures.immediateFailedFuture(new OptimisticLockFailedException("Optimistic lock failed.", e)); } catch (DataValidationFailedException e) { LOG.warn("Store Tx: {} Data Precondition failed for {}.", getTransaction().getIdentifier(), e.getPath(), e); warnDebugContext(getTransaction()); // For debugging purposes, allow dumping of the modification. Coupled with the above // precondition log, it should allow us to understand what went on. LOG.trace("Store Tx: {} modifications: {} tree: {}", getTransaction().getIdentifier(), modification, store); return Futures.immediateFailedFuture( new TransactionCommitFailedException("Data did not pass validation.", e)); } catch (Exception e) { LOG.warn("Unexpected failure in validation phase", e); return Futures.immediateFailedFuture(e); } }