Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/simpaths/experiment/SimPathsMultiRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ public static void main(String[] args) {
} else {
countryString = "United Kingdom";
}
country = Country.getCountryFromNameString(countryString);
String valueYear = lastDatabaseCountryAndYear.getValue(country.toString()).toString();
startYear = Integer.parseInt(valueYear);
} catch (NullPointerException e) {
System.out.println("No last database country and year found.");
countryString = "United Kingdom";
country = Country.getCountryFromNameString(countryString);
Comment on lines +88 to +94
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The country variable is used here but may still be null if an exception occurs during the Country.getCountryFromNameString() call on line 88, which would cause a NullPointerException.

Suggested change
country = Country.getCountryFromNameString(countryString);
String valueYear = lastDatabaseCountryAndYear.getValue(country.toString()).toString();
startYear = Integer.parseInt(valueYear);
} catch (NullPointerException e) {
System.out.println("No last database country and year found.");
countryString = "United Kingdom";
country = Country.getCountryFromNameString(countryString);
country = Country.getCountryFromNameString(countryString);
if (country == null) {
country = Country.UNITED_KINGDOM;
}
String valueYear = lastDatabaseCountryAndYear.getValue(country.toString()).toString();
startYear = Integer.parseInt(valueYear);
} catch (NullPointerException e) {
System.out.println("No last database country and year found.");
countryString = "United Kingdom";
country = Country.getCountryFromNameString(countryString);
if (country == null) {
country = Country.UNITED_KINGDOM;
}

Copilot uses AI. Check for mistakes.
startYear = 2019;
}

country = Country.getCountryFromNameString(countryString);

if (innovationArgs!=null)
updateLocalParameters(innovationArgs);
Expand Down