X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fmdsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fcommon%2Fapi%2FDataValidationFailedException.java;h=526ba6d028ac20e7280f41ed9e98823ce3833f15;hb=11408d627adca7eb71ac956c3ad01f75b6b91596;hp=cab7290bc4a35e0a936e76925a8a8311c64bdf10;hpb=6a192f0eeedc302ae0b506d04f9d79b34406aef5;p=mdsal.git diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java index cab7290bc4..526ba6d028 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java @@ -7,51 +7,45 @@ */ package org.opendaylight.mdsal.common.api; -import org.opendaylight.yangtools.concepts.Path; -import org.opendaylight.yangtools.yang.common.RpcError.ErrorType; -import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import static java.util.Objects.requireNonNull; -import com.google.common.base.Preconditions; +import org.opendaylight.yangtools.concepts.HierarchicalIdentifier; +import org.opendaylight.yangtools.yang.common.ErrorTag; +import org.opendaylight.yangtools.yang.common.ErrorType; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; /** + * Failure of asynchronous transaction commit caused by invalid data. This exception is raised and returned when + * a transaction commit failed, because other data submitted via transactions. * - * Failure of asynchronous transaction commit caused by invalid data. - * - * This exception is raised and returned when transaction commit - * failed, because other data submitted via transactions - * - * Clients usually are not able recover from this error condition by - * retrieving same transaction, since data introduced by this transaction - * are invalid. - * + *

+ * Clients usually are not able recover from this error condition by retrieving same transaction, since data introduced + * by this transaction is invalid. */ public class DataValidationFailedException extends TransactionCommitFailedException { - private static final long serialVersionUID = 1L; - private Path path; + private final HierarchicalIdentifier path; + private final Class> pathType; - private Class> pathType; - - public

> DataValidationFailedException(final Class

pathType,final P path, - final String message, final Throwable cause) { - super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "invalid-value", message, null, - path != null ? path.toString() : null, cause)); - this.pathType = Preconditions.checkNotNull(pathType, "path type must not be null"); - this.path = Preconditions.checkNotNull(path,"path must not be null."); + public

> DataValidationFailedException(final Class

pathType, final P path, + final String message, final Throwable cause) { + super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, ErrorTag.INVALID_VALUE, message, null, + path != null ? path.toString() : null, cause)); + this.pathType = requireNonNull(pathType, "path type must not be null"); + this.path = requireNonNull(path, "path must not be null."); } - public

> DataValidationFailedException(final Class

pathType,final P path, - final String message) { + public

> DataValidationFailedException(final Class

pathType, final P path, + final String message) { this(pathType, path, message, null); } - public final Path getPath() { + public final HierarchicalIdentifier getPath() { return path; } - public final Class> getPathType() { + public final Class> getPathType() { return pathType; } - }