public class HerdStringUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
HIDDEN_TEXT |
| Constructor and Description |
|---|
HerdStringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkCsvInjection(String text,
String errorMessage)
Check if the text is vulnerable to CSV Injection attack.
|
static Integer |
convertStringToInteger(String stringValue,
Integer defaultValue)
Convert a
String to an Integer, returning a default value if the string is blank. |
static String |
decodeBase64(String base64EncodedText)
Decodes and return the base64 encoded string.
|
static String |
getFirstLevelPrefix(String prefix)
Get first level prefix from the relative path.
|
static String |
getMinimizedFilePath(String filePath,
String directoryPath)
This method will minimize a file path by removing the first appearance of the directory path string.
|
static String |
getShortDescription(String description,
Integer shortDescMaxLength)
Truncates the description field to a configurable value thereby producing a 'short description'
|
static String |
sanitizeLogText(String loggingText)
Sanitize log text by replacing the password
|
static String |
stripHtml(String fragment,
String... whitelistTags)
Strips HTML tags from a given input String, allows some tags to be retained via a whitelist
|
static boolean |
verifyHerdVersionConformingString(String versionString)
Determines if a String conforms to Herd's versioning scheme
|
public static final String HIDDEN_TEXT
public static String decodeBase64(String base64EncodedText)
base64EncodedText - the base64 encoded stringpublic static String getMinimizedFilePath(String filePath, String directoryPath)
filePath - the file path to minimizedirectoryPath - the directory path to removepublic static String getShortDescription(String description, Integer shortDescMaxLength)
description - the specified descriptionshortDescMaxLength - the short description maximum lengthpublic static String stripHtml(String fragment, String... whitelistTags)
fragment - the specified StringwhitelistTags - the specified whitelist tagspublic static void checkCsvInjection(String text, String errorMessage)
text - the texterrorMessage - the error message in the exception when CVS Injection check failspublic static Integer convertStringToInteger(String stringValue, Integer defaultValue)
String to an Integer, returning a default value if the string is blank.stringValue - the string to convert, may be nulldefaultValue - the default valuepublic static String sanitizeLogText(String loggingText)
loggingText - logging textpublic static boolean verifyHerdVersionConformingString(String versionString)
versionString - The given input stringpublic static String getFirstLevelPrefix(String prefix)
prefix - the given prefixCopyright © 2021. All rights reserved.