Changeset 31236

Show
Ignore:
Timestamp:
14.12.2016 19:42:53 (3 years ago)
Author:
ak19
Message:

More checking of oaiinf_db: need to make sure it exists before trying to open the database.

Files:
1 modified

Legend:

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

    r31230 r31236  
    131131    if (!oaiinf_db.databaseOK()) { 
    132132      logger.error("Couldn't create the oai-inf database of type "+infodb_type); 
    133       oaiinf_db = null; 
    134133      return false; 
    135134    } 
     
    144143    // the oaiinf_db is called oai-inf.<infodb_type_extension> 
    145144    String oaiinf_db_file = GSFile.OAIInfoDatabaseFile(this.site_home, this.cluster_name, "oai-inf", infodb_type); 
    146     if (oaiinf_db != null && !this.oaiinf_db.openDatabase(oaiinf_db_file, SimpleCollectionDatabase.READ)) { 
    147       logger.warn("Could not open oai-inf database for collection + " + this.cluster_name + "!"); 
     145    File oaiinfFile = new File(oaiinf_db_file); 
     146     
     147    if(!oaiinfFile.exists()) { 
     148    logger.warn("oai-inf database for collection + " + this.cluster_name + " does not exist."); 
     149    oaiinf_db = null; 
     150    } else if (!this.oaiinf_db.openDatabase(oaiinf_db_file, SimpleCollectionDatabase.READ)) { 
     151    logger.warn("Could not open oai-inf database for collection + " + this.cluster_name + "!"); 
     152    oaiinf_db = null; 
    148153    } 
    149154