Closed vasyl91 closed 5 years ago
That was the most ridiculous error that occured to me to unravel. It turned out that this part of code checks every file in provided catalogue and if it is empty - throws an error, even though this file was not called.
This snippet inside initView()
method that sets graphNumber
does the trick:
FileFilter fileFilter = new WildcardFileFilter("*.csv");
File[] files = directory.listFiles(fileFilter);
Arrays.sort(files, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
String stringFile = directoryString + files[number].getName();
try {
BufferedReader br = new BufferedReader(new FileReader(stringFile));
if (br.readLine() != null) {
graphNumber = number;
}
} catch (IOException e) {
e.printStackTrace();
}
Problem was probably related to the fact that I'm using react-native. Closing issue.
Hey sorry I just now saw this (been out of reach of a computer for the weekend). Glad you were able to resolve it!
I wrote snippet that reads simple .csv file:
Catalogue
/storage/emulated/0/ProjectName/
contains .csv files. By changinggraphNumber
user chooses which file to read. 0 is the newest, 1 is the second one and so on.If
graphNumber
(arrows in the code above) is immutable, everything works perfect. But when I try to set it with function (then it becomes not immutable), app loads series and almost instantly crashes.I tried to catch this error with LogCat, it returns:
To reproduce this issue copy/paste provided code, create random .csv file (mine contains two columns with numbers) and call
generateSeriesData()
. NOTE: this snipped uses Univocity so you'll have to add this:implementation group: 'com.univocity', name: 'univocity-parsers', version: '2.7.6'
to your dependencies.