Project

General

Profile

« Previous | Next » 

Revision 8903

Added by Jing Tao over 9 years ago

Added the code to inform users the pid was deleted in the NotFound exception.

View differences:

CNodeService.java
930 930
        systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid);        
931 931

  
932 932
        if (systemMetadata == null ) {
933
            throw new NotFound("1420", "Couldn't find an object identified by " + pid.getValue());
933
            String error ="";
934
            String localId = null;
935
            try {
936
                localId = IdentifierManager.getInstance().getLocalId(pid.getValue());
937
              
938
             } catch (Exception e) {
939
                logMetacat.warn("Couldn't find the local id for the pid "+pid.getValue());
940
            }
941
            
942
            if(localId != null && EventLog.getInstance().isDeleted(localId)) {
943
                error = DELETEDMESSAGE;
944
            }
945
            throw new NotFound("1420", "Couldn't find an object identified by " + pid.getValue()+". "+error);
934 946
        }
935 947
        checksum = systemMetadata.getChecksum();
936 948
        
......
1399 1411
          
1400 1412
      } else {
1401 1413
          logMetacat.debug("System metadata for identifier " + pid.getValue() +
1402
          " is null.");          
1403
          throw new NotFound("4874", "Couldn't find an object identified by " + pid.getValue());
1414
          " is null.");
1415
          String error ="";
1416
          String localId = null;
1417
          try {
1418
              localId = IdentifierManager.getInstance().getLocalId(pid.getValue());
1419
            
1420
           } catch (Exception e) {
1421
              logMetacat.warn("Couldn't find the local id for the pid "+pid.getValue());
1422
          }
1404 1423
          
1424
          if(localId != null && EventLog.getInstance().isDeleted(localId)) {
1425
              error = DELETEDMESSAGE;
1426
          }
1427
          throw new NotFound("4874", "Couldn't find an object identified by " + pid.getValue()+". "+error);
1428
          
1405 1429
      }
1406 1430

  
1407 1431
    } catch (RuntimeException e) {

Also available in: Unified diff