List of usage examples for org.apache.commons.lang3 Validate validIndex
public static <T extends CharSequence> T validIndex(final T chars, final int index)
Validates that the index is within the bounds of the argument character sequence; otherwise throwing an exception.
Validate.validIndex(myStr, 2);
If the character sequence is null , then the message of the exception is "The validated object is null".
If the index is invalid, then the message of the exception is "The validated character sequence index is invalid: " followed by the index.
From source file:com.msg.wmTestHelper.file.NameExtractor.java
public static ProcessFile extractProcessFile(File processFile) { ProcessFile result = new ProcessFile(); String[] varNameParts = processFile.getName().split("[.]"); Validate.validIndex(varNameParts, 2); if (isFiltered(varNameParts[2])) { return null; }/*from ww w . j a va 2 s. co m*/ result.fileReference(processFile).version(getVersion(varNameParts)).name(getName(varNameParts)); return result; }