Skip to content
Permalink
Browse files
BATCHEE-136 ensure exception of job listeners are not hidden (log the…
…m properly)
  • Loading branch information
rmannibucau committed Mar 6, 2020
1 parent eef462e commit f8a0d4671239729bbcb2088443da8d793b39a126
Showing 3 changed files with 1 addition and 16 deletions.
@@ -46,8 +46,6 @@
import javax.batch.runtime.JobInstance;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@@ -439,9 +437,6 @@ public List<Long> getLastRunStepExecutions() {

private void rethrowWithMsg(final String msgBeginning, final Throwable t) {
final String errorMsg = msgBeginning + " ; Caught exception/error: " + t.getLocalizedMessage();
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
throw new BatchContainerRuntimeException(errorMsg, t);
}

@@ -36,8 +36,6 @@

import javax.batch.api.listener.JobListener;
import javax.batch.runtime.BatchStatus;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Timestamp;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@@ -168,9 +166,7 @@ protected void endOfJob() {
try {
jobListenersAfterJob();
} catch (Throwable t) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
LOGGER.log(Level.SEVERE, t.getMessage(), t);
batchStatusFailedFromException();
}

@@ -24,8 +24,6 @@
import org.apache.batchee.container.services.ServicesManager;

import javax.batch.runtime.BatchStatus;
import java.io.PrintWriter;
import java.io.StringWriter;

/*
* I took out the 'work type' constant since I don't see that we want to use
@@ -65,10 +63,6 @@ public void run() {
getBatchKernel().jobExecutionDone(getJobExecutionImpl());
}
} catch (final Throwable t) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);

if (isNotifyCallbackWhenDone()) {
getBatchKernel().jobExecutionDone(getJobExecutionImpl());
}

0 comments on commit f8a0d46

Please sign in to comment.