protected static String verifyNonEmpty ( String value , String argName ) { if ( value != null ) { value = value . trim ( ) ; if ( value . isEmpty ( ) ) { value = null ; } } if ( value == null ) { throw new IllegalArgumentException ( argName ) ; } return value ; }
Verifies a value is null or empty . Returns the value if non - empty and throws exception if empty .