[java-shib-shared] branch main updated: Add wrappers for empty collections and logger acquisition, more cleanup.
Scott Cantor
cantor.2 at osu.edu
Fri Jan 20 18:00:03 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=c89c5c9ac2c56358f98c17537665c75492b92149
The following commit(s) were added to refs/heads/main by this push:
new c89c5c9a Add wrappers for empty collections and logger acquisition, more cleanup.
c89c5c9a is described below
commit c89c5c9ac2c56358f98c17537665c75492b92149
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Jan 20 13:00:00 2023 -0500
Add wrappers for empty collections and logger acquisition, more cleanup.
---
.../net/shibboleth/shared/codec/Base64Support.java | 1 +
.../shibboleth/shared/codec/StringDigester.java | 2 +-
.../shared/collection/ClassIndexedSet.java | 1 +
.../shared/collection/ClassToInstanceMultiMap.java | 6 ++-
.../shared/collection/CollectionSupport.java | 3 +-
.../shared/logic/ScriptedBiConsumer.java | 2 +-
.../shared/logic/ScriptedBiFunction.java | 2 +-
.../shared/logic/ScriptedBiPredicate.java | 2 +-
.../shibboleth/shared/logic/ScriptedConsumer.java | 2 +-
.../shibboleth/shared/logic/ScriptedFunction.java | 2 +-
.../shibboleth/shared/logic/ScriptedPredicate.java | 3 +-
.../shared/primitive/DeprecationSupport.java | 1 -
.../shibboleth/shared/primitive/LoggerFactory.java | 63 ++++++++++++++++++++++
.../shibboleth/shared/primitive/StringSupport.java | 4 +-
.../resolver/CriterionPredicateRegistry.java | 4 +-
.../shared/resolver/ResolverSupport.java | 9 ++--
.../shared/scripting/AbstractScriptEvaluator.java | 8 +--
.../shared/scripting/EvaluableScript.java | 2 +-
.../shared/scripting/ScriptedRunnable.java | 5 +-
.../net/shibboleth/shared/xml/SchemaBuilder.java | 3 +-
.../shared/xml/impl/BasicParserPool.java | 15 +++---
.../java/support/logic/FunctionSupport.java | 2 +-
.../java/support/logic/PredicateSupport.java | 2 +-
23 files changed, 109 insertions(+), 35 deletions(-)
diff --git a/shib-support/src/main/java/net/shibboleth/shared/codec/Base64Support.java b/shib-support/src/main/java/net/shibboleth/shared/codec/Base64Support.java
index a4634e41..e5f3f46f 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/codec/Base64Support.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/codec/Base64Support.java
@@ -128,6 +128,7 @@ public final class Base64Support {
s = s.split("=")[0];
s = s.replace('+', '-');
s = s.replace('/', '_');
+ assert s != null;
return s;
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java b/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
index 63356976..6185aafb 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/codec/StringDigester.java
@@ -28,12 +28,12 @@ import javax.annotation.Nullable;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import org.apache.commons.codec.CharEncoding;
import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A function which accepts a String input, digests it according to a specified {@link MessageDigest} algorithm,
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java b/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java
index fb0eced3..189393b6 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/ClassIndexedSet.java
@@ -53,6 +53,7 @@ public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
/** {@inheritDoc} */
public boolean add(final T o) {
+ assert o != null;
return add(o, false);
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/ClassToInstanceMultiMap.java b/shib-support/src/main/java/net/shibboleth/shared/collection/ClassToInstanceMultiMap.java
index 66e47ad2..2228d3af 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/ClassToInstanceMultiMap.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/ClassToInstanceMultiMap.java
@@ -117,12 +117,12 @@ public class ClassToInstanceMultiMap<B> {
*/
@Nonnull @NonnullElements @Unmodifiable @Live public <T> List<T> get(@Nullable final Class<T> type) {
if (type == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
final List<T> indexedValues = (List<T>) backingMap.get(type);
if (indexedValues == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
return Collections.unmodifiableList(indexedValues);
}
@@ -191,6 +191,7 @@ public class ClassToInstanceMultiMap<B> {
}
for (final B value : newValues) {
+ assert value != null;
put(value);
}
}
@@ -352,6 +353,7 @@ public class ClassToInstanceMultiMap<B> {
if (interfaces.length > 0) {
for (final Class<?> iface : interfaces) {
accumulator.add(iface);
+ assert iface != null;
getSuperTypes(iface, accumulator);
}
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java b/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java
index 6a4e9005..96033156 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/collection/CollectionSupport.java
@@ -27,7 +27,8 @@ import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Support functions for Collection and Map Management.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiConsumer.java b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiConsumer.java
index a82fab1c..17620ece 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiConsumer.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiConsumer.java
@@ -30,12 +30,12 @@ import javax.script.ScriptException;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link BiConsumer} which calls out to a supplied script.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiFunction.java b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiFunction.java
index f8e6a22d..b6944aa3 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiFunction.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiFunction.java
@@ -30,12 +30,12 @@ import javax.script.ScriptException;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link BiFunction} which calls out to a supplied script.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiPredicate.java
index b8c6c0d5..d08e973a 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedBiPredicate.java
@@ -30,12 +30,12 @@ import javax.script.ScriptException;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link BiPredicate} which calls out to a supplied script.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedConsumer.java b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedConsumer.java
index 7ffb0174..dcd56630 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedConsumer.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedConsumer.java
@@ -29,12 +29,12 @@ import javax.script.ScriptException;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link Consumer} which calls out to a supplied script.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedFunction.java b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedFunction.java
index cf90271d..43991788 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedFunction.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedFunction.java
@@ -29,12 +29,12 @@ import javax.script.ScriptException;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link Function} which calls out to a supplied script.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedPredicate.java b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedPredicate.java
index f5167dcf..699d1e6a 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedPredicate.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/logic/ScriptedPredicate.java
@@ -20,7 +20,6 @@ package net.shibboleth.shared.logic;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Collections;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
@@ -30,12 +29,12 @@ import javax.script.ScriptException;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link Predicate} which calls out to a supplied script.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java
index e48d7708..c7b07e4b 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/DeprecationSupport.java
@@ -24,7 +24,6 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java
new file mode 100644
index 00000000..6b5692ad
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/LoggerFactory.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.shared.primitive;
+
+import javax.annotation.Nonnull;
+
+import org.slf4j.Logger;
+
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+
+
+/**
+ * Non-null wrappers for SLF4J logger acquisition.
+ *
+ * @since 9.0.0
+ */
+public final class LoggerFactory {
+
+ /**
+ * Get class-based logger.
+ *
+ * @param claz class for logger
+ *
+ * @return the logger instance
+ */
+ @SuppressWarnings("null")
+ @Nonnull public static Logger getLogger(@Nonnull final Class<?> claz) {
+ return org.slf4j.LoggerFactory.getLogger(claz);
+ }
+
+ /**
+ * Get class-based logger.
+ *
+ * @param category name for logger
+ *
+ * @return the logger instance
+ */
+ @SuppressWarnings("null")
+ @Nonnull public static Logger getLogger(@Nonnull @NotEmpty final String category) {
+ return org.slf4j.LoggerFactory.getLogger(category);
+ }
+
+ /** Constructor. */
+ private LoggerFactory() {
+
+ }
+
+}
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
index 77076bdd..be8fa1c9 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
@@ -25,7 +25,6 @@ import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
@@ -36,6 +35,7 @@ import javax.annotation.Nullable;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NullableElements;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.ConstraintViolationException;
@@ -173,7 +173,7 @@ public final class StringSupport {
@Nonnull @NonnullElements public static Collection<String> normalizeStringCollection(
@Nullable @NullableElements final Collection<String> values) {
if (values == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
return values.stream().map(StringSupport::trimOrNull).filter(e->e != null).collect(Collectors.toList());
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java
index 946b8345..6c2deb6d 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/CriterionPredicateRegistry.java
@@ -30,10 +30,10 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A registry which manages mappings from types of {@link Criterion} to types of {@link Predicate}
@@ -204,6 +204,8 @@ public class CriterionPredicateRegistry<T> {
continue;
}
+ assert criterionClass != null;
+ assert predicateClass != null;
register(criterionClass, predicateClass);
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java
index 6b125661..a161e703 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java
@@ -17,7 +17,6 @@
package net.shibboleth.shared.resolver;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
@@ -27,6 +26,7 @@ import javax.annotation.Nullable;
import com.google.common.collect.Iterables;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.PredicateSupport;
/**
@@ -56,12 +56,13 @@ public final class ResolverSupport {
throws ResolverException {
if (criteriaSet == null) {
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
final Set<Predicate<T>> predicates = new HashSet<>(criteriaSet.size());
for (final Criterion criterion : criteriaSet) {
+ assert criterion != null;
if (predicateCriterionType != null && predicateCriterionType.isInstance(criterion)) {
predicates.add(predicateCriterionType.cast(criterion));
} else if (registry != null) {
@@ -95,12 +96,12 @@ public final class ResolverSupport {
final boolean onEmptyPredicatesReturnEmpty) {
if (candidates == null || !candidates.iterator().hasNext()) {
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
if (predicates == null || predicates.isEmpty()) {
if (onEmptyPredicatesReturnEmpty) {
- return Collections.emptySet();
+ return CollectionSupport.emptySet();
}
return candidates;
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java b/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
index c4c211e2..31b118d7 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
@@ -18,7 +18,6 @@
package net.shibboleth.shared.scripting;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
@@ -30,10 +29,11 @@ import javax.script.SimpleScriptContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A component that evaluates an {@link EvaluableScript} against a set of inputs
@@ -77,7 +77,7 @@ public abstract class AbstractScriptEvaluator {
*/
public AbstractScriptEvaluator(@Nonnull @ParameterName(name="theScript") final EvaluableScript theScript) {
script = Constraint.isNotNull(theScript, "Supplied script cannot be null");
- contextExtenders = Collections.emptyList();
+ contextExtenders = CollectionSupport.emptyList();
}
/**
@@ -183,7 +183,7 @@ public abstract class AbstractScriptEvaluator {
if (extenders != null) {
contextExtenders = List.copyOf(extenders);
} else {
- contextExtenders = Collections.emptyList();
+ contextExtenders = CollectionSupport.emptyList();
}
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/scripting/EvaluableScript.java b/shib-support/src/main/java/net/shibboleth/shared/scripting/EvaluableScript.java
index 6c20e279..5c0474ab 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/scripting/EvaluableScript.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/scripting/EvaluableScript.java
@@ -33,7 +33,6 @@ import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.common.io.Files;
@@ -43,6 +42,7 @@ import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.ConstraintViolationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.resource.Resource;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/scripting/ScriptedRunnable.java b/shib-support/src/main/java/net/shibboleth/shared/scripting/ScriptedRunnable.java
index 7902bf9a..a335b9f9 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/scripting/ScriptedRunnable.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/scripting/ScriptedRunnable.java
@@ -22,13 +22,13 @@ import javax.annotation.Nullable;
import javax.script.ScriptContext;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.component.UnmodifiableComponent;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* A Runnable which executes a script.
@@ -56,6 +56,7 @@ public class ScriptedRunnable extends AbstractIdentifiableInitializableComponent
throw new ComponentInitializationException("No script has been provided");
}
+ assert script != null;
scriptEvaluator = new RunnableScriptEvaluator(script);
scriptEvaluator.setCustomObject(customObject);
@@ -105,6 +106,8 @@ public class ScriptedRunnable extends AbstractIdentifiableInitializableComponent
/** {@inheritDoc} */
@Override public void run() {
+ checkComponentActive();
+
scriptEvaluator.execute();
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java b/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
index 5568f3dc..cdf473bf 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/SchemaBuilder.java
@@ -38,12 +38,13 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NullableElements;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.xml.impl.LoggingErrorHandler;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
index 373bf50d..7454b80a 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
@@ -37,7 +37,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.validation.Schema;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
@@ -46,16 +46,17 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NullableElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.xml.ParserPool;
import net.shibboleth.shared.xml.XMLParserException;
@@ -136,7 +137,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
public BasicParserPool() {
maxPoolSize = 5;
builderPool = new Stack<>();
- builderAttributes = Collections.emptyMap();
+ builderAttributes = CollectionSupport.emptyMap();
coalescing = true;
expandEntityReferences = false;
builderFeatures = buildDefaultFeatures();
@@ -330,7 +331,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
checkSetterPreconditions();
if (newAttributes == null) {
- builderAttributes = Collections.emptyMap();
+ builderAttributes = CollectionSupport.emptyMap();
} else {
builderAttributes = new HashMap<>(Maps.filterKeys(newAttributes, Predicates.notNull()));
}
@@ -394,9 +395,9 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
checkSetterPreconditions();
if (newFeatures == null) {
- builderFeatures = Collections.emptyMap();
+ builderFeatures = CollectionSupport.emptyMap();
} else {
- builderFeatures = ImmutableMap.copyOf(Maps.filterKeys(newFeatures, Predicates.notNull()));
+ builderFeatures = Map.copyOf(Maps.filterKeys(newFeatures, Predicates.notNull()));
}
}
@@ -673,7 +674,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
*
* @return the default features map
*/
- protected Map<String, Boolean> buildDefaultFeatures() {
+ @Nonnull protected Map<String, Boolean> buildDefaultFeatures() {
final HashMap<String, Boolean> features = new HashMap<>();
features.put(XMLConstants.FEATURE_SECURE_PROCESSING, true);
features.put("http://apache.org/xml/features/disallow-doctype-decl", true);
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
index e876398f..b0a685bf 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
@@ -31,7 +31,7 @@ import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
*
* @deprecated
*/
- at Deprecated(since="8.3.0", forRemoval=true)
+ at Deprecated(since="9.0.0", forRemoval=true)
public final class FunctionSupport {
/** Constructor. */
diff --git a/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java b/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
index 4120e287..77a22ffe 100644
--- a/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
@@ -30,7 +30,7 @@ import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
*
* @deprecated
*/
- at Deprecated(since="8.3.0", forRemoval=true)
+ at Deprecated(since="9.0.0", forRemoval=true)
public final class PredicateSupport {
/** Constructor. */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list