[java-plugin-storage-jdbc] branch main updated: Javadoc, checkstyle, factor out NonnullElements annotation.

Codeberg noreply at shibboleth.net
Tue Jul 14 14:50:49 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-plugin-storage-jdbc.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-storage-jdbc/commit/5ea29d3926c2c088b55141ba8a31c43e0bc962a1

The following commit(s) were added to refs/heads/main by this push:
     new 5ea29d3  Javadoc, checkstyle, factor out NonnullElements annotation.
5ea29d3 is described below

commit 5ea29d3926c2c088b55141ba8a31c43e0bc962a1
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Jul 14 10:50:37 2026 -0400

    Javadoc, checkstyle, factor out NonnullElements annotation.
---
 .../storage/jdbc/impl/JDBCStorageService.java      | 53 ++++++++++++++--------
 .../plugin/storage/jdbc/impl/package-info.java     |  5 +-
 2 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
index a491503..ff5263b 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
@@ -469,13 +469,18 @@ public final class JDBCStorageService extends AbstractStorageService
         }
     }
 
-    /** Check that the strings fit within the constrained size, when converted into byte arrays
+    /**
+     * Check that the strings fit within the constrained size.
+     * 
+     * <p>This method assumes databases will properly operate on "characters" when the
+     * proper Unicode collations are used.</p>
+     * 
      * @param context the context
      * @param key the key (if relevant for the operation being policed)
-     * @throws IoException if either are too large.
+     * 
+     * @throws IOException if either are too large.
      */
-    private void checkContextAndKeySize(@Nonnull final String context, @Nullable String key) throws IOException
-    {
+    private void checkContextAndKeySize(@Nonnull final String context, @Nullable final String key) throws IOException {
         if (context.length() > getContextSize()) {
             log.error("Context {} was too large ({{} > {})", context, context.length(), getContextSize());
             throw new IOException("Supplied Context was too large");
@@ -495,7 +500,7 @@ public final class JDBCStorageService extends AbstractStorageService
      * @return all contexts or an empty list
      * @throws IOException if errors occur in the read process
      */
-    @Nonnull @NonnullElements protected List<String> readContexts() throws IOException {
+    @Nonnull protected List<String> readContexts() throws IOException {
         final List<String> result = new ArrayList<>();
         try (final ConnectionWithLock connection= new ConnectionWithLock(true, false)) {
             log.trace("ReadContexts:: ", readContextsSQL);
@@ -521,7 +526,7 @@ public final class JDBCStorageService extends AbstractStorageService
      * @return all records or an empty list
      * @throws IOException if errors occur in the read process
      */
-    @Nonnull @NonnullElements protected List<?> readAll() throws IOException {
+    @Nonnull protected List<?> readAll() throws IOException {
         final List<JDBCStorageRecord<?>> result = new ArrayList<>();
         try (final ConnectionWithLock connection = new ConnectionWithLock(true, false);
              final PreparedStatement query = connection.prepareStatement(readAllSQL);
@@ -553,7 +558,7 @@ public final class JDBCStorageService extends AbstractStorageService
      * @return all records in the context or an empty list
      * @throws IOException if errors occur in the read process
      */
-    @Nonnull @NonnullElements protected List<?> readAll(@Nonnull @NotEmpty final String context)
+    @Nonnull protected List<?> readAll(@Nonnull @NotEmpty final String context)
         throws IOException {
         final List<JDBCStorageRecord<?>> result = new ArrayList<>();
         Constraint.isNotEmpty(Constraint.isNotNull(context, "ReadAll(String): context must not be null"),
@@ -583,8 +588,8 @@ public final class JDBCStorageService extends AbstractStorageService
         }
     }
 
+// Checkstyle: CyclomaticComplexity|MethodLength OFF
     /** {@inheritDoc} */
-    // Checkstyle: CyclomaticComplexity OFF
     public boolean create(@Nonnull @NotEmpty final String context,
                           @Nonnull @NotEmpty final String key,
                           @Nonnull @NotEmpty final String value,
@@ -660,16 +665,18 @@ public final class JDBCStorageService extends AbstractStorageService
             }
         }
     }
-    // Checkstyle: CyclomaticComplexity ON
+// Checkstyle: CyclomaticComplexity|MethodLength ON
 
     /** {@inheritDoc} */
-    @Override @Nullable public <T> StorageRecord<T> read(@Nonnull @NotEmpty final String context,
+    @Override
+    @Nullable public <T> StorageRecord<T> read(@Nonnull @NotEmpty final String context,
                                                          @Nonnull @NotEmpty final String key) throws IOException {
         return this.<T>readImpl(context, key, null).getSecond();
     }
 
     /** {@inheritDoc} */
-    @Override @Nonnull public <T> Pair<Long, StorageRecord<T>>
+    @Override
+    @Nonnull public <T> Pair<Long, StorageRecord<T>>
            read(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
                 @Positive final long version) throws IOException {
         return readImpl(context, key, version);
@@ -757,7 +764,8 @@ public final class JDBCStorageService extends AbstractStorageService
     // Checkstyle: CyclomaticComplexity ON
 
     /** {@inheritDoc} */
-    @Override public boolean update(@Nonnull @NotEmpty final String context,
+    @Override
+    public boolean update(@Nonnull @NotEmpty final String context,
                                     @Nonnull @NotEmpty final String key,
                                     @Nonnull @NotEmpty final String value,
                                     @Nullable @Positive final Long expiration) throws IOException {
@@ -769,7 +777,8 @@ public final class JDBCStorageService extends AbstractStorageService
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public Long updateWithVersion(@Positive final long version,
+    @Override
+    @Nullable public Long updateWithVersion(@Positive final long version,
                                                       @Nonnull @NotEmpty final String context,
                                                       @Nonnull @NotEmpty final String key,
                                                       @Nonnull @NotEmpty final String value,
@@ -779,7 +788,8 @@ public final class JDBCStorageService extends AbstractStorageService
     }
 
     /** {@inheritDoc} */
-    @Override public boolean updateExpiration(@Nonnull @NotEmpty final String context,
+    @Override
+    public boolean updateExpiration(@Nonnull @NotEmpty final String context,
                                               @Nonnull @NotEmpty final String key,
                                               @Nullable @Positive final Long expiration) throws IOException {
         try {
@@ -888,7 +898,8 @@ public final class JDBCStorageService extends AbstractStorageService
 // Checkstyle: CyclomaticComplexity|MethodLength ON
 
     /** {@inheritDoc} */
-    @Override public boolean deleteWithVersion(@Positive final long version,
+    @Override
+    public boolean deleteWithVersion(@Positive final long version,
                                                @Nonnull @NotEmpty final String context,
                                                @Nonnull @NotEmpty final String key)
                                                            throws IOException, VersionMismatchException {
@@ -896,7 +907,8 @@ public final class JDBCStorageService extends AbstractStorageService
     }
 
     /** {@inheritDoc} */
-    @Override public boolean delete(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key)
+    @Override
+    public boolean delete(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key)
         throws IOException {
         try {
             return deleteImpl(null, context, key);
@@ -1253,7 +1265,8 @@ public final class JDBCStorageService extends AbstractStorageService
     }
     
     /** {@inheritDoc} */
-    @Override @Nullable protected TimerTask getCleanupTask() {
+    @Override
+    @Nullable protected TimerTask getCleanupTask() {
         return new TimerTask() {
 
             /** {@inheritDoc} */
@@ -1270,9 +1283,11 @@ public final class JDBCStorageService extends AbstractStorageService
         };
     }
 
-    /** A Class to encapsulate a {@link Connection} protected by an optional
+    /**
+     * A Class to encapsulate a {@link Connection} protected by an optional
      * read/write lock.
-     * Because the class implements {@link AutoCloseable} the unlock can "just happen"
+     * 
+     * <p>Because the class implements {@link AutoCloseable} the unlock can "just happen".</p>
      */
     private class ConnectionWithLock implements AutoCloseable {
 
diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/package-info.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/package-info.java
index 642a3a2..d7e9368 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/package-info.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/package-info.java
@@ -11,8 +11,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /**
  * Package to contain classes to do with the JDBC Storage service provider.
  */
-
+ at NonnullElements
 package net.shibboleth.plugin.storage.jdbc.impl;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list