mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 04:23:13 +00:00
Wrap SQLExceptions in ItemCounter with ItemCountExceptions and wrap ItemCountExceptions in Collection and Community in RuntimeExceptions.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2339 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -178,6 +178,7 @@ public class ItemCounter
|
|||||||
* @param dso
|
* @param dso
|
||||||
* @return
|
* @return
|
||||||
* @throws ItemCountException
|
* @throws ItemCountException
|
||||||
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public int getCount(DSpaceObject dso)
|
public int getCount(DSpaceObject dso)
|
||||||
throws ItemCountException
|
throws ItemCountException
|
||||||
@@ -192,12 +193,22 @@ public class ItemCounter
|
|||||||
// if we make it this far, we need to manually count
|
// if we make it this far, we need to manually count
|
||||||
if (dso instanceof Collection)
|
if (dso instanceof Collection)
|
||||||
{
|
{
|
||||||
return ((Collection) dso).countItems();
|
try {
|
||||||
|
return ((Collection) dso).countItems();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error("caught exception: ", e);
|
||||||
|
throw new ItemCountException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dso instanceof Community)
|
if (dso instanceof Community)
|
||||||
{
|
{
|
||||||
return ((Collection) dso).countItems();
|
try {
|
||||||
|
return ((Collection) dso).countItems();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error("caught exception: ", e);
|
||||||
|
throw new ItemCountException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -1065,7 +1065,7 @@ public class Collection extends DSpaceObject
|
|||||||
{
|
{
|
||||||
// FIXME: upside down exception handling due to lack of good
|
// FIXME: upside down exception handling due to lack of good
|
||||||
// exception framework
|
// exception framework
|
||||||
throw new SQLException(e);
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete collection row
|
// Delete collection row
|
||||||
|
@@ -918,7 +918,7 @@ public class Community extends DSpaceObject
|
|||||||
{
|
{
|
||||||
// FIXME: upside down exception handling due to lack of good
|
// FIXME: upside down exception handling due to lack of good
|
||||||
// exception framework
|
// exception framework
|
||||||
throw new SQLException(e);
|
throw new RuntimeException(e.getMessage(),e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete community row
|
// Delete community row
|
||||||
|
Reference in New Issue
Block a user