Project

General

Profile

« Previous | Next » 

Revision 6022

Added by Duane Costa over 13 years ago

Bug 3835 - design and implement OAI-PMH compliant harvest subsystem
Minor bug fix to handle irregular Metacat docids containing two or more dot ('.') characters. In the LTER Metacat, the following docids (scope and identifier, excluding the revision value) have that characteristic:

jeremy.nigon.4
owen.jones.3
owen.jones.4

claude.garcia.3
ARCNZ31.1.4
ARCNZ31.1.7
nikkis.nikkis.27

View differences:

src/edu/ucsb/nceas/metacat/oaipmh/provider/server/catalog/MetacatRecordFactory.java
113 113
    if (localIdentifier != null) {
114 114
      String[] localIdentifierArray = splitLocalIdentifier(localIdentifier);
115 115
      
116
      if (localIdentifierArray.length >= 2) {
116
      if (localIdentifierArray.length == 2) {
117 117
        sb.append(LSID_PREFIX);
118 118
        String scope = localIdentifierArray[0];
119 119
        sb.append(scope);
......
265 265
  
266 266
  
267 267
  private String[] splitLocalIdentifier(String s) {
268
    StringTokenizer tokenizer = new StringTokenizer(s, ".");
269
    String[] tokens = new String[tokenizer.countTokens()];
270
    for (int i=0; i<tokens.length; ++i) {
271
        tokens[i] = tokenizer.nextToken();
272
    }
273
    return tokens;
268
    String[] tokenPair = new String[2];
269
    
270
    int lastDotIndex = s.lastIndexOf('.');
271
    String scope = s.substring(0, lastDotIndex);
272
    String identifier = s.substring(lastDotIndex + 1);
273
    tokenPair[0] = scope;
274
    tokenPair[1] = identifier;
275
    
276
    return tokenPair;
274 277
  }
275 278
  
279

  
276 280
  private String[] splitOAIIdentifier(String s) {
277 281
    StringTokenizer tokenizer = new StringTokenizer(s, ":");
278 282
    String[] tokens = new String[tokenizer.countTokens()];

Also available in: Unified diff