Index: chromeos/network/shill_property_util.cc |
diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc |
index 613478e214381ffa97887fc9a831d2e13cc791dc..35e4bb19a9154c532b57d8419f6690e94ffc7789 100644 |
--- a/chromeos/network/shill_property_util.cc |
+++ b/chromeos/network/shill_property_util.cc |
@@ -120,6 +120,22 @@ std::string GetSSIDFromProperties(const base::DictionaryValue& properties, |
return ssid; |
} |
+std::string GetNetworkIdFromProperties( |
+ const base::DictionaryValue& properties) { |
+ if (properties.empty()) |
+ return "EmptyProperties"; |
+ std::string result; |
+ if (properties.GetStringWithoutPathExpansion(shill::kGuidProperty, &result)) |
+ return result; |
+ if (properties.GetStringWithoutPathExpansion(shill::kSSIDProperty, &result)) |
+ return result; |
+ if (properties.GetStringWithoutPathExpansion(shill::kNameProperty, &result)) |
+ return result; |
+ std::string type = "UnknownType"; |
+ properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); |
+ return "Unidentified " + type; |
+} |
+ |
std::string GetNameFromProperties(const std::string& service_path, |
const base::DictionaryValue& properties) { |
std::string name; |
@@ -135,6 +151,10 @@ std::string GetNameFromProperties(const std::string& service_path, |
std::string type; |
properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); |
+ if (type.empty()) { |
+ NET_LOG_ERROR("GetNameFromProperties: No type", service_path); |
+ return validated_name; |
+ } |
if (!NetworkTypePattern::WiFi().MatchesType(type)) |
return validated_name; |
@@ -222,8 +242,9 @@ bool CopyIdentifyingProperties(const base::DictionaryValue& service_properties, |
// with the keys "Provider.Type" and "Provider.Host". |
const base::DictionaryValue* provider_properties = NULL; |
if (!service_properties.GetDictionaryWithoutPathExpansion( |
- shill::kProviderProperty, &provider_properties)) { |
- NET_LOG_ERROR("CopyIdentifyingProperties", "Missing VPN provider dict"); |
+ shill::kProviderProperty, &provider_properties)) { |
+ NET_LOG_ERROR("Missing VPN provider dict", |
+ GetNetworkIdFromProperties(service_properties)); |
return false; |
} |
std::string vpn_provider_type; |
@@ -246,8 +267,10 @@ bool CopyIdentifyingProperties(const base::DictionaryValue& service_properties, |
NOTREACHED() << "Unsupported network type " << type; |
success = false; |
} |
- if (!success) |
- NET_LOG_ERROR("CopyIdentifyingProperties", "Missing required properties"); |
+ if (!success) { |
+ NET_LOG_ERROR("Missing required properties", |
+ GetNetworkIdFromProperties(service_properties)); |
+ } |
return success; |
} |