2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.api;
10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import org.opendaylight.yangtools.yang.common.ErrorSeverity;
13 import org.opendaylight.yangtools.yang.common.ErrorType;
14 import org.w3c.dom.Document;
17 * Checked exception to communicate an error that needs to be sent to the netconf client.
19 public class NetconfDocumentedException extends DocumentedException {
20 private static final long serialVersionUID = 1L;
22 public NetconfDocumentedException(final String message) {
26 public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
27 final ErrorSeverity errorSeverity) {
28 super(message, errorType, errorTag, errorSeverity);
31 public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
32 final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
33 super(message, errorType, errorTag, errorSeverity, errorInfo);
36 public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
37 final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
38 super(message, cause, errorType, errorTag, errorSeverity);
41 public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
42 final ErrorTag errorTag, final ErrorSeverity errorSeverity,
43 final Map<String, String> errorInfo) {
44 super(message, cause, errorType, errorTag, errorSeverity, errorInfo);
47 @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
48 public NetconfDocumentedException(final DocumentedException exception) {
49 super(exception.getMessage(), (Exception) exception.getCause(), exception.getErrorType(),
50 exception.getErrorTag(), exception.getErrorSeverity(), exception.getErrorInfo());
53 public static NetconfDocumentedException fromXMLDocument(final Document fromDoc) {
54 return new NetconfDocumentedException(DocumentedException.fromXMLDocument(fromDoc));