Fix a nullness warning 98/101798/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Jul 2022 19:04:40 +0000 (21:04 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Jul 2022 19:04:40 +0000 (21:04 +0200)
The result can be null, add an annotation to reflect that.

Change-Id: I6d26539bf3853bd9ed8289b896bd530ff4abb09d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-idm-store-h2/src/main/java/org/opendaylight/aaa/datastore/h2/AbstractStore.java

index 9b9aa3130b1e1002f1bebe8759389c4052dc75bb..0bd5b38ef2ff73ff7cff6bd66c6aff9b6e0fead8 100644 (file)
@@ -20,6 +20,7 @@ import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.List;
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -164,7 +165,7 @@ abstract class AbstractStore<T> {
      * @return The first item, or {@code null} if none.
      * @throws StoreException if an error occurs.
      */
-    final T firstFromStatement(final PreparedStatement ps) throws StoreException {
+    final @Nullable T firstFromStatement(final PreparedStatement ps) throws StoreException {
         try (var rs = ps.executeQuery()) {
             return rs.next() ? fromResultSet(rs) : null;
         } catch (SQLException e) {