diff -r d44748d98fe6 src/core/model/object-factory.cc --- a/src/core/model/object-factory.cc Mon Jun 20 00:00:15 2016 +0200 +++ b/src/core/model/object-factory.cc Wed Jun 22 17:43:14 2016 -0700 @@ -139,8 +139,22 @@ NS_ASSERT (lbracket != std::string::npos); NS_ASSERT (rbracket != std::string::npos); std::string tid = v.substr (0, lbracket); + factory.SetTypeId (tid); std::string parameters = v.substr (lbracket+1,rbracket-(lbracket+1)); - factory.SetTypeId (tid); + bool invalidDelimiter = false; + if (parameters.find (',', 0) != std::string::npos) + { + invalidDelimiter = true; + } + if (parameters.find (':', 0) != std::string::npos) + { + invalidDelimiter = true; + } + if (invalidDelimiter == true) + { + is.setstate (std::ios_base::failbit); + return is; + } std::string::size_type cur; cur = 0; while (cur != parameters.size ()) diff -r d44748d98fe6 src/core/test/attribute-test-suite.cc --- a/src/core/test/attribute-test-suite.cc Mon Jun 20 00:00:15 2016 +0200 +++ b/src/core/test/attribute-test-suite.cc Wed Jun 22 17:43:14 2016 -0700 @@ -823,17 +823,13 @@ // // Try to set a UniformRandomVariable // - ok = p->SetAttributeFailSafe ("TestRandom", StringValue ("ns3::UniformRandomVariable[Min=0.,Max=1.]")); + ok = p->SetAttributeFailSafe ("TestRandom", StringValue ("ns3::UniformRandomVariable[Min=0.|Max=1.]")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a UniformRandomVariable"); // // Try to set a ConstantRandomVariable // - // ok = p->SetAttributeFailSafe ("TestRandom", StringValue ("ns3::ConstantRandomVariable[Constant=10.0]")); - //ok = p->SetAttributeFailSafe ("TestRandom", StringValue ("ns3::UniformRandomVariable[Min=0.,Max=1.]")); - - ok = p->SetAttributeFailSafe ("TestRandom", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]")); - + ok = p->SetAttributeFailSafe ("TestRandom", StringValue ("ns3::ConstantRandomVariable[Constant=10.0]")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a ConstantRandomVariable"); }