maybe just use `IOUtils` here they handle null values as well