I\'ve readed from the .txt file this:
do this private static String str = "";. By default, your str variable is null so while concatenating null is used.
private static String str = "";
str
null
Initialize it to a blank string as I've shown.