Changeset 7823


Ignore:
Timestamp:
2004-07-29T09:24:24+12:00 (20 years ago)
Author:
kjdon
Message:

check that the content retrieved from MG is not null before using it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java

    r5098 r7823  
    105105   
    106106    // The location of the MG index and text files
    107     String basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name)
    108                           + File.separatorChar;  // Needed by MG
     107    String basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + File.separatorChar;  // Needed by MG
    109108    String textdir = GSFile.collectionTextPath(this.cluster_name);
    110109    // index is only needed to start up MG, not used so just use the default index
     
    121120        }
    122121        long doc_num = this.gdbm_src.oid2Docnum(doc_id);
     122
    123123        String doc_content = this.mg_src.getDocument(basedir, textdir, doc_num);
    124         // remove any ctrl-c or ctrl-b (I hope these are the right codes)
    125         doc_content = doc_content.replaceAll("\u0002|\u0003", "");
    126         // replace _httpimg_ with the correct address
    127         doc_content = resolveImages(doc_content, doc_id);
    128         // Stick it in a text node
     124        // Create the  text node
    129125        Element doc = this.doc.createElement(GSXML.DOC_NODE_ELEM);
    130126        doc.setAttribute(GSXML.NODE_ID_ATT, doc_id);
    131         GSXML.addDocText(this.doc, doc, doc_content);
    132127        doc_list.appendChild(doc);
     128       
     129        if (doc_content!=null) {
     130        System.err.println("got the content");
     131        // remove any ctrl-c or ctrl-b (I hope these are the right codes)
     132        //System.err.println("doc content "+doc_content);
     133        doc_content = doc_content.replaceAll("\u0002|\u0003", "");
     134        // replace _httpimg_ with the correct address
     135        doc_content = resolveImages(doc_content, doc_id);
     136        GSXML.addDocText(this.doc, doc, doc_content);
     137        } else {
     138        System.err.println("the doc content was null, not getting that section\n");
     139        GSXML.addDocText(this.doc, doc, "couldn't retrieve content for this section\n");
     140        }
    133141    }
    134142
Note: See TracChangeset for help on using the changeset viewer.