Revision 9314
Added by Jing Tao over 9 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
1265 | 1265 |
*/ |
1266 | 1266 |
@Override |
1267 | 1267 |
public InputStream getReplica(Session session, Identifier pid) |
1268 |
throws NotAuthorized, NotImplemented, ServiceFailure, InvalidToken { |
|
1268 |
throws NotAuthorized, NotImplemented, ServiceFailure, InvalidToken, NotFound {
|
|
1269 | 1269 |
|
1270 | 1270 |
logMetacat.info("MNodeService.getReplica() called."); |
1271 | 1271 |
|
... | ... | |
1287 | 1287 |
try { |
1288 | 1288 |
localId = IdentifierManager.getInstance().getLocalId(pid.getValue()); |
1289 | 1289 |
} catch (McdbDocNotFoundException e) { |
1290 |
throw new ServiceFailure("2181", "The object specified by " +
|
|
1290 |
throw new NotFound("2185", "The object specified by " +
|
|
1291 | 1291 |
pid.getValue() + " does not exist at this node."); |
1292 | 1292 |
|
1293 | 1293 |
} catch (SQLException e) { |
... | ... | |
1305 | 1305 |
+ e1.getMessage()); |
1306 | 1306 |
|
1307 | 1307 |
} catch (NotFound e1) { |
1308 |
throw new ServiceFailure("2181", "Could not determine if node is authorized: "
|
|
1308 |
throw new NotFound("2185", "Could not find the object "+pid.getValue()+" in this node - "
|
|
1309 | 1309 |
+ e1.getMessage()); |
1310 | 1310 |
|
1311 | 1311 |
} catch (InvalidRequest e1) { |
... | ... | |
1322 | 1322 |
try { |
1323 | 1323 |
inputStream = MetacatHandler.read(localId); |
1324 | 1324 |
} catch (Exception e) { |
1325 |
throw new ServiceFailure("1020", "The object specified by " +
|
|
1325 |
throw new ServiceFailure("2181", "The object specified by " +
|
|
1326 | 1326 |
pid.getValue() + "could not be returned due to error: " + e.getMessage()); |
1327 | 1327 |
} |
1328 |
} else { |
|
1329 |
throw new NotAuthorized("2182", "The pid "+pid.getValue()+" is not authorized to be read by the client."); |
|
1328 | 1330 |
} |
1329 | 1331 |
|
1330 | 1332 |
// if we fail to set the input stream |
1331 | 1333 |
if (inputStream == null) { |
1332 | 1334 |
throw new ServiceFailure("2181", "The object specified by " + |
1333 |
pid.getValue() + "does not exist at this node.");
|
|
1335 |
pid.getValue() + " can't be returned from the node.");
|
|
1334 | 1336 |
} |
1335 | 1337 |
|
1336 | 1338 |
// log the replica event |
Also available in: Unified diff
Fixed some incorrect exceptions in the getReplica method.