koushikkothagal / coronavirus-tracker

Spring Boot Java app to track coronavirus confirmed cases across the globe
119 stars 165 forks source link

Error: java.lang.NumberFormatException #9

Open ruhuang2001 opened 2 years ago

ruhuang2001 commented 2 years ago

CoronaVirusDataService.java code:

45        int latestCases = Integer.parseInt(record.get(record.size() - 1));
46        int prevDayCases = Integer.parseInt(record.get(record.size() - 2));
47        locationStat.setLatestTotalCases(latestCases);
48        locationStat.setDiffFromPrevDay(latestCases - prevDayCases);

Integer.parseInt(string) will throw the Error: java.lang.NumberFormatException if the string is empty.