[java-identity-provider] branch main updated: Some null/checkstyle fixes.
Scott Cantor
cantor.2 at osu.edu
Mon Nov 10 16:22:12 UTC 2025
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
https://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=8f9c8333d3e07031ed14ff330a50814c4ee1e550
The following commit(s) were added to refs/heads/main by this push:
new 8f9c8333d Some null/checkstyle fixes.
8f9c8333d is described below
commit 8f9c8333d3e07031ed14ff330a50814c4ee1e550
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 10 11:22:06 2025 -0500
Some null/checkstyle fixes.
---
.../impl/InstallableComponentPropertyCache.java | 30 +++++++++++++++-------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentPropertyCache.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentPropertyCache.java
index 1fca76c3e..3138888c8 100644
--- a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentPropertyCache.java
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InstallableComponentPropertyCache.java
@@ -41,7 +41,8 @@ import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
/**
- * A caching shim on top of {@link InstallableComponentSupport#loadInfo(List, HttpClient, HttpClientSecurityParameters)}.
+ * A caching shim on top of
+ * {@link InstallableComponentSupport#loadInfo(List, HttpClient, HttpClientSecurityParameters)}.
*/
public class InstallableComponentPropertyCache extends AbstractIdentifiableInitializableComponent {
@@ -56,13 +57,15 @@ public class InstallableComponentPropertyCache extends AbstractIdentifiableIniti
*/
@NonnullAfterInit private Duration cacheLife;
+ /** Shared lock. */
@Nonnull private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(true);
/** Set {@link #cacheLife}.
* @param howLong what to set
*/
- public void setCacheLife(@Nullable Duration howLong) {
+ public void setCacheLife(@Nullable final Duration howLong) {
cacheLife = Constraint.isNotNull(howLong, "Duration cache life should be non null");
+ assert howLong != null;
Constraint.isTrue(!howLong.isNegative(), "Duration cache life should be positive");
log.debug("Setting a delay of {} minutes", cacheLife.toMinutes());
}
@@ -74,8 +77,11 @@ public class InstallableComponentPropertyCache extends AbstractIdentifiableIniti
}
}
- /** Provide a shim on top of {@link InstallableComponentSupport#loadInfo(List, HttpClient, HttpClientSecurityParameters)}.
- * We use the first URL in the list as the cache key.
+ /** Provide a shim on top of
+ * {@link InstallableComponentSupport#loadInfo(List, HttpClient, HttpClientSecurityParameters)}.
+ *
+ * <p>We use the first URL in the list as the cache key.</p>
+ *
* @param updateURLs where to look
* @param client the http client to use
* @param securityParameters the HttpClientSecurityParameters, if any
@@ -96,12 +102,15 @@ public class InstallableComponentPropertyCache extends AbstractIdentifiableIniti
readLock.lock();
final Instant now = Instant.now();
- Pair<Instant, Properties> cachedValue = cache.get(updateURLs.get(0));
+ final Pair<Instant, Properties> cachedValue = cache.get(updateURLs.get(0));
if (cachedValue != null) {
log.trace("Cache hit: [expires: {} now: {}]", cachedValue.getFirst(), now);
// if it expires after now
- if (cachedValue.getFirst().isAfter(now)) {
- return cachedValue.getSecond();
+ final Instant ts = cachedValue.getFirst();
+ if (ts != null) {
+ if (ts.isAfter(now)) {
+ return cachedValue.getSecond();
+ }
}
}
} finally {
@@ -118,8 +127,11 @@ public class InstallableComponentPropertyCache extends AbstractIdentifiableIniti
if (cachedValue != null) {
log.trace("Cache hit: [expires: {} now: {}]", cachedValue.getFirst(), now);
// if it expires after now
- if (cachedValue.getFirst().isAfter(now)) {
- return cachedValue.getSecond();
+ final Instant ts = cachedValue.getFirst();
+ if (ts != null) {
+ if (ts.isAfter(now)) {
+ return cachedValue.getSecond();
+ }
}
}
// ask the URL(s)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list