Source:
<code>public void postEvents() throws Exception { DateTimeZone zone = DateTimeZone.forID("UTC"); final ServerDiscoverySelector eventReceiverSelector = factory.createSelector(EVENT_RECEIVER_SERVICE_NAME); eventReceiverSelector.start(); BufferedReader reader = null; InputStreamReader isr = null; try { isr = new InputStreamReader( ITRealtimeIndexTaskTest.class.getResourceAsStream( EVENT_DATA_FILE ) ); } catch (Exception e) { Throwables.propagate(e); } try { reader = new BufferedReader(isr); ServerDiscoveryUtil.waitUntilInstanceReady(eventReceiverSelector, "Event Receiver"); String host = config.getMiddleManagerHost() + ":" + eventReceiverSelector.pick().getPort(); LOG.info("Event Receiver Found at host %s", host); EventReceiverFirehoseTestClient client = new EventReceiverFirehoseTestClient( host, EVENT_RECEIVER_SERVICE_NAME, jsonMapper, httpClient, smileMapper ); int i=1; DateTime dt = new DateTime(zone); dtFirst = dt; dtLast = dt; String line; while ((line = reader.readLine()) != null) { if (i == 15) { dt = dt.minusMinutes(10); } else if (i == 18) { dt = dt.minusSeconds(6); } String event = line.replace (TIME_PLACEHOLDER, EVENT_FMT.print(dt)); LOG.info ("sending event: \n" + event); Collection<Map<String, Object>> events = new ArrayList<Map<String, Object>>(); events.add( (Map<String, Object>) this.jsonMapper.readValue( event, new TypeReference<Map<String, Object>>() { } ) ); int eventsPosted = client.postEvents(events, this.jsonMapper, MediaType.APPLICATION_JSON); if (eventsPosted != events.size()) { throw new ISE("Event not posted"); } try { Thread.sleep(DELAY_BETWEEN_EVENTS_SECS * 1000); } catch (InterruptedException ex) { } <START> dtLast = dt; <END> dt = new DateTime(zone); i++; } } catch (Exception e) { Throwables.propagate(e); } finally { reader.close(); eventReceiverSelector.stop(); } }</code><technical_language>a bunch of formatting issues. IntelliJ style guide</technical_language>

Target:
public void postEvents() throws Exception { DateTimeZone zone = DateTimeZone.forID("UTC"); final ServerDiscoverySelector eventReceiverSelector = factory.createSelector(EVENT_RECEIVER_SERVICE_NAME); eventReceiverSelector.start(); BufferedReader reader = null; InputStreamReader isr = null; try { isr = new InputStreamReader(ITRealtimeIndexTaskTest.class.getResourceAsStream(EVENT_DATA_FILE)); } catch (Exception e) { Throwables.propagate(e); } try { reader = new BufferedReader(isr); ServerDiscoveryUtil.waitUntilInstanceReady(eventReceiverSelector, "Event Receiver"); String host = config.getMiddleManagerHost() + ":" + eventReceiverSelector.pick().getPort(); LOG.info("Event Receiver Found at host [%s]", host); EventReceiverFirehoseTestClient client = new EventReceiverFirehoseTestClient( host, EVENT_RECEIVER_SERVICE_NAME, jsonMapper, httpClient, smileMapper ); int i = 1; DateTime dt = new DateTime(zone); dtFirst = dt; dtLast = dt; String line; while ((line = reader.readLine()) != null) { if (i == 15) { dt = dt.minusMinutes(10); } else if (i == 18) { dt = dt.minusSeconds(6); } String event = line.replace(TIME_PLACEHOLDER, EVENT_FMT.print(dt)); LOG.info("sending event: [%s]\n", event); Collection<Map<String, Object>> events = new ArrayList<Map<String, Object>>(); events.add( (Map<String, Object>) this.jsonMapper.readValue( event, new TypeReference<Map<String, Object>>() { } ) ); int eventsPosted = client.postEvents(events, this.jsonMapper, MediaType.APPLICATION_JSON); if (eventsPosted != events.size()) { throw new ISE("Event not posted"); } try { Thread.sleep(DELAY_BETWEEN_EVENTS_SECS * 1000); } catch (InterruptedException ex) { } dtLast = dt; dt = new DateTime(zone); i++; } } catch (Exception e) { Throwables.propagate(e); } finally { reader.close(); eventReceiverSelector.stop(); } }