diff --git a/src/libraries/JANA/Services/JParameterManager.h b/src/libraries/JANA/Services/JParameterManager.h index 70255898d..291407974 100644 --- a/src/libraries/JANA/Services/JParameterManager.h +++ b/src/libraries/JANA/Services/JParameterManager.h @@ -366,6 +366,7 @@ template inline void JParameterManager::Parse(const std::string& value, std::vector &val) { std::stringstream ss(value); std::string s; + val.clear(); // clearing the input vector to ensure no dulication which can be caused due to val.push_back(t); while (getline(ss, s, ',')) { T t; Parse(s, t); diff --git a/src/programs/tests/JParameterManagerTests.cc b/src/programs/tests/JParameterManagerTests.cc index b509d6eda..89c3c8ea0 100644 --- a/src/programs/tests/JParameterManagerTests.cc +++ b/src/programs/tests/JParameterManagerTests.cc @@ -195,6 +195,7 @@ TEST_CASE("JParameterManager_VectorParams") { std::vector outputs; auto param = jpm.GetParameter("test", outputs); REQUIRE(param->GetValue() == "first,second one, third one "); + REQUIRE(inputs.size()==3); // an additional test to see that the size of the input vector remains the same: Issue #256 } SECTION("Reading a vector of ints") { jpm.SetParameter("test", "1,2, 3 ");