Project

General

Profile

« Previous | Next » 

Revision 6300

catch exceptions from system meta data query and throw service failure rather than swallowing them with an error msg

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
583 583

  
584 584
    ObjectList objectList = null;
585 585
    
586
    objectList = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
587
        objectFormat, replicaStatus, start, count);
586
    try {
587
	    objectList = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
588
	        objectFormat, replicaStatus, start, count);
589
    } catch (Exception e) {
590
		throw new ServiceFailure("1580", "Error querying system metadata: " + e.getMessage());
591
	}
588 592
    
589
    if ( objectList == null ) {
590
      throw new ServiceFailure("1580", "The object list was null.");
591
    }
592
    
593 593
    return objectList;
594 594
  }
595 595

  
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
422 422
	  throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest,
423 423
	  NotImplemented {
424 424

  
425
	    ObjectList objectList = 
426
	    	IdentifierManager.getInstance().querySystemMetadata(
427
	    			null, //startTime, 
428
	    			null, //endTime,
429
	    			null, //objectFormat, 
430
	    			true, //replicaStatus, 
431
	    			0, //start, 
432
	    			-1 //count
433
	    			);
434
	    
435
	    if ( objectList == null ) {
436
	      throw new ServiceFailure("4310", "The object list was null.");
437
	    }
438
	    
425
		ObjectList objectList = null;
426
		try {
427
		    objectList = 
428
		    	IdentifierManager.getInstance().querySystemMetadata(
429
		    			null, //startTime, 
430
		    			null, //endTime,
431
		    			null, //objectFormat, 
432
		    			false, //replicaStatus, 
433
		    			0, //start, 
434
		    			-1 //count
435
		    			);
436
		    
437
		} catch (Exception e) {
438
			throw new ServiceFailure("4310", "Error querying system metadata: " + e.getMessage());
439
		}
440

  
439 441
	    return objectList;
440 442
	    
441 443
		//throw new NotImplemented("4281", "search not implemented");
src/edu/ucsb/nceas/metacat/dataone/CrudService.java
532 532
      //int totalAfterQuery = 0;
533 533
      
534 534
      
535
      return IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
536
              objectFormat, replicaStatus, start, count);
535
    	ObjectList objectList = null;
536
        try {
537
    	    objectList = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime,
538
    	              objectFormat, replicaStatus, start, count);
539
        } catch (Exception e) {
540
    		throw new ServiceFailure("1580", "Error querying system metadata: " + e.getMessage());
541
    	}
542
        
543
        return objectList;
537 544
      
538 545
      
539 546
      /////////////////////////////////////////////////////////////////////////

Also available in: Unified diff