OperationsContent requires a context 60/107860/3
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Sep 2023 19:14:05 +0000 (21:14 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 14 Sep 2023 08:58:02 +0000 (10:58 +0200)
All callers are guaranteed to have a non-null context, just ditch the
check.

Change-Id: I23d3d1873a5008b5da8683b665df4bf7e9dd0def
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/OperationsContent.java

index 465b47978c73a87167979aece708f21fe4098e84..34d06652d7b29f79c89f0c89fbbeabb561749d0f 100644 (file)
@@ -13,7 +13,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.restconf.nb.rfc8040.legacy.InstanceIdentifierContext;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
@@ -101,7 +100,7 @@ enum OperationsContent {
      * @param context Context to use
      * @return Content of HTTP GET operation as a String
      */
-    public final @NonNull String bodyFor(final @Nullable EffectiveModelContext context) {
+    public final @NonNull String bodyFor(final EffectiveModelContext context) {
         if (isEmptyContext(context)) {
             // No modules, or defensive return empty content
             return emptyBody;
@@ -142,9 +141,6 @@ enum OperationsContent {
     }
 
     private static boolean isEmptyContext(final EffectiveModelContext context) {
-        if (context == null) {
-            return true;
-        }
         return context.getModuleStatements().isEmpty();
     }