You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2020/10/08 08:17:14 UTC

[ws-wss4j] branch master updated: Switch to using .length() instead of "".equals for performance reasons

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-wss4j.git


The following commit(s) were added to refs/heads/master by this push:
     new 7923539  Switch to using .length() instead of "".equals for performance reasons
7923539 is described below

commit 7923539117127296a65392f4c83ebd885386b7e4
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Oct 8 09:16:51 2020 +0100

    Switch to using .length() instead of "".equals for performance reasons
---
 .../main/java/org/apache/wss4j/policy/SP11Constants.java   |  2 +-
 .../main/java/org/apache/wss4j/policy/SP12Constants.java   |  2 +-
 .../apache/wss4j/policy/builders/RequiredPartsBuilder.java |  4 ++--
 .../wss4j/policy/builders/SignedElementsBuilder.java       |  4 ++--
 .../org/apache/wss4j/common/cache/EHCacheReplayCache.java  |  2 +-
 .../org/apache/wss4j/common/cache/MemoryReplayCache.java   |  4 ++--
 .../wss4j/common/saml/builder/SAML1ComponentBuilder.java   |  2 +-
 .../wss4j/common/saml/builder/SAML2ComponentBuilder.java   |  2 +-
 .../java/org/apache/wss4j/common/token/BinarySecurity.java |  4 ++--
 .../main/java/org/apache/wss4j/common/token/Reference.java |  2 +-
 .../apache/wss4j/common/token/SecurityTokenReference.java  |  6 +++---
 .../main/java/org/apache/wss4j/common/util/KeyUtils.java   |  2 +-
 .../main/java/org/apache/wss4j/common/util/XMLUtils.java   |  4 ++--
 .../src/main/java/org/apache/wss4j/dom/WSDocInfo.java      |  2 +-
 .../org/apache/wss4j/dom/callback/DOMCallbackLookup.java   |  3 +--
 .../main/java/org/apache/wss4j/dom/handler/WSHandler.java  |  8 ++++----
 .../org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java  |  2 +-
 .../org/apache/wss4j/dom/message/WSSecEncryptedKey.java    |  4 ++--
 .../apache/wss4j/dom/message/token/DerivedKeyToken.java    |  2 +-
 .../wss4j/dom/message/token/SignatureConfirmation.java     |  2 +-
 .../java/org/apache/wss4j/dom/message/token/Timestamp.java |  4 ++--
 .../org/apache/wss4j/dom/message/token/UsernameToken.java  |  6 +++---
 .../wss4j/dom/processor/BinarySecurityTokenProcessor.java  |  4 ++--
 .../wss4j/dom/processor/DerivedKeyTokenProcessor.java      |  2 +-
 .../apache/wss4j/dom/processor/EncryptedDataProcessor.java |  2 +-
 .../apache/wss4j/dom/processor/EncryptedKeyProcessor.java  | 14 +++++++-------
 .../apache/wss4j/dom/processor/ReferenceListProcessor.java |  2 +-
 .../org/apache/wss4j/dom/processor/SAMLTokenProcessor.java |  2 +-
 .../wss4j/dom/processor/SecurityContextTokenProcessor.java |  2 +-
 .../dom/processor/SignatureConfirmationProcessor.java      |  2 +-
 .../org/apache/wss4j/dom/processor/SignatureProcessor.java |  4 ++--
 .../org/apache/wss4j/dom/processor/TimestampProcessor.java |  2 +-
 .../apache/wss4j/dom/processor/UsernameTokenProcessor.java |  4 ++--
 .../main/java/org/apache/wss4j/dom/str/STRParserUtil.java  |  6 +++---
 .../java/org/apache/wss4j/dom/util/WSSecurityUtil.java     |  2 +-
 .../src/main/java/org/apache/wss4j/dom/util/X509Util.java  |  2 +-
 .../java/org/apache/wss4j/policy/stax/PolicyUtils.java     |  2 +-
 .../stax/assertionStates/IssuedTokenAssertionState.java    |  2 +-
 .../processor/output/UsernameTokenOutputProcessor.java     |  2 +-
 .../stax/impl/securityToken/SecurityTokenFactoryImpl.java  |  2 +-
 .../apache/wss4j/stax/setup/ConfigurationConverter.java    |  2 +-
 41 files changed, 66 insertions(+), 67 deletions(-)

diff --git a/policy/src/main/java/org/apache/wss4j/policy/SP11Constants.java b/policy/src/main/java/org/apache/wss4j/policy/SP11Constants.java
index 5b63d8f..a358c2e 100644
--- a/policy/src/main/java/org/apache/wss4j/policy/SP11Constants.java
+++ b/policy/src/main/java/org/apache/wss4j/policy/SP11Constants.java
@@ -329,7 +329,7 @@ public class SP11Constants extends SPConstants {
 
     @Override
     public IncludeTokenType getInclusionFromAttributeValue(String value) throws IllegalArgumentException {
-        if (value == null || "".equals(value)) {
+        if (value == null || value.length() == 0) {
             return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
         } else if (INCLUDE_ALWAYS.equals(value)) {
             return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
diff --git a/policy/src/main/java/org/apache/wss4j/policy/SP12Constants.java b/policy/src/main/java/org/apache/wss4j/policy/SP12Constants.java
index a7f7d8a..77ef91f 100644
--- a/policy/src/main/java/org/apache/wss4j/policy/SP12Constants.java
+++ b/policy/src/main/java/org/apache/wss4j/policy/SP12Constants.java
@@ -385,7 +385,7 @@ public class SP12Constants extends SPConstants {
 
     @Override
     public IncludeTokenType getInclusionFromAttributeValue(String value) {
-        if (value == null || "".equals(value)) {
+        if (value == null || value.length() == 0) {
             return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
         } else if (INCLUDE_ALWAYS.equals(value)) {
             return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
diff --git a/policy/src/main/java/org/apache/wss4j/policy/builders/RequiredPartsBuilder.java b/policy/src/main/java/org/apache/wss4j/policy/builders/RequiredPartsBuilder.java
index 6efc8f8..9a6a330 100644
--- a/policy/src/main/java/org/apache/wss4j/policy/builders/RequiredPartsBuilder.java
+++ b/policy/src/main/java/org/apache/wss4j/policy/builders/RequiredPartsBuilder.java
@@ -53,7 +53,7 @@ public class RequiredPartsBuilder implements AssertionBuilder<Element> {
             if (SPConstants.HEADER.equals(child.getLocalName())
                     && spVersion.getNamespace().equals(child.getNamespaceURI())) {
                 String headerName = child.getAttributeNS(null, SPConstants.NAME);
-                if ("".equals(headerName)) {
+                if (headerName.length() == 0) {
                     if (ignoreNameElement) {
                         headerName = null;
                     } else {
@@ -62,7 +62,7 @@ public class RequiredPartsBuilder implements AssertionBuilder<Element> {
                     }
                 }
                 String headerNamespace = child.getAttributeNS(null, SPConstants.NAMESPACE);
-                if (headerNamespace == null || "".equals(headerNamespace)) {
+                if (headerNamespace == null || headerNamespace.length() == 0) {
                     throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
                 }
                 headers.add(new Header(headerName, headerNamespace));
diff --git a/policy/src/main/java/org/apache/wss4j/policy/builders/SignedElementsBuilder.java b/policy/src/main/java/org/apache/wss4j/policy/builders/SignedElementsBuilder.java
index f3d6cc0..aed1094 100755
--- a/policy/src/main/java/org/apache/wss4j/policy/builders/SignedElementsBuilder.java
+++ b/policy/src/main/java/org/apache/wss4j/policy/builders/SignedElementsBuilder.java
@@ -81,7 +81,7 @@ public class SignedElementsBuilder implements AssertionBuilder<Element> {
                 Map<String, String> declaredNamespaces = new HashMap<>();
                 addDeclaredNamespaces(child, declaredNamespaces);
                 String filter = child.getAttributeNS(null, SPConstants.FILTER);
-                if (filter == null || "".equals(filter)) {
+                if (filter == null || filter.length() == 0) {
                     throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
                 }
                 xPaths.add(new XPath(child.getTextContent().trim(), XPath.Version.V2, filter, declaredNamespaces));
@@ -93,7 +93,7 @@ public class SignedElementsBuilder implements AssertionBuilder<Element> {
 
     protected String getXPathVersion(Element element) {
         String xPathVersion = element.getAttributeNS(null, SPConstants.XPATH_VERSION);
-        if (xPathVersion == null || "".equals(xPathVersion)) {
+        if (xPathVersion == null || xPathVersion.length() == 0) {
             xPathVersion = "1.0";
         }
         return xPathVersion;
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java b/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
index 79debbc..d46bdff 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/cache/EHCacheReplayCache.java
@@ -120,7 +120,7 @@ public class EHCacheReplayCache implements ReplayCache {
      * @param expiry A custom expiry time for the identifier. Can be null in which case, the default expiry is used.
      */
     public void add(String identifier, Instant expiry) {
-        if (identifier == null || "".equals(identifier)) {
+        if (identifier == null || identifier.length() == 0) {
             return;
         }
 
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java b/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
index b46df3a..9bd0bbf 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/cache/MemoryReplayCache.java
@@ -56,7 +56,7 @@ public class MemoryReplayCache implements ReplayCache {
      * @param expiry A custom expiry time for the identifier
      */
     public void add(String identifier, Instant expiry) {
-        if (identifier == null || "".equals(identifier)) {
+        if (identifier == null || identifier.length() == 0) {
             return;
         }
 
@@ -84,7 +84,7 @@ public class MemoryReplayCache implements ReplayCache {
     public boolean contains(String identifier) {
         processTokenExpiry();
 
-        if (identifier != null && !"".equals(identifier)) {
+        if (identifier != null && identifier.length() != 0) {
             return ids.contains(identifier);
         }
         return false;
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java b/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java
index 74463aa..cae6f7b 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java
@@ -448,7 +448,7 @@ public final class SAML1ComponentBuilder {
 
         if ("Password".equals(sourceMethod)) {
             transformedMethod = SAML1Constants.AUTH_METHOD_PASSWORD;
-        } else if (sourceMethod != null && !"".equals(sourceMethod)) {
+        } else if (sourceMethod != null && sourceMethod.length() != 0) {
             return sourceMethod;
         }
 
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java b/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
index f00fa49..3e7051b 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
@@ -524,7 +524,7 @@ public final class SAML2ComponentBuilder {
 
         if ("Password".equalsIgnoreCase(sourceMethod)) {
             transformedMethod = SAML2Constants.AUTH_CONTEXT_CLASS_REF_PASSWORD;
-        } else if (sourceMethod != null && !"".equals(sourceMethod)) {
+        } else if (sourceMethod != null && sourceMethod.length() != 0) {
             return sourceMethod;
         }
 
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java b/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java
index c4a6448..c9956e2 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java
@@ -76,7 +76,7 @@ public class BinarySecurity {
                 "unhandledToken", new Object[] {el});
         }
         String encoding = getEncodingType();
-        if (encoding == null || "".equals(encoding)) {
+        if (encoding == null || encoding.length() == 0) {
             bspEnforcer.handleBSPRule(BSPRule.R3029);
         }
 
@@ -85,7 +85,7 @@ public class BinarySecurity {
         }
 
         String valueType = getValueType();
-        if (valueType == null || "".equals(valueType)) {
+        if (valueType == null || valueType.length() == 0) {
             bspEnforcer.handleBSPRule(BSPRule.R3031);
         }
     }
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java b/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java
index bdc3d5d..21e7f8d 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java
@@ -55,7 +55,7 @@ public class Reference {
 
         String uri = getURI();
         // Reference URI cannot be null or empty
-        if (uri == null || "".equals(uri)) {
+        if (uri == null || uri.length() == 0) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.INVALID_SECURITY, "badReferenceURI"
             );
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java b/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
index 78a7d54..a1996e9 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
@@ -574,19 +574,19 @@ public class SecurityTokenReference {
 
             String valueType = getKeyIdentifierValueType();
             // ValueType cannot be null
-            if (valueType == null || "".equals(valueType)) {
+            if (valueType == null || valueType.length() == 0) {
                 bspEnforcer.handleBSPRule(BSPRule.R3054);
             }
             String encodingType = getFirstElement().getAttributeNS(null, "EncodingType");
             // Encoding Type must be equal to Base64Binary if it's specified
-            if (!"".equals(encodingType) && !WSS4JConstants.BASE64_ENCODING.equals(encodingType)) {
+            if (encodingType.length() != 0 && !WSS4JConstants.BASE64_ENCODING.equals(encodingType)) {
                 bspEnforcer.handleBSPRule(BSPRule.R3071);
             }
             // Encoding type must be specified other than for a SAML Assertion
 
             if (!WSS4JConstants.WSS_SAML_KI_VALUE_TYPE.equals(valueType)
                 && !WSS4JConstants.WSS_SAML2_KI_VALUE_TYPE.equals(valueType)
-                && "".equals(encodingType)) {
+                && encodingType.length() == 0) {
                 bspEnforcer.handleBSPRule(BSPRule.R3070);
             }
         } else if ("Embedded".equals(child.getLocalName())) {
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java b/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java
index 21d0933..de0805c 100644
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java
@@ -121,7 +121,7 @@ public final class KeyUtils {
             // Assume AES as default, so initialize it
             //
             String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(algorithm);
-            if (keyAlgorithm == null || "".equals(keyAlgorithm)) {
+            if (keyAlgorithm == null || keyAlgorithm.length() == 0) {
                 keyAlgorithm = JCEMapper.translateURItoJCEID(algorithm);
             }
             KeyGenerator keyGen = KeyGenerator.getInstance(keyAlgorithm);
diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java b/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java
index 9135ecf..2d43b72 100755
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java
@@ -289,10 +289,10 @@ public final class XMLUtils {
                 Element se = (Element) startNode;
                 // Try the wsu:Id first
                 String attributeNS = se.getAttributeNS(WSU_NS, "Id");
-                if ("".equals(attributeNS) || !id.equals(attributeNS)) {
+                if (attributeNS.length() == 0 || !id.equals(attributeNS)) {
                     attributeNS = se.getAttributeNS(null, "Id");
                 }
-                if (!"".equals(attributeNS) && id.equals(attributeNS)) {
+                if (attributeNS.length() != 0 && id.equals(attributeNS)) {
                     if (!checkMultipleElements) {
                         return se;
                     } else if (foundElement == null) {
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSDocInfo.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSDocInfo.java
index 0e6d7a9..74eff53 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSDocInfo.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSDocInfo.java
@@ -283,7 +283,7 @@ public class WSDocInfo {
      */
     public boolean hasResult(Integer tag, String uri) {
         String id = XMLUtils.getIDFromReference(uri);
-        if (id == null || "".equals(uri)) {
+        if (id == null || uri.length() == 0) {
             return false;
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/callback/DOMCallbackLookup.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/callback/DOMCallbackLookup.java
index 23573b0..7a9cf38 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/callback/DOMCallbackLookup.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/callback/DOMCallbackLookup.java
@@ -115,8 +115,7 @@ public class DOMCallbackLookup implements CallbackLookup {
         //
         if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(valueType)
             || WSConstants.WSS_SAML2_KI_VALUE_TYPE.equals(valueType)
-            || "".equals(valueType)
-            || valueType == null) {
+            || valueType == null || valueType.length() == 0) {
             foundElement =
                 XMLUtils.findSAMLAssertionElementById(
                     doc.getDocumentElement(), idToMatch
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
index 73d0150..07638b0 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
@@ -644,20 +644,20 @@ public abstract class WSHandler {
         AlgorithmSuite algorithmSuite = new AlgorithmSuite();
 
         String signatureAlgorithm = getString(WSHandlerConstants.SIG_ALGO, mc);
-        if (signatureAlgorithm != null && !"".equals(signatureAlgorithm)) {
+        if (signatureAlgorithm != null && signatureAlgorithm.length() != 0) {
             algorithmSuite.addSignatureMethod(signatureAlgorithm);
         }
         String signatureDigestAlgorithm = getString(WSHandlerConstants.SIG_DIGEST_ALGO, mc);
-        if (signatureDigestAlgorithm != null && !"".equals(signatureDigestAlgorithm)) {
+        if (signatureDigestAlgorithm != null && signatureDigestAlgorithm.length() != 0) {
             algorithmSuite.addDigestAlgorithm(signatureDigestAlgorithm);
         }
 
         String encrAlgorithm = getString(WSHandlerConstants.ENC_SYM_ALGO, mc);
-        if (encrAlgorithm != null && !"".equals(encrAlgorithm)) {
+        if (encrAlgorithm != null && encrAlgorithm.length() != 0) {
             algorithmSuite.addEncryptionMethod(encrAlgorithm);
         }
         String transportAlgorithm = getString(WSHandlerConstants.ENC_KEY_TRANSPORT, mc);
-        if (transportAlgorithm != null && !"".equals(transportAlgorithm)) {
+        if (transportAlgorithm != null && transportAlgorithm.length() != 0) {
             algorithmSuite.addKeyWrapAlgorithm(transportAlgorithm);
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
index e8b6c10..d8ebd0f 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
@@ -263,7 +263,7 @@ public abstract class WSSecDerivedKeyBase extends WSSecSignatureBase {
                 } else {
                     ref.setURI("#" + tokenIdentifier);
                 }
-                if (customValueType != null && !"".equals(customValueType)) {
+                if (customValueType != null && customValueType.length() != 0) {
                     ref.setValueType(customValueType);
                 }
                 if (WSConstants.WSS_SAML_KI_VALUE_TYPE.equals(customValueType)) {
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
index 55a0ce2..ce0b835 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
@@ -242,7 +242,7 @@ public class WSSecEncryptedKey extends WSSecBase {
      */
     protected void createEncryptedKeyElement(X509Certificate remoteCert, Crypto crypto) throws WSSecurityException {
         encryptedKeyElement = createEncryptedKey(getDocument(), keyEncAlgo);
-        if (encKeyId == null || "".equals(encKeyId)) {
+        if (encKeyId == null || encKeyId.length() == 0) {
             encKeyId = IDGenerator.generateID("EK-");
         }
         encryptedKeyElement.setAttributeNS(null, "Id", encKeyId);
@@ -380,7 +380,7 @@ public class WSSecEncryptedKey extends WSSecBase {
      */
     protected void createEncryptedKeyElement(Key key) throws WSSecurityException {
         encryptedKeyElement = createEncryptedKey(getDocument(), keyEncAlgo);
-        if (encKeyId == null || "".equals(encKeyId)) {
+        if (encKeyId == null || encKeyId.length() == 0) {
             encKeyId = IDGenerator.generateID("EK-");
         }
         encryptedKeyElement.setAttributeNS(null, "Id", encKeyId);
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
index 17e70d6..356983a 100755
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
@@ -488,7 +488,7 @@ public class DerivedKeyToken {
      */
     public String getAlgorithm() {
         String algo = element.getAttributeNS(ns, "Algorithm");
-        if ("".equals(algo)) {
+        if (algo.length() == 0) {
             return ConversationConstants.DerivationAlgorithm.P_SHA_1;
         } else {
             return algo;
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SignatureConfirmation.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SignatureConfirmation.java
index 33ea7d0..87749ff 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SignatureConfirmation.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SignatureConfirmation.java
@@ -52,7 +52,7 @@ public class SignatureConfirmation {
         element = elem;
 
         String id = getID();
-        if (id == null || "".equals(id)) {
+        if (id == null || id.length() == 0) {
             bspEnforcer.handleBSPRule(BSPRule.R5441);
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java
index 0583e8f..e99153c 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Timestamp.java
@@ -75,7 +75,7 @@ public class Timestamp {
                     && WSConstants.WSU_NS.equals(currentChild.getNamespaceURI())) {
                     if (createdString == null) {
                         String valueType = currentChildElement.getAttributeNS(null, "ValueType");
-                        if (valueType != null && !"".equals(valueType)) {
+                        if (valueType != null && valueType.length() != 0) {
                             // We can't have a ValueType attribute as per the BSP spec
                             bspEnforcer.handleBSPRule(BSPRule.R3225);
                         }
@@ -95,7 +95,7 @@ public class Timestamp {
                         bspEnforcer.handleBSPRule(BSPRule.R3224);
                     } else {
                         String valueType = currentChildElement.getAttributeNS(null, "ValueType");
-                        if (valueType != null && !"".equals(valueType)) {
+                        if (valueType != null && valueType.length() != 0) {
                             // We can't have a ValueType attribute as per the BSP spec
                             bspEnforcer.handleBSPRule(BSPRule.R3226);
                         }
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
index 1ecd68b..b8b2bf7 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
@@ -200,7 +200,7 @@ public class UsernameToken {
 
         if (elementCreated != null) {
             String createdString = getCreated();
-            if (createdString != null && !"".equals(createdString)) {
+            if (createdString != null && createdString.length() != 0) {
                 try {
                     created = ZonedDateTime.parse(createdString).toInstant();
                 } catch (DateTimeParseException e) {
@@ -755,7 +755,7 @@ public class UsernameToken {
         if (passwordElements.size() == 1) {
             Element passwordChild = passwordElements.get(0);
             String type = passwordChild.getAttributeNS(null, WSConstants.PASSWORD_TYPE_ATTR);
-            if (type == null || "".equals(type)) {
+            if (type == null || type.length() == 0) {
                 LOG.debug("The Username Token password does not have a Type attribute");
                 bspEnforcer.handleBSPRule(BSPRule.R4201);
             }
@@ -785,7 +785,7 @@ public class UsernameToken {
             Element nonce = nonceElements.get(0);
             String encodingType = nonce.getAttributeNS(null, "EncodingType");
             // Encoding Type must be equal to Base64Binary
-            if (encodingType == null || "".equals(encodingType)) {
+            if (encodingType == null || encodingType.length() == 0) {
                 bspEnforcer.handleBSPRule(BSPRule.R4220);
             } else if (!WSConstants.BASE64_ENCODING.equals(encodingType)) {
                 LOG.debug("The Username Token's nonce element has a bad encoding type");
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java
index 20a17c0..4c0ca0a 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/BinarySecurityTokenProcessor.java
@@ -54,7 +54,7 @@ public class BinarySecurityTokenProcessor implements Processor {
     ) throws WSSecurityException {
         // See if the token has been previously processed
         String id = elem.getAttributeNS(WSConstants.WSU_NS, "Id");
-        if (!"".equals(id)) {
+        if (id.length() != 0) {
             Element foundElement = data.getWsDocInfo().getTokenElement(id);
             if (elem.equals(foundElement)) {
                 WSSecurityEngineResult result = data.getWsDocInfo().getResult(id);
@@ -80,7 +80,7 @@ public class BinarySecurityTokenProcessor implements Processor {
         WSSecurityEngineResult result =
             new WSSecurityEngineResult(WSConstants.BST, token, certs);
         data.getWsDocInfo().addTokenElement(elem);
-        if (!"".equals(id)) {
+        if (id.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, id);
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/DerivedKeyTokenProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/DerivedKeyTokenProcessor.java
index 0b7c8ad..12d3fa7 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/DerivedKeyTokenProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/DerivedKeyTokenProcessor.java
@@ -82,7 +82,7 @@ public class DerivedKeyTokenProcessor implements Processor {
             new WSSecurityEngineResult(WSConstants.DKT, null, keyBytes, null);
         data.getWsDocInfo().addTokenElement(elem);
         String tokenId = dkt.getID();
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
         result.put(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN, dkt);
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedDataProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedDataProcessor.java
index 0a0fa1a..4476381 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedDataProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedDataProcessor.java
@@ -170,7 +170,7 @@ public class EncryptedDataProcessor implements Processor {
 
         WSSecurityEngineResult result =
                 new WSSecurityEngineResult(WSConstants.ENCR, Collections.singletonList(dataRef));
-        if (!"".equals(encryptedDataId)) {
+        if (encryptedDataId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, encryptedDataId);
         }
         data.getWsDocInfo().addResult(result);
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
index bd5f339..2edd4c9 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
@@ -99,7 +99,7 @@ public class EncryptedKeyProcessor implements Processor {
 
         // See if this key has already been processed. If so then just return the result
         String id = elem.getAttributeNS(null, "Id");
-        if (!"".equals(id)) {
+        if (id.length() != 0) {
              WSSecurityEngineResult result = data.getWsDocInfo().getResult(id);
              if (result != null
                  && WSConstants.ENCR == (Integer)result.get(WSSecurityEngineResult.TAG_ACTION)
@@ -243,7 +243,7 @@ public class EncryptedKeyProcessor implements Processor {
         );
         result.put(WSSecurityEngineResult.TAG_TOKEN_ELEMENT, elem);
         String tokenId = elem.getAttributeNS(null, "Id");
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
         if (referenceType != null) {
@@ -309,7 +309,7 @@ public class EncryptedKeyProcessor implements Processor {
                 // Get the DigestMethod if it exists
                 String digestAlgorithm = EncryptionUtils.getDigestAlgorithm(encryptedKeyElement);
                 String jceDigestAlgorithm = "SHA-1";
-                if (digestAlgorithm != null && !"".equals(digestAlgorithm)) {
+                if (digestAlgorithm != null && digestAlgorithm.length() != 0) {
                     jceDigestAlgorithm = JCEMapper.translateURItoJCEID(digestAlgorithm);
                 }
 
@@ -610,19 +610,19 @@ public class EncryptedKeyProcessor implements Processor {
         Element elem, String encAlgo, BSPEnforcer bspEnforcer
     ) throws WSSecurityException {
         String attribute = elem.getAttributeNS(null, "Type");
-        if (attribute != null && !"".equals(attribute)) {
+        if (attribute != null && attribute.length() != 0) {
             bspEnforcer.handleBSPRule(BSPRule.R3209);
         }
         attribute = elem.getAttributeNS(null, "MimeType");
-        if (attribute != null && !"".equals(attribute)) {
+        if (attribute != null && attribute.length() != 0) {
             bspEnforcer.handleBSPRule(BSPRule.R5622);
         }
         attribute = elem.getAttributeNS(null, "Encoding");
-        if (attribute != null && !"".equals(attribute)) {
+        if (attribute != null && attribute.length() != 0) {
             bspEnforcer.handleBSPRule(BSPRule.R5623);
         }
         attribute = elem.getAttributeNS(null, "Recipient");
-        if (attribute != null && !"".equals(attribute)) {
+        if (attribute != null && attribute.length() != 0) {
             bspEnforcer.handleBSPRule(BSPRule.R5602);
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
index 049c15a..5b51eb1 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
@@ -64,7 +64,7 @@ public class ReferenceListProcessor implements Processor {
         WSSecurityEngineResult result =
             new WSSecurityEngineResult(WSConstants.ENCR, dataRefs);
         String tokenId = elem.getAttributeNS(null, "Id");
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
         data.getWsDocInfo().addTokenElement(elem);
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
index 3bbf47e..b27e889 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
@@ -123,7 +123,7 @@ public class SAMLTokenProcessor implements Processor {
             result = new WSSecurityEngineResult(WSConstants.ST_UNSIGNED, samlAssertion);
         }
 
-        if (!"".equals(id)) {
+        if (id.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, id);
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
index 182aeca..ae1db72 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
@@ -62,7 +62,7 @@ public class SecurityContextTokenProcessor implements Processor {
             Credential returnedCredential = validator.validate(credential, data);
             result.put(WSSecurityEngineResult.TAG_VALIDATED_TOKEN, Boolean.TRUE);
             String tokenId = sct.getID();
-            if (!"".equals(tokenId)) {
+            if (tokenId.length() != 0) {
                 result.put(WSSecurityEngineResult.TAG_ID, tokenId);
             }
             result.put(WSSecurityEngineResult.TAG_SECRET, returnedCredential.getSecretKey());
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureConfirmationProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureConfirmationProcessor.java
index 62e9a45..cbf8502 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureConfirmationProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureConfirmationProcessor.java
@@ -45,7 +45,7 @@ public class SignatureConfirmationProcessor implements Processor {
         WSSecurityEngineResult result =
             new WSSecurityEngineResult(WSConstants.SC, sigConf);
         String tokenId = sigConf.getID();
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
         data.getWsDocInfo().addResult(result);
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
index 07518f3..fc68ba1 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
@@ -250,7 +250,7 @@ public class SignatureProcessor implements Processor {
         result.put(WSSecurityEngineResult.TAG_SIGNATURE_METHOD, signatureMethod);
         result.put(WSSecurityEngineResult.TAG_CANONICALIZATION_METHOD, c14nMethod);
         String tokenId = elem.getAttributeNS(null, "Id");
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
         result.put(WSSecurityEngineResult.TAG_SECRET, secretKey);
@@ -527,7 +527,7 @@ public class SignatureProcessor implements Processor {
             Reference siRef = (Reference)reference;
             String uri = siRef.getURI();
 
-            if (!"".equals(uri)) {
+            if (uri.length() != 0) {
                 Element se = dereferenceSTR(doc, siRef, requestData, wsDocInfo);
                 // If an STR Transform is not used then just find the cached element
                 boolean attachment = false;
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/TimestampProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/TimestampProcessor.java
index e1cb076..c6d2fbe 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/TimestampProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/TimestampProcessor.java
@@ -49,7 +49,7 @@ public class TimestampProcessor implements Processor {
         WSSecurityEngineResult result =
             new WSSecurityEngineResult(WSConstants.TS, timestamp);
         String tokenId = timestamp.getID();
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/UsernameTokenProcessor.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/UsernameTokenProcessor.java
index d26f573..5222e69 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/UsernameTokenProcessor.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/UsernameTokenProcessor.java
@@ -47,7 +47,7 @@ public class UsernameTokenProcessor implements Processor {
         LOG.debug("Found UsernameToken list element");
         // See if the token has been previously processed
         String id = elem.getAttributeNS(WSConstants.WSU_NS, "Id");
-        if (!"".equals(id)) {
+        if (id.length() != 0) {
             Element foundElement = data.getWsDocInfo().getTokenElement(id);
             if (elem.equals(foundElement)) {
                 WSSecurityEngineResult result = data.getWsDocInfo().getResult(id);
@@ -76,7 +76,7 @@ public class UsernameTokenProcessor implements Processor {
         }
         WSSecurityEngineResult result = new WSSecurityEngineResult(action, token);
         String tokenId = token.getID();
-        if (!"".equals(tokenId)) {
+        if (tokenId.length() != 0) {
             result.put(WSSecurityEngineResult.TAG_ID, tokenId);
         }
         result.put(WSSecurityEngineResult.TAG_SECRET, secretKey);
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/STRParserUtil.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/STRParserUtil.java
index f7730c2..41ddcf1 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/STRParserUtil.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/STRParserUtil.java
@@ -136,7 +136,7 @@ public final class STRParserUtil {
             if (token instanceof X509Security && !X509Security.X509_V3_TYPE.equals(valueType)
                 || token instanceof PKIPathSecurity && !PKIPathSecurity.PKI_TYPE.equals(valueType)
                 || token instanceof KerberosSecurity
-                        && !(valueType == null || "".equals(valueType))
+                        && !(valueType == null || valueType.length() == 0)
                         && !WSConstants.WSS_GSS_KRB_V5_AP_REQ.equals(valueType)) {
                 bspEnforcer.handleBSPRule(BSPRule.R3058);
             }
@@ -207,7 +207,7 @@ public final class STRParserUtil {
                 bspEnforcer.handleBSPRule(BSPRule.R6616);
             }
             String encoding = secRef.getKeyIdentifierEncodingType();
-            if (encoding != null && !"".equals(encoding)) {
+            if (encoding != null && encoding.length() != 0) {
                 bspEnforcer.handleBSPRule(BSPRule.R6604);
             }
         }
@@ -224,7 +224,7 @@ public final class STRParserUtil {
         // Check the ValueType attribute of the Reference for SAML2
         if (samlAssertion.getSaml2() != null && secRef.containsReference()) {
             String valueType = secRef.getReference().getValueType();
-            if (valueType != null && !"".equals(valueType)) {
+            if (valueType != null && valueType.length() != 0) {
                 bspEnforcer.handleBSPRule(BSPRule.R6614);
             }
         }
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
index 53d3bce..68ca6ed 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
@@ -522,7 +522,7 @@ public final class WSSecurityUtil {
             return Collections.emptyList();
         }
         actionToParse = actionToParse.trim();
-        if ("".equals(actionToParse)) {
+        if (actionToParse.length() == 0) {
             return Collections.emptyList();
         }
 
diff --git a/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/X509Util.java b/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/X509Util.java
index 6989d33..2e138f8 100644
--- a/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/X509Util.java
+++ b/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/X509Util.java
@@ -67,7 +67,7 @@ public final class X509Util {
         String symEncAlgo = null;
         if (tmpE != null) {
             symEncAlgo = tmpE.getAttributeNS(null, "Algorithm");
-            if (symEncAlgo == null || "".equals(symEncAlgo)) {
+            if (symEncAlgo == null || symEncAlgo.length() == 0) {
                 throw new WSSecurityException(
                     WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "noEncAlgo"
                 );
diff --git a/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/PolicyUtils.java b/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/PolicyUtils.java
index 88b75f1..16de076 100644
--- a/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/PolicyUtils.java
+++ b/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/PolicyUtils.java
@@ -35,7 +35,7 @@ public final class PolicyUtils {
         String[] xPathElements = xPath.getXPath().split("/");
         for (int j = 0; j < xPathElements.length; j++) {
             String xPathElement = xPathElements[j];
-            if (xPathElement == null || "".equals(xPathElement)) {
+            if (xPathElement == null || xPathElement.length() == 0) {
                 continue;
             }
             String[] elementParts = xPathElement.split(":");
diff --git a/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java b/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java
index a9ff374..e190d6f 100644
--- a/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java
+++ b/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java
@@ -215,7 +215,7 @@ public class IssuedTokenAssertionState extends TokenAssertionState {
                 String claimTypeUri = claimType.getAttributeNS(null, "Uri");
                 String claimTypeOptional = claimType.getAttributeNS(null, "Optional");
 
-                if ("".equals(claimTypeOptional) || !Boolean.parseBoolean(claimTypeOptional)) {
+                if (claimTypeOptional.length() == 0 || !Boolean.parseBoolean(claimTypeOptional)) {
                     String errorMsg = findClaimInAssertion(samlTokenSecurityEvent.getSamlAssertionWrapper(), URI.create(claimTypeUri));
                     if (errorMsg != null) {
                         return errorMsg;
diff --git a/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/UsernameTokenOutputProcessor.java b/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/UsernameTokenOutputProcessor.java
index dd2da02..8d1538c 100644
--- a/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/UsernameTokenOutputProcessor.java
+++ b/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/UsernameTokenOutputProcessor.java
@@ -231,7 +231,7 @@ public class UsernameTokenOutputProcessor extends AbstractOutputProcessor {
                     createEndElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_WSSE_NONCE);
                 }
 
-                if (!"".equals(created)) {
+                if (created != null && created.length() != 0) {
                     createStartElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_WSU_CREATED, false, null);
                     createCharactersAndOutputAsEvent(subOutputProcessorChain, created);
                     createEndElementAndOutputAsEvent(subOutputProcessorChain, WSSConstants.TAG_WSU_CREATED);
diff --git a/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java b/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java
index a97119f..d805b97 100644
--- a/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java
+++ b/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java
@@ -441,7 +441,7 @@ public class SecurityTokenFactoryImpl extends SecurityTokenFactory {
             WSSecurityTokenConstants.TokenType samlTokenType = securityTokenProvider.getSecurityToken().getTokenType();
             if (WSSecurityTokenConstants.SAML_20_TOKEN.equals(samlTokenType)) {
                 String valueType = referenceType.getValueType();
-                if (valueType != null && !"".equals(valueType)) {
+                if (valueType != null && valueType.length() != 0) {
                     ((WSInboundSecurityContext) inboundSecurityContext).handleBSPRule(BSPRule.R6614);
                 }
                 if (!WSSConstants.NS_SAML20_TOKEN_PROFILE_TYPE.equals(tokenType)) {
diff --git a/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/ConfigurationConverter.java b/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/ConfigurationConverter.java
index 5db798f..c223d01 100644
--- a/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/ConfigurationConverter.java
+++ b/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/ConfigurationConverter.java
@@ -86,7 +86,7 @@ public final class ConfigurationConverter {
             return;
         }
         actionToParse = actionToParse.trim();
-        if ("".equals(actionToParse)) {
+        if (actionToParse.length() == 0) {
             return;
         }
         String[] single = actionToParse.split("\\s");