mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
catch exceptions stemming from invalid id's
This commit is contained in:
@@ -1618,10 +1618,15 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
|
||||
@Override
|
||||
public Item findByIdOrLegacyId(Context context, String id) throws SQLException {
|
||||
if (StringUtils.isNumeric(id)) {
|
||||
return findByLegacyId(context, Integer.parseInt(id));
|
||||
} else {
|
||||
return find(context, UUID.fromString(id));
|
||||
try {
|
||||
if (StringUtils.isNumeric(id)) {
|
||||
return findByLegacyId(context, Integer.parseInt(id));
|
||||
} else {
|
||||
return find(context, UUID.fromString(id));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Not a valid legacy ID or valid UUID
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user