Changeset 15787 for greenstone3/branches/customizingGreenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
- Timestamp:
- 2008-05-29T13:29:54+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/branches/customizingGreenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r15191 r15787 64 64 public static final String DISPLAY_ELEM = "display"; 65 65 public static final String LEVEL_ELEM = "level"; 66 public static final String DATABASE_TYPE_ELEM = "databaseType"; 66 67 public static final String SHORTNAME_ATT = "shortname"; 67 68 public static final String NOTIFY_ELEM = "notify"; 68 69 public static final String NOTIFY_HOST_ATT = "host"; 69 70 70 // elems for the pages to be processed by xslt 71 71 public final static String PAGE_ELEM = "page"; … … 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.