Changeset 8830


Ignore:
Timestamp:
2004-12-16T15:34:06+13:00 (19 years ago)
Author:
kjdon
Message:

added some checks for null results from the database

File:
1 edited

Legend:

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

    r8674 r8830  
    116116    for (int i = 0; i < doc_ids.length; i++) {
    117117        String doc_id = doc_ids[i];
     118        Element doc = this.doc.createElement(GSXML.DOC_NODE_ELEM);
     119        doc.setAttribute(GSXML.NODE_ID_ATT, doc_id);
     120        doc_list.appendChild(doc);
     121       
    118122        if (extlink) {
    119123        doc_id = this.gdbm_src.extlink2OID(doc_id);
     124        if (doc_id==null) {
     125            continue;
     126        }
     127        doc.setAttribute(GSXML.NODE_ID_ATT, doc_id);
    120128        }
    121129        else if (OID.needsTranslating(doc_id)) {
    122130        doc_id = this.gdbm_src.translateOID(doc_id);
     131        if (doc_id==null) {
     132            continue;
     133        }
     134        doc.setAttribute(GSXML.NODE_ID_ATT, doc_id);
    123135        }
    124 
     136       
    125137        long doc_num = this.gdbm_src.OID2Docnum(doc_id);
     138        if (doc_num == -1) {
     139        continue;
     140        }
    126141        String doc_content = this.mgpp_src.getDocument(textdir, this.default_level, doc_num);
    127142        doc_content = resolveTextMacros(doc_content, doc_id, lang);
    128 
     143       
    129144        // For now, stick it in a text node - eventually should be parsed as xml??
    130 
    131         Element doc = this.doc.createElement(GSXML.DOC_NODE_ELEM);
    132         doc.setAttribute(GSXML.NODE_ID_ATT, doc_id);
    133145        GSXML.addDocText(this.doc, doc, doc_content);
    134         doc_list.appendChild(doc);
     146       
    135147
    136148    }
Note: See TracChangeset for help on using the changeset viewer.