diff --git a/dspace-api/src/main/java/org/dspace/versioning/VersioningServiceImpl.java b/dspace-api/src/main/java/org/dspace/versioning/VersioningServiceImpl.java index 3028bc4cfa58..a1d49b5a8ab2 100644 --- a/dspace-api/src/main/java/org/dspace/versioning/VersioningServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/versioning/VersioningServiceImpl.java @@ -12,8 +12,8 @@ import java.util.List; import java.util.Objects; import java.util.UUID; +import javax.ws.rs.NotAuthorizedException; -import de.undercouch.citeproc.helper.oauth.UnauthorizedException; import org.dspace.content.DCDate; import org.dspace.content.Item; import org.dspace.content.MetadataValue; @@ -70,7 +70,7 @@ public Version createNewVersion(Context c, Item item) { public Version createNewVersion(Context c, Item item, String summary) { try { if (!itemService.canCreateNewVersion(c, item)) { - throw new UnauthorizedException("Current User is not allowed to create a new version of this item"); + throw new NotAuthorizedException("Current User is not allowed to create a new version of this item"); } VersionHistory vh = versionHistoryService.findByItem(c, item); if (vh == null) { @@ -199,10 +199,10 @@ public Version getVersion(Context c, Item item) throws SQLException { @Override public Version createNewVersion(Context context, VersionHistory history, Item item, String summary, Date date, - int versionNumber) throws UnauthorizedException { + int versionNumber) { try { if (!itemService.canCreateNewVersion(context, item)) { - throw new UnauthorizedException("Current User is not allowed to create a new version of this item"); + throw new NotAuthorizedException("Current User is not allowed to create a new version of this item"); } Version version = versionDAO.create(context, new Version()); if (versionNumber > 0 && !isVersionExist(context, item, versionNumber)) { @@ -248,7 +248,7 @@ public List getVersionsByHistoryWithItems(Context c, VersionHistory vh, // **** PROTECTED METHODS!! protected Version createVersion(Context c, VersionHistory vh, Item item, String summary, Date date) - throws SQLException, UnauthorizedException { + throws SQLException { return createNewVersion(c, vh, item, summary, date, getNextVersionNumer(c, vh)); } diff --git a/dspace-api/src/main/java/org/dspace/versioning/service/VersioningService.java b/dspace-api/src/main/java/org/dspace/versioning/service/VersioningService.java index 56316068029f..3260dd5d8b45 100644 --- a/dspace-api/src/main/java/org/dspace/versioning/service/VersioningService.java +++ b/dspace-api/src/main/java/org/dspace/versioning/service/VersioningService.java @@ -12,7 +12,6 @@ import java.util.List; import java.util.UUID; -import de.undercouch.citeproc.helper.oauth.UnauthorizedException; import org.dspace.content.Item; import org.dspace.core.Context; import org.dspace.versioning.Version; @@ -80,7 +79,7 @@ List getVersionsByHistoryWithItems(Context c, VersionHistory vh, int of Version getVersion(Context c, Item item) throws SQLException; Version createNewVersion(Context context, VersionHistory history, Item item, String summary, Date date, - int versionNumber) throws UnauthorizedException; + int versionNumber); /** * Update the Version