From 6151f0444151183903debc231039dbf3183cd560 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 3 Aug 2023 17:51:26 +0200 Subject: [PATCH] Use ErrorSeverity.elementBody() in RestconfError ErrorSeverity provides the element body through a dedicated method, do to use toLowerCase(). Change-Id: I5a036dc65de8b798f2dd0eb1121f27f00c4752c7 Signed-off-by: Robert Varga --- .../opendaylight/restconf/common/errors/RestconfError.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java index f44717bdf8..fbf66610ef 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java @@ -9,9 +9,7 @@ package org.opendaylight.restconf.common.errors; import static java.util.Objects.requireNonNull; -import java.io.Serial; import java.io.Serializable; -import java.util.Locale; import org.opendaylight.yangtools.yang.common.ErrorTag; import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.RpcError; @@ -28,7 +26,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; * See also RESTCONF. */ public class RestconfError implements Serializable { - @Serial + @java.io.Serial private static final long serialVersionUID = 1L; private final ErrorType errorType; @@ -149,8 +147,7 @@ public class RestconfError implements Serializable { if (rpcError.getCause() != null) { localErrorInfo = rpcError.getCause().getMessage(); } else if (rpcError.getSeverity() != null) { - localErrorInfo = "" + rpcError.getSeverity().toString().toLowerCase(Locale.ROOT) - + ""; + localErrorInfo = "" + rpcError.getSeverity().elementBody() + ""; } } else { localErrorInfo = rpcError.getInfo(); -- 2.36.6