X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fapi%2Fdata%2FDataValidationFailedException.java;h=a7445489d09794bf8695aea6a99560871a5bf016;hp=c59c12ec5c3c59314d94094d421ab45c96deb4cb;hb=99f994b3e45963f6ef46bc2b71ab4dd8eea8b9ac;hpb=f6609a5ab258b69a0d8ae2a97ee140b4da3b82ba diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java index c59c12ec5c..a7445489d0 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataValidationFailedException.java @@ -7,38 +7,44 @@ */ package org.opendaylight.controller.md.sal.common.api.data; -import org.opendaylight.yangtools.concepts.Path; - import com.google.common.base.Preconditions; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.opendaylight.yangtools.concepts.Path; +import org.opendaylight.yangtools.yang.common.RpcError.ErrorType; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; /** - * * 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 + * 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. - * */ public class DataValidationFailedException extends TransactionCommitFailedException { private static final long serialVersionUID = 1L; - private Path path; + @SuppressFBWarnings("SE_BAD_FIELD") + private final Path path; - private Class> pathType; + private final Class> pathType; - public

> DataValidationFailedException(final Class

pathType,final P path, final String message, final Throwable cause) { - super(message, cause); + 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) { - this(pathType,path,message,null); + public

> DataValidationFailedException(final Class

pathType,final P path, + final String message) { + this(pathType, path, message, null); } public final Path getPath() { @@ -48,5 +54,4 @@ public class DataValidationFailedException extends TransactionCommitFailedExcept public final Class> getPathType() { return pathType; } - }