Changeset 32869

Show
Ignore:
Timestamp:
05.03.2019 20:46:53 (4 months ago)
Author:
ak19
Message:

1. Other possible return value from getCollectionListForSet() is now also a clone rather than the member variable because we don't want our destructive remove() operations affecting member variable data structures. 2. Cleaning up debugging.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java

    r32868 r32869  
    275275        Vector <String> subcolls = this.super_coll_map.get(set_spec); 
    276276        if (subcolls == null) { 
    277           logger.info("*** its new!!"); 
     277          logger.info("*** it's new!!"); 
    278278          // not in there yet 
    279279          subcolls = new Vector<String>(); 
     
    295295    } // for each OAI enabled collection 
    296296     
    297      
    298     debugListActivatedCollections("List of collections after configuring Set Info"); 
    299     return true; 
     297    return true; 
    300298  } 
    301299 
     
    353351        } else { 
    354352            logger.error("@@@@ index == -1, could not find collection " + collName +  " in collection_name_list"); 
    355         } 
    356         debugListActivatedCollections("After activation/deactivation: " + changedState);         
    357      
     353        }    
    358354        return true; 
    359355    } 
    360356  } 
    361    
    362     private void debugListActivatedCollections(String heading) { 
    363          
    364         logger.info("#### " + heading + ", colls are: "); 
    365         for(int i = 0; i < collection_name_list.size(); i++) { 
    366             logger.info("###### collname: " + collection_name_list.get(i)); 
    367             logger.info("###### state: " + collection_state_list.get(i)); 
    368         }      
    369     } 
    370    
    371   private void debugPrintCurrentCollList(Vector<String> current_coll_list, String heading) { 
    372       logger.info("@@@@ " + heading + ", colls are: "); 
    373       for(int i = 0; i < current_coll_list.size(); i++) { 
    374           String coll = current_coll_list.get(i); 
    375           logger.info("@@@@@@ collname: " + coll); 
    376       } 
    377   }   
    378357       
    379358  /** process using strings - just calls process using Elements */ 
     
    682661    // if a single collection, send to it 
    683662    // if a subset, send to the collection 
    684     Vector<String> current_coll_list = getCollectionListForSet(set_spec_str); 
    685     if(set_spec_str != null) { 
    686         logger.info(">>>> Set spec: " + set_spec_str); 
    687         debugPrintCurrentCollList(current_coll_list, "Before removing any deactivated colls. Set spec: " + set_spec_str); 
    688     }    
    689      
     663    Vector<String> current_coll_list = getCollectionListForSet(set_spec_str); // return value is now safe to modify such as with .remove() operations 
    690664    boolean single_collection = false; 
    691665    if (current_coll_list.size() == 1) { 
     
    705679    } else { 
    706680         
    707         debugListActivatedCollections("doListRecordsOrIdentifiers"); 
    708          
    709681        for(int i = 0; i < collection_name_list.size(); i++) {           
    710682            if(collection_state_list.get(i).equals(DEACTIVATED)) { 
     
    712684                // remove from the list of collections for which we're going to get identifiers/records 
    713685                // so we won't get identifiers/records for any deactivated collections 
    714                 current_coll_list.remove(collName); 
    715                 logger.info("@@@@ collection " + collName + " is still deactivated!"); 
     686                current_coll_list.remove(collName);              
    716687            }            
    717688        } 
     
    723694            return OAIXML.createErrorMessage(errorCode, "OAI collections temporarily active. Likely because of collection rebuilding. Check back shortly."); 
    724695        } 
    725          
    726         debugPrintCurrentCollList(current_coll_list, "After removing any deactivated colls"); 
    727696    } 
    728697    if (set_spec_str != null && set_spec_str.indexOf(":") != -1) { 
     
    866835      // Important to return a clone of the member variable, since collection names can be locally removed from the Vector by 
    867836      // the caller for any collection that is deactivated. This is so the caller can determine which collections are active and 
    868       // thus have records/identifiers to display. We don't want to remove elements from the member variable collection_name_list. 
     837      // thus have records/identifiers to display. We don't want to remove elements from the member variable collection_name_list itself. 
    869838      return (Vector<String>)this.collection_name_list.clone(); 
    870839    } 
    871840    if (has_super_colls && super_coll_map.containsKey(set)) { 
    872       return super_coll_map.get(set); 
     841      Vector<String> supercoll_list = super_coll_map.get(set); 
     842      return (Vector<String>)supercoll_list.clone(); // see comment just above, don't want member data structure modified by caller's destructive operations 
    873843    } 
    874844