Skip to content

Commit

Permalink
#634 Fixed IllegalStateException in ThUniBibImportJobAction (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
Possommi authored Oct 24, 2024
1 parent 91bec10 commit 7bbf194
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.mycore.common.MCRSession;
import org.mycore.common.MCRSessionMgr;
import org.mycore.common.MCRSystemUserInformation;
import org.mycore.common.MCRTransactionHelper;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.common.xml.MCRURIResolver;
import org.mycore.datamodel.metadata.MCRObject;
Expand All @@ -22,7 +21,7 @@
import java.util.Objects;
import java.util.concurrent.ExecutionException;

import static org.mycore.common.MCRConstants.*;
import static org.mycore.common.MCRConstants.XPATH_FACTORY;

public class ThUniBibImportJobAction extends MCRJobAction {

Expand All @@ -43,8 +42,6 @@ public void execute() throws ExecutionException {
MCRSession mcrSession = MCRSessionMgr.getCurrentSession();
try {
mcrSession.setUserInformation(MCRSystemUserInformation.getJanitorInstance());
MCRTransactionHelper.beginTransaction();

List<String> ppns = getList(new ArrayList<>(), query, 1);
LOGGER.info("Found a total of {} ppn matching query {}", ppns.size(), query);

Expand Down Expand Up @@ -76,16 +73,8 @@ public void execute() throws ExecutionException {
} catch (Exception e) {
LOGGER.error("Could not send e-mail for import job {} {}", job.getId(), query, e);
}
} catch (Throwable throwable) {
} catch (Exception throwable) {
LOGGER.error("Could not run {} for query {}", name(), query, throwable);
MCRTransactionHelper.rollbackTransaction();
// MCRJob remains in state PROCESSING and will be reset to NEW after MCR.QueuedJob.TimeTillReset minutes
throw throwable;
} finally {
if (MCRTransactionHelper.isTransactionActive()) {
MCRTransactionHelper.commitTransaction();
}
MCRSessionMgr.releaseCurrentSession();
}
}

Expand Down

0 comments on commit 7bbf194

Please sign in to comment.