mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 20:43:18 +00:00
Added finally statements.
Added finally statements with context.abort() to cover all exception.
This commit is contained in:
@@ -108,6 +108,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Someting went wrong while reading bitstream(id=" + bitstreamId + ") from database! Message: " + e,context);
|
processException("Someting went wrong while reading bitstream(id=" + bitstreamId + ") from database! Message: " + e,context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Someting went wrong while reading bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Someting went wrong while reading bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bitstream;
|
return bitstream;
|
||||||
@@ -154,6 +156,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Someting went wrong while reading policies of bitstream(id=" + bitstreamId + "), SQLException! Message: " + e, context);
|
processException("Someting went wrong while reading policies of bitstream(id=" + bitstreamId + "), SQLException! Message: " + e, context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Someting went wrong while reading policies of bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Someting went wrong while reading policies of bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return policies.toArray(new ResourcePolicy[0]);
|
return policies.toArray(new ResourcePolicy[0]);
|
||||||
@@ -219,6 +223,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Something get wrong while reading bitstreams from database!. Message: " + e, context);
|
processException("Something get wrong while reading bitstreams from database!. Message: " + e, context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Something get wrong while reading bitstreams, ContextException. Message: " + e.getMessage(), context);
|
processException("Something get wrong while reading bitstreams, ContextException. Message: " + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bitstreams.toArray(new Bitstream[0]);
|
return bitstreams.toArray(new Bitstream[0]);
|
||||||
@@ -279,6 +285,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Could not retrieve file of bitstream(id=" + bitstreamId + "), AuthorizeException! Message: " + e, context);
|
processException("Could not retrieve file of bitstream(id=" + bitstreamId + "), AuthorizeException! Message: " + e, context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Could not retrieve file of bitstream(id=" + bitstreamId + "), ContextException! Message: " + e.getMessage(), context);
|
processException("Could not retrieve file of bitstream(id=" + bitstreamId + "), ContextException! Message: " + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -341,6 +349,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Someting went wrong while adding policy to bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Someting went wrong while adding policy to bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
} catch (AuthorizeException e) {
|
} catch (AuthorizeException e) {
|
||||||
processException("Someting went wrong while adding policy to bitstream(id=" + bitstreamId + "), AuthorizeException! Message: " + e, context);
|
processException("Someting went wrong while adding policy to bitstream(id=" + bitstreamId + "), AuthorizeException! Message: " + e, context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
}
|
}
|
||||||
@@ -444,6 +454,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Could not update bitstream(id=" + bitstreamId + ") metadata, AuthorizeException. Message: " + e, context);
|
processException("Could not update bitstream(id=" + bitstreamId + ") metadata, AuthorizeException. Message: " + e, context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Could not update bitstream(id=" + bitstreamId + ") metadata, ContextException. Message: " + e.getMessage(), context);
|
processException("Could not update bitstream(id=" + bitstreamId + ") metadata, ContextException. Message: " + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Bitstream metadata(id=" + bitstreamId + ") were successfully updated.");
|
log.info("Bitstream metadata(id=" + bitstreamId + ") were successfully updated.");
|
||||||
@@ -517,6 +529,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Could not update bitstream(id=" + bitstreamId + ") data, IOException. Message: " + e, context);
|
processException("Could not update bitstream(id=" + bitstreamId + ") data, IOException. Message: " + e, context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Could not update bitstream(id=" + bitstreamId + ") data, ContextException. Message: " + e.getMessage(), context);
|
processException("Could not update bitstream(id=" + bitstreamId + ") data, ContextException. Message: " + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Bitstream(id=" + bitstreamId + ") data was successfully updated.");
|
log.info("Bitstream(id=" + bitstreamId + ") data was successfully updated.");
|
||||||
@@ -577,6 +591,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Could not delete bitstream(id=" + bitstreamId + "), IOException. Message: " + e, context);
|
processException("Could not delete bitstream(id=" + bitstreamId + "), IOException. Message: " + e, context);
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Could not delete bitstream(id=" + bitstreamId + "), ContextException. Message:" + e.getMessage(), context);
|
processException("Could not delete bitstream(id=" + bitstreamId + "), ContextException. Message:" + e.getMessage(), context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Bitstream(id=" + bitstreamId + ") was successfully deleted.");
|
log.info("Bitstream(id=" + bitstreamId + ") was successfully deleted.");
|
||||||
@@ -632,6 +648,8 @@ public class BitstreamResource extends Resource{
|
|||||||
processException("Someting went wrong while deleting READ policy(id=" + policyId + ") to bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Someting went wrong while deleting READ policy(id=" + policyId + ") to bitstream(id=" + bitstreamId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
} catch (AuthorizeException e) {
|
} catch (AuthorizeException e) {
|
||||||
processException("Someting went wrong while deleting READ policy(id=" + policyId + ") to bitstream(id=" + bitstreamId + "), AuthorizeException! Message: " + e, context);
|
processException("Someting went wrong while deleting READ policy(id=" + policyId + ") to bitstream(id=" + bitstreamId + "), AuthorizeException! Message: " + e, context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
}
|
}
|
||||||
@@ -684,6 +702,8 @@ public class BitstreamResource extends Resource{
|
|||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
processException("Something get wrong while finding bitstream. SQLException, Message:" + e, context);
|
processException("Something get wrong while finding bitstream. SQLException, Message:" + e, context);
|
||||||
|
} finally {
|
||||||
|
context.abort();
|
||||||
}
|
}
|
||||||
return bitstream;
|
return bitstream;
|
||||||
}
|
}
|
||||||
|
@@ -115,6 +115,10 @@ public class CollectionsResource extends Resource
|
|||||||
processException("Could not read collection(id=" + collectionId + "), ContextException. Message: " + e.getMessage(),
|
processException("Could not read collection(id=" + collectionId + "), ContextException. Message: " + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.trace("Collection(id=" + collectionId + ") has been successfully read.");
|
log.trace("Collection(id=" + collectionId + ") has been successfully read.");
|
||||||
return collection;
|
return collection;
|
||||||
@@ -200,6 +204,10 @@ public class CollectionsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Something went wrong while reading collections, ContextError. Message: " + e.getMessage(), context);
|
processException("Something went wrong while reading collections, ContextError. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.trace("All collections were successfully read.");
|
log.trace("All collections were successfully read.");
|
||||||
return collections.toArray(new org.dspace.rest.common.Collection[0]);
|
return collections.toArray(new org.dspace.rest.common.Collection[0]);
|
||||||
@@ -284,6 +292,10 @@ public class CollectionsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not read collection items, ContextException. Message: " + e.getMessage(), context);
|
processException("Could not read collection items, ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.trace("All items in collection(id=" + collectionId + ") were successfully read.");
|
log.trace("All items in collection(id=" + collectionId + ") were successfully read.");
|
||||||
return null;
|
return null;
|
||||||
@@ -386,6 +398,10 @@ public class CollectionsResource extends Resource
|
|||||||
"Could not add item into collection(id=" + collectionId + "), ContextException. Message: " + e.getMessage(),
|
"Could not add item into collection(id=" + collectionId + "), ContextException. Message: " + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Item successfully created in collection(id=" + collectionId + "). Item handle=" + returnItem.getHandle());
|
log.info("Item successfully created in collection(id=" + collectionId + "). Item handle=" + returnItem.getHandle());
|
||||||
return returnItem;
|
return returnItem;
|
||||||
@@ -457,6 +473,10 @@ public class CollectionsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not update collection(id=" + collectionId + "), AuthorizeException. Message: " + e, context);
|
processException("Could not update collection(id=" + collectionId + "), AuthorizeException. Message: " + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Collection(id=" + collectionId + ") successfully updated.");
|
log.info("Collection(id=" + collectionId + ") successfully updated.");
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
@@ -523,6 +543,10 @@ public class CollectionsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not delete collection(id=" + collectionId + "), IOException. Message: " + e, context);
|
processException("Could not delete collection(id=" + collectionId + "), IOException. Message: " + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Collection(id=" + collectionId + ") was successfully deleted.");
|
log.info("Collection(id=" + collectionId + ") was successfully deleted.");
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
@@ -625,6 +649,10 @@ public class CollectionsResource extends Resource
|
|||||||
processException("Could not delete item(id=" + itemId + ") in collection(id=" + collectionId
|
processException("Could not delete item(id=" + itemId + ") in collection(id=" + collectionId
|
||||||
+ "), IOException. Message: " + e, context);
|
+ "), IOException. Message: " + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Item(id=" + itemId + ") in collection(id=" + collectionId + ") was successfully deleted.");
|
log.info("Item(id=" + itemId + ") in collection(id=" + collectionId + ") was successfully deleted.");
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
@@ -671,6 +699,10 @@ public class CollectionsResource extends Resource
|
|||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Something went wrong while searching for collection(name=" + name + "), ContextError. Message: " + e.getMessage(), context);
|
processException("Something went wrong while searching for collection(name=" + name + "), ContextError. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
log.info("Collection was not found.");
|
log.info("Collection was not found.");
|
||||||
@@ -730,6 +762,10 @@ public class CollectionsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Something get wrong while finding collection(id=" + id + "). SQLException, Message: " + e, context);
|
processException("Something get wrong while finding collection(id=" + id + "). SQLException, Message: " + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -106,6 +106,10 @@ public class CommunitiesResource extends Resource
|
|||||||
processException("Could not read community(id=" + communityId + "), ContextException. Message:" + e.getMessage(),
|
processException("Could not read community(id=" + communityId + "), ContextException. Message:" + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.trace("Community(id=" + communityId + ") was successfully read.");
|
log.trace("Community(id=" + communityId + ") was successfully read.");
|
||||||
return community;
|
return community;
|
||||||
@@ -184,6 +188,10 @@ public class CommunitiesResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not read communities, ContextException. Message:" + e.getMessage(), context);
|
processException("Could not read communities, ContextException. Message:" + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -264,6 +272,10 @@ public class CommunitiesResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not read top communities, ContextException. Message:" + e.getMessage(), context);
|
processException("Could not read top communities, ContextException. Message:" + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -348,6 +360,10 @@ public class CommunitiesResource extends Resource
|
|||||||
"Could not read community(id=" + communityId + ") collections, ContextException. Message:" + e.getMessage(),
|
"Could not read community(id=" + communityId + ") collections, ContextException. Message:" + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -433,6 +449,10 @@ public class CommunitiesResource extends Resource
|
|||||||
"Could not read community(id=" + communityId + ") subcommunities, ContextException. Message:"
|
"Could not read community(id=" + communityId + ") subcommunities, ContextException. Message:"
|
||||||
+ e.getMessage(), context);
|
+ e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -506,6 +526,10 @@ public class CommunitiesResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not create new top community, AuthorizeException. Message: " + e.getMessage(), context);
|
processException("Could not create new top community, AuthorizeException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Community at top level has been successfully created. Handle:" + retCommunity.getHandle());
|
log.info("Community at top level has been successfully created. Handle:" + retCommunity.getHandle());
|
||||||
return retCommunity;
|
return retCommunity;
|
||||||
@@ -583,6 +607,10 @@ public class CommunitiesResource extends Resource
|
|||||||
"Could not add collection into community(id=" + communityId + "), ContextException. Message:"
|
"Could not add collection into community(id=" + communityId + "), ContextException. Message:"
|
||||||
+ e.getMessage(), context);
|
+ e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Collection was successfully added into community(id=" + communityId + "). Collection handle=" + retCollection.getHandle());
|
log.info("Collection was successfully added into community(id=" + communityId + "). Collection handle=" + retCollection.getHandle());
|
||||||
return retCollection;
|
return retCollection;
|
||||||
@@ -658,6 +686,10 @@ public class CommunitiesResource extends Resource
|
|||||||
processException("Could not add subcommunity into community(id=" + communityId + "), ContextException. Message:" + e,
|
processException("Could not add subcommunity into community(id=" + communityId + "), ContextException. Message:" + e,
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Subcommunity was successfully added in community(id=" + communityId + ").");
|
log.info("Subcommunity was successfully added in community(id=" + communityId + ").");
|
||||||
return retCommunity;
|
return retCommunity;
|
||||||
@@ -726,6 +758,10 @@ public class CommunitiesResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not update community(id=" + communityId + "), AuthorizeException. Message:" + e, context);
|
processException("Could not update community(id=" + communityId + "), AuthorizeException. Message:" + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Community(id=" + communityId + ") has been successfully updated.");
|
log.info("Community(id=" + communityId + ") has been successfully updated.");
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
@@ -787,6 +823,10 @@ public class CommunitiesResource extends Resource
|
|||||||
processException("Could not delete community(id=" + communityId + "), ContextException. Message:" + e.getMessage(),
|
processException("Could not delete community(id=" + communityId + "), ContextException. Message:" + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Community(id=" + communityId + ") was successfully deleted.");
|
log.info("Community(id=" + communityId + ") was successfully deleted.");
|
||||||
return Response.status(Response.Status.OK).build();
|
return Response.status(Response.Status.OK).build();
|
||||||
@@ -888,6 +928,10 @@ public class CommunitiesResource extends Resource
|
|||||||
processException("Could not delete collection(id=" + collectionId + ") in community(id=" + communityId
|
processException("Could not delete collection(id=" + collectionId + ") in community(id=" + communityId
|
||||||
+ "), ContextExcpetion. Message:" + e.getMessage(), context);
|
+ "), ContextExcpetion. Message:" + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Collection(id=" + collectionId + ") in community(id=" + communityId + ") was successfully deleted.");
|
log.info("Collection(id=" + collectionId + ") in community(id=" + communityId + ") was successfully deleted.");
|
||||||
return Response.status(Response.Status.OK).build();
|
return Response.status(Response.Status.OK).build();
|
||||||
@@ -989,6 +1033,10 @@ public class CommunitiesResource extends Resource
|
|||||||
processException("Could not delete subcommunity(id=" + subcommunityId + ") in community(id=" + parentCommunityId
|
processException("Could not delete subcommunity(id=" + subcommunityId + ") in community(id=" + parentCommunityId
|
||||||
+ "), ContextExcpetion. Message:" + e.getMessage(), context);
|
+ "), ContextExcpetion. Message:" + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Subcommunity(id=" + subcommunityId + ") from community(id=" + parentCommunityId + ") was successfully deleted.");
|
log.info("Subcommunity(id=" + subcommunityId + ") from community(id=" + parentCommunityId + ") was successfully deleted.");
|
||||||
return Response.status(Response.Status.OK).build();
|
return Response.status(Response.Status.OK).build();
|
||||||
@@ -1044,6 +1092,10 @@ public class CommunitiesResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Something get wrong while finding community(id=" + id + "). SQLException, Message:" + e, context);
|
processException("Something get wrong while finding community(id=" + id + "). SQLException, Message:" + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
return community;
|
return community;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -119,6 +119,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not read item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Could not read item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@@ -196,6 +200,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Something went wrong while reading items, ContextException. Message: " + e.getMessage(), context);
|
processException("Something went wrong while reading items, ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -251,6 +259,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not read item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Could not read item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,6 +332,10 @@ public class ItemsResource extends Resource
|
|||||||
processException("Could not read item(id=" + itemId + ") bitstreams, ContextException. Message: " + e.getMessage(),
|
processException("Could not read item(id=" + itemId + ") bitstreams, ContextException. Message: " + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -393,6 +409,10 @@ public class ItemsResource extends Resource
|
|||||||
processException("Could not write metadata to item(id=" + itemId + "), ContextException. Message: " + e.getMessage(),
|
processException("Could not write metadata to item(id=" + itemId + "), ContextException. Message: " + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Metadata to item(id=" + itemId + ") were successfully added.");
|
log.info("Metadata to item(id=" + itemId + ") were successfully added.");
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
@@ -536,6 +556,10 @@ public class ItemsResource extends Resource
|
|||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
processException("Could not create bitstream in item(id=" + itemId + "), ContextException Message: " + e.getMessage(), context);
|
processException("Could not create bitstream in item(id=" + itemId + "), ContextException Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Bitstream(id=" + bitstream.getId() + ") was successfully added into item(id=" + itemId + ").");
|
log.info("Bitstream(id=" + bitstream.getId() + ") was successfully added into item(id=" + itemId + ").");
|
||||||
return bitstream;
|
return bitstream;
|
||||||
@@ -618,6 +642,10 @@ public class ItemsResource extends Resource
|
|||||||
processException(
|
processException(
|
||||||
"Could not update metadata in item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
"Could not update metadata in item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Metadata of item(id=" + itemId + ") were successfully updated.");
|
log.info("Metadata of item(id=" + itemId + ") were successfully updated.");
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
@@ -683,6 +711,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not delete item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
processException("Could not delete item(id=" + itemId + "), ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Item(id=" + itemId + ") was successfully deleted.");
|
log.info("Item(id=" + itemId + ") was successfully deleted.");
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
@@ -758,6 +790,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Could not delete item(id=" + itemId + "), ContextException. Message:" + e.getMessage(), context);
|
processException("Could not delete item(id=" + itemId + "), ContextException. Message:" + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Item(id=" + itemId + ") metadata were successfully deleted.");
|
log.info("Item(id=" + itemId + ") metadata were successfully deleted.");
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
@@ -850,6 +886,10 @@ public class ItemsResource extends Resource
|
|||||||
processException("Could not delete bitstream(id=" + bitstreamId + "), ContextException. Message:" + e.getMessage(),
|
processException("Could not delete bitstream(id=" + bitstreamId + "), ContextException. Message:" + e.getMessage(),
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Bitstream(id=" + bitstreamId + ") from item(id=" + itemId + ") was successfuly deleted .");
|
log.info("Bitstream(id=" + bitstreamId + ") from item(id=" + itemId + ") was successfuly deleted .");
|
||||||
return Response.status(Status.OK).build();
|
return Response.status(Status.OK).build();
|
||||||
@@ -959,6 +999,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Context error:" + e.getMessage(), context);
|
processException("Context error:" + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
if (items.size() == 0)
|
if (items.size() == 0)
|
||||||
{
|
{
|
||||||
@@ -1021,6 +1065,10 @@ public class ItemsResource extends Resource
|
|||||||
{
|
{
|
||||||
processException("Something get wrong while finding item(id=" + id + "). SQLException, Message: " + e, context);
|
processException("Something get wrong while finding item(id=" + id + "). SQLException, Message: " + e, context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,10 @@ public class Resource
|
|||||||
context.abort();
|
context.abort();
|
||||||
throw new ContextException("Could not create context, SQLException. Message: " + e, e);
|
throw new ContextException("Could not create context, SQLException. Message: " + e, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,6 +146,10 @@ public class Resource
|
|||||||
{
|
{
|
||||||
processException("Could not write usageEvent, ContextException. Message: " + e.getMessage(), context);
|
processException("Could not write usageEvent, ContextException. Message: " + e.getMessage(), context);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -93,6 +93,10 @@ public class TokenHolder
|
|||||||
log.error("Could not find user, AuthorizeException. Message:" + e);
|
log.error("Could not find user, AuthorizeException. Message:" + e);
|
||||||
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
|
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.abort();
|
||||||
|
}
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user