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.ErrorTag;
14 import org.opendaylight.yangtools.yang.common.ErrorType;
15 import org.w3c.dom.Document;
18 * Checked exception to communicate an error that needs to be sent to the netconf client.
20 public class NetconfDocumentedException extends DocumentedException {
21 private static final long serialVersionUID = 1L;
23 public NetconfDocumentedException(final String message) {
27 public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
28 final ErrorSeverity errorSeverity) {
29 super(message, errorType, errorTag, errorSeverity);
32 public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
33 final ErrorSeverity errorSeverity, final Map<String, String> errorInfo) {
34 super(message, errorType, errorTag, errorSeverity, errorInfo);
37 public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
38 final ErrorTag errorTag, final ErrorSeverity errorSeverity) {
39 super(message, cause, errorType, errorTag, errorSeverity);
42 public NetconfDocumentedException(final String message, final Exception cause, final ErrorType errorType,
43 final ErrorTag errorTag, final ErrorSeverity errorSeverity,
44 final Map<String, String> errorInfo) {
45 super(message, cause, errorType, errorTag, errorSeverity, errorInfo);
48 @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
49 public NetconfDocumentedException(final DocumentedException exception) {
50 super(exception.getMessage(), (Exception) exception.getCause(), exception.getErrorType(),
51 exception.getErrorTag(), exception.getErrorSeverity(), exception.getErrorInfo());
54 public static NetconfDocumentedException fromXMLDocument(final Document fromDoc) {
55 return new NetconfDocumentedException(DocumentedException.fromXMLDocument(fromDoc));