Project

General

Profile

« Previous | Next » 

Revision 6021

Added by Duane Costa over 13 years ago

Bug 3835 - design and implement OAI-PMH compliant harvest subsystem
Return a 'badVerb' response when the 'verb' request parameter is missing from the request. Previously this generated a NullPointerException.

View differences:

src/edu/ucsb/nceas/metacat/oaipmh/provider/server/OAIHandler.java
418 418
      throws Throwable {
419 419
    String verb = request.getParameter("verb");
420 420
    log.debug("verb: " + verb);
421
    String result;
421
    String result = null;
422 422

  
423
    if (verb.equals("GetRecord")) {
424
      result = GetRecord.construct(attributes, request, response,
423
    if (verb != null) {
424
      if (verb.equals("GetRecord")) {
425
        result = GetRecord.construct(attributes, request, response,
425 426
          serverTransformer);
426
    } 
427
    else if (verb.equals("Identify")) {
428
      result = Identify.construct(attributes, request, response,
427
      } 
428
      else if (verb.equals("Identify")) {
429
        result = Identify.construct(attributes, request, response,
429 430
          serverTransformer);
430
    } 
431
    else if (verb.equals("ListIdentifiers")) {
432
      result = ListIdentifiers.construct(attributes, request, response,
431
      } 
432
      else if (verb.equals("ListIdentifiers")) {
433
        result = ListIdentifiers.construct(attributes, request, response,
433 434
          serverTransformer);
434
    } 
435
    else if (verb.equals("ListMetadataFormats")) {
436
      result = ListMetadataFormats.construct(attributes, request, response,
435
      } 
436
      else if (verb.equals("ListMetadataFormats")) {
437
        result = ListMetadataFormats.construct(attributes, request, response,
437 438
          serverTransformer);
438
    } 
439
    else if (verb.equals("ListRecords")) {
440
      result = ListRecords.construct(attributes, request, response,
439
      } 
440
      else if (verb.equals("ListRecords")) {
441
        result = ListRecords.construct(attributes, request, response,
441 442
          serverTransformer);
442
    } 
443
    else if (verb.equals("ListSets")) {
444
      result = ListSets.construct(attributes, request, response,
443
      } 
444
      else if (verb.equals("ListSets")) {
445
        result = ListSets.construct(attributes, request, response,
445 446
          serverTransformer);
446
    } 
447
      } 
448
      else {
449
        result = BadVerb.construct(attributes, request, response,
450
          serverTransformer);
451
      }
452
    }
447 453
    else {
454
      // Return a 'badVerb' response when the verb is missing from the request
448 455
      result = BadVerb.construct(attributes, request, response,
449 456
          serverTransformer);
450 457
    }

Also available in: Unified diff