auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldBeAbleToRequestARefund_multiplePartialAmounts_andRefundShouldBeInFullStatus() { Long firstRefundAmount = 80L; Long secondRefundAmount = 20L; Long chargeId = defaultTestCharge.getChargeId(); String externalChargeId = defaultTestCharge.getExternalChargeId(); ValidatableResponse firstValidatableResponse = postRefundFor(externalChargeId, firstRefundAmount, defaultTestCharge.getAmount()); String firstRefundId = assertRefundResponseWith(firstRefundAmount, firstValidatableResponse, ACCEPTED.getStatusCode()); ValidatableResponse secondValidatableResponse = postRefundFor(externalChargeId, secondRefundAmount, defaultTestCharge.getAmount() - firstRefundAmount); String secondRefundId = assertRefundResponseWith(secondRefundAmount, secondValidatableResponse, ACCEPTED.getStatusCode()); List<Map<String, Object>> refundsFoundByChargeId = databaseTestHelper.getRefundsByChargeId(chargeId); assertThat(refundsFoundByChargeId.size(), is(2)); assertThat(refundsFoundByChargeId, hasItems( aRefundMatching(secondRefundId, is(notNullValue()), chargeId, secondRefundAmount, "REFUNDED"), aRefundMatching(firstRefundId, is(notNullValue()), chargeId, firstRefundAmount, "REFUNDED"))); <START> assertRefundsHistoryInDBForTwoRefunds(defaultTestCharge); <END> connectorRestApiClient.withChargeId(externalChargeId) .getCharge() .statusCode(200) .body("refund_summary.status", is("full")) .body("refund_summary.amount_available", is(0)) .body("refund_summary.amount_submitted", is(100)); }</code><technical_language>delete this asserted in shouldBeAbleToRefundTwoRequestsWhereAmountAvailableMatch</technical_language>

Target:
public void shouldBeAbleToRequestARefund_multiplePartialAmounts_andRefundShouldBeInFullStatus() { Long firstRefundAmount = 80L; Long secondRefundAmount = 20L; Long chargeId = defaultTestCharge.getChargeId(); String externalChargeId = defaultTestCharge.getExternalChargeId(); ValidatableResponse firstValidatableResponse = postRefundFor(externalChargeId, firstRefundAmount, defaultTestCharge.getAmount()); String firstRefundId = assertRefundResponseWith(firstRefundAmount, firstValidatableResponse, ACCEPTED.getStatusCode()); ValidatableResponse secondValidatableResponse = postRefundFor(externalChargeId, secondRefundAmount, defaultTestCharge.getAmount() - firstRefundAmount); String secondRefundId = assertRefundResponseWith(secondRefundAmount, secondValidatableResponse, ACCEPTED.getStatusCode()); List<Map<String, Object>> refundsFoundByChargeId = databaseTestHelper.getRefundsByChargeId(chargeId); assertThat(refundsFoundByChargeId.size(), is(2)); assertThat(refundsFoundByChargeId, hasItems( aRefundMatching(secondRefundId, is(notNullValue()), chargeId, secondRefundAmount, "REFUNDED"), aRefundMatching(firstRefundId, is(notNullValue()), chargeId, firstRefundAmount, "REFUNDED"))); assertRefundsHistoryInOrderInDBForTwoRefunds(defaultTestCharge); connectorRestApiClient.withChargeId(externalChargeId) .getCharge() .statusCode(200) .body("refund_summary.status", is("full")) .body("refund_summary.amount_available", is(0)) .body("refund_summary.amount_submitted", is(100)); }
Source:
<code>protected void remove() { if (getWindow() != null) { return; } ConfirmationModel window = new ConfirmationModel(); setWindow(window); window.setTitle(ConstantsManager.getInstance().getConstants().removeUnregisteredTemplatesTitle()); window.setHelpTag(HelpTag.remove_unregistered_template); window.setHashName("remove_unregistered_templates"); ArrayList<String> items = new ArrayList<>(); List<VmTemplate> templates = (List<VmTemplate>) getSelectedItems(); for (VmTemplate template : templates) { if <START> (!template.getId().equals(Guid.Empty)) { <END> items.add(template.getName()); } } window.setItems(items); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); window.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); window.getCommands().add(tempVar2); }</code><technical_language>Consider GUID.isNullOrEmpty(). IMHO more maintainable</technical_language>

Target:
protected void remove() { if (getWindow() != null) { return; } ConfirmationModel window = new ConfirmationModel(); setWindow(window); window.setTitle(ConstantsManager.getInstance().getConstants().removeUnregisteredTemplatesTitle()); window.setHelpTag(HelpTag.remove_unregistered_template); window.setHashName("remove_unregistered_templates"); List<String> items = getSelectedItems().stream() .map(item -> (VmTemplate) item) .filter(vmTemplate -> vmTemplate.getId().isNullOrEmpty(Guid.Empty)) .map(VmTemplate::getName) .collect(Collectors.toList()); window.setItems(items); UICommand onRemoveUiCommand = UICommand.createDefaultOkUiCommand("OnRemove", this); window.getCommands().add(onRemoveUiCommand); UICommand cancelUiCommand = UICommand.createCancelUiCommand("Cancel", this); window.getCommands().add(cancelUiCommand); }
Source:
<code>public void requestDone(HttpServerExchange exchange) { try { Session<LocalSessionContext> session = this.entry.getKey(); if (session.isValid()) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { if (this.batch.getState() == Batch.State.DISCARDED) { this.batch.close(); } try (Batch batch = (this.batch.getState() == Batch.State.CLOSED) ? batcher.createBatch() : this.batch) { if (this.startTime != null) { <START> session.getMetaData().setLastAccessedTime(this.startTime); <END> } session.close(); } } catch (Throwable e) { UndertowClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } } else if (this.batch.getState() != Batch.State.CLOSED) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { this.batch.close(); } } } finally { this.closeTask.accept(exchange); } }</code><technical_language>Is a new of DistributableSession objects created request? startTime change Batch object passed c'tor sound span requests</technical_language>

Target:
public void requestDone(HttpServerExchange exchange) { try { Session<LocalSessionContext> session = this.entry.getKey(); if (session.isValid()) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { if (this.batch.getState() == Batch.State.DISCARDED) { this.batch.close(); } try (Batch batch = (this.batch.getState() == Batch.State.CLOSED) ? batcher.createBatch() : this.batch) { if (this.startTime != null) { session.getMetaData().setLastAccess(this.startTime, Instant.now()); } session.close(); } } catch (Throwable e) { UndertowClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } } else if (this.batch.getState() != Batch.State.CLOSED) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { this.batch.close(); } } } finally { this.closeTask.accept(exchange); } }
Source:
<code>public void queuePublishingWithoutSubscribers() throws XPathExpressionException, AndesClientConfigurationException, IOException, AndesClientException, JMSException, NamingException, AutomationUtilException, AndesAdminServiceBrokerManagerAdminException { int messageCount = 2000; String queueName = "pubWithoutSubQueue"; LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext); String sessionCookie = loginLogoutClientForAdmin.login(); AndesAdminClient admin = new AndesAdminClient(super.backendURL, sessionCookie); admin.createQueue(queueName); AndesJMSPublisherClientConfiguration publisherConfig = new AndesJMSPublisherClientConfiguration(getAMQPPort(), ExchangeType.QUEUE, queueName); publisherConfig.setTransactionalSession(true); publisherConfig.setNumberOfMessagesToSend(messageCount); AndesClient publisherClient = new AndesClient(publisherConfig, true); publisherClient.startClient(); <START> AndesClientUtils.sleepForInterval(5000); <END> org.wso2.carbon.andes.stub.admin.types.Message[] messages = admin.browseQueue(queueName, 0, messageCount); Assert.assertEquals(messages.length, messageCount, "All messages did not get published to the queue."); }</code><technical_language>browsing messages 5 seconds of publishing. This enough. need wait for more 2 minutes is timeout for publisher flow controling</technical_language>

Target:
public void queuePublishingWithoutSubscribers() throws XPathExpressionException, AndesClientConfigurationException, IOException, AndesClientException, JMSException, NamingException, AutomationUtilException, AndesAdminServiceBrokerManagerAdminException { int messageCount = 2000; String queueName = "pubWithoutSubQueue"; LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext); String sessionCookie = loginLogoutClientForAdmin.login(); AndesAdminClient admin = new AndesAdminClient(super.backendURL, sessionCookie); admin.createQueue(queueName); AndesJMSPublisherClientConfiguration publisherConfig = new AndesJMSPublisherClientConfiguration(getAMQPPort(), ExchangeType.QUEUE, queueName); publisherConfig.setTransactionalSession(true); publisherConfig.setNumberOfMessagesToSend(messageCount); AndesClient publisherClient = new AndesClient(publisherConfig, true); publisherClient.startClient(); AndesClientUtils.sleepForInterval(121000); org.wso2.carbon.andes.stub.admin.types.Message[] messages = admin.browseQueue(queueName, 0, messageCount); Assert.assertEquals(messages.length, messageCount, "All messages did not get published to the queue."); }
Source:
<code><START> private void generateIdentifiers(final ElkGraphElement element) { <END> new ElkGraphSwitch<Object>() { @Override public Object caseElkNode(final ElkNode node) { if (node.getParent() == null) { setIdentifierIfMissing(node, "G1"); } else { setIdentifierIfMissing(node, "N" + currNodeId++); } node.getLabels().stream().forEach(l -> generateIdentifiers(l)); node.getPorts().stream().forEach(l -> generateIdentifiers(l)); node.getContainedEdges().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkPort(final ElkPort port) { setIdentifierIfMissing(port, "P" + currPortId++); port.getLabels().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkLabel(final ElkLabel label) { setIdentifierIfMissing(label, "L" + currLabelId++); label.getLabels().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkEdge(final ElkEdge edge) { setIdentifierIfMissing(edge, "E" + currEdgeId++); edge.getLabels().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkEdgeSection(final ElkEdgeSection section) { setIdentifierIfMissing(section, "ES" + currEdgeSectionId++); return null; } }.doSwitch(element); }</code><technical_language>In case elements assigned ids, this code generated ids unique wrt. existing ones. is sufficient for ids unique for container</technical_language>

Target:
private void generateIdentifiers(final ElkGraphElement element) { new ElkGraphSwitch<Object>() { @Override public Object caseElkNode(final ElkNode node) { if (node.getParent() == null) { if (node.getIdentifier() == null || node.getIdentifier().trim().isEmpty()) { node.setIdentifier("G1"); } } else { setIdentifierIfMissing(node, ElementType.NODE); } node.getLabels().stream().forEach(l -> generateIdentifiers(l)); node.getPorts().stream().forEach(l -> generateIdentifiers(l)); node.getContainedEdges().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkPort(final ElkPort port) { setIdentifierIfMissing(port, ElementType.PORT); port.getLabels().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkLabel(final ElkLabel label) { setIdentifierIfMissing(label, ElementType.LABEL); label.getLabels().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkEdge(final ElkEdge edge) { setIdentifierIfMissing(edge, ElementType.EDGE); edge.getLabels().stream().forEach(l -> generateIdentifiers(l)); return null; } @Override public Object caseElkEdgeSection(final ElkEdgeSection section) { setIdentifierIfMissing(section); return null; } }.doSwitch(element); }
Source:
<code>private void notify(final Error error, boolean blocking) { if (error.shouldIgnoreClass()) { return; } if (!config.shouldNotifyForReleaseStage(appData.getReleaseStage())) { return; } HashMap<String, String> breadcrumbMetadata = new HashMap<String, String>(); <START> breadcrumbMetadata.put("message", error.getExceptionMessage()); <END> breadcrumbs.add(error.getExceptionName(), BreadcrumbType.ERROR, breadcrumbMetadata); error.setAppData(appData); error.setDeviceData(deviceData); error.setAppState(new AppState(appContext)); error.setDeviceState(new DeviceState(appContext)); error.setBreadcrumbs(breadcrumbs); error.setUser(user); if (!runBeforeNotifyTasks(error)) { Logger.info("Skipping notification - beforeNotify task returned false"); return; } final Notification notification = new Notification(config); notification.addError(error); if (blocking) { deliver(notification, error); } else { Async.run(new Runnable() { @Override public void run() { deliver(notification, error); } }); } }</code><technical_language>Collections.singletonMap for a more space-efficient implementation of a single-element Map</technical_language>

Target:
private void notify(final Error error, boolean blocking) { if (error.shouldIgnoreClass()) { return; } if (!config.shouldNotifyForReleaseStage(appData.getReleaseStage())) { return; } breadcrumbs.add(error.getExceptionName(), BreadcrumbType.ERROR, Collections.singletonMap("message", error.getExceptionMessage())); error.setAppData(appData); error.setDeviceData(deviceData); error.setAppState(new AppState(appContext)); error.setDeviceState(new DeviceState(appContext)); error.setBreadcrumbs(breadcrumbs); error.setUser(user); if (!runBeforeNotifyTasks(error)) { Logger.info("Skipping notification - beforeNotify task returned false"); return; } final Notification notification = new Notification(config); notification.addError(error); if (blocking) { deliver(notification, error); } else { Async.run(new Runnable() { @Override public void run() { deliver(notification, error); } }); } }
Source:
<code>public void execute(final JobExecutionContext jobContext) throws JobExecutionException { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); <START> if (!ff4j.check(FeatureList.EFFECTIVE_RULE_DATE)) { <END> LOGGER.info("The " + FeatureList.EFFECTIVE_RULE_DATE + " flag is off. " + "Macra Measueres will not be updated."); } else { LOGGER.info(SPACER + " Started the " + JOB_NAME + " job " + SPACER); TransactionTemplate txnTemplate = new TransactionTemplate(txnMgr); txnTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { try { macraMeasureDAO.updateSubstringInAllValues(OLD_G1G2_SUBSTRING, NEW_G1G2_SUBSTRING); LOGGER.info(SPACER + " Updated all g1g2 '" + OLD_G1G2_SUBSTRING + "' MACRA measures to '" + NEW_G1G2_SUBSTRING + "' " + SPACER); } catch (Exception e) { LOGGER.error(e.getMessage(), e); status.setRollbackOnly(); } } }); certifiedProductDetailsManager.refreshData(); LOGGER.info(SPACER + " Completed the " + JOB_NAME + " job " + SPACER); } }</code><technical_language>I I this in of jobs I wrote I remember. of Cures jobs this check leave out for consistency. I a strong feeling consistency argument</technical_language>

Target:
public void execute(final JobExecutionContext jobContext) throws JobExecutionException { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); LOGGER.info(SPACER + " Started the " + JOB_NAME + " job " + SPACER); TransactionTemplate txnTemplate = new TransactionTemplate(txnMgr); txnTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { try { updateMacraMeasuresDao.updateSubstringInAllValues(OLD_G1G2_SUBSTRING, NEW_G1G2_SUBSTRING); LOGGER.info(SPACER + " Updated all g1g2 '" + OLD_G1G2_SUBSTRING + "' MACRA measures to '" + NEW_G1G2_SUBSTRING + "' " + SPACER); } catch (Exception e) { LOGGER.error(e.getMessage(), e); status.setRollbackOnly(); } } }); CacheManager.getInstance().clearAll(); certifiedProductDetailsManager.refreshData(); pcpManager.refreshData(); LOGGER.info(SPACER + " Completed the " + JOB_NAME + " job " + SPACER); }
Source:
<code>private Method resolveMethod(ClientConnectionContext ctx, Class<?> cls) throws ReflectiveOperationException { if (paramTypeIds != null) { MethodDescriptor desc = new MethodDescriptor(cls, methodName, paramTypeIds); Method method = methodsCache.get(desc); if (method != null) return method; BinaryContext bctx = ((CacheObjectBinaryProcessorImpl)ctx.kernalContext().cacheObjects()).binaryContext(); for (Method method0 : cls.getMethods()) { <START> if (methodName.equals(method0.getName())) { <END> MethodDescriptor desc0 = MethodDescriptor.forMethod(bctx, method0); methodsCache.putIfAbsent(desc0, method0); if (desc0.equals(desc)) return method0; } } throw new NoSuchMethodException("Method not found: " + desc); } return PlatformServices.getMethod(cls, methodName, args); }</code><technical_language>if multiple methods name</technical_language>

Target:
private Method resolveMethod(ClientConnectionContext ctx, Class<?> cls) throws ReflectiveOperationException { if (paramTypeIds != null) { MethodDescriptor desc = new MethodDescriptor(cls, methodName, paramTypeIds); Method method = methodsCache.get(desc); if (method != null) return method; IgniteBinary binary = ctx.kernalContext().grid().binary(); for (Method method0 : cls.getMethods()) { if (methodName.equals(method0.getName())) { MethodDescriptor desc0 = MethodDescriptor.forMethod(binary, method0); methodsCache.putIfAbsent(desc0, method0); if (desc0.equals(desc)) return method0; } } throw new NoSuchMethodException("Method not found: " + desc); } return PlatformServices.getMethod(cls, methodName, args); }
Source:
<code>public void removeServiceEventListener(Object listener) { assert getExecutor().isInExecutorThread(); ListenerEntry entry = new ListenerEntry(listener, null); <START> if (DsfDebugOptions.DEBUG && DsfDebugOptions.DEBUG_SESSION && DsfDebugOptions.DEBUG_SESSION_LISTENERS) { <END> String msg = new Formatter().format( "%s %s removed as a service listener to %s (id=%s)", DsfPlugin.getDebugTime(), LoggingUtils.toString(listener), LoggingUtils.toString(this), getId() ).toString(); DsfDebugOptions.trace(msg); } fListeners.remove(entry); }</code><technical_language>DsfDebugOptions.DEBUG_SESSION_LISTENERS include others in DsfDebugOptions</technical_language>

Target:
public void removeServiceEventListener(Object listener) { assert getExecutor().isInExecutorThread(); ListenerEntry entry = new ListenerEntry(listener, null); if (DsfDebugOptions.DEBUG_SESSION_LISTENERS) { String msg = new Formatter().format( "%s %s removed as a service listener to %s (id=%s)", DsfPlugin.getDebugTime(), LoggingUtils.toString(listener), LoggingUtils.toString(this), getId() ).toString(); DsfDebugOptions.trace(msg); } fListeners.remove(entry); }
Source:
<code>private static IEnumState getEventState(ITimeEvent event) { <START> if (event instanceof BarChartEvent) { <END> BarChartEvent tcEvent = (BarChartEvent) event; ResourcesEntry entry = (ResourcesEntry)event.getEntry(); int value = tcEvent.getValue(); if (entry instanceof ResourcesEntryCpu) { if (value == StateValues.CPU_STATUS_IDLE) { return State.IDLE; } else if (value == StateValues.CPU_STATUS_RUN_USERMODE) { return State.USERMODE; } else if (value == StateValues.CPU_STATUS_RUN_SYSCALL) { return State.SYSCALL; } else if (value == StateValues.CPU_STATUS_IRQ) { return State.IRQ; } else if (value == StateValues.CPU_STATUS_SOFTIRQ) { return State.SOFT_IRQ; } } else if (entry instanceof ResourcesEntryIrq && value != BarChartEvent.NOVALUE) { return State.IRQ_ACTIVE; } else if (entry instanceof ResourcesEntrySoftirq && value != BarChartEvent.NOVALUE) { if (value == StateValues.SOFT_IRQ_RAISED) { return State.SOFT_IRQ_RAISED; } return State.SOFT_IRQ_ACTIVE; } } return null; }</code><technical_language>a BarChartEvent parameter</technical_language>

Target:
private static IEnumState getEventState(ITimeEvent event) { if (event instanceof BarChartEvent) { BarChartEvent tcEvent = (BarChartEvent) event; ResourcesEntry entry = (ResourcesEntry) event.getEntry(); int value = tcEvent.getValue(); if (entry.getType() == Type.CPU) { if (value == StateValues.CPU_STATUS_IDLE) { return State.IDLE; } else if (value == StateValues.CPU_STATUS_RUN_USERMODE) { return State.USERMODE; } else if (value == StateValues.CPU_STATUS_RUN_SYSCALL) { return State.SYSCALL; } else if (value == StateValues.CPU_STATUS_IRQ) { return State.IRQ; } else if (value == StateValues.CPU_STATUS_SOFTIRQ) { return State.SOFT_IRQ; } } else if ((entry.getType() == Type.IRQ) && (value != BarChartEvent.NOVALUE)) { return State.IRQ_ACTIVE; } else if ((entry.getType() == Type.SOFT_IRQ) && (value != BarChartEvent.NOVALUE)) { if (value == StateValues.SOFT_IRQ_RAISED) { return State.SOFT_IRQ_RAISED; } return State.SOFT_IRQ_ACTIVE; } } return null; }
Source:
<code><START> public Builder(Builder<T> builder) { <END> super(builder); this.useLayerNormalization=builder.useLayerNormalization; }</code><technical_language>I need sorts of constructors... needed before, special useLayerNormalization arg (it's another boolean)... missing something</technical_language>

Target:
public Builder(Builder<T> builder) { super(builder); this.useLayerNormalization = builder.useLayerNormalization; this.normalizePerRecord = builder.normalizePerRecord; }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); Binding type; for (int i = 0, length = valueTable.length; i < length; i++) { if ((type = valueTable[i]) != null) { <START> sb.append(type.toString()); <END> sb.append("\n"); } } return sb.toString(); }</code><technical_language>type.toString() a null-safe call, while sb.append(Object arg) is 'String.valueOf(arg), a null-safe Object-to-String conversion. call toString() here</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); Binding type; for (int i = 0, length = valueTable.length; i < length; i++) { if ((type = valueTable[i]) != null) { sb.append(type); sb.append("\n"); } } return sb.toString(); }
Source:
<code>public List<WorkerInfo> getWorkerInfoList() throws UnavailableException { if (mSafeModeManager.isInSafeMode()) { throw new UnavailableException(ExceptionMessage.MASTER_IN_SAFEMODE.getMessage()); } try { return mWorkerInfoCache.get(WORKER_INFO_CACHE_KEY); } catch (ExecutionException e) { <START> throw new UnavailableException("Unable to get worker info list from cache"); <END> } }</code><technical_language>include information e in this exception message</technical_language>

Target:
public List<WorkerInfo> getWorkerInfoList() throws UnavailableException { if (mSafeModeManager.isInSafeMode()) { throw new UnavailableException(ExceptionMessage.MASTER_IN_SAFEMODE.getMessage()); } try { return mWorkerInfoCache.get(WORKER_INFO_CACHE_KEY); } catch (ExecutionException e) { throw new UnavailableException("Unable to get worker info list from cache", e); } }
Source:
<code>public void awaitFlushCompletion(long timeoutMs) throws InterruptedException { try { Long expireMs = System.currentTimeMillis() + timeoutMs; for (ProducerBatch batch : this.incomplete.copyAll()) { Long currentMs = System.currentTimeMillis(); if (currentMs > expireMs) { <START> throw new TimeoutException("Failed to flush accumulated records within" + timeoutMs + "milliseconds."); <END> } boolean completed = batch.produceFuture.await(Math.max(expireMs - currentMs, 0), TimeUnit.MILLISECONDS); if (!completed) { throw new TimeoutException("Failed to flush accumulated records within" + timeoutMs + "milliseconds."); } } } finally { this.flushesInProgress.decrementAndGet(); } }</code><technical_language>exception improved a bit - "failed flush X ms, successfully completed Y/Z batches". wuold distinguish slow connection connection</technical_language>

Target:
public void awaitFlushCompletion(long timeoutMs) throws InterruptedException { try { Long expireMs = System.currentTimeMillis() + timeoutMs; int numBatchesFlushed = 0; for (ProducerBatch batch : this.incomplete.copyAll()) { Long currentMs = System.currentTimeMillis(); if (currentMs > expireMs) { throw new TimeoutException(String.format("Failed to flush accumulated records within %d milliseconds," + " successfully completed %d batches.", timeoutMs, numBatchesFlushed)); } boolean completed = batch.produceFuture.await(Math.max(expireMs - currentMs, 0), TimeUnit.MILLISECONDS); if (!completed) { throw new TimeoutException(String.format("Failed to flush accumulated records within %d milliseconds," + " successfully completed %d batches.", timeoutMs, numBatchesFlushed)); } numBatchesFlushed++; } } finally { this.flushesInProgress.decrementAndGet(); } }
Source:
<code>private synchronized void checkAllTaskFinal() { if (stateMachine.getState().isDone() && tasksWithFinalInfo.containsAll(allTasks)) { if (getFragment().getStageExecutionDescriptor().isStageGroupedExecution()) { <START> switch (stateMachine.getState()) { <END> case FINISHED: checkState(finishedLifespans.size() == totalLifespans); break; case CANCELED: case ABORTED: case FAILED: checkState(finishedLifespans.size() <= totalLifespans); break; default: throw new IllegalStateException("Unrecognized done stage state: " + stateMachine.getState()); } } else { checkState(finishedLifespans.isEmpty()); } List<TaskInfo> finalTaskInfos = getAllTasks().stream() .map(RemoteTask::getTaskInfo) .collect(toImmutableList()); stateMachine.setAllTasksFinal(finalTaskInfos, totalLifespans); } }</code><technical_language>feels this sanity check is overkill. feel free leave if feel strongly it</technical_language>

Target:
private synchronized void checkAllTaskFinal() { if (stateMachine.getState().isDone() && tasksWithFinalInfo.containsAll(allTasks)) { if (getFragment().getStageExecutionDescriptor().isStageGroupedExecution()) { checkState(finishedLifespans.size() <= totalLifespans, format("Number of finished lifespans (%s) exceeds number of total lifespans (%s)", finishedLifespans.size(), totalLifespans)); } else { checkState(finishedLifespans.isEmpty()); } List<TaskInfo> finalTaskInfos = getAllTasks().stream() .map(RemoteTask::getTaskInfo) .collect(toImmutableList()); stateMachine.setAllTasksFinal(finalTaskInfos, totalLifespans); } }
Source:
<code>public static Optional<boolean[]> decodeNullBits(SliceInput sliceInput, int positionCount) { <START> if (sliceInput.readByte() == 0) { <END> return Optional.empty(); } boolean[] valueIsNull = new boolean[positionCount]; for (int position = 0; position < (positionCount & ~0b111); position += 8) { byte value = sliceInput.readByte(); valueIsNull[position] = ((value & 0b1000_0000) != 0); valueIsNull[position + 1] = ((value & 0b0100_0000) != 0); valueIsNull[position + 2] = ((value & 0b0010_0000) != 0); valueIsNull[position + 3] = ((value & 0b0001_0000) != 0); valueIsNull[position + 4] = ((value & 0b0000_1000) != 0); valueIsNull[position + 5] = ((value & 0b0000_0100) != 0); valueIsNull[position + 6] = ((value & 0b0000_0010) != 0); valueIsNull[position + 7] = ((value & 0b0000_0001) != 0); } if ((positionCount & 0b111) > 0) { byte value = sliceInput.readByte(); int mask = 0b1000_0000; for (int position = positionCount & ~0b111; position < positionCount; position++) { valueIsNull[position] = ((value & mask) != 0); mask >>>= 1; } } return Optional.of(valueIsNull); }</code><technical_language>! sliceInput.readBoolean()</technical_language>

Target:
public static Optional<boolean[]> decodeNullBits(SliceInput sliceInput, int positionCount) { if (!sliceInput.readBoolean()) { return Optional.empty(); } boolean[] valueIsNull = new boolean[positionCount]; for (int position = 0; position < (positionCount & ~0b111); position += 8) { byte value = sliceInput.readByte(); valueIsNull[position] = ((value & 0b1000_0000) != 0); valueIsNull[position + 1] = ((value & 0b0100_0000) != 0); valueIsNull[position + 2] = ((value & 0b0010_0000) != 0); valueIsNull[position + 3] = ((value & 0b0001_0000) != 0); valueIsNull[position + 4] = ((value & 0b0000_1000) != 0); valueIsNull[position + 5] = ((value & 0b0000_0100) != 0); valueIsNull[position + 6] = ((value & 0b0000_0010) != 0); valueIsNull[position + 7] = ((value & 0b0000_0001) != 0); } if ((positionCount & 0b111) > 0) { byte value = sliceInput.readByte(); int mask = 0b1000_0000; for (int position = positionCount & ~0b111; position < positionCount; position++) { valueIsNull[position] = ((value & mask) != 0); mask >>>= 1; } } return Optional.of(valueIsNull); }
Source:
<code>public void toggleTransparency() { CustomScaleImageView imageView = findScaleImageView(); GifImageView gifView = findGifImageView(); if (imageView == null && gifView == null) return; boolean isImage = imageView != null && gifView == null; <START> if (backgroundToggle) { <END> if (isImage) { imageView.setTileBackgroundColor(Color.TRANSPARENT); } else { gifView.getDrawable().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.DST_OVER); } backgroundToggle = false; } else { if (isImage) { imageView.setTileBackgroundColor(BACKGROUND_COLOR); } else { gifView.getDrawable().setColorFilter(BACKGROUND_COLOR, PorterDuff.Mode.DST_OVER); } backgroundToggle = true; } }</code><technical_language>able remove this exterior conditional a ternary backgroundColor = backgroundToggle ? Color.TRANSPARENT : Color.BACKGROUND_COLOR if (isImage) { imageView.setTileBackgroundColor(backgroundColor); } else { gifView.getDrawable().setColorFilter(backgroundColor, PorterDuff.Mode.DST_OVER); } backgroundToggle = !backgroundToggle</technical_language>

Target:
public void toggleTransparency() { CustomScaleImageView imageView = findScaleImageView(); GifImageView gifView = findGifImageView(); if (imageView == null && gifView == null) return; boolean isImage = imageView != null && gifView == null; int backgroundColor = backgroundToggle ? Color.TRANSPARENT : BACKGROUND_COLOR; if (isImage) { imageView.setTileBackgroundColor(backgroundColor); } else { gifView.getDrawable().setColorFilter(backgroundColor, PorterDuff.Mode.DST_OVER); } backgroundToggle = !backgroundToggle; }
Source:
<code>private void addScript() throws IOException { ExtensionScript extScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); <START> String scriptName = "SOAP Support.js"; <END> if (extScript != null && extScript.getScript(scriptName) == null) { ScriptType variantType = extScript.getScriptType(ExtensionActiveScan.SCRIPT_TYPE_VARIANT); ScriptEngineWrapper engine = extScript.getEngineWrapper("Oracle Nashorn"); if (variantType != null && engine != null) { File scriptPath = Paths.get( Constant.getZapHome(), ExtensionScript.SCRIPTS_DIR, ExtensionScript.SCRIPTS_DIR, ExtensionActiveScan.SCRIPT_TYPE_VARIANT, scriptName) .toFile(); ScriptWrapper script = new ScriptWrapper( scriptName, Constant.messages.getString("soap.script.description"), engine, variantType, true, scriptPath); script.reloadScript(); extScript.addScript(script, false); } } }</code><technical_language>suggest SOAP_support.js soap_support.js</technical_language>

Target:
private void addScript() throws IOException { ExtensionScript extScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); String scriptName = "SOAP Support.js"; if (extScript != null && extScript.getScript(scriptName) == null) { ScriptType variantType = extScript.getScriptType(ExtensionActiveScan.SCRIPT_TYPE_VARIANT); ScriptEngineWrapper engine = extScript.getEngineWrapper("Oracle Nashorn"); if (variantType != null && engine != null) { File scriptPath = Paths.get( Constant.getZapHome(), ExtensionScript.SCRIPTS_DIR, ExtensionScript.SCRIPTS_DIR, ExtensionActiveScan.SCRIPT_TYPE_VARIANT, scriptName) .toFile(); ScriptWrapper script = new ScriptWrapper( scriptName, Constant.messages.getString("soap.script.description"), engine, variantType, true, scriptPath); script.setLoadOnStart(true); script.reloadScript(); extScript.addScript(script, false); } } }
Source:
<code>void processWebCacheDbFile(String eseDumperPath, List<AbstractFile> webCacheFiles) throws IOException, TskCoreException { for (AbstractFile webCacheFile : webCacheFiles) { if (context.dataSourceIngestIsCancelled()) { return; } clearContainerTable(); String tempWebCacheFileName = EDGE_WEBCACHE_PREFIX + Integer.toString((int) webCacheFile.getId()) + EDGE_WEBCACHE_EXT; File tempWebCacheFile = new File(RAImageIngestModule.getRATempPath(currentCase, EDGE), tempWebCacheFileName); try { ContentUtils.writeToFile(webCacheFile, tempWebCacheFile, context::dataSourceIngestIsCancelled); } catch (IOException ex) { throw new IOException("Error writingToFile: " + webCacheFile, ex); } File resultsDir = new File(moduleTempResultPath.toAbsolutePath() + Integer.toString((int) webCacheFile.getId())); <START> resultsDir.mkdirs(); <END> try { executeDumper(eseDumperPath, tempWebCacheFile.getAbsolutePath(), resultsDir.getAbsolutePath()); if (context.dataSourceIngestIsCancelled()) { return; } this.getHistory(webCacheFile, resultsDir); if (context.dataSourceIngestIsCancelled()) { return; } this.getCookie(webCacheFile, resultsDir); } finally { tempWebCacheFile.delete(); resultsDir.delete(); } } }</code><technical_language>if File.mkdirs fails? returns a boolean success failure (too bad throw!)</technical_language>

Target:
void processWebCacheDbFile(String eseDumperPath, List<AbstractFile> webCacheFiles) throws IOException, TskCoreException { for (AbstractFile webCacheFile : webCacheFiles) { if (context.dataSourceIngestIsCancelled()) { return; } clearContainerTable(); String tempWebCacheFileName = EDGE_WEBCACHE_PREFIX + Integer.toString((int) webCacheFile.getId()) + EDGE_WEBCACHE_EXT; File tempWebCacheFile = new File(RAImageIngestModule.getRATempPath(currentCase, EDGE), tempWebCacheFileName); try { ContentUtils.writeToFile(webCacheFile, tempWebCacheFile, context::dataSourceIngestIsCancelled); } catch (IOException ex) { throw new IOException("Error writingToFile: " + webCacheFile, ex); } File resultsDir = new File(moduleTempResultPath.toAbsolutePath() + Integer.toString((int) webCacheFile.getId())); resultsDir.mkdirs(); try { executeDumper(eseDumperPath, tempWebCacheFile.getAbsolutePath(), resultsDir.getAbsolutePath()); if (context.dataSourceIngestIsCancelled()) { return; } this.getHistory(webCacheFile, resultsDir); if (context.dataSourceIngestIsCancelled()) { return; } this.getCookies(webCacheFile, resultsDir); } finally { tempWebCacheFile.delete(); resultsDir.delete(); } } }
Source:
<code>private void completeRequest(boolean closeNetworkChannel) { if (closeNetworkChannel && ctx.channel().isOpen()) { writeFuture.addListener(ChannelFutureListener.CLOSE); logger.trace("Requested closing of channel {}", ctx.channel()); } <START> if (request != null && request.isOpen()) { <END> closeRequest(); } responseComplete = true; }</code><technical_language>duplicating checks. closeRequest() this check</technical_language>

Target:
private void completeRequest(boolean closeNetworkChannel) { if (closeNetworkChannel && ctx.channel().isOpen()) { writeFuture.addListener(ChannelFutureListener.CLOSE); logger.trace("Requested closing of channel {}", ctx.channel()); } closeRequest(); responseComplete = true; }
Source:
<code>public void shouldBreakOnInvalidAuthenticationHandler() throws Exception { final CombinedTestClient client = new CombinedTestClient(getProtocol()); try { client.sendAndAssert("2+2", 4); <START> } catch (NoHttpResponseException | SocketException e) { <END> } finally { client.close(); } }</code><technical_language>this line by: java fail("Should throw exception"); expect sendAndAssert work, right</technical_language>

Target:
public void shouldBreakOnInvalidAuthenticationHandler() throws Exception { final CombinedTestClient client = new CombinedTestClient(getProtocol()); try { client.sendAndAssert("2+2", 4); Assert.fail("An exception should be thrown with an invalid authentication handler"); } catch (NoHttpResponseException | SocketException e) { } finally { client.close(); } }
Source:
<code>private void updateMessageState(List<Message> readMsgs, HelixDataAccessor accessor, String instanceName) { Builder keyBuilder = accessor.keyBuilder(); List<String> readMsgPaths = new ArrayList<>(); List<DataUpdater<ZNRecord>> updaters = new ArrayList<>(); for (Message msg : readMsgs) { <START> readMsgPaths.add(msg.getKey(keyBuilder, instanceName).getPath()); <END> _knownMessageIds.add(msg.getId()); updaters.add(new DataUpdater<ZNRecord>() { @Override public ZNRecord update(ZNRecord currentData) { if (currentData == null) { return null; } return msg.getRecord(); } }); } accessor.updateChildren(readMsgPaths, updaters, AccessOption.PERSISTENT); }</code><technical_language>throw exception here? throws exception need handle</technical_language>

Target:
private void updateMessageState(List<Message> readMsgs, HelixDataAccessor accessor, String instanceName) { Builder keyBuilder = accessor.keyBuilder(); List<String> readMsgPaths = new ArrayList<>(); List<DataUpdater<ZNRecord>> updaters = new ArrayList<>(); for (Message msg : readMsgs) { readMsgPaths.add(msg.getKey(keyBuilder, instanceName).getPath()); _knownMessageIds.add(msg.getId()); updaters.add(new DataUpdater<ZNRecord>() { @Override public ZNRecord update(ZNRecord currentData) { if (currentData == null) { LOG.warn("Message targets at has already been removed before it is set as READ on instance {}", msg.getId(), msg.getTgtName(), instanceName); return null; } return msg.getRecord(); } }); } accessor.updateChildren(readMsgPaths, updaters, AccessOption.PERSISTENT); }
Source:
<code>public boolean processAutoDiscovery(byte[] buffer) { boolean reinit = false; String[] discovered; try { <START> String configs = new String(buffer, "UTF-8"); <END> String separator = App.AD_CONFIG_SEP; if (configs.indexOf(App.AD_LEGACY_CONFIG_SEP) != -1) { separator = App.AD_LEGACY_CONFIG_SEP; } discovered = configs.split(separator + System.getProperty("line.separator")); } catch(UnsupportedEncodingException e) { LOGGER.debug("Unable to parse byte buffer to UTF-8 String."); return false; } for (String config : discovered) { if (config == null || config.isEmpty()) { continue; } try{ String name = getAutoDiscoveryName(config); LOGGER.debug("Attempting to apply config. Name: " + name + "\nconfig: \n" + config); InputStream stream = new ByteArrayInputStream(config.getBytes("UTF-8")); YamlParser yaml = new YamlParser(stream); if (this.addConfig(name, yaml)){ reinit = true; LOGGER.debug("Configuration added succesfully reinit in order"); } else { LOGGER.debug("Unable to apply configuration."); } } catch(UnsupportedEncodingException e) { LOGGER.debug("Unable to parse byte buffer to UTF-8 String."); } } return reinit; }</code><technical_language>Good catch remove this dependency for this. creating constant instead of duplicated strings</technical_language>

Target:
public boolean processAutoDiscovery(byte[] buffer) { boolean reinit = false; String[] discovered; String configs = new String(buffer, UTF_8); String separator = App.AD_CONFIG_SEP; if (configs.indexOf(App.AD_LEGACY_CONFIG_SEP) != -1) { separator = App.AD_LEGACY_CONFIG_SEP; } discovered = configs.split(separator + System.getProperty("line.separator")); for (String config : discovered) { if (config == null || config.isEmpty()) { continue; } String name = getAutoDiscoveryName(config); LOGGER.debug("Attempting to apply config. Name: " + name + "\nconfig: \n" + config); InputStream stream = new ByteArrayInputStream(config.getBytes(UTF_8)); YamlParser yaml = new YamlParser(stream); if (this.addConfig(name, yaml)){ reinit = true; LOGGER.debug("Configuration added succesfully reinit in order"); } else { LOGGER.debug("Unable to apply configuration."); } } return reinit; }
Source:
<code><START> protected boolean isDiskInBackupDomain() { if (!validate(createDiskValidator(getImage()).isDiskPluggedToAnyNonDownVm(false))) { return failValidation( EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); } return true; } <END></code><technical_language>code fix that: protected boolean isDiskInBackupDomain() { // If running VM's disk is moved/copy a backup storage domain if (getStorageDomain().isBackup()) { if (!validate(createDiskValidator(getImage()).isDiskPluggedToAnyNonDownVm(false))) { return failValidation( EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); } } return true; }</technical_language>

Target:
protected boolean isDiskInBackupDomain() { StorageDomain destDomain = storageDomainDao.get(getParameters().getStorageDomainId()); if (getStorageDomain().isBackup()) { if (destDomain.isBackup()) { if (!validate(createDiskValidator(getImage()).isDiskPluggedToAnyNonDownVm(false))) { return failValidation( EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_OR_MOVE_TO_BACKUP_DOMAIN); } } } return true; }
Source:
<code>public void checkValue(String envVar, String operation, String value) throws Exception { switch (operation) { case "is": Assertions.assertThat(envVar).isEqualTo(value); break; case "matches": Assertions.assertThat(envVar).matches(value); break; case "is higher than": if (envVar.matches("^-?\\d+$") && value.matches("^-?\\d+$")) { Assertions.assertThat(Integer.parseInt(envVar)).isGreaterThan(Integer.parseInt(value)); } else { Fail.fail("A number should be provided in order to perform a valid comparison."); } break; case "is lower than": if (envVar.matches("^-?\\d+$") && value.matches("^-?\\d+$")) { Assertions.assertThat(Integer.parseInt(envVar)).isLessThan(Integer.parseInt(value)); } else { Fail.fail("A number should be provided in order to perform a valid comparison."); } break; case "contains": Assertions.assertThat(envVar).contains(value); break; case "is different from": Assertions.assertThat(envVar).isNotEqualTo(value); break; default: <START> Fail.fail("Not a valid comparison."); <END> } }</code><technical_language>echo values</technical_language>

Target:
public void checkValue(String envVar, String operation, String value) throws Exception { switch (operation.toLowerCase()) { case "is": Assertions.assertThat(envVar).isEqualTo(value); break; case "matches": Assertions.assertThat(envVar).matches(value); break; case "is higher than": if (envVar.matches("^-?\\d+$") && value.matches("^-?\\d+$")) { Assertions.assertThat(Integer.parseInt(envVar)).isGreaterThan(Integer.parseInt(value)); } else { Fail.fail("A number should be provided in order to perform a valid comparison."); } break; case "is lower than": if (envVar.matches("^-?\\d+$") && value.matches("^-?\\d+$")) { Assertions.assertThat(Integer.parseInt(envVar)).isLessThan(Integer.parseInt(value)); } else { Fail.fail("A number should be provided in order to perform a valid comparison."); } break; case "contains": Assertions.assertThat(envVar).contains(value); break; case "is different from": Assertions.assertThat(envVar).isNotEqualTo(value); break; default: Fail.fail("Not a valid comparison. Valid ones are: is | matches | is higher than | is lower than | contains | is different from"); } }
Source:
<code>public WriteResponseHandler(Replica replica, WriteType writeType, Runnable callback, long queryStartNanoTime) { <START> this(new ReplicaList(Collections.singleton(replica)), new ReplicaList(), ConsistencyLevel.ONE, null, callback, writeType, queryStartNanoTime); <END> }</code><technical_language>Allocates extra singleton, replica list immutable empty list instead of allocating</technical_language>

Target:
public WriteResponseHandler(Replica replica, WriteType writeType, Runnable callback, long queryStartNanoTime) { this(ReplicaList.of(replica), Replicas.empty(), ConsistencyLevel.ONE, null, callback, writeType, queryStartNanoTime); }
Source:
<code>public void testWithOfflineInstancesLimit() throws Exception { MaintenanceSignal maintenanceSignal = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); Assert.assertNull(maintenanceSignal); checkForRebalanceError(false); int i; for (i = 2; i < 2 + _maxOfflineInstancesAllowed; i++) { _participants.get(i).syncStop(); } boolean result = TestHelper.verify(() -> { MaintenanceSignal ms = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); return ms == null; }, TestHelper.WAIT_DURATION); Assert.assertTrue(result); _participants.get(i).syncStop(); result = TestHelper.verify(() -> { MaintenanceSignal ms =_dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); return ms != null && ms.getReason() != null; }, TestHelper.WAIT_DURATION); <START> checkForRebalanceError(true); <END> }</code><technical_language>Assert</technical_language>

Target:
public void testWithOfflineInstancesLimit() throws Exception { MaintenanceSignal maintenanceSignal = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); Assert.assertNull(maintenanceSignal); checkForRebalanceError(false); int i; for (i = 2; i < 2 + _maxOfflineInstancesAllowed; i++) { _participants.get(i).syncStop(); } boolean result = TestHelper.verify(() -> { MaintenanceSignal ms = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); return ms == null; }, TestHelper.WAIT_DURATION); Assert.assertTrue(result); _participants.get(i).syncStop(); result = TestHelper.verify(() -> { MaintenanceSignal ms =_dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); return ms != null && ms.getReason() != null; }, TestHelper.WAIT_DURATION); Assert.assertTrue(result); checkForRebalanceError(true); }
Source:
<code>public String getTitle() { <START> return title.get(); <END> }</code><technical_language>add this (also below)</technical_language>

Target:
public String getTitle() { return this.title.get(); }
Source:
<code>public synchronized void setupTaskAndConn(final int taskNum) { final Configuration commonConf = Configurations.merge(commonConfigs.getConfiguration(), taskConfigs.getConfiguration()); try { for (int i = 0; i < taskNum; i++) { final String taskId = TASK_ID_PREFIX + taskIdIndex; final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(TaskId.class, taskId); final String serializedConf = confSerializer.toString(Configurations.merge(commonConf, jcb.build())); final TaskRequest taskRequest = TaskRequest.newBuilder() .setTaskId(taskId) .setTaskCpuNum(numTaskCores) .setTaskMemSize(taskMemSize) .setNewRatio(newRatio) .setReservedCodeCacheSize(reservedCodeCacheSize) .setSerializedTaskConfiguration(serializedConf) .build(); taskIdIndex += 1; LOG.log(Level.INFO, "Requesting for a task to the driver... Task ID = {0}", taskId); proxyToDriver.requestNewTask(taskRequest); countDownLatch = new CountDownLatch(1); countDownLatch.await(); } } catch (final AvroRemoteException | InterruptedException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>throw exception</technical_language>

Target:
public synchronized void setupTaskAndConn(final int taskNum) throws AvroRemoteException, InterruptedException { final Configuration commonConf = Configurations.merge(commonConfigs.getConfiguration(), taskConfigs.getConfiguration()); for (int i = 0; i < taskNum; i++) { final String taskId = TASK_ID_PREFIX + taskIdIndex; final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(TaskId.class, taskId); final String serializedConf = confSerializer.toString(Configurations.merge(commonConf, jcb.build())); final TaskRequest taskRequest = TaskRequest.newBuilder() .setTaskId(taskId) .setTaskCpuNum(numTaskCores) .setTaskMemSize(taskMemSize) .setNewRatio(newRatio) .setReservedCodeCacheSize(reservedCodeCacheSize) .setSerializedTaskConfiguration(serializedConf) .build(); taskIdIndex += 1; LOG.log(Level.INFO, "Requesting for a task to the driver... Task ID = {0}", taskId); proxyToDriver.requestNewTask(taskRequest); countDownLatch = new CountDownLatch(1); countDownLatch.await(); } }
Source:
<code>public void onEvent(final PusherEvent event) { <START> System.out.println(String.format("Received event [%s] on channel [%s] with data [%s] and event [%s]", event.toString())); <END> }</code><technical_language>Missing strings fill in placeholders: suggestion System.out.println(String.format("Received event [%s] channel [%s] data [%s] event [%s]", event.getEventName(), event.getChannelName(), event.getData(), event.toString()));</technical_language>

Target:
public void onEvent(final PusherEvent event) { System.out.println(String.format("Received event [%s] on channel [%s] with data [%s] and event [%s]", event.getEventName(), event.getChannelName(), event.getData(), event.toString())); }