Changeset 10786


Ignore:
Timestamp:
2005-10-27T16:12:58+13:00 (19 years ago)
Author:
kjdon
Message:

fixed a bug where it was trying to get the last three chars of the id, doesn't work if the id is only two chars long

File:
1 edited

Legend:

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

    r10589 r10786  
    157157    // Create a new (empty) result message
    158158    Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
    159 
    160159    String lang = request.getAttribute(GSXML.LANG_ATT);
    161160    result.setAttribute(GSXML.FROM_ATT, DOCUMENT_METADATA_RETRIEVE_SERVICE);
     
    194193        param = (Element) param.getNextSibling();
    195194    }
    196    
     195
    197196    // check that there has been some metadata specified
    198197    if (!all_metadata && metadata_names_list.size()==0) {
     
    207206        return result;
    208207    }
    209    
     208
    210209    // copy the request doc node list to the response
    211210    Element response_node_list = (Element) this.doc.importNode(request_node_list, true);
     
    219218        return result;
    220219    }
    221    
     220
    222221    // Whew, now we have checked (almost) all the syntax of the request, now we can process it.
    223222   
     
    225224        Element request_node = (Element) request_nodes.item(i);
    226225        String node_id = request_node.getAttribute(GSXML.NODE_ID_ATT);
    227        
    228226        if (external_id) {
    229227        // can we have .pr etc extensions with external ids?
     
    231229        } else if (idNeedsTranslating(node_id)) {
    232230        node_id = translateId(node_id);
    233         }
    234        
     231        }       
    235232        if (node_id == null) {
    236233        continue;
    237234        }
     235       
    238236        try {
    239237        Element metadata_list = getMetadataList(node_id, all_metadata, metadata_names_list);
     
    245243            return result;
    246244        }
    247         }
    248     }
    249    
     245        } 
     246    }
     247       
    250248    return result;
    251249    }
     
    581579    */
    582580    protected boolean idNeedsTranslating(String id) {
     581    if (id.length()<5) return false;
    583582    String tail = id.substring(id.length()-3);
    584583    return (tail.equals(".fc") || tail.equals(".lc") ||
Note: See TracChangeset for help on using the changeset viewer.