From b1ce9d22e60bf76d80cc31efb0919ca458d190a4 Mon Sep 17 00:00:00 2001 From: "Greg L. Turnquist" Date: Wed, 25 Jan 2023 13:41:29 -0600 Subject: [PATCH] Polishing. Related: #1317. --- .../java/org/springframework/ws/soap/support/SoapUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-ws-core/src/main/java/org/springframework/ws/soap/support/SoapUtils.java b/spring-ws-core/src/main/java/org/springframework/ws/soap/support/SoapUtils.java index 5d641bd3..189055c4 100644 --- a/spring-ws-core/src/main/java/org/springframework/ws/soap/support/SoapUtils.java +++ b/spring-ws-core/src/main/java/org/springframework/ws/soap/support/SoapUtils.java @@ -27,6 +27,7 @@ import org.springframework.ws.transport.TransportConstants; * Contains various utility methods for handling SOAP messages. * * @author Arjen Poutsma + * @author Greg Turnquist * @since 1.5.5 */ public abstract class SoapUtils { @@ -37,6 +38,7 @@ public abstract class SoapUtils { /** Escapes the given SOAP action to be surrounded by quotes. */ public static String escapeAction(String soapAction) { + if (!StringUtils.hasLength(soapAction)) { soapAction = "\"\""; } @@ -56,6 +58,7 @@ public abstract class SoapUtils { * @return the action */ public static String extractActionFromContentType(String contentType) { + if (contentType != null) { Matcher matcher = ACTION_PATTERN.matcher(contentType); if (matcher.find() && matcher.groupCount() == 1) { @@ -73,7 +76,9 @@ public abstract class SoapUtils { * @return the new content type */ public static String setActionInContentType(String contentType, String action) { + Assert.hasLength(contentType, "'contentType' must not be empty"); + if (StringUtils.hasText(action)) { Matcher matcher = ACTION_PATTERN.matcher(contentType); if (matcher.find() && matcher.groupCount() == 1) { @@ -88,5 +93,4 @@ public abstract class SoapUtils { return contentType; } } - }