[java-opensaml] branch main updated: Revert "Null cleanup."
Codeberg
noreply at shibboleth.net
Tue Nov 25 16:23:16 UTC 2025
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-opensaml.
View the commit online:
https://codeberg.org/Shibboleth/java-opensaml/commit/7f3c06530a5d05f52214ac6fa2302d60aeb07e26
The following commit(s) were added to refs/heads/main by this push:
new 7f3c06530 Revert "Null cleanup."
7f3c06530 is described below
commit 7f3c06530a5d05f52214ac6fa2302d60aeb07e26
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Nov 25 11:22:42 2025 -0500
Revert "Null cleanup."
This reverts commit 8eaaf5a8afc456b5466591f3008a64b0b7bec215.
Pending broader changes to deal with JSpecify issues.
---
.../org/opensaml/core/config/ConfigurationService.java | 3 ++-
.../xml/persist/impl/FilesystemLoadSaveManagerTest.java | 2 +-
.../servlet/BaseHttpServletResponseXMLMessageEncoder.java | 5 ++++-
.../saml2/binding/decoding/impl/HTTPArtifactDecoder.java | 1 -
.../saml/saml2/binding/decoding/impl/HTTPPostDecoder.java | 1 -
.../binding/decoding/impl/HTTPPostSimpleSignDecoder.java | 6 +-----
.../binding/decoding/impl/HTTPRedirectDeflateDecoder.java | 10 ++--------
.../saml2/binding/encoding/impl/HTTPArtifactEncoder.java | 6 +-----
.../org/opensaml/saml/saml2/encryption/tests/ECDHTest.java | 4 ++--
.../encoder/http/impl/HttpClientRequestSOAP11Encoder.java | 14 ++++----------
.../encryption/support/tests/DHWithExplicitKDFTest.java | 5 ++---
.../encryption/support/tests/DHWithLegacyKDFTest.java | 5 ++---
.../opensaml/xmlsec/encryption/support/tests/ECDHTest.java | 5 ++---
13 files changed, 23 insertions(+), 44 deletions(-)
diff --git a/opensaml-core-api/src/main/java/org/opensaml/core/config/ConfigurationService.java b/opensaml-core-api/src/main/java/org/opensaml/core/config/ConfigurationService.java
index 8894babe9..3b0bb975e 100644
--- a/opensaml-core-api/src/main/java/org/opensaml/core/config/ConfigurationService.java
+++ b/opensaml-core-api/src/main/java/org/opensaml/core/config/ConfigurationService.java
@@ -24,6 +24,7 @@ import javax.annotation.Nullable;
import org.opensaml.core.config.provider.EmptyConfigurationProperties;
import org.opensaml.core.config.provider.MapBasedConfiguration;
import org.opensaml.core.config.provider.PropertiesAdapter;
+import org.opensaml.core.config.provider.SystemPropertyConfigurationPropertiesSource;
import org.slf4j.Logger;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
@@ -279,7 +280,7 @@ public class ConfigurationService {
*/
@Nonnull @NotEmpty protected static String getPartitionName() {
final ConfigurationProperties configProperties = getConfigurationProperties();
- final String partitionName = configProperties.getProperty(PROPERTY_PARTITION_NAME, DEFAULT_PARTITION_NAME);
+ String partitionName = configProperties.getProperty(PROPERTY_PARTITION_NAME, DEFAULT_PARTITION_NAME);
LOG.trace("Resolved effective configuration partition name '{}'", partitionName);
return partitionName;
}
diff --git a/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java b/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java
index 87ac1737f..3cc1571f6 100644
--- a/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java
+++ b/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java
@@ -440,7 +440,7 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
for (String expectedKey : expectedKeys) {
Assert.assertTrue(manager.exists(expectedKey));
SimpleXMLObject sxo = manager.load(expectedKey);
- assert sxo != null;
+ Assert.assertNotNull(sxo);
Assert.assertEquals(sxo.getObjectMetadata().get(XMLObjectSource.class).size(), 1);
}
diff --git a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/encoder/servlet/BaseHttpServletResponseXMLMessageEncoder.java b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/encoder/servlet/BaseHttpServletResponseXMLMessageEncoder.java
index 42049497c..77a2318b8 100644
--- a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/encoder/servlet/BaseHttpServletResponseXMLMessageEncoder.java
+++ b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/encoder/servlet/BaseHttpServletResponseXMLMessageEncoder.java
@@ -33,6 +33,9 @@ import net.shibboleth.shared.xml.SerializeSupport;
* Base class for message encoders which encode XML messages to HttpServletResponse.
*/
public abstract class BaseHttpServletResponseXMLMessageEncoder extends AbstractHttpServletResponseMessageEncoder {
+
+ /** Used to log protocol messages. */
+ @Nonnull private Logger protocolMessageLog = LoggerFactory.getLogger("PROTOCOL_MESSAGE");
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(BaseHttpServletResponseXMLMessageEncoder.class);
@@ -64,7 +67,7 @@ public abstract class BaseHttpServletResponseXMLMessageEncoder extends Abstract
try {
final Element dom = XMLObjectSupport.marshall(XMLObject.class.cast(message));
return SerializeSupport.prettyPrintXML(dom);
- } catch (final MarshallingException e) {
+ } catch (MarshallingException e) {
log.error("Unable to marshall message for logging purposes", e);
return null;
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPArtifactDecoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPArtifactDecoder.java
index be5b2302d..3bacf4702 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPArtifactDecoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPArtifactDecoder.java
@@ -358,7 +358,6 @@ public class HTTPArtifactDecoder extends BaseSAMLHttpServletRequestDecoder imple
protected void doDecode() throws MessageDecodingException {
final MessageContext messageContext = new MessageContext();
final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
final String relayState = StringSupport.trim(request.getParameter("RelayState"));
log.debug("Decoded SAML relay state of: {}", relayState);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostDecoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostDecoder.java
index d0e7c8cb1..f74d0668a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostDecoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostDecoder.java
@@ -76,7 +76,6 @@ public class HTTPPostDecoder extends BaseSAMLHttpServletRequestDecoder implement
protected void doDecode() throws MessageDecodingException {
final MessageContext messageContext = new MessageContext();
final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
if (!"POST".equalsIgnoreCase(request.getMethod())) {
throw new MessageDecodingException("This message decoder only supports the HTTP POST method");
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java
index f71c3a50c..dac75508e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java
@@ -51,14 +51,11 @@ public class HTTPPostSimpleSignDecoder extends HTTPPostDecoder {
* @param messageContext the current message context
*/
protected void populateBindingContext(@Nonnull final MessageContext messageContext) {
- final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
-
final SAMLBindingContext bindingContext = messageContext.ensureSubcontext(SAMLBindingContext.class);
bindingContext.setBindingUri(getBindingURI());
bindingContext.setBindingDescriptor(getBindingDescriptor());
bindingContext.setHasBindingSignature(
- !Strings.isNullOrEmpty(request.getParameter("Signature")));
+ !Strings.isNullOrEmpty(getHttpServletRequest().getParameter("Signature")));
bindingContext.setIntendedDestinationEndpointURIRequired(SAMLBindingSupport.isMessageSigned(messageContext));
}
@@ -87,7 +84,6 @@ public class HTTPPostSimpleSignDecoder extends HTTPPostDecoder {
*/
@Nullable protected byte[] getSignedContent() throws MessageDecodingException {
final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
final StringBuilder builder = new StringBuilder();
final String samlMsg;
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
index 134f0fd56..c5832294b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
@@ -89,7 +89,6 @@ public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecode
protected void doDecode() throws MessageDecodingException {
final MessageContext messageContext = new MessageContext();
final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
if (!"GET".equalsIgnoreCase(request.getMethod())) {
throw new MessageDecodingException("This message decoder only supports the HTTP GET method");
@@ -170,9 +169,7 @@ public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecode
// We have to construct a string containing the signature input by accessing the
// request directly. We can't use the decoded parameters because we need the raw
// data and URL-encoding isn't canonical.
- final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
- final String queryString = request.getQueryString();
+ final String queryString = getHttpServletRequest().getQueryString();
log.debug("Constructing signed content string from URL query string {}", queryString);
final String constructed = buildSignedContentString(queryString, samlMessageParamName, samlMessage);
@@ -309,14 +306,11 @@ public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecode
* @param messageContext the current message context
*/
protected void populateBindingContext(@Nonnull final MessageContext messageContext) {
- final HttpServletRequest request = getHttpServletRequest();
- assert request != null;
-
final SAMLBindingContext bindingContext = messageContext.ensureSubcontext(SAMLBindingContext.class);
bindingContext.setBindingUri(getBindingURI());
bindingContext.setBindingDescriptor(bindingDescriptor);
bindingContext.setHasBindingSignature(
- !Strings.isNullOrEmpty(request.getParameter("Signature")));
+ !Strings.isNullOrEmpty(getHttpServletRequest().getParameter("Signature")));
bindingContext.setIntendedDestinationEndpointURIRequired(SAMLBindingSupport.isMessageSigned(messageContext));
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPArtifactEncoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPArtifactEncoder.java
index cf43dafcf..20cd05454 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPArtifactEncoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPArtifactEncoder.java
@@ -214,9 +214,7 @@ public class HTTPArtifactEncoder extends BaseSAML2MessageEncoder implements HTML
/** {@inheritDoc} */
@Override
protected void doEncode() throws MessageEncodingException {
- final HttpServletResponse response = getHttpServletResponse();
- assert response != null;
- response.setCharacterEncoding("UTF-8");
+ getHttpServletResponse().setCharacterEncoding("UTF-8");
if (postEncoding) {
postEncode();
@@ -269,7 +267,6 @@ public class HTTPArtifactEncoder extends BaseSAML2MessageEncoder implements HTML
}
final HttpServletResponse response = getHttpServletResponse();
- assert response != null;
context.put("response", response);
try {
@@ -324,7 +321,6 @@ public class HTTPArtifactEncoder extends BaseSAML2MessageEncoder implements HTML
}
final HttpServletResponse response = getHttpServletResponse();
- assert response != null;
try {
response.sendRedirect(urlBuilder.buildURL());
} catch (final IOException e) {
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ECDHTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ECDHTest.java
index deb09ec23..7a1299779 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ECDHTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/encryption/tests/ECDHTest.java
@@ -147,7 +147,7 @@ public class ECDHTest extends XMLObjectBaseTestCase {
encConfig = new BasicEncryptionConfiguration();
EncryptionConfigurationCriterion encConfCrit = new EncryptionConfigurationCriterion(encConfig,
- Constraint.isNotNull(ConfigurationService.get(EncryptionConfiguration.class), "EncryptionConfiguration absent"));
+ ConfigurationService.get(EncryptionConfiguration.class));
encCriteria = new CriteriaSet(encConfCrit, roleDescCriterion);
decryptConfig = new BasicDecryptionConfiguration();
@@ -155,7 +155,7 @@ public class ECDHTest extends XMLObjectBaseTestCase {
decryptConfig.setKEKKeyInfoCredentialResolver(localKeyInfoResolver);
decryptCriteria = new CriteriaSet(new DecryptionConfigurationCriterion(decryptConfig,
- Constraint.isNotNull(ConfigurationService.get(DecryptionConfiguration.class), "DecryptionConfiguration absent")));
+ ConfigurationService.get(DecryptionConfiguration.class)));
}
@Test
diff --git a/opensaml-soap-impl/src/main/java/org/opensaml/soap/client/soap11/encoder/http/impl/HttpClientRequestSOAP11Encoder.java b/opensaml-soap-impl/src/main/java/org/opensaml/soap/client/soap11/encoder/http/impl/HttpClientRequestSOAP11Encoder.java
index 2fcede750..07a8db75d 100644
--- a/opensaml-soap-impl/src/main/java/org/opensaml/soap/client/soap11/encoder/http/impl/HttpClientRequestSOAP11Encoder.java
+++ b/opensaml-soap-impl/src/main/java/org/opensaml/soap/client/soap11/encoder/http/impl/HttpClientRequestSOAP11Encoder.java
@@ -16,7 +16,6 @@ package org.opensaml.soap.client.soap11.encoder.http.impl;
import java.io.ByteArrayOutputStream;
import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
import java.util.List;
import javax.annotation.Nonnull;
@@ -115,10 +114,8 @@ public class HttpClientRequestSOAP11Encoder extends BaseHttpClientRequestXMLMess
}
prepareHttpRequest();
-
- final HttpPost request = getHttpRequest();
- assert request != null;
- request.setEntity(createRequestEntity(envelope, StandardCharsets.UTF_8));
+
+ getHttpRequest().setEntity(createRequestEntity(envelope, Charset.forName("UTF-8")));
}
/**
@@ -203,15 +200,12 @@ public class HttpClientRequestSOAP11Encoder extends BaseHttpClientRequestXMLMess
* @throws MessageEncodingException thrown if there is a problem preprocessing the transport
*/
protected void prepareHttpRequest() throws MessageEncodingException {
- final HttpPost request = getHttpRequest();
- assert request != null;
-
//TODO - need to do more here?
final String soapAction = getSOAPAction();
if (soapAction != null) {
- request.setHeader("SOAPAction", soapAction);
+ getHttpRequest().setHeader("SOAPAction", soapAction);
} else {
- request.setHeader("SOAPAction", "");
+ getHttpRequest().setHeader("SOAPAction", "");
}
}
diff --git a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithExplicitKDFTest.java b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithExplicitKDFTest.java
index 1fe576670..c8ea73b4e 100644
--- a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithExplicitKDFTest.java
+++ b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithExplicitKDFTest.java
@@ -70,7 +70,6 @@ import org.testng.annotations.Test;
import org.w3c.dom.Element;
import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.xml.ParserPool;
import net.shibboleth.shared.xml.SerializeSupport;
@@ -119,7 +118,7 @@ public class DHWithExplicitKDFTest extends XMLObjectBaseTestCase {
encConfig = new BasicEncryptionConfiguration();
encConfig2 = new BasicEncryptionConfiguration();
encCriteria = new CriteriaSet(new EncryptionConfigurationCriterion(encConfig, encConfig2,
- Constraint.isNotNull(ConfigurationService.get(EncryptionConfiguration.class), "EncryptionConfiguration absent")));
+ ConfigurationService.get(EncryptionConfiguration.class)));
// Configure the middle slot explicitly so that we aren't relying on whichever DH variant the library wide config has.
KeyAgreementEncryptionConfiguration kaConfig = new KeyAgreementEncryptionConfiguration();
@@ -137,7 +136,7 @@ public class DHWithExplicitKDFTest extends XMLObjectBaseTestCase {
decryptConfig.setKEKKeyInfoCredentialResolver(localKeyInfoResolver);
decryptCriteria = new CriteriaSet(new DecryptionConfigurationCriterion(decryptConfig,
- Constraint.isNotNull(ConfigurationService.get(DecryptionConfiguration.class), "DecryptionConfiguration absent")));
+ ConfigurationService.get(DecryptionConfiguration.class)));
}
@Test
diff --git a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java
index 796d7105c..7e39b9adf 100644
--- a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java
+++ b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java
@@ -70,7 +70,6 @@ import org.testng.annotations.Test;
import org.w3c.dom.Element;
import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.xml.ParserPool;
import net.shibboleth.shared.xml.SerializeSupport;
@@ -119,7 +118,7 @@ public class DHWithLegacyKDFTest extends XMLObjectBaseTestCase {
encConfig = new BasicEncryptionConfiguration();
encConfig2 = new BasicEncryptionConfiguration();
encCriteria = new CriteriaSet(new EncryptionConfigurationCriterion(encConfig, encConfig2,
- Constraint.isNotNull(ConfigurationService.get(EncryptionConfiguration.class), "EncryptionConfiguration absent")));
+ ConfigurationService.get(EncryptionConfiguration.class)));
// Configure the middle slot explicitly so that we aren't relying on whichever DH variant the library wide config has.
KeyAgreementEncryptionConfiguration kaConfig = new KeyAgreementEncryptionConfiguration();
@@ -137,7 +136,7 @@ public class DHWithLegacyKDFTest extends XMLObjectBaseTestCase {
decryptConfig.setKEKKeyInfoCredentialResolver(localKeyInfoResolver);
decryptCriteria = new CriteriaSet(new DecryptionConfigurationCriterion(decryptConfig,
- Constraint.isNotNull(ConfigurationService.get(DecryptionConfiguration.class), "DecryptionConfiguration absent")));
+ ConfigurationService.get(DecryptionConfiguration.class)));
}
@Test
diff --git a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/ECDHTest.java b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/ECDHTest.java
index 78e7e7a90..8d70e4a29 100644
--- a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/ECDHTest.java
+++ b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/ECDHTest.java
@@ -69,7 +69,6 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
-import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.xml.ParserPool;
import net.shibboleth.shared.xml.SerializeSupport;
@@ -117,14 +116,14 @@ public class ECDHTest extends XMLObjectBaseTestCase {
public void beforeMethod() throws Exception {
encConfig = new BasicEncryptionConfiguration();
encCriteria = new CriteriaSet(new EncryptionConfigurationCriterion(encConfig,
- Constraint.isNotNull(ConfigurationService.get(EncryptionConfiguration.class), "EncryptionConfiguration absent")));
+ ConfigurationService.get(EncryptionConfiguration.class)));
decryptConfig = new BasicDecryptionConfiguration();
decryptConfig.setDataKeyInfoCredentialResolver(localKeyInfoResolver);
decryptConfig.setKEKKeyInfoCredentialResolver(localKeyInfoResolver);
decryptCriteria = new CriteriaSet(new DecryptionConfigurationCriterion(decryptConfig,
- Constraint.isNotNull(ConfigurationService.get(DecryptionConfiguration.class), "DecryptionConfiguration absent")));
+ ConfigurationService.get(DecryptionConfiguration.class)));
}
@Test
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list