Fix findbugs violations in netconf
[netconf.git] / netconf / netconf-api / src / main / java / org / opendaylight / netconf / api / NetconfDocumentedException.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.netconf.api;
10
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import java.util.Map;
13 import org.opendaylight.controller.config.util.xml.DocumentedException;
14 import org.w3c.dom.Document;
15
16 /**
17  * Checked exception to communicate an error that needs to be sent to the netconf client.
18  */
19 public class NetconfDocumentedException extends DocumentedException {
20     private static final long serialVersionUID = 1L;
21
22     public NetconfDocumentedException(final String message) {
23         super(message);
24     }
25
26     public NetconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
27                                       final ErrorSeverity errorSeverity) {
28         super(message, errorType, errorTag, errorSeverity);
29     }
30
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);
34     }
35
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);
39     }
40
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);
45     }
46
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());
51     }
52
53     public static NetconfDocumentedException fromXMLDocument(final Document fromDoc) {
54         return new NetconfDocumentedException(DocumentedException.fromXMLDocument(fromDoc));
55     }
56 }