Source:
<code>private EventGenerator<String> getEventGenerator(final WatermarkTypeEnum watermarkType, final Map<String, Object> sourceConfString, final Map<String, Object> watermarkConfString, final ClassLoader classLoader) { <START> try { <END> final Function<String, Tuple<String, Long>> timestampExtractionFunc; final ByteBuffer serializedExtractionFunc = (ByteBuffer) sourceConfString.get(TextSocketSourceParameters.TIMESTAMP_EXTRACTION_FUNCTION); if (serializedExtractionFunc != null) { timestampExtractionFunc = (Function) deserializeLambda(serializedExtractionFunc, classLoader); } else { timestampExtractionFunc = null; } if (watermarkType == WatermarkTypeEnum.PERIODIC) { final long period = Long.parseLong(watermarkConfString.get(PeriodicWatermarkParameters.PERIOD).toString()); final long expectedDelay = Long.parseLong(watermarkConfString.get(PeriodicWatermarkParameters.EXPECTED_DELAY).toString()); return new PeriodicEventGenerator<>( timestampExtractionFunc, period, expectedDelay, TimeUnit.MILLISECONDS, scheduler); } else { final Predicate<String> isWatermark = (Predicate)deserializeLambda((ByteBuffer) watermarkConfString.get( PunctuatedWatermarkParameters.WATERMARK_PREDICATE), classLoader); final Function<String, Long> parseTimestamp = (Function) deserializeLambda((ByteBuffer) watermarkConfString.get( PunctuatedWatermarkParameters.PARSING_TIMESTAMP_FROM_WATERMARK), classLoader); return new PunctuatedEventGenerator<>(timestampExtractionFunc, isWatermark, parseTimestamp); } } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }</code><technical_language>removed</technical_language>

Target:
private EventGenerator<String> getEventGenerator(final WatermarkTypeEnum watermarkType, final Map<String, Object> sourceConfString, final Map<String, Object> watermarkConfString, final ClassLoader classLoader) throws RuntimeException { try { final Function<String, Tuple<String, Long>> timestampExtractionFunc; final ByteBuffer serializedExtractionFunc = (ByteBuffer) sourceConfString.get(TextSocketSourceParameters.TIMESTAMP_EXTRACTION_FUNCTION); if (serializedExtractionFunc != null) { timestampExtractionFunc = (Function) deserializeLambda(serializedExtractionFunc, classLoader); } else { timestampExtractionFunc = null; } switch (watermarkType) { case PERIODIC: final long period = Long.parseLong(watermarkConfString.get(PeriodicWatermarkParameters.PERIOD).toString()); final long expectedDelay = Long.parseLong(watermarkConfString.get(PeriodicWatermarkParameters.EXPECTED_DELAY).toString()); return new PeriodicEventGenerator<>( timestampExtractionFunc, period, expectedDelay, TimeUnit.MILLISECONDS, scheduler); case PUNCTUATED: final Predicate<String> isWatermark = (Predicate)deserializeLambda((ByteBuffer) watermarkConfString.get( PunctuatedWatermarkParameters.WATERMARK_PREDICATE), classLoader); final Function<String, Long> parseTimestamp = (Function) deserializeLambda((ByteBuffer) watermarkConfString.get( PunctuatedWatermarkParameters.PARSING_TIMESTAMP_FROM_WATERMARK), classLoader); return new PunctuatedEventGenerator<>(timestampExtractionFunc, isWatermark, parseTimestamp); default: throw new IllegalArgumentException("MISTTask: Invalid WatermarkTypeEnum is detected!"); } } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }