Java : Error handling: exception when argument is null or empty string