From 5881dfafa67cfe56411b1dd98e63035aa9e707f7 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 20 Sep 2010 15:09:54 -0700 Subject: [PATCH] bug 5119: fixing the npe, the document obj we parse might be null, as a result of which there can be a npe. adding a check against the same status 5119: resolved fixed --- .../cloud/hypervisor/xen/resource/CitrixResourceBase.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 6c093c52e66..2aef2983f24 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -1674,8 +1674,15 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR try { doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(statsSource); } catch (Exception e) { + s_logger.warn("Exception caught whilst processing the document via document factory:"+e); + return null; } + if(doc==null){ + s_logger.warn("Null document found after tryinh to parse the stats source"); + return null; + } + NodeList firstLevelChildren = doc.getChildNodes(); NodeList secondLevelChildren = (firstLevelChildren.item(0)).getChildNodes(); Node metaNode = secondLevelChildren.item(0);