Changeset 24214

Show
Ignore:
Timestamp:
29.06.2011 14:22:41 (8 years ago)
Author:
sjm84
Message:

Fixed a potential null pointer exception when printing XML nodes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r24024 r24214  
    991991    System.out.print(e.getNodeName()); 
    992992    NamedNodeMap attrs = e.getAttributes(); 
    993     for (int i = 0; i < attrs.getLength(); i++) { 
    994       Node attr = attrs.item(i); 
    995       System.out.print(' '); 
    996       System.out.print(attr.getNodeName()); 
    997       System.out.print("=\""); 
    998       System.out.print(attr.getNodeValue()); 
    999       System.out.print('"'); 
    1000     } 
     993     
     994    if (attrs != null) 
     995    { 
     996        for (int i = 0; i < attrs.getLength(); i++) { 
     997            Node attr = attrs.item(i); 
     998            System.out.print(' '); 
     999            System.out.print(attr.getNodeName()); 
     1000            System.out.print("=\""); 
     1001            System.out.print(attr.getNodeValue()); 
     1002            System.out.print('"'); 
     1003        } 
     1004    } 
    10011005     
    10021006    NodeList children = e.getChildNodes();