Fix checkstyle violations in sal-common-api
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / OptimisticLockFailedException.java
index 222289ab6cb967396478a67869dbb11cf6689903..6c7c54fb7f9094e6c10e138c43dc104912e9bfd0 100644 (file)
@@ -1,14 +1,26 @@
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.md.sal.common.api.data;
 
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
 /**
-*
 * Failure of asynchronous transaction commit caused by failure
 * of optimistic locking.
 *
+* <p>
 * This exception is raised and returned when transaction commit
 * failed, because other transaction finished successfully
 * and modified same data as failed transaction.
 *
+* <p>
 *  Clients may recover from this error condition by
 *  retrieving current state and submitting new updated
 *  transaction.
@@ -18,17 +30,12 @@ public class OptimisticLockFailedException extends TransactionCommitFailedExcept
 
     private static final long serialVersionUID = 1L;
 
-    protected OptimisticLockFailedException(final String message, final Throwable cause, final boolean enableSuppression,
-            final boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-
     public OptimisticLockFailedException(final String message, final Throwable cause) {
-        super(message, cause);
+        super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "resource-denied",
+                                                        message, null, null, cause));
     }
 
     public OptimisticLockFailedException(final String message) {
-        super(message);
+        this(message, null);
     }
-
 }