auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private String shortenPackage(final String pkg) { <END> final int sep = pkg.indexOf('/'); return sep == -1 ? "" : pkg.substring(sep + 1); }</code><technical_language>suggestion private static String shortenPackage(final String pkg) {</technical_language>

Target:
private static String shortenPackage(final String pkg) { final int sep = pkg.indexOf('/'); return sep == -1 ? "" : pkg.substring(sep + 1); }
Source:
<code>public void testTelemetryStoresUpAndDownEvents() throws Exception { TestUtils.assertMemoryLeak(() -> { serverConfiguration = new PropServerConfiguration(temp.getRoot().getAbsolutePath(), new Properties()) { @Override public CairoConfiguration getCairoConfiguration() { <START> return new DefaultCairoConfiguration(root); <END> } }; configuration = serverConfiguration.getCairoConfiguration(); messageBus = new MessageBusImpl(serverConfiguration); CairoEngine engine = new CairoEngine(configuration, messageBus); TelemetryJob telemetryJob = new TelemetryJob(serverConfiguration, engine, messageBus); Misc.free(telemetryJob); final String expectedEvent = "100\n" + "101\n"; assertColumn(expectedEvent, "telemetry", 1); final String expectedOrigin = "1\n" + "1\n"; assertColumn(expectedOrigin, "telemetry", 2); Misc.free(engine); }); }</code><technical_language>existing configuration instance</technical_language>

Target:
public void testTelemetryStoresUpAndDownEvents() throws Exception { TestUtils.assertMemoryLeak(() -> { serverConfiguration = new PropServerConfiguration(temp.getRoot().getAbsolutePath(), new Properties()) { @Override public CairoConfiguration getCairoConfiguration() { return configuration; } }; configuration = serverConfiguration.getCairoConfiguration(); messageBus = new MessageBusImpl(serverConfiguration); CairoEngine engine = new CairoEngine(configuration, messageBus); TelemetryJob telemetryJob = new TelemetryJob(serverConfiguration, engine, messageBus); Misc.free(telemetryJob); final String expectedEvent = "100\n" + "101\n"; assertColumn(expectedEvent, "telemetry", 1); final String expectedOrigin = "1\n" + "1\n"; assertColumn(expectedOrigin, "telemetry", 2); Misc.free(engine); }); }
Source:
<code>private void testFocus(final boolean withOOPath) { final String str = "package org.kie.test\n" + "global java.util.List list\n" + "rule rule1\n" + "agenda-group \"badfocus\"" + "when\n" + (withOOPath ? " Integer(/intValue{this > 0})\n" : " Integer(intValue > 0)\n") + "then\n" + " list.add( 1 );\n" + "end\n" + "\n"; final KieBase kbase = new KieHelper().addContent(str, ResourceType.DRL).build(); final KieSession ksession = KieServices.get().getStoreServices().newKieSession(kbase, null, env); final List<?> list = new ArrayList<>(); ksession.setGlobal("list", list); ksession.insert(1); ksession.insert(2); <START> ksession.insert(3); <END> ksession.getAgenda().getAgendaGroup("badfocus").setFocus(); ksession.fireAllRules(); assertEquals(3, list.size()); }</code><technical_language>Is 3 3 below? If so, a constant</technical_language>

Target:
private void testFocus(final boolean withOOPath) { final String str = "package org.kie.test\n" + "global java.util.List list\n" + "rule rule1\n" + "agenda-group \"badfocus\"" + "when\n" + (withOOPath ? " Integer(/intValue{this > 0})\n" : " Integer(intValue > 0)\n") + "then\n" + " list.add( 1 );\n" + "end\n" + "\n"; final KieBase kbase = new KieHelper().addContent(str, ResourceType.DRL).build(); final KieSession ksession = KieServices.get().getStoreServices().newKieSession(kbase, null, env); final List<Integer> list = new ArrayList<>(); ksession.setGlobal("list", list); insertIntRange(ksession, 1, 3); ksession.getAgenda().getAgendaGroup("badfocus").setFocus(); ksession.fireAllRules(); assertThat(list).hasSize(3); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_inventory_explorer); <START> toolbar = (Toolbar) findViewById(R.id.toolbar); <END> callback = new PerformOperationCallback(); setUpToolbar(); ViewGroup containerView = (ViewGroup) findViewById(R.id.container); root = TreeNode.root(); holder = root.getViewHolder(); tView = new AndroidTreeView(this, root); tView.setDefaultAnimation(true); tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom); tView.setDefaultViewHolder(IconTreeItemHolder.class); tView.setDefaultNodeClickListener(nodeClickListener); tView.setDefaultNodeLongClickListener(nodeLongClickListener); containerView.addView(tView.getView()); BackendClient.of(this).getFeeds(new FeedsCallback()); if (savedInstanceState != null) { String state = savedInstanceState.getString("tState"); if (!TextUtils.isEmpty(state)) { tView.restoreState(state); } } }</code><technical_language>@pg301 Hawkular Android Client ButterKnife for binding UI. means @BindView(R.id.id_of_item) UI instance ButterKnife.bind(this, getView()); please visit [sample](<LINK_0> clearer understanding Happy Open Source</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_inventory_explorer); callback = new PerformOperationCallback(); setUpBindings(); setUpToolbar(); ViewGroup containerView = (ViewGroup) findViewById(R.id.container); root = TreeNode.root(); holder = root.getViewHolder(); tView = new AndroidTreeView(this, root); tView.setDefaultAnimation(true); tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom); tView.setDefaultViewHolder(IconTreeItemHolder.class); tView.setDefaultNodeClickListener(nodeClickListener); tView.setDefaultNodeLongClickListener(nodeLongClickListener); containerView.addView(tView.getView()); BackendClient.of(this).getFeeds(new FeedsCallback()); if (savedInstanceState != null) { String state = savedInstanceState.getString("tState"); if (!TextUtils.isEmpty(state)) { tView.restoreState(state); } } }
Source:
<code>protected void onPause() { <START> if(isReceiverRegistered) { <END> LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver); isReceiverRegistered =false; } super.onPause(); }</code><technical_language>need for if here, registration occur in onCreate onResume, onPause is called receiver registered</technical_language>

Target:
protected void onPause() { LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver); isReceiverRegistered = false; super.onPause(); }
Source:
<code>public void onChange(ConfigChangeEvent changeEvent) { System.out.println("Changes for namespace " + changeEvent.getNamespace()); <START> for (String key : changeEvent.changedKeys()) { <END> ConfigChange change = changeEvent.getChange(key); if (change.getPropertyName().equals(url.getServiceKey() + Constants.CONFIGURATORS_SUFFIX)) { listener.process(change.getNewValue(), ConfigType.CONFIGURATORS, getChangeType(change.getChangeType())); } else if (change.getPropertyName().equals(url.getParameter(Constants.APPLICATION_KEY) + Constants.CONFIGURATORS_SUFFIX)) { listener.process(change.getNewValue(), ConfigType.CONFIGURATORS, getChangeType(change.getChangeType())); } else if (change.getPropertyName().equals(url.getServiceKey() + Constants.ROUTERS_SUFFIX)) { listener.process(change.getNewValue(), ConfigType.ROUTERS, getChangeType(change.getChangeType())); } System.out.println(String.format("Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType())); } }</code><technical_language>next version of apollo-client provide api appConfig. addChangeListener(someListener, someInterestedKeys) listener called interested keys changed. Right now, ConfigChangeEvent#isChanged check some key is changed in this event</technical_language>

Target:
public void onChange(ConfigChangeEvent changeEvent) { for (String key : changeEvent.changedKeys()) { ConfigChange change = changeEvent.getChange(key); if (change.getPropertyName().endsWith(Constants.CONFIGURATORS_SUFFIX)) { listener.process(new org.apache.dubbo.config.dynamic.ConfigChangeEvent(key, change.getNewValue(), ConfigType.CONFIGURATORS, getChangeType(change.getChangeType()))); } else if (change.getPropertyName().endsWith(Constants.ROUTERS_SUFFIX)) { listener.process(new org.apache.dubbo.config.dynamic.ConfigChangeEvent(key, change.getNewValue(), ConfigType.ROUTERS, getChangeType(change.getChangeType()))); } } }
Source:
<code>public <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit) { long requestId = requests.newRequestId(); logRequest(requestId, command, targets); if (targets.isEmpty()) { return CompletableFuture.completedFuture(collector.finish()); } Address excludedTarget = deliverOrder == DeliverOrder.TOTAL ? null : getAddress(); MultiTargetRequest<T> request = new MultiTargetRequest<>(collector, requestId, requests, targets, excludedTarget); <START> if (!request.isDone()) { <END> try { addRequest(request); boolean checkView = request.onNewView(clusterView.getMembersSet()); sendCommand(targets, command, requestId, deliverOrder, isRsvpCommand(command), checkView); } catch (Throwable t) { request.cancel(true); throw t; } if (timeout > 0) { request.setTimeout(timeoutExecutor, timeout, unit); } } return request; }</code><technical_language>I suggest if (request.isDone() return request; avoid indenting rest of method</technical_language>

Target:
public <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit) { long requestId = requests.newRequestId(); logRequest(requestId, command, targets); if (targets.isEmpty()) { return CompletableFuture.completedFuture(collector.finish()); } Address excludedTarget = deliverOrder == DeliverOrder.TOTAL ? null : getAddress(); MultiTargetRequest<T> request = new MultiTargetRequest<>(collector, requestId, requests, targets, excludedTarget); if (request.isDone()) { return request; } try { addRequest(request); boolean checkView = request.onNewView(clusterView.getMembersSet()); sendCommand(targets, command, requestId, deliverOrder, isRsvpCommand(command), checkView); } catch (Throwable t) { request.cancel(true); throw t; } if (timeout > 0) { request.setTimeout(timeoutExecutor, timeout, unit); } return request; }
Source:
<code>void should_fail_if_actual_is_null() { <START> assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> throwables.assertHasMessageNotContaining(someInfo(), null, "Throwable")) <END> .withMessage(actualIsNull()); }</code><technical_language>I created AssertionUtil a class provides shortcut test assertion error, replace assertThatExceptionOfType(AssertionError.class).isThrownBy assertThatAssertionErrorIsThrownBy</technical_language>

Target:
void should_fail_if_actual_is_null() { assertThatAssertionErrorIsThrownBy( () -> throwables.assertHasMessageNotContaining(someInfo(), null, "Throwable")) .withMessage(actualIsNull()); }
Source:
<code>public void testThrottlingWhenAllJobsAreKnown() { final int NUM_JOBS = 100; final int MAX_THREADS = 10; TestJob[] jobs = new TestJob[NUM_JOBS]; final JobGroup jobGroup = new JobGroup("JobGroup", MAX_THREADS, NUM_JOBS); final int[] maxThreadsUsed = new int[1]; final TestBarrier barrier = new TestBarrier(); for (int i = 0; i < NUM_JOBS; i++) { jobs[i] = new TestJob("TestJob", 1000000, 10); jobs[i].setJobGroup(jobGroup); jobs[i].schedule(); } maxThreadsUsed[0] = 0; final Thread t = new Thread(() -> { barrier.setStatus(TestBarrier.STATUS_RUNNING); while (jobGroup.getState() != JobGroup.NONE) { List<TestJob> runningJobs = new ArrayList<>(); <START> for (Job job1 : jobGroup.getActiveJobs()) { <END> if (job1.getState() == Job.RUNNING) { runningJobs.add((TestJob) job1); } } int runningJobsSize = runningJobs.size(); if (runningJobsSize > maxThreadsUsed[0]) { maxThreadsUsed[0] = runningJobsSize; } for (Job job2 : runningJobs) { job2.cancel(); waitForCompletion(job2); } } barrier.setStatus(TestBarrier.STATUS_DONE); }); assertEquals("1.0", JobGroup.ACTIVE, jobGroup.getState()); t.start(); barrier.waitForStatus(TestBarrier.STATUS_RUNNING); barrier.waitForStatus(TestBarrier.STATUS_DONE); assertEquals("2.0", JobGroup.NONE, jobGroup.getState()); assertTrue("3.0", maxThreadsUsed[0] > 0); assertTrue("4.0", maxThreadsUsed[0] <= MAX_THREADS); }</code><technical_language>jobs1 -> activeJob</technical_language>

Target:
public void testThrottlingWhenAllJobsAreKnown() { final int NUM_JOBS = 100; final int MAX_THREADS = 10; TestJob[] jobs = new TestJob[NUM_JOBS]; final JobGroup jobGroup = new JobGroup("JobGroup", MAX_THREADS, NUM_JOBS); final int[] maxThreadsUsed = new int[1]; final TestBarrier barrier = new TestBarrier(); for (int i = 0; i < NUM_JOBS; i++) { jobs[i] = new TestJob("TestJob", 1000000, 10); jobs[i].setJobGroup(jobGroup); jobs[i].schedule(); } maxThreadsUsed[0] = 0; final Thread t = new Thread(() -> { barrier.setStatus(TestBarrier.STATUS_RUNNING); while (jobGroup.getState() != JobGroup.NONE) { List<TestJob> runningJobs = new ArrayList<>(); for (Job activeJob : jobGroup.getActiveJobs()) { if (activeJob.getState() == Job.RUNNING) { runningJobs.add((TestJob) activeJob); } } int runningJobsSize = runningJobs.size(); if (runningJobsSize > maxThreadsUsed[0]) { maxThreadsUsed[0] = runningJobsSize; } for (Job runningJob : runningJobs) { runningJob.cancel(); waitForCompletion(runningJob); } } barrier.setStatus(TestBarrier.STATUS_DONE); }); assertEquals("1.0", JobGroup.ACTIVE, jobGroup.getState()); t.start(); barrier.waitForStatus(TestBarrier.STATUS_RUNNING); barrier.waitForStatus(TestBarrier.STATUS_DONE); assertEquals("2.0", JobGroup.NONE, jobGroup.getState()); assertTrue("3.0", maxThreadsUsed[0] > 0); assertTrue("4.0", maxThreadsUsed[0] <= MAX_THREADS); }
Source:
<code>public synchronized CompletableFuture<Void> stop() { if (closeFuture != null) { return closeFuture; } metadataService.removeNode(clusterService.getLocalNode()); closeFuture = primitives.stop() .thenComposeAsync(v -> partitions.close(), context) .thenComposeAsync(v -> corePartitionGroup.close(), context) .thenComposeAsync(v -> clusterMessagingService.stop(), context) .thenComposeAsync(v -> clusterEventingService.stop(), context) .thenComposeAsync(v -> clusterService.stop(), context) .thenComposeAsync(v -> metadataService.stop(), context) .thenComposeAsync(v -> messagingService.stop(), context) .thenRunAsync(() -> { <START> executorService.shutdown(); <END> context.close(); started.set(false); LOGGER.info("Stopped"); }); return closeFuture; }</code><technical_language>graceful executor shutdown? java executorService.shutdown(); // Disable new tasks submitted try { // Wait a while for existing tasks terminate if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) { logger.info("Timeout elapsed termination, forcing shutdown"); List<Runnable> tasksAwaitingExecution = executorService.shutdownNow(); // Cancel currently executing tasks logger.info("Tasks awaiting execution forced shutdown: " + tasksAwaitingExecution.size()); // Wait a while for tasks respond cancelled if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) { logger.error("Pool terminate"); } } } catch (InterruptedException ie) { logger.error("Exception occurred while shutting thread pool", ie); // (Re-)Cancel if current thread interrupted executorService.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } logger.info("Thread pool shutdown complete");</technical_language>

Target:
public synchronized CompletableFuture<Void> stop() { if (shutdownHook != null) { try { Runtime.getRuntime().removeShutdownHook(shutdownHook); shutdownHook = null; } catch (IllegalStateException e) { } } return doStop(); }
Source:
<code>protected String enableLogicalVolume(String lvName) throws EucalyptusCloudException { EucalyptusCloudException ex = null; String result = null; int attempt = 1; final int max_attempts = 9; int timeout = 10; final int timeout_multiplier = 4; do { try { result = LVMWrapper.enableLogicalVolume(lvName); if (attempt > 1) { LOG.info("Enabling " + lvName + "succeeded on retry."); } } catch (EucalyptusCloudException ece) { ex = ece; LOG.error(ece + ", retrying..."); LVMWrapper.scanPhysicalVolume(lvName); try { Thread.sleep(timeout); } catch (InterruptedException ie) { LOG.error(ie); break; } timeout *= timeout_multiplier; } } while (attempt++ < max_attempts); if (ex != null) { <START> throw ex; <END> } return result; }</code><technical_language>This operation exception out logical volume is enabled. If logical volume is enabled a retry attempt, ex hold a valid reference some exception a previous attempt</technical_language>

Target:
protected String enableLogicalVolume(String lvName) throws EucalyptusCloudException { EucalyptusCloudException ex = null; String result = null; int attempt = 1; final int max_attempts = 9; int timeout = 10; final int timeout_multiplier = 4; do { try { LOG.trace("Enabling logical volume " + lvName + ", attempt " + attempt); result = LVMWrapper.enableLogicalVolume(lvName); ex = null; if (attempt > 1) { LOG.info("Enabling " + lvName + "succeeded on retry attempt " + attempt); } } catch (EucalyptusCloudException ece) { ex = ece; LOG.warn("Failed to enable logical volume " + lvName + " on attempt " + attempt, ece); LVMWrapper.scanPhysicalVolume(lvName); try { Thread.sleep(timeout); } catch (InterruptedException ie) { LOG.error(ie); break; } timeout *= timeout_multiplier; } } while (attempt++ < max_attempts); if (ex != null) { LOG.error("Failed to enable logical volume " + lvName + ", all retries exhausted."); throw ex; } return result; }
Source:
<code>private MapContext prepareContext(Position position) { MapContext result = new MapContext(); Method[] methods = position.getClass().getMethods(); for (Method method : methods) { if (method.getName().startsWith("get") && method.getParameterTypes().length == 0 && !method.getName().equals("getClass")) { <START> String name = method.getName().substring(3, 4).toLowerCase() + method.getName().substring(4); <END> try { if (!method.getReturnType().equals(Map.class)) { result.set(name, method.invoke(position)); } else { for (Object key : ((Map) method.invoke(position)).keySet()) { result.set((String) key, ((Map) method.invoke(position)).get(key)); } } } catch (IllegalAccessException | InvocationTargetException error) { Log.warning(error); } } } return result; }</code><technical_language>do a small optimization Character.toLowerCase(...) method a single char</technical_language>

Target:
private MapContext prepareContext(Position position) { MapContext result = new MapContext(); Set<Method> methods = new HashSet<>(Arrays.asList(position.getClass().getMethods())); methods.removeAll(Arrays.asList(Object.class.getMethods())); for (Method method : methods) { if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) { String name = Character.toLowerCase(method.getName().charAt(3)) + method.getName().substring(4); try { if (!method.getReturnType().equals(Map.class)) { result.set(name, method.invoke(position)); } else { for (Object key : ((Map) method.invoke(position)).keySet()) { result.set((String) key, ((Map) method.invoke(position)).get(key)); } } } catch (IllegalAccessException | InvocationTargetException error) { Log.warning(error); } } } return result; }
Source:
<code>public void moveSprintPlan(IProject project, IUserSession session, int oldId, int newId) { List<ISprintPlanDesc> descs = this.loadListPlans(); this.moveSprint(oldId, newId); ProductBacklogHelper PBHelper = new ProductBacklogHelper(session, project); Map<String, ArrayList<IIssue>> map = PBHelper.getSprintHashMap(); <START> ArrayList<Integer> list = new ArrayList<Integer>(); <END> if (oldId > newId) { for (int i = newId; i <= oldId; i++) { if (this.isSprintPlan(descs, i)) list.add(i); } } else { for (int i = 0; i <= newId - oldId; i++) { if (this.isSprintPlan(descs, newId - i)) list.add(newId - i); } } ProductBacklogLogic productBacklogLogic = new ProductBacklogLogic( session, project); if (list.size() != 0) { for (int i = 0; i < list.size(); i++) { if ((i + 1) != list.size()) { String sprintID = String.valueOf(list.get(i)); String nextSprintID = String.valueOf(list.get(i + 1)); List<IIssue> stories = map.get(sprintID); if (stories != null) { ArrayList<Long> total = convertTolong(stories); productBacklogLogic.addIssueToSprint(total, nextSprintID); } } else { String sprintID = String.valueOf(list.get(i)); String nextSprintID = String.valueOf(list.get(0)); List<IIssue> stories = map.get(sprintID); if (stories != null) { ArrayList<Long> total = convertTolong(stories); productBacklogLogic.addIssueToSprint(total, nextSprintID); } } } } }</code><technical_language>naming</technical_language>

Target:
public void moveSprintPlan(IProject project, IUserSession session, int oldId, int newId) { List<ISprintPlanDesc> descs = loadListPlans(); moveSprint(oldId, newId); ProductBacklogHelper PBHelper = new ProductBacklogHelper(session, project); Map<String, ArrayList<IIssue>> map = PBHelper.getSprintHashMap(); ArrayList<Integer> sprintsId = new ArrayList<Integer>(); if (oldId > newId) { for (int i = newId; i <= oldId; i++) { if (isSprintPlan(descs, i)) sprintsId.add(i); } } else { for (int i = 0; i <= newId - oldId; i++) { if (isSprintPlan(descs, newId - i)) sprintsId.add(newId - i); } } ProductBacklogLogic productBacklogLogic = new ProductBacklogLogic( session, project); if (sprintsId.size() != 0) { for (int i = 0; i < sprintsId.size(); i++) { if ((i + 1) != sprintsId.size()) { String sprintID = String.valueOf(sprintsId.get(i)); String nextSprintID = String.valueOf(sprintsId.get(i + 1)); List<IIssue> stories = map.get(sprintID); if (stories != null) { ArrayList<Long> total = convertToLong(stories); productBacklogLogic.addIssueToSprint(total, nextSprintID); } } else { String sprintID = String.valueOf(sprintsId.get(i)); String nextSprintID = String.valueOf(sprintsId.get(0)); List<IIssue> stories = map.get(sprintID); if (stories != null) { ArrayList<Long> total = convertToLong(stories); productBacklogLogic.addIssueToSprint(total, nextSprintID); } } } } }
Source:
<code>private Integer getLastBuildNumberWithHistory(String planKey, int buildNumber) { while (true) { ResultsSummary lastBuild = Optional.ofNullable(resultsSummaryManager.findLastBuildResultBefore( planKey, buildNumber)).orElseThrow( <START> () -> new RuntimeException("Could not found a previous buildId with the history artifact.")); <END> if (historyArtifactExists(planKey, lastBuild.getBuildNumber())) { return lastBuild.getBuildNumber(); } else { buildNumber = lastBuild.getBuildNumber(); } } }</code><technical_language>return Optional.empty instead</technical_language>

Target:
private Optional<Integer> getLastBuildNumberWithHistory(String planKey, int buildNumber) { int currentBuild = buildNumber; do { ResultsSummary lastBuild = resultsSummaryManager.findLastBuildResultBefore(planKey, currentBuild); if (Objects.isNull(lastBuild)) { return Optional.empty(); } currentBuild = lastBuild.getBuildNumber(); } while (!historyArtifactExists(planKey, currentBuild)); return Optional.of(currentBuild); }
Source:
<code>public void commit(TransactionService transactionService) { if (state.get() == State.COMMITTED) { return; } if (state.get() == State.FAILED) { throw new IllegalStateException("this transaction has already failed"); } while (true) { Preconditions.checkState(state.get() == State.UNCOMMITTED, "Transaction must be uncommitted."); if (state.compareAndSet(State.UNCOMMITTED, State.COMMITTING)) { break; } } if (getTransactionType() == TransactionType.AGGRESSIVE_HARD_DELETE || getTransactionType() == TransactionType.HARD_DELETE) { cleaner.queueCellsForScrubbing(getCellsToQueueForScrubbing(), getStartTimestamp()); } boolean success = false; try { if (numWriters.get() > 0) { throw new IllegalStateException("Cannot commit while other threads are still calling put."); } checkConstraints(); commitWrites(transactionService); long transactionMillis = TimeUnit.NANOSECONDS.toMillis(transactionTimerContext.stop()); <START> if (perfLogger.isDebugEnabled()) { <END> perfLogger.debug("Committed transaction in {}ms", getStartTimestamp(), transactionMillis); } success = true; } finally { state.set(success ? State.COMMITTED : State.FAILED); } }</code><technical_language>nit: move this a line if want</technical_language>

Target:
public void commit(TransactionService transactionService) { if (state.get() == State.COMMITTED) { return; } if (state.get() == State.FAILED) { throw new IllegalStateException("this transaction has already failed"); } while (true) { Preconditions.checkState(state.get() == State.UNCOMMITTED, "Transaction must be uncommitted."); if (state.compareAndSet(State.UNCOMMITTED, State.COMMITTING)) { break; } } if (getTransactionType() == TransactionType.AGGRESSIVE_HARD_DELETE || getTransactionType() == TransactionType.HARD_DELETE) { cleaner.queueCellsForScrubbing(getCellsToQueueForScrubbing(), getStartTimestamp()); } boolean success = false; try { if (numWriters.get() > 0) { throw new IllegalStateException("Cannot commit while other threads are still calling put."); } checkConstraints(); commitWrites(transactionService); if (perfLogger.isDebugEnabled()) { long transactionMillis = TimeUnit.NANOSECONDS.toMillis(transactionTimerContext.stop()); perfLogger.debug("Committed transaction in {}ms", getStartTimestamp(), transactionMillis); } success = true; } finally { state.set(success ? State.COMMITTED : State.FAILED); } }
Source:
<code>public Set<AgentIdentity> selectAgent(User user, Set<AgentIdentity> allFreeAgents, int agentCount) { Set<AgentIdentity> userAgent = new HashSet<>(); for (AgentIdentity each : allFreeAgents) { String region = ((AgentControllerIdentityImplementation) each).getRegion(); <START> if (StringUtils.endsWith(region, "owned_" + user.getUserId())) { <END> userAgent.add(each); if (userAgent.size() == agentCount) { return userAgent; } } } for (AgentIdentity each : allFreeAgents) { String region = ((AgentControllerIdentityImplementation) each).getRegion(); if (!StringUtils.contains(region, "owned_")) { userAgent.add(each); if (userAgent.size() == agentCount) { return userAgent; } } } return userAgent; }</code><technical_language>stream here</technical_language>

Target:
public Set<AgentIdentity> selectAgent(User user, Set<AgentIdentity> allFreeAgents, int agentCount) { Stream<AgentIdentity> ownedFreeAgentStream = allFreeAgents.stream().filter(isOwnedAgent.apply(user.getUserId())); Stream<AgentIdentity> freeAgentStream = allFreeAgents.stream().filter(isCommonAgent); return Stream.concat(ownedFreeAgentStream, freeAgentStream) .limit(agentCount) .collect(toSet()); }
Source:
<code>public CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery> getCacheStrategy(final SegmentMetadataQuery query) { return new CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery>() { @Override public boolean isCacheable(SegmentMetadataQuery query, boolean willMergeRunners) { return true; } @Override public byte[] computeCacheKey(SegmentMetadataQuery query) { SegmentMetadataQuery updatedQuery = query.withFinalizedAnalysisTypes(config); byte[] includerBytes = updatedQuery.getToInclude().getCacheKey(); byte[] analysisTypesBytes = updatedQuery.getAnalysisTypesCacheKey(); return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) .put(SEGMENT_METADATA_CACHE_PREFIX) .put(includerBytes) .put(analysisTypesBytes) .array(); } @Override public TypeReference<SegmentAnalysis> getCacheObjectClazz() { return getResultTypeReference(); } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForResultLevelCache() { return prepareForCache(); <START> } <END> @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromResultLevelCache() { return pullFromCache(); } }; }</code><technical_language>default implementations in CacheStrategy interface , repeated</technical_language>

Target:
public CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery> getCacheStrategy(final SegmentMetadataQuery query) { return new CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery>() { @Override public boolean isCacheable(SegmentMetadataQuery query, boolean willMergeRunners) { return true; } @Override public byte[] computeCacheKey(SegmentMetadataQuery query) { SegmentMetadataQuery updatedQuery = query.withFinalizedAnalysisTypes(config); byte[] includerBytes = updatedQuery.getToInclude().getCacheKey(); byte[] analysisTypesBytes = updatedQuery.getAnalysisTypesCacheKey(); return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) .put(SEGMENT_METADATA_CACHE_PREFIX) .put(includerBytes) .put(analysisTypesBytes) .array(); } @Override public TypeReference<SegmentAnalysis> getCacheObjectClazz() { return getResultTypeReference(); } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForCache(boolean isResultLevelCache) { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromCache(boolean isResultLevelCache) { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } }; }
Source:
<code>public void deleteAllTimelinesForEventType(final String eventTypeName) throws TopicDeletionException, TimelineException, NotFoundException { LOG.info("Deleting all timelines for event type {}", eventTypeName); final List<Timeline> timelines = getTimelines(eventTypeName); <START> for (final Timeline timeline:timelines) { <END> final TopicRepository topicRepository = getTopicRepositoryForTimeline(timeline); topicRepository.deleteTopic(timeline.getTopic()); timelineDbRepository.deleteTimeline(timeline.getId()); } }</code><technical_language>spaces missing ":"</technical_language>

Target:
public Multimap<TopicRepository, String> deleteAllTimelinesForEventType(final String eventTypeName) throws TopicDeletionException, TimelineException, NotFoundException, InternalNakadiException, NoSuchEventTypeException { LOG.info("Deleting all timelines for event type {}", eventTypeName); final Multimap<TopicRepository, String> topicsToDelete = ArrayListMultimap.create(); for (final Timeline timeline : getActiveTimelinesOrdered(eventTypeName)) { topicsToDelete.put(getTopicRepository(timeline), timeline.getTopic()); timelineDbRepository.deleteTimeline(timeline.getId()); } return topicsToDelete; }
Source:
<code><START> private String createIntermediateTableForeignKeyActionId() { <END> if (DbConnectionFactory.isMySql()) { return MYSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } else if (DbConnectionFactory.isPostgres()) { return POSTGRES_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } else if (DbConnectionFactory.isMsSql()) { return MSSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } else if (DbConnectionFactory.isOracle()) { return ORACLE_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } return H2_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Reduce number of returns of this method 5, maximum allowed 3. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private String createIntermediateTableForeignKeyActionId() { String sql = H2_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; if (DbConnectionFactory.isMySql()) { sql = MYSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } else if (DbConnectionFactory.isPostgres()) { sql = POSTGRES_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } else if (DbConnectionFactory.isMsSql()) { sql = MSSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } else if (DbConnectionFactory.isOracle()) { sql = ORACLE_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEY_ACTION_ID; } return sql; }
Source:
<code>public static void fhirResourceGetPatientEverything(String resourceName) throws IOException, URISyntaxException { CloudHealthcare client = createClient(); HttpClient httpClient = HttpClients.createDefault(); String uri = String.format( <START> "%sv1beta1/%s/$everything", client.getRootUrl(), resourceName); <END> URIBuilder uriBuilder = new URIBuilder(uri) .setParameter("access_token", getAccessToken()); HttpUriRequest request = RequestBuilder .get(uriBuilder.build()) .addHeader("Content-Type", "application/json-patch+json") .addHeader("Accept-Charset", "utf-8") .addHeader("Accept", "application/fhir+json; charset=utf-8") .build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { System.err.print(String.format( "Exception getting patient everythingresource: %s\n", response.getStatusLine().toString())); responseEntity.writeTo(System.err); throw new RuntimeException(); } System.out.println("FHIR resource search results: "); responseEntity.writeTo(System.out); }</code><technical_language>s.b. v1 v1beta1</technical_language>

Target:
public static void fhirResourceGetPatientEverything(String resourceName) throws IOException, URISyntaxException { CloudHealthcare client = createClient(); HttpClient httpClient = HttpClients.createDefault(); String uri = String.format( "%sv1/%s/$everything", client.getRootUrl(), resourceName); URIBuilder uriBuilder = new URIBuilder(uri) .setParameter("access_token", getAccessToken()); HttpUriRequest request = RequestBuilder .get(uriBuilder.build()) .addHeader("Content-Type", "application/json-patch+json") .addHeader("Accept-Charset", "utf-8") .addHeader("Accept", "application/fhir+json; charset=utf-8") .build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { System.err.print(String.format( "Exception getting patient everythingresource: %s\n", response.getStatusLine().toString())); responseEntity.writeTo(System.err); throw new RuntimeException(); } System.out.println("FHIR resource search results: "); responseEntity.writeTo(System.out); }
Source:
<code>public Function<Group, Object> makeJsonQueryExtractor(String expr) { <START> return null; <END> }</code><technical_language>I throw exception</technical_language>

Target:
public Function<Group, Object> makeJsonQueryExtractor(String expr) { throw new UnsupportedOperationException("Parquet does not support JQ"); }
Source:
<code><START> private boolean isIsUnsignedIntegerField(String lengthName) { <END> IDeclaration decl = getCurrentScope().rLookupIdentifier(lengthName); if (decl instanceof IntegerDeclaration) { return !((IntegerDeclaration) decl).isSigned(); } return false; }</code><technical_language>"is" "is unsigned" = false is a double-negative. a bit clearer call "isSigned" (and drop ! in return clause)</technical_language>

Target:
private boolean isIsUnsignedIntegerField(String lengthName) { IDeclaration decl = getCurrentScope().lookupIdentifierRecursive(lengthName); if (decl instanceof IntegerDeclaration) { return !((IntegerDeclaration) decl).isSigned(); } return false; }
Source:
<code>private void checkTagsThatSupportEscaping(ASTElement node, Object data) { final List<ASTAttribute> attributes = node.findChildrenOfType(ASTAttribute.class); final Set<ASTElExpression> toReport = new HashSet<>(); boolean isUnescaped = false; boolean isEL = false; boolean hasPlaceholders = false; for (ASTAttribute attr : attributes) { String name = attr.getName().toLowerCase(); switch (name) { case ESCAPE: case ITEM_ESCAPED: final ASTText text = attr.getFirstDescendantOfType(ASTText.class); if (text != null) { if (text.getImage().equalsIgnoreCase(FALSE)) { isUnescaped = true; } } break; case VALUE: case ITEM_VALUE: final List<ASTElExpression> elsInVal = attr.findDescendantsOfType(ASTElExpression.class); for (ASTElExpression el : elsInVal) { if (doesElContainAnyUnescapedIdentifiers(el, ESCAPING.HTMLENCODE)) { isEL = true; toReport.add(el); } } final ASTText textValue = attr.getFirstDescendantOfType(ASTText.class); if (textValue != null) { <START> if (Pattern.compile("\\{(\\w|,|\\.|'|:|\\s)*\\}").matcher(textValue.getImage()).matches()) { <END> hasPlaceholders = true; } } break; default: break; } } if (hasPlaceholders && isUnescaped) { for (ASTElExpression expr : hasELInInnerElements(node)) { addViolation(data, expr); } } if (isEL && isUnescaped) { for (ASTElExpression expr : toReport) { addViolation(data, expr); } } }</code><technical_language>consider moving compiled pattern a static final field. Regex compilation is a slow process done fly, specially for constant patterns</technical_language>

Target:
private void checkTagsThatSupportEscaping(ASTElement node, Object data) { final List<ASTAttribute> attributes = node.findChildrenOfType(ASTAttribute.class); final Set<ASTElExpression> toReport = new HashSet<>(); boolean isUnescaped = false; boolean isEL = false; boolean hasPlaceholders = false; for (ASTAttribute attr : attributes) { String name = attr.getName().toLowerCase(); switch (name) { case ESCAPE: case ITEM_ESCAPED: final ASTText text = attr.getFirstDescendantOfType(ASTText.class); if (text != null) { if (text.getImage().equalsIgnoreCase(FALSE)) { isUnescaped = true; } } break; case VALUE: case ITEM_VALUE: final List<ASTElExpression> elsInVal = attr.findDescendantsOfType(ASTElExpression.class); for (ASTElExpression el : elsInVal) { if (startsWithSafeResource(el)) { continue; } if (doesElContainAnyUnescapedIdentifiers(el, Escaping.HTMLENCODE)) { isEL = true; toReport.add(el); } } final ASTText textValue = attr.getFirstDescendantOfType(ASTText.class); if (textValue != null) { if (PLACEHOLDERS.matcher(textValue.getImage()).matches()) { hasPlaceholders = true; } } break; default: break; } } if (hasPlaceholders && isUnescaped) { for (ASTElExpression expr : hasELInInnerElements(node)) { addViolation(data, expr); } } if (isEL && isUnescaped) { for (ASTElExpression expr : toReport) { addViolation(data, expr); } } }
Source:
<code>private static String decryptPasswordAES(String encodedPassword) { <START> String decryptedPassword = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM) <END> .decrypt(encodedPassword); return decryptedPassword; }</code><technical_language>return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(encodedPassword); method of encryptPasswordAES</technical_language>

Target:
private static String decryptPasswordAES(String encodedPassword) { return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(encodedPassword); }
Source:
<code>public Object setRoleAndVariable(ProceedingJoinPoint joinPoint) throws Throwable { if (isInAHttpRequest()) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); DataSource dataSource = jdbcTemplate.getJdbcTemplate().getDataSource(); Connection connection = DataSourceUtils.getConnection(dataSource); boolean mustCheck = false; String formattedOrgIds = ""; if (DataSourceUtils.isConnectionTransactional(connection, dataSource)) { mustCheck = !isCurrentlyInAPublicUrlRequest() && isLoggedUser() && !isAdmin(); if (mustCheck) { Set<Integer> orgIds = new TreeSet<>(organizationRepository.findAllOrganizationIdForUser(SecurityContextHolder.getContext().getAuthentication().getName())); formattedOrgIds = orgIds.stream().map(s -> Integer.toString(s)).collect(Collectors.joining(",", "'{", "}'")); jdbcTemplate.update("set local role application_user", new EmptySqlParameterSource()); jdbcTemplate.update("set local alfio.checkRowAccess = true", new EmptySqlParameterSource()); jdbcTemplate.update("set local alfio.currentUserOrgs = " + formattedOrgIds, new EmptySqlParameterSource()); } } <START> if (log.isDebugEnabled()) { <END> logEntry(connection, dataSource, joinPoint, request, mustCheck, formattedOrgIds); } } return joinPoint.proceed(); }</code><technical_language>IMO print information a TRACE level</technical_language>

Target:
public Object setRoleAndVariable(ProceedingJoinPoint joinPoint) throws Throwable { if (isInAHttpRequest()) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); DataSource dataSource = jdbcTemplate.getJdbcTemplate().getDataSource(); Connection connection = DataSourceUtils.getConnection(dataSource); boolean mustCheck = false; String formattedOrgIds = ""; if (DataSourceUtils.isConnectionTransactional(connection, dataSource)) { mustCheck = !isCurrentlyInAPublicUrlRequest() && isLoggedUser() && !isAdmin(); if (mustCheck) { Set<Integer> orgIds = new TreeSet<>(organizationRepository.findAllOrganizationIdForUser(SecurityContextHolder.getContext().getAuthentication().getName())); formattedOrgIds = orgIds.stream().map(s -> Integer.toString(s)).collect(Collectors.joining(",", "'{", "}'")); jdbcTemplate.update("set local role application_user", new EmptySqlParameterSource()); jdbcTemplate.update("set local alfio.checkRowAccess = true", new EmptySqlParameterSource()); jdbcTemplate.update("set local alfio.currentUserOrgs = " + formattedOrgIds, new EmptySqlParameterSource()); } } if (log.isTraceEnabled()) { logEntry(connection, dataSource, joinPoint, request, mustCheck, formattedOrgIds); } } return joinPoint.proceed(); }
Source:
<code>protected void onInit() { super.onInit(); if (this.clustered) { Assert.state(this.addresses.length == this.adminAddresses.length && this.addresses.length == this.nodes.length, "'addresses', 'adminAddresses', and 'nodes' properties must have equal length"); this.connectionFactory = new LocalizedQueueConnectionFactory(this.connectionFactory, this.addresses, <START> this.adminAddresses, this.nodes, this.vhost, this.username, this.password); <END> } }</code><technical_language>useSSL sslPropertiesLocation propagated here</technical_language>

Target:
protected void onInit() { super.onInit(); if (this.clustered) { Assert.state(this.addresses.length == this.adminAddresses.length && this.addresses.length == this.nodes.length, "'addresses', 'adminAddresses', and 'nodes' properties must have equal length"); this.connectionFactory = new LocalizedQueueConnectionFactory(this.connectionFactory, this.addresses, this.adminAddresses, this.nodes, this.vhost, this.username, this.password, this.useSSL, this.sslPropertiesLocation); } }
Source:
<code><START> public String toString() { <END> return "Added in: " + startCommit.abbreviate(7) + ", Revisions:" + numbers.length; }</code><technical_language>Missing @Override</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append('^'); builder.append(commit.abbreviate(7).name()); builder.append(' ').append('('); PersonIdent author = commit.getAuthorIdent(); builder.append(author.getName()); builder.append(' '); final SimpleDateFormat format; format = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z", Locale.US); format.setTimeZone(author.getTimeZone()); builder.append(format.format(author.getWhen())); builder.append(' '); builder.append(number + 1); builder.append(')'); return builder.toString(); }
Source:
<code>void ctor_v4() { try { AAAARecord ar = new AAAARecord(m_an, DClass.IN, m_ttl, InetAddress.getByName("192.168.1.1")); assertEquals("::ffff:192.168.1.1", ar.rrToString()); <START> } catch (UnknownHostException ignore) { <END> } }</code><technical_language>Please add a throws UnknownHostException method level instead silently catching (event if happen)</technical_language>

Target:
void ctor_v4() throws UnknownHostException { AAAARecord ar = new AAAARecord(m_an, DClass.IN, m_ttl, InetAddress.getByName("192.168.1.1")); assertEquals("::ffff:192.168.1.1", ar.rrToString()); }
Source:
<code>protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } <START> if (!glusterVolume.isOnline()) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SHOULD_BE_STARTED); return false; } if (glusterVolume.getAsyncTask() == null || glusterVolume.getAsyncTask().getType() != GlusterTaskType.REBALANCE_VOLUME || glusterVolume.getAsyncTask().getStatus() != JobExecutionStatus.STARTED) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REBALANCE_NOT_STARTED); return false; } return true; }</code><technical_language>move this check superclass</technical_language>

Target:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } if (glusterVolume.getAsyncTask() == null || glusterVolume.getAsyncTask().getType() != GlusterTaskType.REBALANCE_VOLUME || glusterVolume.getAsyncTask().getStatus() != JobExecutionStatus.STARTED) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REBALANCE_NOT_STARTED); return false; } return true; }
Source:
<code>private void updateText() { if (img != null) { if (img.isDeleted()) { putValue(NAME, tr("Undelete Image")); <START> putValue(SHORT_DESCRIPTION, tr("Unmark whole imguence for deletion ")); <END> } else { putValue(NAME, tr("Delete Image")); putValue(SHORT_DESCRIPTION, tr("Mark whole imguence for deletion ")); } } else { putValue(NAME, tr("Delete Image")); putValue(SHORT_DESCRIPTION, tr("Mark whole imguence for deletion ")); } }</code><technical_language>is imguence? image sequence? sequence? (there a more occurrences)</technical_language>

Target:
private void updateText() { if (img != null) { if (img.isDeleted()) { putValue(NAME, tr("Undelete Image")); putValue(SHORT_DESCRIPTION, tr("Unmark image for deletion")); } else { putValue(NAME, tr("Delete Image")); putValue(SHORT_DESCRIPTION, tr("Mark image for deletion")); } } else { putValue(NAME, tr("Delete Image")); putValue(SHORT_DESCRIPTION, tr("Mark image for deletion")); } }
Source:
<code>public boolean canDecode(final String path) { final String toDecode; if (AbstractFeatureReader.hasBlockCompressedExtension(path)) { toDecode = path.substring(0, path.lastIndexOf(".")); } else { toDecode = path; } <START> return toDecode.toLowerCase().endsWith(".bed"); <END> }</code><technical_language>While here, expose this a static constant</technical_language>

Target:
public boolean canDecode(final String path) { final String toDecode; if (AbstractFeatureReader.hasBlockCompressedExtension(path)) { toDecode = path.substring(0, path.lastIndexOf(".")); } else { toDecode = path; } return toDecode.toLowerCase().endsWith(BED_EXTENSION); }
Source:
<code>public void onLogout() { AsyncQuery query = new AsyncQuery(); query.setHandleFailure(true); query.setModel(this); query.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { if (clientAgentType.isIE8OrBelow()) { Window.Location.reload(); } frontend.clearLoggedInUser(); <START> ApplicationInit.super.performLogout(); <END> connectAutomaticallyManager.resetAlreadyOpened(); } }; frontend.logoffAsync(frontend.getLoggedInUser(), query); }</code><technical_language>Small nit-pick: I guess "ApplicationInit.super" necessary here</technical_language>

Target:
public void onLogout() { AsyncQuery query = new AsyncQuery(); query.setHandleFailure(true); query.setModel(this); query.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { if (clientAgentType.isIE8OrBelow()) { Window.Location.reload(); } frontend.clearLoggedInUser(); performLogout(); connectAutomaticallyManager.resetAlreadyOpened(); } }; frontend.logoffAsync(frontend.getLoggedInUser(), query); }
Source:
<code>public void tearDown() { if (morphline != null) { Notifications.notifyShutdown(morphline); Notifications.notifyShutdown(morphline); <START> morphline = null; <END> } }</code><technical_language>call super.tearDown()</technical_language>

Target:
public void tearDown() throws Exception { if (morphline != null) { Notifications.notifyShutdown(morphline); Notifications.notifyShutdown(morphline); morphline = null; } super.tearDown(); }