Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
70e1506
Update README.md
DarioViva42 Aug 6, 2024
c738596
EncodingPatternPreservation: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
0190e97
EncodingPatternPreservation: fix typo
DarioViva42 Aug 6, 2024
31d8200
AbstractCodec: fix typo
DarioViva42 Aug 6, 2024
fc7800a
AbstractCodec: there is no such thing as a footgun usage
DarioViva42 Aug 6, 2024
0b35b31
AbstractPushbackSequence: fix typo. see https://languagetool.org/insi…
DarioViva42 Aug 6, 2024
efb6300
AbstractPushbackSequence: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
8cc7fdb
Base64: fix typo
DarioViva42 Aug 6, 2024
ab000a6
Base64: declaring static methods with modifier 'final' makes no sense
DarioViva42 Aug 6, 2024
b0a85f4
Base64: fix typo
DarioViva42 Aug 6, 2024
ccde885
CSSCodec: fix typo
DarioViva42 Aug 6, 2024
ad33ea8
HashTrie: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
43e7d21
HashTrie: fix typo
DarioViva42 Aug 6, 2024
e75eacb
HashTrie: fix typo
DarioViva42 Aug 6, 2024
8e7dbc3
HashTrie: fix typo
DarioViva42 Aug 6, 2024
3db27a4
HTMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
0fb0f93
HTMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
9506a16
HTMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
29a842e
HTMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
bd56cf6
JSONCodec: simplify boolean expression
DarioViva42 Aug 6, 2024
8912f7b
MySQLCodec: fix typo
DarioViva42 Aug 6, 2024
a27f903
MySQLCodec: fix typo
DarioViva42 Aug 6, 2024
14ba93f
PercentCodec: fix link
DarioViva42 Aug 6, 2024
c9d8368
PushBackSequenceImpl: fix typo
DarioViva42 Aug 6, 2024
2bbe522
PushBackSequenceImpl: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
d419c6b
PushbackString: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
aac6ab1
PushbackString: fix typo
DarioViva42 Aug 6, 2024
3d47910
Trie: Modifier 'public' is redundant in interface
DarioViva42 Aug 6, 2024
86ef51d
Trie: Modifier 'static' is redundant for inner classes of interfaces
DarioViva42 Aug 6, 2024
2b55b33
XMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
e95e5d9
XMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
0611d3c
XMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
34f96cf
XMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
108f659
XMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
329acdd
XMLEntityCodec: fix typo
DarioViva42 Aug 6, 2024
ceb85e8
EsapiConfiguration: fix typo
DarioViva42 Aug 6, 2024
5d2bc33
AbstractPrioritizedPropertyLoader: fix typo
DarioViva42 Aug 6, 2024
6b05a8e
AbstractPrioritizedPropertyLoader: fix grammar
DarioViva42 Aug 6, 2024
78eb9c2
AbstractPrioritizedPropertyLoader: fix typo
DarioViva42 Aug 6, 2024
72a1429
EsapiPropertyLoaderFactory: replace with isEmpty call
DarioViva42 Aug 6, 2024
a43c119
CipherText: fix typo
DarioViva42 Aug 6, 2024
41b4ee4
CipherText: fix typo
DarioViva42 Aug 6, 2024
74b1548
CipherText: fix typo
DarioViva42 Aug 6, 2024
0b4db8c
CipherText: fix typo
DarioViva42 Aug 6, 2024
90c930d
CipherTextSerializer: fix grammar
DarioViva42 Aug 6, 2024
cee815c
CipherTextSerializer: fix typo
DarioViva42 Aug 6, 2024
1474758
CipherTextSerializer: fix typo
DarioViva42 Aug 6, 2024
23985cd
CipherTextSerializer: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
3df9171
CryptoHelper: fix typo
DarioViva42 Aug 6, 2024
86ba9ed
CryptoHelper: fix typo
DarioViva42 Aug 6, 2024
058ba93
CryptoHelper: replace with isEmpty call
DarioViva42 Aug 6, 2024
28216b7
CryptoHelper: fix grammar
DarioViva42 Aug 6, 2024
62f1e5f
CryptoToken: fix typo
DarioViva42 Aug 6, 2024
ac70d55
CryptoToken: fix typo
DarioViva42 Aug 6, 2024
f5002a4
CryptoToken: fix typo
DarioViva42 Aug 6, 2024
2c34a36
CryptoToken: remove unnecessary return
DarioViva42 Aug 6, 2024
8fbedf0
CryptoToken: fix typo
DarioViva42 Aug 6, 2024
03d9d72
KeyDerivationFunction: replace with isEmpty call
DarioViva42 Aug 6, 2024
29ed93d
KeyDerivationFunction: fix typo
DarioViva42 Aug 6, 2024
312b713
KeyDerivationFunction: fix typo
DarioViva42 Aug 6, 2024
cc8dba1
PlainText: fix typo
DarioViva42 Aug 6, 2024
03e4f68
SecurityProviderLoader: fix typo
DarioViva42 Aug 6, 2024
29ec1d6
RequestRateThrottleFilter: fix typo
DarioViva42 Aug 6, 2024
2b0f179
SecurityWrapperRequest: fix typo
DarioViva42 Aug 6, 2024
ae0be48
SecurityWrapperResponse: replace length check with isEmpty call
DarioViva42 Aug 6, 2024
5474967
SecurityWrapperResponse: replace String concatenation with StringBuilder
DarioViva42 Aug 6, 2024
ebf891d
CompositeLogScrubber: fix typo
DarioViva42 Aug 6, 2024
0b3e757
JavaLogBridge: fix typo
DarioViva42 Aug 6, 2024
0fc8ec3
Authenticator: fix typo
DarioViva42 Aug 6, 2024
e3227ae
Encoder: fix typo
DarioViva42 Aug 6, 2024
8a598ae
Encryptor: untangle unclear sentence
DarioViva42 Aug 6, 2024
8a25f26
ESAPI: fix typo
DarioViva42 Aug 6, 2024
5412623
HTTPUtilities: fix typo
DarioViva42 Aug 6, 2024
da38c89
HTTPUtilities: fix typo
DarioViva42 Aug 6, 2024
86c8d17
Logger: fix typo
DarioViva42 Aug 6, 2024
82a8e72
Logger: fix typo
DarioViva42 Aug 6, 2024
157eb29
SafeFile: remove unnecessary null checks
DarioViva42 Aug 6, 2024
25827f5
SecurityConfiguration: fix typo
DarioViva42 Aug 6, 2024
c6ed930
StringUtilities: replace with isEmpty call
DarioViva42 Aug 6, 2024
a5f7706
StringUtilities: correct javadoc
DarioViva42 Aug 6, 2024
efcba68
StringUtilities: replace length check with isEmpty
DarioViva42 Aug 6, 2024
b01219f
StringUtilities: replace with isEmpty call
DarioViva42 Aug 6, 2024
979391b
User: fix typo
DarioViva42 Aug 6, 2024
7ca441b
Validator: fix typo
DarioViva42 Aug 6, 2024
b490a31
Validator: fix typo
DarioViva42 Aug 6, 2024
b173d85
CollectionsUtil: fix typo
DarioViva42 Aug 6, 2024
054726c
NullSafe: don't reinvent the wheel
DarioViva42 Aug 6, 2024
01d2ab2
ObjFactory: fix typo
DarioViva42 Aug 6, 2024
915711d
ObjFactory: replace with isEmpty call
DarioViva42 Aug 6, 2024
7fc8384
ObjFactory: fix typo
DarioViva42 Aug 6, 2024
60a63b8
BaseEncodeTag: fix typo
DarioViva42 Aug 6, 2024
fbcc3ae
EncodeForBase64Tag: fix typo
DarioViva42 Aug 6, 2024
07cfa84
EncodeForCSSTag: fix typo
DarioViva42 Aug 6, 2024
2f6ec5d
EncodeForHTMLAttributeTag: fix typo
DarioViva42 Aug 6, 2024
3879e62
EncodeForHTMLTag: fix typo
DarioViva42 Aug 6, 2024
9352108
EncodeForJavaScriptTag: fix typo
DarioViva42 Aug 6, 2024
58a4429
EncodeForURLTag: fix typo
DarioViva42 Aug 6, 2024
f674f3b
EncodeForVBScriptTag: fix typo
DarioViva42 Aug 6, 2024
8f4c125
EncodeForXMLAttributeTag: fix typo
DarioViva42 Aug 6, 2024
43eca5e
EncodeForXMLTag: fix typo
DarioViva42 Aug 6, 2024
763364d
EncodeForXPathTag: fix typo
DarioViva42 Aug 6, 2024
2847bf6
AbstractAccessReferenceMap: fix typo
DarioViva42 Aug 6, 2024
b42e32a
DefaultEncoder: replace length check with isEmpty
DarioViva42 Aug 6, 2024
19ac3d7
DefaultEncoder: replace == with equals to not rely on java string poo…
DarioViva42 Aug 6, 2024
0ae5b04
DefaultEncoder: replace with isEmpty call
DarioViva42 Aug 6, 2024
faa6c09
DefaultEncoder: simplify boolean expression
DarioViva42 Aug 6, 2024
49ee56e
DefaultEncoder: replace with isEmpty call
DarioViva42 Aug 6, 2024
281ee13
DefaultExecutor: use contains instead of indexOf
DarioViva42 Aug 6, 2024
00b9e30
DefaultExecutor: use replaceAll
DarioViva42 Aug 6, 2024
aabd775
DefaultExecutor: remove unnecessary null check
DarioViva42 Aug 6, 2024
b2bb261
DefaultExecutor: replace length check with isEmpty
DarioViva42 Aug 6, 2024
fcd5c8f
DefaultHTTPUtilities: replace length check with isEmpty
DarioViva42 Aug 6, 2024
4052953
DefaultSecurityConfiguration: replace with isEmpty call
DarioViva42 Aug 6, 2024
d732231
DefaultSecurityConfiguration: simplify boolean expression
DarioViva42 Aug 6, 2024
eb7ba9e
DefaultSecurityConfiguration: replace length check with isEmpty
DarioViva42 Aug 6, 2024
b00dc08
DefaultSecurityConfiguration: replace with isEmpty call
DarioViva42 Aug 6, 2024
bb3836c
DefaultUser: replace with isEmpty call
DarioViva42 Aug 6, 2024
6737088
DefaultValidator: replace length check with isEmpty
DarioViva42 Aug 6, 2024
ba99b2d
DefaultValidator: use StringUtilities.isEmpty
DarioViva42 Aug 6, 2024
12f5d7b
FileBasedAuthenticator: fix typo
DarioViva42 Aug 6, 2024
dcb77ad
FileBasedAuthenticator: use NullSafe.equals
DarioViva42 Aug 6, 2024
5a5542d
FileBasedAuthenticator: replace length check with isEmpty
DarioViva42 Aug 6, 2024
2442c92
FileBasedAuthenticator: use String.join
DarioViva42 Aug 6, 2024
ff6222d
FileBasedAuthenticator: use contains instead of indexOf
DarioViva42 Aug 6, 2024
eef6ced
RandomAccessReferenceMap: use containsKey
DarioViva42 Aug 6, 2024
aad3434
DynaBeanACRParameter: LazyDynaMap uses Strings as keys
DarioViva42 Aug 6, 2024
7bac60e
FileBasedACRs: use contains instead of indexOf
DarioViva42 Aug 6, 2024
48ac095
FileBasedACRs: use for loop (uses iterator under the hood)
DarioViva42 Aug 6, 2024
2f048c5
FileBasedACRs: use String as generic type
DarioViva42 Aug 6, 2024
e8c0d90
FileBasedACRs: simplify boolean expression
DarioViva42 Aug 6, 2024
4bd9405
FileBasedACRs: replace length check with isEmpty
DarioViva42 Aug 6, 2024
44209c4
FileBasedACRs: remove unused imports
DarioViva42 Aug 6, 2024
6dfdb2e
FileBasedACRs: use more generic types and for loops
DarioViva42 Aug 6, 2024
c0c58dd
DefaultEncryptedProperties: use StringUtilities.isEmpty
DarioViva42 Aug 6, 2024
dce76c9
DefaultEncryptedProperties: use for loop
DarioViva42 Aug 6, 2024
653e675
EncryptedPropertiesUtils: use StringUtilities.isEmpty
DarioViva42 Aug 6, 2024
59b9e4c
JavaEncryptor: use for loop
DarioViva42 Aug 6, 2024
3b2d0f5
BaseValidationRule: fix typo and add link
DarioViva42 Aug 6, 2024
72609e4
CreditCardValidationRule: fix typo
DarioViva42 Aug 6, 2024
5c5e576
StringValidationRule: fix typo
DarioViva42 Aug 6, 2024
3af86fa
AddHTTPOnlyFlagRule: use for loop
DarioViva42 Aug 6, 2024
1a1723a
AddSecureFlagRule: use for loop
DarioViva42 Aug 6, 2024
c006345
BeanShellRule: chain append calls
DarioViva42 Aug 6, 2024
8fae578
BeanShellRule: use System.lineSeparator
DarioViva42 Aug 6, 2024
0ebe2a1
IPRule: concatenating empty String is not necessary as String is immu…
DarioViva42 Aug 6, 2024
f418d84
Rule: use StringUtilities.isEmpty
DarioViva42 Aug 6, 2024
a191170
RuleUtil: use for loop
DarioViva42 Aug 6, 2024
eb34553
InterceptingHTTPServletResponse: simplify boolean expression
DarioViva42 Aug 6, 2024
9268ac9
InterceptingHTTPServletResponse: use for loop
DarioViva42 Aug 6, 2024
9d14960
InterceptingHTTPServletResponse: use StringBuilder
DarioViva42 Aug 6, 2024
9bd4b31
ObjFactory: use StringUtilities.isEmpty
DarioViva42 Aug 6, 2024
e1716ed
DefaultEncoder: use StringUtilities.isEmpty
DarioViva42 Aug 7, 2024
3519568
DefaultEncoder: buildUrl: refactor to optimize String building process
DarioViva42 Aug 7, 2024
e673b20
DefaultValidator: replace with single class imports
DarioViva42 Aug 7, 2024
8963c83
DefaultValidator: remove redundant boxing
DarioViva42 Aug 7, 2024
9a563b0
DefaultValidator: use for loop
DarioViva42 Aug 7, 2024
8e952b8
Base64: read: refactor code
DarioViva42 Aug 7, 2024
18951ce
Base64: write: refactor code
DarioViva42 Aug 7, 2024
4e4da2f
Base64: flushBase64: refactor code
DarioViva42 Aug 7, 2024
b88c0e6
Base64: decode: refactor code
DarioViva42 Aug 7, 2024
8cdc97b
Base64: read: refactor code
DarioViva42 Aug 7, 2024
669e5a3
JavaScriptCodec: use switch
DarioViva42 Aug 7, 2024
7c61256
MySQLCodec: use switch
DarioViva42 Aug 7, 2024
c7ecb76
MySQLCodec: use switch
DarioViva42 Aug 7, 2024
9567f59
CryptoHelper: isCipherTextMACvalid: invert 'if' condition
DarioViva42 Aug 7, 2024
d37245b
EnforceHTTPSRule: use for loop
DarioViva42 Aug 7, 2024
23e3eb7
EnforceHTTPSRule: check: refactor
DarioViva42 Aug 7, 2024
033e6c3
HTTPMethodRule: check: invert 'if' condition
DarioViva42 Aug 7, 2024
8e956c1
MustMatchRule: check: refactor
DarioViva42 Aug 7, 2024
e88ef17
RuleUtil: replace for with while
DarioViva42 Aug 7, 2024
8d0c4eb
RuleUtil: replace while with for
DarioViva42 Aug 7, 2024
8a95734
SimpleVirtualPatchRule: remove redundant else
DarioViva42 Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OWASP® ESAPI (The OWASP Enterprise Security API) is a free, open source, web ap
# Jakarta EE Support
**IMPORTANT:**
ESAPI has supported the Jakarta Servlet API (i.e., **jakarta.servlet.api**) since release
2.5.3.0. (Unfortunately, we were just forgot to note that in this **README** file. Duh!)
2.5.3.0. (Unfortunately, this information was previously missing in this **README** file.)

Therefore, for release 2.5.3.0 and later versions of ESAPI, ESAPI ought to be able to support Spring Boot 3, Spring 6, Tomcat 10,
and other applications or libraries requiring Jarkata EE. (If you find a case where it does
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/esapi/Authenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public interface Authenticator {
* <p>
* <b>WARNING:</b> The implementation of this method as defined in the
* default reference implementation class, {@code FileBasedAuthenticator},
* uses a password hash algorthim that is known to be weak. You are advised
* uses a password hash algorithm that is known to be weak. You are advised
* to replace the default reference implementation class with your own custom
* implementation that uses a stronger password hashing algorithm.
* See class comments in * {@code FileBasedAuthenticator} for further details.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/esapi/ESAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static Authenticator authenticator() {
}

/**
* The ESAPI Encoder is primarilly used to provide <i>output</i> encoding to
* The ESAPI Encoder is primarily used to provide <i>output</i> encoding to
* prevent Cross-Site Scripting (XSS).
* @return the current ESAPI Encoder object being used to encode and decode data for this application.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/esapi/Encoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public interface Encoder {
*
* NB: The reference implementation encodes almost everything and may over-encode.
*
* The difficulty with XPath encoding is that XPath has no built in mechanism for escaping
* The difficulty with XPath encoding is that XPath has no built-in mechanism for escaping
* characters. It is possible to use XQuery in a parameterized way to
* prevent injection.
*
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/owasp/esapi/Encryptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ CipherText encrypt(SecretKey key, PlainText plaintext)
* </p>
* @param ciphertext The {@code CipherText} object to be decrypted.
* @return The {@code PlainText} object resulting from decrypting the specified
* ciphertext. Note that it it is desired to convert the returned
* plaintext byte array to a Java String is should be done using
* ciphertext. Note that the returned plaintext byte array
* should be converted to a Java String using
* {@code new String(byte[], "UTF-8");} rather than simply using
* {@code new String(byte[]);} which uses native encoding and may
* not be portable across hardware and/or OS platforms.
Expand All @@ -186,8 +186,8 @@ CipherText encrypt(SecretKey key, PlainText plaintext)
* @param key The {@code SecretKey} to use for encrypting the plaintext.
* @param ciphertext The {@code CipherText} object to be decrypted.
* @return The {@code PlainText} object resulting from decrypting the specified
* ciphertext. Note that it it is desired to convert the returned
* plaintext byte array to a Java String is should be done using
* ciphertext. Note that the returned plaintext byte array
* should be converted to a Java String using
* {@code new String(byte[], "UTF-8");} rather than simply using
* {@code new String(byte[]);} which uses native encoding and may
* not be portable across hardware and/or OS platforms.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/esapi/HTTPUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public interface HTTPUtilities
* everything to keey your application and environment secure. Some of the more obvious omissions are the
* absence of examining the actual file content to determine the actual file type or running some AV scan
* on the uploaded files. You have to add that functionality to you if you want or need that. Some
* reasource that you may find usefule are:
* resource that you may find useful are:
* <ul>
* <li><a href="https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html">OWASP File Upload Cheat Sheet</a></li>
* <li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Denial_of_Service_Cheat_Sheet.html">OWASP Denial of Service Cheat Sheet</a></li>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/owasp/esapi/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
* the basis for its logging implementation. Both provided implementations implement requirements #1 through #5 above.
* </p><p>
* <i>Customization</i>: It is expected that most organizations may wish to implement their own custom {@code Logger} class in
* order to integrate ESAPI logging with their specific logging infrastructure. The ESAPI feference implementations
* order to integrate ESAPI logging with their specific logging infrastructure. The ESAPI reference implementations
* can serve as a useful starting point to intended to provide a simple functional example of an implementation, but
* they are also largely usuable out-of-the-box with some additional minimal log configuration.
* they are also largely usable out-of-the-box with some additional minimal log configuration.
*
* @author Jeff Williams (jeff.williams .at. aspectsecurity.com) <a
* href="http://www.aspectsecurity.com">Aspect Security</a>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/owasp/esapi/SafeFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public SafeFile(URI uri) throws ValidationException {

private void doDirCheck(String path) throws ValidationException {
Matcher m1 = DIR_BLACKLIST_PAT.matcher( path );
if ( null != m1 && m1.find() ) {
if ( m1.find() ) {
throw new ValidationException( "Invalid directory", "Directory path (" + path + ") contains illegal character: " + m1.group() );
}

Matcher m2 = PERCENTS_PAT.matcher( path );
if (null != m2 && m2.find() ) {
if ( m2.find() ) {
throw new ValidationException( "Invalid directory", "Directory path (" + path + ") contains encoded characters: " + m2.group() );
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/esapi/SecurityConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public interface SecurityConfiguration extends EsapiPropertyLoader {
* considered the <i>default</i> key size that ESAPI will use for symmetric
* ciphers supporting multiple key sizes. (Note that there is also an <b>Encryptor.MinEncryptionKeyLength</b>,
* which is the <i>minimum</i> key size (in bits) that ESAPI will support
* for encryption. (There is no miminimum for decryption.)
* for encryption. (There is no minimum for decryption.)
*
* @return the key length (in bits)
* @deprecated Use SecurityConfiguration.getIntProp("appropriate_esapi_prop_name") instead.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/owasp/esapi/StringUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ public static boolean contains(StringBuilder input, char c) {
}

/**
* Returns the replace value if the value of test is null, "null", or ""
* Returns the replace value if the value of test is null, "null" (case-insensitive), or blank
*
* @param test The value to test
* @param replace The replacement value
* @return The correct value
*/
public static String replaceNull( String test, String replace ) {
return test == null || "null".equalsIgnoreCase( test.trim() ) || "".equals( test.trim() ) ? replace : test;
return test == null || "null".equalsIgnoreCase( test.trim() ) || test.trim().isEmpty() ? replace : test;
}

/**
Expand Down Expand Up @@ -185,16 +185,16 @@ public static int getLevenshteinDistance (String s, String t) {
*/
public static boolean notNullOrEmpty(String str, boolean trim) {
if ( trim ) {
return !( str == null || str.trim().equals("") );
return !( str == null || str.trim().isEmpty() );
} else {
return !( str == null || str.equals("") );
return !( str == null || str.isEmpty() );
}
}

/**
* Returns true if String is empty ("") or null.
*/
public static boolean isEmpty(String str) {
return str == null || str.length() == 0;
return str == null || str.isEmpty();
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/esapi/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public interface User extends Principal, Serializable {
/**
* Set the time of the last failed login for this user.
*
* @param lastFailedLoginTime the date and time when the user just failed to login correctly.
* @param lastFailedLoginTime the date and time when the user just failed to log in correctly.
*/
void setLastFailedLoginTime(Date lastFailedLoginTime);

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/owasp/esapi/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ public interface Validator {
boolean isValidSafeHTML(String context, String input, int maxLength, boolean allowNull, ValidationErrorList errorList) throws IntrusionException;

/**
* Canonicalize and then sanitize the input so that it is "safe" for renderinger in an HTML context (i.e., that
* Canonicalize and then sanitize the input so that it is "safe" for rendering in an HTML context (i.e., that
* it does not contain unwanted scripts in the body, attributes, CSS, URLs, or anywhere else). Note that the resulting
* returned value may omit input that is considered dangerous and cannot be safely sanitized and other input
* that gets HTML encoded (e.g., a single quote (') might get chaged to "&quot;").
* that gets HTML encoded (e.g., a single quote (') might get changed to "&quot;").
* <p>
* The default behavior of this check depends on the {@code antisamy-esapi.xml} AntiSamy policy configuration file
* (or an alternate filename, specified via the "Validator.HtmlValidationConfigurationFile" property in your
Expand All @@ -414,10 +414,10 @@ public interface Validator {
String getValidSafeHTML(String context, String input, int maxLength, boolean allowNull) throws ValidationException, IntrusionException;

/**
* Canonicalize and then sanitize the input so that it is "safe" for renderinger in an HTML context (i.e., that
* Canonicalize and then sanitize the input so that it is "safe" for rendering in an HTML context (i.e., that
* it does not contain unwanted scripts in the body, attributes, CSS, URLs, or anywhere else). Note that the resulting
* returned value may omit input that is considered dangerous and cannot be safely sanitized and other input
* that gets HTML encoded (e.g., a single quote (') might get chaged to "&quot;").
* that gets HTML encoded (e.g., a single quote (') might get changed to "&quot;").
* <p>
* The default behavior of this check depends on the {@code antisamy-esapi.xml} AntiSamy policy configuration file
* (or an alternate filename, specified via the "Validator.HtmlValidationConfigurationFile" property in your
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/owasp/esapi/codecs/AbstractCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* <p>
* Be sure to see the several <b>WARNING</b>s associated with the detailed
* method descriptions. You will not find that in the "Method Summary" section
* of the javadoc because that only shows the intial sentence.
* of the javadoc because that only shows the initial sentence.
*
* @author Jeff Williams (jeff.williams .at. aspectsecurity.com) <a
* href="http://www.aspectsecurity.com">Aspect Security</a>
Expand Down Expand Up @@ -96,7 +96,7 @@ public String encodeCharacter( char[] immune, Character c ) {


/**
* To prevent accidental footgun usage and calling
* To prevent accidental usage and calling
* {@link #encodeCharacter( char[], int)} when called with {@code char} and
* {@code char} is first silently converted to {@code int} and then the
* unexpected method is called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/**
* This Abstract class provides the generic logic for using a {@link PushbackSequence}
* in regards to iterating strings. The final Impl is intended for the user to supply
* in regard to iterating strings. The final Impl is intended for the user to supply
* a type T such that the pushback interface can be utilized for sequences
* of type T. Presently this generic class is limited by the fact that
* input is a String.
Expand Down Expand Up @@ -61,7 +61,7 @@ public boolean hasNext() {
return true;
if (input == null)
return false;
if (input.length() == 0)
if (input.isEmpty())
return false;
if (index >= input.length())
return false;
Expand Down
Loading