Refactor DocumentedException class 22/48322/4
authorJakub Morvay <jmorvay@cisco.com>
Mon, 14 Nov 2016 15:19:47 +0000 (16:19 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 15 Nov 2016 17:40:20 +0000 (17:40 +0000)
Deprecate ErrorType and ErrorSeverity getTagValue methods. Add new
replacement getTypeValue and getSeverityValue methods respectively.

Change-Id: If7915c65e72a26bfd6c676bb17c94c896cc0c5e2
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/xml/DocumentedException.java

index 736a4fc..bfeb2a6 100644 (file)
@@ -65,6 +65,14 @@ public class DocumentedException extends Exception {
     public enum ErrorType {
         TRANSPORT, RPC, PROTOCOL, APPLICATION;
 
+        public String getTypeValue() {
+            return name();
+        }
+
+        /**
+         * @deprecated Use {@link #getTypeValue()} instead.
+         */
+        @Deprecated
         public String getTagValue() {
             return name();
         }
@@ -125,6 +133,14 @@ public class DocumentedException extends Exception {
     public enum ErrorSeverity {
         ERROR, WARNING;
 
+        public String getSeverityValue() {
+            return name();
+        }
+
+        /**
+         * @deprecated Use {@link #getSeverityValue()} instead.
+         */
+        @Deprecated
         public String getTagValue() {
             return name();
         }
@@ -285,9 +301,9 @@ public class DocumentedException extends Exception {
             Node rpcError = doc.createElementNS( URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, RPC_ERROR );
             rpcReply.appendChild( rpcError );
 
-            rpcError.appendChild( createTextNode( doc, ERROR_TYPE, getErrorType().getTagValue() ) );
+            rpcError.appendChild( createTextNode( doc, ERROR_TYPE, getErrorType().getTypeValue() ) );
             rpcError.appendChild( createTextNode( doc, ERROR_TAG, getErrorTag().getTagValue() ) );
-            rpcError.appendChild( createTextNode( doc, ERROR_SEVERITY, getErrorSeverity().getTagValue() ) );
+            rpcError.appendChild( createTextNode( doc, ERROR_SEVERITY, getErrorSeverity().getSeverityValue() ) );
             rpcError.appendChild( createTextNode( doc, ERROR_MESSAGE, getLocalizedMessage() ) );
 
             Map<String, String> errorInfoMap = getErrorInfo();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.