Use FrameworkUtil.asDictionary() 05/101805/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Jul 2022 21:02:24 +0000 (23:02 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Jul 2022 21:02:24 +0000 (23:02 +0200)
We do not need a Hashtable, use FrameworkUtil to give us what we need.

Change-Id: Ib85e8fcfb7511e8c78576b7d27d33af896025abe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-password-service/impl/pom.xml
aaa-password-service/impl/src/main/java/org/opendaylight/aaa/impl/password/service/OSGiPasswordServiceConfig.java

index 51098e98423dc9095fae1c930b202feba21f28e6..c8ba22abbb384ed48cffd7a49c9b069563318b13 100644 (file)
@@ -31,6 +31,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <groupId>org.opendaylight.aaa</groupId>
       <artifactId>repackaged-shiro</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.framework</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.service.component</artifactId>
index 183b322c582fd4f04c265da98b987ee8f8ac8a06..6c67017f2959fac1d579d6eb20df6a3f35f39b6b 100644 (file)
@@ -8,17 +8,15 @@
 package org.opendaylight.aaa.impl.password.service;
 
 import static com.google.common.base.Verify.verifyNotNull;
-import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ForwardingObject;
 import java.util.Dictionary;
-import java.util.Hashtable;
 import java.util.Map;
-import org.gaul.modernizer_maven_annotations.SuppressModernizer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.password.service.config.rev170619.PasswordServiceConfig;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.osgi.framework.FrameworkUtil;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
@@ -81,10 +79,7 @@ public final class OSGiPasswordServiceConfig extends ForwardingObject implements
         delegate = null;
     }
 
-    @SuppressModernizer
     static Dictionary<String, ?> props(final PasswordServiceConfig delegate) {
-        final Dictionary<String, Object> ret = new Hashtable<>(2);
-        ret.put(DELEGATE, requireNonNull(delegate));
-        return ret;
+        return FrameworkUtil.asDictionary(Map.of(DELEGATE, delegate));
     }
 }