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:
@@ -694,10 +694,15 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
|
||||
@Override
|
||||
public Community 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