* @return Array from tokenized string
*/
public static String[] getArrayFromString (final String str, final String delimiter) {
+ // Check all parameter
+ if (null == str) {
+ // Throw NPE
+ throw new NullPointerException("Parameter 'str' is null"); //NOI18N
+ } else if (str.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("Parameter 'str' is empty"); //NOI18N
+ } else if (null == delimiter) {
+ // Throw NPE
+ throw new NullPointerException("Parameter 'delimiter' is null"); //NOI18N
+ } else if (delimiter.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("Parameter 'delimiter' is empty"); //NOI18N
+ }
+
// Get tokenizer
- StringTokenizer tokenizer = new StringTokenizer(str, delimiter);
+ final StringTokenizer tokenizer = new StringTokenizer(str, delimiter);
// Init array and index
String[] tokens = new String[tokenizer.countTokens()];