/** * Implements processing and all related listener calls. * * @param item the item to be processed * @return the processed item * @throws Exception thrown if error occurs during processing. */ protected final O doTransform(I item) throws Exception { try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * @param item the input item * @return the result of the processing * @throws Exception thrown if error occurs. */ protected final O doProcess(I item) throws Exception { if (itemProcessor == null) { @SuppressWarnings("unchecked") O result = (O) item; return result; } try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
@Test public void testBeforeProcessFails_withAnnotatedListener() { StepListener listener = StepListenerFactoryBean.getListener(new AnnotationBasedStepListener()); multicast.register(listener); try { multicast.beforeProcess(null); fail("Expected StepListenerFailedException"); } catch (StepListenerFailedException e) { // expected Throwable cause = e.getCause(); String message = cause.getMessage(); assertTrue(cause instanceof IllegalStateException); assertEquals("Wrong message: " + message, "listener error", message); } }
/** * Implements processing and all related listener calls. * * @param item the item to be processed * @return the processed item * @throws Exception thrown if error occurs during processing. */ protected final O doTransform(I item) throws Exception { try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * @param item the input item * @return the result of the processing * @throws Exception thrown if error occurs. */ protected final O doProcess(I item) throws Exception { if (itemProcessor == null) { @SuppressWarnings("unchecked") O result = (O) item; return result; } try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * Implements processing and all related listener calls. * * @param item the item to be processed * @return the processed item * @throws Exception thrown if error occurs during processing. */ protected final O doTransform(I item) throws Exception { try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * Implements processing and all related listener calls. * * @param item the item to be processed * @return the processed item * @throws Exception */ protected final O doTransform(I item) throws Exception { try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * @param item the input item * @return the result of the processing * @throws Exception thrown if error occurs. */ protected final O doProcess(I item) throws Exception { if (itemProcessor == null) { @SuppressWarnings("unchecked") O result = (O) item; return result; } try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * @param item the input item * @return the result of the processing * @throws Exception */ protected final O doProcess(I item) throws Exception { if (itemProcessor==null) { @SuppressWarnings("unchecked") O result = (O) item; return result; } try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }
/** * @param item the input item * @return the result of the processing * @throws Exception */ protected final O doProcess(I item) throws Exception { if (itemProcessor == null) { @SuppressWarnings("unchecked") O result = (O) item; return result; } try { listener.beforeProcess(item); O result = itemProcessor.process(item); listener.afterProcess(item, result); return result; } catch (Exception e) { listener.onProcessError(item, e); throw e; } }