Ignore:
Timestamp:
2008-05-29T13:29:54+12:00 (16 years ago)
Author:
oranfry
Message:

updating from trunk: brought in trunk changes from r15191 to r15785

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/branches/customizingGreenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r15191 r15787  
    6464  public static final String DISPLAY_ELEM = "display";
    6565  public static final String LEVEL_ELEM = "level";
     66  public static final String DATABASE_TYPE_ELEM = "databaseType";
    6667  public static final String SHORTNAME_ATT = "shortname";
    6768  public static final String NOTIFY_ELEM = "notify";
    6869  public static final String NOTIFY_HOST_ATT = "host";
    69  
    7070  // elems for the pages to be processed by xslt
    7171  public final static String PAGE_ELEM = "page";
     
    423423  /** returns the (first) child element with the given name */
    424424  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
    434440  }
    435441 
Note: See TracChangeset for help on using the changeset viewer.