mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 05:23:14 +00:00
catch exceptions stemming from invalid id's
This commit is contained in:
@@ -146,10 +146,15 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
|
||||
|
||||
@Override
|
||||
public EPerson 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