diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java index c0ef6ea42fce..bf89205c6093 100644 --- a/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/dao/impl/CollectionDAOImpl.java @@ -159,7 +159,7 @@ public List findAuthorizedByGroup(Context context, EPerson ePerson, @Override public List findCollectionsWithSubscribers(Context context) throws SQLException { - return list(createQuery(context, "SELECT DISTINCT col FROM Subscription s join s.collection col")); + return list(createQuery(context, "SELECT DISTINCT col FROM Subscription s join s.dSpaceObject col")); } @Override diff --git a/dspace-api/src/main/java/org/dspace/health/ChecksumCheck.java b/dspace-api/src/main/java/org/dspace/health/ChecksumCheck.java index 80e19aef70e5..f1003b4076a6 100644 --- a/dspace-api/src/main/java/org/dspace/health/ChecksumCheck.java +++ b/dspace-api/src/main/java/org/dspace/health/ChecksumCheck.java @@ -18,6 +18,7 @@ import org.dspace.checker.ChecksumResultsCollector; import org.dspace.checker.MostRecentChecksum; import org.dspace.checker.SimpleDispatcher; +import org.dspace.content.Bitstream; import org.dspace.core.Context; /** @@ -40,8 +41,30 @@ public String run(ReportInfo ri) { checker.setReportVerbose(true); try { checker.process(); + if (collector.arr.size() > 0) { + ret = String.format("Checksum performed on [%d] items:\n", + collector.arr.size()); + int ok_items = 0; + for (MostRecentChecksum bi : collector.arr) { + if (!ChecksumResultCode.CHECKSUM_MATCH.equals(bi + .getChecksumResult().getResultCode())) { + Bitstream reloadedBitstream = context.reloadEntity(bi.getBitstream()); + ret += String + .format("md5 checksum FAILED (%s): %s id: %s bitstream-id: %s\n was: %s\n is: %s\n", + bi.getChecksumResult(), reloadedBitstream.getName(), + reloadedBitstream.getInternalId(), reloadedBitstream.getID(), + bi.getExpectedChecksum(), + bi.getCurrentChecksum()); + } else { + ok_items++; + } + } + + ret += String.format("checksum OK for [%d] items\n", ok_items); + } context.complete(); context = null; + return ret; } catch (SQLException e) { error(e); } finally { @@ -49,28 +72,7 @@ public String run(ReportInfo ri) { context.abort(); } } - - if (collector.arr.size() > 0) { - ret = String.format("Checksum performed on [%d] items:\n", - collector.arr.size()); - int ok_items = 0; - for (MostRecentChecksum bi : collector.arr) { - if (!ChecksumResultCode.CHECKSUM_MATCH.equals(bi - .getChecksumResult().getResultCode())) { - ret += String - .format("md5 checksum FAILED (%s): %s id: %s bitstream-id: %s\n was: %s\n is: %s\n", - bi.getChecksumResult(), bi.getBitstream().getName(), - bi.getBitstream().getInternalId(), bi.getBitstream().getID(), - bi.getExpectedChecksum(), - bi.getCurrentChecksum()); - } else { - ok_items++; - } - } - - ret += String.format("checksum OK for [%d] items\n", ok_items); - } - return ret; + return ret; } }