Mention bitstream ID in exception for better debugging. (3061)

This commit is contained in:
Mark H. Wood
2021-09-08 15:40:44 -04:00
parent 20816f945e
commit 948014646a

View File

@@ -45,7 +45,8 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
/**
* log4j logger
*/
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(BitstreamServiceImpl.class);
private static final Logger log
= org.apache.logging.log4j.LogManager.getLogger();
@Autowired(required = true)
@@ -350,7 +351,8 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
public void expunge(Context context, Bitstream bitstream) throws SQLException, AuthorizeException {
authorizeService.authorizeAction(context, bitstream, Constants.DELETE);
if (!bitstream.isDeleted()) {
throw new IllegalStateException("Bitstream must be deleted before it can be removed from the database");
throw new IllegalStateException("Bitstream " + bitstream.getID().toString()
+ " must be deleted before it can be removed from the database.");
}
bitstreamDAO.delete(context, bitstream);
}