Skip to content

Commit

Permalink
124579: catch any exceptions during process and end task gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Vannerum committed Jan 23, 2025
1 parent 046c1b5 commit 11a1c9a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions dspace-api/src/main/java/org/dspace/ctask/general/ClamScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections4.ListUtils;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.DSpaceObject;
Expand Down Expand Up @@ -127,10 +125,11 @@ public int perform(DSpaceObject dso) throws IOException {
}

}
} catch (AuthorizeException authE) {
throw new IOException(authE.getMessage(), authE);
} catch (SQLException sqlE) {
throw new IOException(sqlE.getMessage(), sqlE);
} catch (Exception e) {
// Any exception which may occur during the performance of the task should be caught here
// And end the process gracefully
log.error("Error scanning item: " + getItemHandle(item), e);
status = Curator.CURATE_ERROR;
} finally {
closeSession();
}
Expand Down

0 comments on commit 11a1c9a

Please sign in to comment.