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 736a4fc035eff377863c2d60e7683194f2477ff8..bfeb2a69ee3c94bcee0e2de34f2deb3660a5bf1e 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();