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
This commit is contained in:
abhishek 2010-09-20 15:09:54 -07:00
parent 33d97d32c7
commit 5881dfafa6
1 changed files with 7 additions and 0 deletions

View File

@ -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);