From 8e47e6daf165bc7d56e5c4a07637c82f293a4e96 Mon Sep 17 00:00:00 2001 From: awagner Date: Mon, 24 Jul 2023 16:23:27 +0200 Subject: [PATCH] changed loadHouseholds when households eq. null --- .../core/scenario/ScenarioLoaderImpl.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/matsim/src/main/java/org/matsim/core/scenario/ScenarioLoaderImpl.java b/matsim/src/main/java/org/matsim/core/scenario/ScenarioLoaderImpl.java index 7685b927f9a..440ecdc19b1 100644 --- a/matsim/src/main/java/org/matsim/core/scenario/ScenarioLoaderImpl.java +++ b/matsim/src/main/java/org/matsim/core/scenario/ScenarioLoaderImpl.java @@ -257,20 +257,22 @@ private void loadHouseholds() { else { log.info("no households file set in config, not loading households"); } - final String fn = this.config.households().getInputHouseholdAttributesFile(); - if ((this.config.households() != null) && ( fn != null)) { - if (!this.config.households().isInsistingOnUsingDeprecatedHouseholdsAttributeFile()) { - throw new RuntimeException(HouseholdsConfigGroup.HOUSEHOLD_ATTRIBUTES_DEPRECATION_MESSAGE); + if ((this.config.households() != null)) { + final String fn = this.config.households().getInputHouseholdAttributesFile(); + if(( fn != null)) { + if (!this.config.households().isInsistingOnUsingDeprecatedHouseholdsAttributeFile()) { + throw new RuntimeException(HouseholdsConfigGroup.HOUSEHOLD_ATTRIBUTES_DEPRECATION_MESSAGE); + } + + URL householdAttributesFileName = ConfigGroup.getInputFileURL(this.config.getContext(), fn ) ; + log.info("loading household attributes from " + householdAttributesFileName); + parseObjectAttributesToAttributable( + householdAttributesFileName, + this.scenario.getHouseholds().getHouseholds().values(), + "householdAttributes not empty after going through all households, meaning that it contains material for householdIDs that " + + "are not in the container. This is not necessarily a bug so we will continue, but note that such material " + + "will no longer be contained in the output_* files."); } - - URL householdAttributesFileName = ConfigGroup.getInputFileURL(this.config.getContext(), fn ) ; - log.info("loading household attributes from " + householdAttributesFileName); - parseObjectAttributesToAttributable( - householdAttributesFileName, - this.scenario.getHouseholds().getHouseholds().values(), - "householdAttributes not empty after going through all households, meaning that it contains material for householdIDs that " + - "are not in the container. This is not necessarily a bug so we will continue, but note that such material " + - "will no longer be contained in the output_* files."); } else { log.info("no household-attributes file set in config, not loading any household attributes");