Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions include/pluginlib/class_loader_imp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ std::map<std::string, ClassDesc> ClassLoader<T>::determineAvailableClasses(
for (std::vector<std::string>::const_iterator it = plugin_xml_paths.begin();
it != plugin_xml_paths.end(); ++it)
{
processSingleXMLPluginFile(*it, classes_available);
try {
processSingleXMLPluginFile(*it, classes_available);
} catch (const pluginlib::InvalidXMLException & e) {
ROS_ERROR_NAMED("pluginlib.ClassLoader",
"Skipped loading plugin with error: %s.",
e.what());
}
}

ROS_DEBUG_NAMED("pluginlib.ClassLoader", "Exiting determineAvailableClasses()...");
Expand Down Expand Up @@ -645,14 +651,15 @@ void ClassLoader<T>::processSingleXMLPluginFile(
tinyxml2::XMLElement * config = document.RootElement();
if (NULL == config) {
throw pluginlib::InvalidXMLException(
"XML Document has no Root Element. This likely means the XML is malformed or missing.");
"XML Document '" + xml_file +
"' has no Root Element. This likely means the XML is malformed or missing.");
return;
}
if (!(strcmp(config->Value(), "library") == 0 ||
strcmp(config->Value(), "class_libraries") == 0))
{
throw pluginlib::InvalidXMLException(
"The XML document given to add must have either \"library\" or "
"The XML document '" + xml_file + "' given to add must have either \"library\" or "
"\"class_libraries\" as the root tag");
return;
}
Expand Down
3 changes: 2 additions & 1 deletion test/utest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ TEST(PluginlibTest, brokenXML) {
try {
pluginlib::ClassLoader<test_base::Fubar> test_loader("pluginlib", "test_base::Fubar",
"plugin_test");
} catch (pluginlib::InvalidXMLException & ex) {
test_loader.createInstance("pluginlib/foo");
} catch (pluginlib::PluginlibException & ex) {
SUCCEED();
return;
}
Expand Down