I\'ve readed from the .txt file this:
private static String str;
is null. You have to initialize it.
private static String str = "";