mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
Merge pull request #307 from tuub/DS-1677
DS-1677 While registering a specified identifier IdentifierServiceImpl doesn't check if an IdentifierProvider supports it
This commit is contained in:
@@ -88,9 +88,19 @@ public class IdentifierServiceImpl implements IdentifierService {
|
|||||||
|
|
||||||
//We need to commit our context because one of the providers might require the handle created above
|
//We need to commit our context because one of the providers might require the handle created above
|
||||||
// Next resolve all other services
|
// Next resolve all other services
|
||||||
|
boolean registered = false;
|
||||||
for (IdentifierProvider service : providers)
|
for (IdentifierProvider service : providers)
|
||||||
{
|
{
|
||||||
service.register(context, object, identifier);
|
if (service.supports(identifier))
|
||||||
|
{
|
||||||
|
service.register(context, object, identifier);
|
||||||
|
registered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!registered)
|
||||||
|
{
|
||||||
|
throw new IdentifierException("Cannot register identifier: Didn't "
|
||||||
|
+ "find a provider that supports this identifier.");
|
||||||
}
|
}
|
||||||
//Update our item
|
//Update our item
|
||||||
object.update();
|
object.update();
|
||||||
|
Reference in New Issue
Block a user