[icinga-checkins] icinga.org: icinga2/feature/escalation-notification-5011: Ignore invalid fields in the state file.

git at icinga.org git at icinga.org
Mon Nov 11 09:32:28 CET 2013


Module: icinga2
Branch: feature/escalation-notification-5011
Commit: 17834e0a777a210423bc3045b17e9c4eaab78d6a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=17834e0a777a210423bc3045b17e9c4eaab78d6a

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Sat Nov  9 18:30:17 2013 +0100

Ignore invalid fields in the state file.

Refs #5039

---

 lib/base/serializer.cpp |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/base/serializer.cpp b/lib/base/serializer.cpp
index 270e6f7..449222c 100644
--- a/lib/base/serializer.cpp
+++ b/lib/base/serializer.cpp
@@ -175,7 +175,11 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
 		if (!input->Contains(field.Name))
 			continue;
 
-		instance->SetField(i, Deserialize(input->Get(field.Name), attributeTypes));
+		try {
+			instance->SetField(i, Deserialize(input->Get(field.Name), attributeTypes));
+		} catch (const std::exception&) {
+			instance->SetField(i, Empty);
+		}
 	}
 
 	return instance;





More information about the icinga-checkins mailing list