Changeset 26274

Show
Ignore:
Timestamp:
01.10.2012 19:06:42 (7 years ago)
Author:
ak19
Message:

Bugfix: sometimes GS3 asks for docnodes with ids like hash.dir, which aren't fedoraPIDs. They shouldn't be passed onto fedora.

Files:
1 modified

Legend:

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

    r26273 r26274  
    593593    } 
    594594 
     595    // get the requested nodeIDs out of a request message 
    595596    protected String[] parse(Element request, String nodeType, String attribute) {   
    596597    String[] nodevalues = null; 
     598    int count = 0; 
    597599 
    598600    Element docList = (Element) GSXML.getChildByTagName(request, nodeType+GSXML.LIST_MODIFIER); 
     
    603605        for(int i = 0; i < nodevalues.length; i++) { 
    604606            Element e = (Element)docNodes.item(i); 
    605             nodevalues[i] = e.getAttribute(attribute); 
    606         } 
    607         } 
    608     } 
     607            String id = e.getAttribute(attribute); 
     608            // Not sure why there are at times requests for hashXXX.dir, which is not a fedora PID 
     609            // To skip these: if not requesting an externalURL and if requesting a docNode,  
     610            // then the ID has to contain the : character special to fedora PIDs 
     611            if(attribute == "externalURL" || (nodeType != GSXML.DOC_NODE_ELEM || id.contains(":"))) { 
     612            nodevalues[count++] = id; 
     613            } 
     614        } 
     615        } 
     616    } 
     617 
     618    if(count == 0) { 
     619        return null; 
     620    } 
     621 
     622    String[] tmp = new String[count]; 
     623    for(int i = 0; i < count; i++) { 
     624        tmp[i] = nodevalues[i]; 
     625    } 
     626    nodevalues = null; 
     627    nodevalues = tmp; 
     628 
    609629    return nodevalues; 
    610630    }