Changeset 15767
- Timestamp:
- 2008-05-28T16:22:47+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/gsdl3/util/GSXML.java
r15321 r15767 423 423 /** returns the (first) child element with the given name */ 424 424 public static Node getChildByTagName(Node n, String name) { 425 426 Node child = n.getFirstChild(); 427 while (child!=null) { 428 if (child.getNodeName().equals(name)) { 429 return child; 430 } 431 child = child.getNextSibling(); 432 } 433 return null; //not found 425 if(n != null) { // this line is an attempted solution to the NullPointerException mentioned 426 // in trac bug ticket #225. If n is null can't do n.getFirstChild() below. As per bug #225: 427 // GSXML.getNodeByPath() is called by GS2BrowseAction, which then calls this method. 428 // If n is null, null will be returned which GS2BrowseAction already checks for. It's here 429 // that the NullPointerException was thrown. 430 431 Node child = n.getFirstChild(); 432 while (child!=null) { 433 if (child.getNodeName().equals(name)) { 434 return child; 435 } 436 child = child.getNextSibling(); 437 } 438 } 439 return null; //not found 434 440 } 435 441
Note:
See TracChangeset
for help on using the changeset viewer.