Changeset 22974

Show
Ignore:
Timestamp:
28.09.2010 10:21:36 (9 years ago)
Author:
davidb
Message:

Code used to test 'coll_db == null' to determine if a database was opened correctly. Since this value is returned by a constructor, it is always non-null, even when it failed to open the database. The routine databaseOK() was added to core class, and is now used in these routines instead of testing for null

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service
Files:
5 modified

Legend:

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

    r22319 r22974  
    102102    } 
    103103    coll_db = new SimpleCollectionDatabase(database_type); 
    104     if (coll_db == null) { 
     104    if (!coll_db.databaseOK()) { 
    105105      logger.error("Couldn't create the collection database of type "+database_type); 
    106106      return false; 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2Search.java

    r20236 r22974  
    110110    } 
    111111    coll_db = new SimpleCollectionDatabase(database_type); 
    112     if (coll_db == null) { 
     112    if (!coll_db.databaseOK()) { 
    113113      logger.error("Couldn't create the collection database of type "+database_type); 
    114114      return false; 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CoverageMetadataRetrieve.java

    r22457 r22974  
    9292    } 
    9393    coll_db = new SimpleCollectionDatabase(database_type); 
    94     if (coll_db == null) { 
     94    if (!coll_db.databaseOK()) { 
    9595      logger.error("Couldn't create the collection database of type "+database_type); 
    9696      return false; 
     
    190190    protected Element processCoverageMetadataRetrieve(Element request) { 
    191191 
     192     
     193    if (!this.coll_db.databaseOK()) { 
     194    logger.error("No valid database found\n"); 
     195    return null; 
     196    } 
     197 
    192198    DBInfo collection_info = this.coll_db.getInfo("collection"); 
    193199     
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Browse.java

    r22319 r22974  
    8686      database_type = database_type_elem.getAttribute(GSXML.NAME_ATT); 
    8787    } 
     88 
    8889    if (database_type == null || database_type.equals("")) { 
    8990      database_type = "gdbm"; // the default 
    9091    } 
    9192    coll_db = new SimpleCollectionDatabase(database_type); 
    92     if (coll_db == null) { 
     93    if (!coll_db.databaseOK()) { 
    9394      logger.error("Couldn't create the collection database of type "+database_type); 
    9495      return false; 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/OAIPMH.java

    r21795 r22974  
    115115 
    116116    coll_db = new SimpleCollectionDatabase(infodb_type); 
    117     if (coll_db == null) { 
     117    if (!coll_db.databaseOK()) { 
    118118      logger.error("Couldn't create the collection database of type "+infodb_type); 
    119119      return false;