Changeset 33346

Show
Ignore:
Timestamp:
23.07.2019 13:15:39 (4 weeks ago)
Author:
kjdon
Message:

check for empty child_id, and null DBInfo before using them

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java

    r33341 r33346  
    321321  } 
    322322       
    323     protected void processChildren(String node_id, DBInfo info, String metadata, Vector<String> values, 
    324                    boolean recursive) { 
     323    protected void processChildren(String node_id, DBInfo info, String metadata, Vector<String> values, boolean recursive) { 
    325324      String contains = info.getInfo("contains"); 
    326325      contains = StringUtils.replace(contains, "\"", node_id); 
    327       String[] children = contains.split(";");  
     326      String[] children = contains.split(";"); 
     327 
    328328      for (int i = 0; i < children.length; i++) { 
    329329     
    330330    String child_id = children[i]; 
    331     Vector<String> more_values = getMetaValuesForOID(child_id, null, metadata); 
    332     if (more_values != null) { 
    333       values.addAll(more_values); 
    334     } 
    335     if (recursive) { 
    336        DBInfo child_info = this.coll_db.getInfo(child_id); 
    337        processChildren(child_id, child_info, metadata, values, recursive); 
     331    if (!child_id.equals("")) { 
     332      DBInfo child_info = this.coll_db.getInfo(child_id); 
     333      if (child_info !=null) { 
     334        Vector<String> more_values = getMetaValuesForOID(child_id, child_info, metadata); 
     335        if (more_values != null) { 
     336          values.addAll(more_values); 
     337        } 
     338        if (recursive) { 
     339          processChildren(child_id, child_info, metadata, values, recursive); 
     340        } 
     341      } else { 
     342        logger.error("DB info was null for id "+child_id); 
     343      } 
    338344    } 
    339345      }