auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void before() { final String safeTestName = safeUniqueTestName(getClass(), testName); inputTopicName = "input-topic-" + safeTestName; outputTopicName = "output-topic-" + safeTestName; stateStoreName = "lagfetch-test-store" + safeTestName; streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, "app-" + safeTestName); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 100); consumerConfiguration = new Properties(); consumerConfiguration.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); <START> consumerConfiguration.setProperty(ConsumerConfig.GROUP_ID_CONFIG, safeTestName + "-consumer"); <END> consumerConfiguration.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); consumerConfiguration.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); consumerConfiguration.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class.getName()); }</code><technical_language>else is set "group-" + safeTestName, is this change intentional</technical_language>

Target:
public void before() { final String safeTestName = safeUniqueTestName(getClass(), testName); inputTopicName = "input-topic-" + safeTestName; outputTopicName = "output-topic-" + safeTestName; stateStoreName = "lagfetch-test-store" + safeTestName; streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, "app-" + safeTestName); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 100); consumerConfiguration = new Properties(); consumerConfiguration.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); consumerConfiguration.setProperty(ConsumerConfig.GROUP_ID_CONFIG, "group-" + safeTestName); consumerConfiguration.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); consumerConfiguration.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); consumerConfiguration.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class.getName()); }
Source:
<code>public void testParseField_sequence_value() { Definition fieldDef = fixture.lookupDefinition(SEQ); CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME); long[] values = (long[]) result.getValue(); assertEquals(2, values.length); <START> assertEquals(2, values[0]); <END> assertEquals(2, values[1]); }</code><technical_language>assertArrayEquals(new long[] { 2, 2 }, values);</technical_language>

Target:
public void testParseField_sequence_value() { Definition fieldDef = fixture.lookupDefinition(SEQ); CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME); long[] values = (long[]) result.getValue(); long[] expected = new long[] { 2, 2 }; assertArrayEquals(expected, values); }
Source:
<code>private void setLevel(Level level) { networkInterceptor.level(level); <START> applicationInterceptor.level(level); <END> }</code><technical_language>If good level(...) this time, remove commit. please rebase commit if changes fine :)</technical_language>

Target:
private void setLevel(Level level) { networkInterceptor.setLevel(level); applicationInterceptor.setLevel(level); }
Source:
<code>private boolean executeWithoutTransaction() { boolean functionReturnValue = false; boolean exceptionOccurred = true; try { logRunningCommand(); if (hasTaskHandlers()) { getCurrentTaskHandler().execute(); } else { executeCommand(); } functionReturnValue = getSucceeded(); exceptionOccurred = false; } catch (VdcBLLException e) { log.error(String.format("Command %1$s throw Vdc Bll exception. With error message %2$s", getClass().getName(), e.getMessage())); if (log.isDebugEnabled()) { log.debug(String.format("Command %1$s throw Vdc Bll exception", getClass().getName()), e); } processExceptionToClient(new VdcFault(e, e.getVdsError().getCode())); } catch (RuntimeException e) { processExceptionToClient(new VdcFault(e, VdcBllErrors.ENGINE)); log.error(String.format("Command %1$s throw exception", getClass().getName()), e); } finally { <START> if (exceptionOccurred) { <END> clearChildAsyncTasksWithOutVdsmId(); } if (exceptionOccurred || !getSucceeded()) { setCommandStatus(CommandStatus.FAILED); setSucceeded(false); compensate(); } else { cleanUpCompensationData(); } } return functionReturnValue; }</code><technical_language>reason for this code opposing code clears tasks executeAction()? reason place? (here there) - this solution is problematic some cases, condition in line 1164 (Exception thrown)</technical_language>

Target:
private boolean executeWithoutTransaction() { boolean functionReturnValue = false; boolean exceptionOccurred = true; try { logRunningCommand(); if (hasTaskHandlers()) { getCurrentTaskHandler().execute(); } else { executeCommand(); } functionReturnValue = getSucceeded(); exceptionOccurred = false; } catch (VdcBLLException e) { log.error(String.format("Command %1$s throw Vdc Bll exception. With error message %2$s", getClass().getName(), e.getMessage())); if (log.isDebugEnabled()) { log.debug(String.format("Command %1$s throw Vdc Bll exception", getClass().getName()), e); } processExceptionToClient(new VdcFault(e, e.getVdsError().getCode())); } catch (RuntimeException e) { processExceptionToClient(new VdcFault(e, VdcBllErrors.ENGINE)); log.error(String.format("Command %1$s throw exception", getClass().getName()), e); } finally { if (exceptionOccurred || !getSucceeded()) { clearChildAsyncTasksWithOutVdsmId(); setCommandStatus(CommandStatus.FAILED); setSucceeded(false); compensate(); } else { cleanUpCompensationData(); } } return functionReturnValue; }
Source:
<code>private static PasswordAuthentication getSystemCreds( final AuthScope authscope, final Authenticator.RequestorType requestorType, final HttpContext context) { final String hostname = authscope.getHost(); final int port = authscope.getPort(); final HttpHost origin = authscope.getOrigin(); final String protocol = origin != null ? origin.getSchemeName() : (port == 443 ? "https" : "http"); final URL targetHostURL; if (context != null) { <START> final HttpUriRequest httpUriRequest = (HttpUriRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST); <END> try { targetHostURL = httpUriRequest.getURI().toURL(); } catch (final MalformedURLException e) { throw new IllegalStateException("Unexpected request url format: " + httpUriRequest, e); } } else { targetHostURL = null; } return Authenticator.requestPasswordAuthentication( hostname, null, port, protocol, authscope.getRealm(), translateScheme(authscope.getScheme()), targetHostURL, requestorType); }</code><technical_language>assume request object in context of type of HttpUriRequest. safer generic HttpRequest type here. good me</technical_language>

Target:
private static PasswordAuthentication getSystemCreds( final AuthScope authscope, final Authenticator.RequestorType requestorType, final HttpContext context) { final String hostname = authscope.getHost(); final int port = authscope.getPort(); final HttpHost origin = authscope.getOrigin(); final String protocol = origin != null ? origin.getSchemeName() : (port == 443 ? "https" : "http"); final URL targetHostURL = getTargetHostURL(context); return Authenticator.requestPasswordAuthentication( hostname, null, port, protocol, authscope.getRealm(), translateScheme(authscope.getScheme()), targetHostURL, requestorType); }
Source:
<code>public RenderPipelineTask generateTask() { if (enabled) { return new SetWireframeTask(ENABLED); } else { return new SetWireframeTask(DISABLED); } <START> } <END></code><technical_language>I recommend in this method follow pattern established in BindFBO task generated once. simplicity of boolean case suggest add/modify: private static final RenderPipelineTask enablingTask; private static final RenderPipelineTask disablingTask; public RenderPipelineTask generateTask() { if (enabled) { if(enablingTask == null) { enablingTask = new SetWireframeTask(ENABLED); } return enablingTask; } else { // similar code for disablingTask } }</technical_language>

Target:
public RenderPipelineTask generateTask() { if (enabled) { if (enablingTask == null) { enablingTask = new SetWireframeTask(true); } return enablingTask; } else { if (disablingTask == null) { disablingTask = new SetWireframeTask(false); } return enablingTask; } }
Source:
<code>private void checkDRepresentationDescriptor(DAnalysis dAnalysis) { List<DRepresentation> repList = dAnalysis.eResource().getContents().stream().filter(DRepresentation.class::isInstance).map(DRepresentation.class::cast).collect(Collectors.toList()); dAnalysis.getOwnedViews().stream().flatMap(v -> v.getOwnedRepresentationDescriptors().stream()) .forEachOrdered(repDesc -> { DRepresentation representation = repDesc.getRepresentation(); assertNotNull("DRepresentationDescriptor.representation is null", representation); assertTrue("The DRepresentation " + representation + " is not found as root object.", repList.contains(representation)); assertEquals("The representation documentation has not been migrated.","todo",repDesc.getDocumentation()); assertTrue("The representation name has not been <START> migrated.",repDesc.getName()!=null && !repDesc.getName().isEmpty()); <END> }); }</code><technical_language>StrigUtil</technical_language>

Target:
private void checkDRepresentationDescriptor(DAnalysis dAnalysis) { List<DRepresentation> repList = dAnalysis.eResource().getContents().stream().filter(DRepresentation.class::isInstance).map(DRepresentation.class::cast).collect(Collectors.toList()); dAnalysis.getOwnedViews().stream().flatMap(v -> v.getOwnedRepresentationDescriptors().stream()) .forEachOrdered(repDesc -> { DRepresentation representation = repDesc.getRepresentation(); assertNotNull("DRepresentationDescriptor.representation is null", representation); assertTrue("The DRepresentation " + representation + " is not found as root object.", repList.contains(representation)); assertEquals("The representation documentation has not been migrated.","todo",repDesc.getDocumentation()); assertTrue("The representation name has not been migrated.",!StringUtil.isEmpty(repDesc.getName())); }); }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { int numChunks = 0; for (World world : server.getWorlds()) { numChunks += unloadUnusedChunks(world); } <START> TFM_Util.adminAction(sender.getName(), "Unloading unused chunks", true); <END> if (!senderIsConsole) { sender_p.sendMessage(numChunks + " chunks unloaded."); } TFM_Log.info(numChunks + " chunks unloaded."); return true; }</code><technical_language>Message unloading chunks. :)</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { TFM_Util.adminAction(sender.getName(), "Unloading unused chunks", true); int numChunks = 0; for (World world : server.getWorlds()) { numChunks += unloadUnusedChunks(world); } if (!senderIsConsole) { sender_p.sendMessage(numChunks + " chunks unloaded."); } TFM_Log.info(numChunks + " chunks unloaded."); return true; }
Source:
<code>public void init(IWorkbench workbench) { <START> setDescription("Capra Generic Preferences"); <END> setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, CAPRA_PREFERENCE_PAGE_ID)); }</code><technical_language>of all, string externalized a constant. of all, I if a name for this. "Eclipse Capra UI Preferences", maybe</technical_language>

Target:
public void init(IWorkbench workbench) { setDescription(PREFERENCE_PAGE_DESCRIPTION); setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, CAPRA_PREFERENCE_PAGE_ID)); }
Source:
<code>public void cleanup() { for (Map.Entry<View, int[]> original:mOriginalValues.entrySet()) { final View changedView = original.getKey(); final int[] originalValue = original.getValue(); <START> RelativeLayout.LayoutParams originalParams = (RelativeLayout.LayoutParams) changedView.getLayoutParams(); <END> for (int i = 0; i < originalValue.length; i++) { originalParams.addRule(i, originalValue[i]); } changedView.setLayoutParams(originalParams); } mAlive = false; }</code><technical_language>declare originalParams final (since assigned in block)</technical_language>

Target:
public void cleanup() { for (Map.Entry<View, int[]> original:mOriginalValues.entrySet()) { final View changedView = original.getKey(); final int[] originalValue = original.getValue(); final RelativeLayout.LayoutParams originalParams = (RelativeLayout.LayoutParams) changedView.getLayoutParams(); for (int i = 0; i < originalValue.length; i++) { originalParams.addRule(i, originalValue[i]); } changedView.setLayoutParams(originalParams); } mAlive = false; }
Source:
<code>private static Page somePage(List<Type> types) { <START> int[] initialValues = new int[types.size()]; <END> Arrays.setAll(initialValues, i -> 100 * i); return SequencePageBuilder.createSequencePage(types, 7, initialValues); }</code><technical_language>renaming this newPage()</technical_language>

Target:
private static Page somePage(List<Type> types) { int[] initialValues = new int[types.size()]; Arrays.setAll(initialValues, i -> 100 * i); return createSequencePage(types, 7, initialValues); }
Source:
<code>public KubernetesClient createKubernetesClient() { <START> Config config = new ConfigBuilder() <END> .withMasterUrl(masterUrl) .withUsername(user) .withPassword(password) .build(); return new DefaultKubernetesClient(config); }</code><technical_language>Add final keyword</technical_language>

Target:
public KubernetesClient createKubernetesClient() { final Config config = new ConfigBuilder() .withMasterUrl(masterUrl) .withUsername(user) .withPassword(password) .build(); return new DefaultKubernetesClient(config); }
Source:
<code><START> public String toString() { <END> StringBuilder str = new StringBuilder(); str.append('['); if (this.countArray.length > 0) { str.append(this.countArray[0]); } for (int index = 1; index < this.countArray.length; index++) { str.append(", "); str.append(this.countArray[index]); } str.append(']'); return str.toString(); }</code><technical_language>this need a toString method? use/test it. Arrays.toString(this.countArray) instead of this long method</technical_language>

Target:
public String toString() { updateCount(); return Arrays.toString(this.countArray); }
Source:
<code>public CompletableFuture<PollerResult> execute() { Map<String, Object> props = new HashMap<>(); attributes.forEach(props::put); <START> MonitoredService service = new SimpleMonitoredService(address, serviceName); <END> CompletableFuture<PollerResponse> future = pollerClient.poll() .withService(service) .withMonitorClassName(className) .withTimeToLive(ttlInMs) .withAttributes(props) .execute(); CompletableFuture<PollerResult> result = new CompletableFuture<>(); PollStatus pollStatus; try { PollerResponse pollerResponse = future.get(); pollStatus = pollerResponse.getPollStatus(); switch (Status.valueOf(pollStatus.getStatusName())) { case Up: result.complete(new PollerResultImpl(Status.Up, pollStatus.getProperties())); break; case Down: result.complete(new PollerResultImpl(Status.Down, pollStatus.getReason())); break; case Unknown: result.complete(new PollerResultImpl(Status.Unknown, pollStatus.getReason())); break; case UnResponsive: result.complete(new PollerResultImpl(Status.UnResponsive, pollStatus.getReason())); break; default: result.complete(new PollerResultImpl(Status.Unknown, pollStatus.getReason())); } } catch (InterruptedException | ExecutionException e) { result.complete(new PollerResultImpl(Status.Unknown, e.getMessage())); } return result; }</code><technical_language>execute() method moved out of request client? I encapsulation avoid pass in instance of client request. request builder actual builder returns a request object is accepted a parameter in execute() method moved (or if a idea). This involve updating api interfaces</technical_language>

Target:
public CompletableFuture<PollerResult> execute() { Map<String, Object> props = Collections.unmodifiableMap(attributes); MonitoredService service = new SimpleMonitoredService(address, serviceName); CompletableFuture<PollerResponse> future = pollerClient.poll() .withService(service) .withMonitorClassName(className) .withTimeToLive(ttlInMs) .withAttributes(props) .execute(); CompletableFuture<PollerResult> result = new CompletableFuture<>(); try { PollerResponse pollerResponse = future.get(); result.complete(new PollerResultImpl(pollerResponse.getPollStatus())); } catch (InterruptedException | ExecutionException e) { result.completeExceptionally(e); } return result; }
Source:
<code>public void usingManagementRegistry() throws Exception { CacheConfiguration<Long, String> cacheConfiguration = CacheConfigurationBuilder.newCacheConfigurationBuilder() .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES).build()) .buildConfig(Long.class, String.class); DefaultManagementRegistryConfiguration registryConfiguration = new DefaultManagementRegistryConfiguration().setCacheManagerAlias("myCacheManager"); ManagementRegistry managementRegistry = new DefaultManagementRegistry(registryConfiguration); CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("aCache", cacheConfiguration) .using(managementRegistry) .build(true); Cache<Long, String> aCache = cacheManager.getCache("aCache", Long.class, String.class); aCache.get(0L); aCache.get(0L); aCache.get(0L); Map<String, String> context = createContext(managementRegistry); <START> Collection<Statistic<?, ?>> counters = managementRegistry.withCapability("StatisticsCapability") END> .queryStatistic("GetCounter") .on(context) .build() .execute() .get(0) .getStatistics(); Assert.assertThat(counters.size(), Matchers.is(1)); Counter getCounter = (Counter) counters.iterator().next(); Assert.assertThat(getCounter.getValue(), Matchers.equalTo(3L)); cacheManager.close(); }</code><technical_language>I find DSL readable. build().execute().get(0).getStatistics() a felling I idea kind of objects returned in calls</technical_language>

Target:
public void usingManagementRegistry() throws Exception { CacheConfiguration<Long, String> cacheConfiguration = CacheConfigurationBuilder.newCacheConfigurationBuilder() .withResourcePools(ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES).build()) .buildConfig(Long.class, String.class); DefaultManagementRegistryConfiguration registryConfiguration = new DefaultManagementRegistryConfiguration().setCacheManagerAlias("myCacheManager"); ManagementRegistry managementRegistry = new DefaultManagementRegistry(registryConfiguration); CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .withCache("aCache", cacheConfiguration) .using(managementRegistry) .build(true); Cache<Long, String> aCache = cacheManager.getCache("aCache", Long.class, String.class); aCache.get(0L); aCache.get(0L); aCache.get(0L); Context context = createContext(managementRegistry); ContextualStatistics counters = managementRegistry.withCapability("StatisticsCapability") .queryStatistic("GetCounter") .on(context) .build() .execute() .getSingleResult(); Assert.assertThat(counters.size(), Matchers.is(1)); Counter getCounter = counters.getStatistic(Counter.class); Assert.assertThat(getCounter.getValue(), Matchers.equalTo(3L)); cacheManager.close(); }
Source:
<code>public void setUp() { final HashMap<String, String> keyStoreMap = new HashMap<>(); keyStoreMap.put(CertificateManagerImpl.KEY_STORE_KEY, KEY_STORE_PATH); keyStoreMap.put(CertificateManagerImpl.KEY_STORE_PSWRD_KEY, "changeit"); keyStoreMap.put(CertificateManagerImpl.KEY_STORE_TYPE_KEY, "JKS"); final HashMap<String, String> trustStoreMap = new HashMap<>(); trustStoreMap.put(CertificateManagerImpl.TRUST_STORE_KEY, TRUST_STORE_PATH); <START> trustStoreMap.put(CertificateManagerImpl.TRUST_STORE_PSWRD_KEY, "changeit"); <END> trustStoreMap.put(CertificateManagerImpl.TRUST_STORE_TYPE_KEY, "JKS"); certManager = (CertificateManagerImpl) CertificateManagerImpl.getInstance(keyStoreMap, trustStoreMap); }</code><technical_language>Please change password, descriptive name for constant</technical_language>

Target:
public void setUp() { final HashMap<String, String> keyStoreMap = new HashMap<>(); keyStoreMap.put(CertificateManagerImpl.KEY_STORE_KEY, KEY_STORE_PATH); keyStoreMap.put(CertificateManagerImpl.KEY_STORE_PASSWORD_KEY, "changeit"); keyStoreMap.put(CertificateManagerImpl.KEY_STORE_TYPE_KEY, "JKS"); final HashMap<String, String> trustStoreMap = new HashMap<>(); trustStoreMap.put(CertificateManagerImpl.TRUST_STORE_KEY, TRUST_STORE_PATH); trustStoreMap.put(CertificateManagerImpl.TRUST_STORE_PASSWORD_KEY, "changeit"); trustStoreMap.put(CertificateManagerImpl.TRUST_STORE_TYPE_KEY, "JKS"); certManager = (CertificateManagerImpl) CertificateManagerImpl.getInstance(keyStoreMap, trustStoreMap); }
Source:
<code>public void showDialog(Project project) { this.project = project; getCommitsLog(); selectedRevision = null; view.selectProjectChangesButton(true); view.selectResourceChangesButton(false); showChangesInProject = true; view.selectDiffWithPrevVersionButton(true); diffType = DiffWith.DIFF_WITH_PREV_VERSION; displayCommitA(null); displayCommitB(null); view.setDiffContext(""); view.setCompareType(constant.historyNothingToDisplay()); if (isViewClosed) { workspaceAgent.openPart(this, PartStackType.TOOLING); isViewClosed = false; } <START> partStack.setActivePart(HistoryPresenter.this); <END> }</code><technical_language>simplified partStack.setActivePart(this)</technical_language>

Target:
public void showDialog(Project project) { this.project = project; getCommitsLog(); selectedRevision = null; view.selectProjectChangesButton(true); view.selectResourceChangesButton(false); showChangesInProject = true; view.selectDiffWithPrevVersionButton(true); diffType = DiffWith.DIFF_WITH_PREV_VERSION; displayCommitA(null); displayCommitB(null); view.setDiffContext(""); view.setCompareType(constant.historyNothingToDisplay()); if (isViewClosed) { workspaceAgent.openPart(this, PartStackType.TOOLING); isViewClosed = false; } partStack.setActivePart(this); }
Source:
<code>public void testConcurrentMoveSiblings() throws Exception { final int N = 5; final Fqn X = Fqn.fromString("/x"), Y = Fqn.fromString("/y"); Node<Object, Object> rootNode = treeCache.getRoot(); Node<Object, Object> nodeA = rootNode.addChild(A); nodeA.addChild(X); nodeA.addChild(Y); Node<Object, Object> nodeB = rootNode.addChild(B); Node<Object, Object> nodeC = rootNode.addChild(C); Callable<Object>[] movers = new Callable[N]; for (int i = 0; i < N; i++) { final Fqn source = Fqn.fromRelativeFqn(A, i % 2 == 0 ? X : Y); final Fqn dest = i % 2 == 0 ? B : C; movers[i] = new Callable<Object>() { public Object call() { try { treeCache.move(source, dest); } catch (Exception e) { } return null; } }; } <START> runConcurrently(movers[0], movers[1], Arrays.copyOfRange(movers, 2, movers.length)); <END> log.info("Tree: " + TreeStructureSupport.printTree(treeCache, true)); assertNoLocks(); assertTrue(nodeA.getChildrenNames().contains("x") ^ nodeB.getChildrenNames().contains("x")); assertTrue(nodeA.getChildrenNames().contains("y") ^ nodeC.getChildrenNames().contains("y")); }</code><technical_language>runConcurrently(Callable[])</technical_language>

Target:
public void testConcurrentMoveSiblings() throws Exception { final int N = 5; final Fqn X = Fqn.fromString("/x"), Y = Fqn.fromString("/y"); Node<Object, Object> rootNode = treeCache.getRoot(); Node<Object, Object> nodeA = rootNode.addChild(A); nodeA.addChild(X); nodeA.addChild(Y); Node<Object, Object> nodeB = rootNode.addChild(B); Node<Object, Object> nodeC = rootNode.addChild(C); Callable<Object>[] movers = new Callable[N]; for (int i = 0; i < N; i++) { final Fqn source = Fqn.fromRelativeFqn(A, i % 2 == 0 ? X : Y); final Fqn dest = i % 2 == 0 ? B : C; movers[i] = new Callable<Object>() { public Object call() { try { treeCache.move(source, dest); } catch (Exception e) { } return null; } }; } runConcurrently(movers); log.info("Tree: " + TreeStructureSupport.printTree(treeCache, true)); assertNoLocks(); assertTrue(nodeA.getChildrenNames().contains("x") ^ nodeB.getChildrenNames().contains("x")); assertTrue(nodeA.getChildrenNames().contains("y") ^ nodeC.getChildrenNames().contains("y")); }
Source:
<code>private ChangeDetail cherryPickRest(Id id, String message, String destBranch, IProgressMonitor monitor) throws GerritException { String url = "/changes/" + id.getParentKey() + "/revisions/" + id.get() + "/cherrypick"; CherryPickInput input = new CherryPickInput(message, destBranch); ChangeInfo result = executePostRestRequest(url, input, ChangeInfo.class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { String errorMsg = getResponseBodyAsString(method); if (isNotPermitted(method, errorMsg)) { errorMsg = NLS.bind("Cannot cherry pick: {0}", errorMsg); } else if (isConflict(method)) { errorMsg = NLS.bind("Request Conflict: {0}", errorMsg); } else if (isBadRequest(method)) { errorMsg = NLS.bind("Bad Request: {0}", errorMsg); } throw new GerritException(errorMsg); } private String getResponseBodyAsString(HttpMethodBase method) { try { return method.getResponseBodyAsString(); } catch (IOException e) { return null; } } private boolean isNotPermitted(HttpMethodBase method, String msg) { return method.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN <START> && "cherry pick not permitted\n".equals(msg); END> } private boolean isConflict(HttpMethodBase method) { return method.getStatusCode() == HttpURLConnection.HTTP_CONFLICT; } private boolean isBadRequest(HttpMethodBase method) { return method.getStatusCode() == HttpURLConnection.HTTP_BAD_REQUEST; } }, monitor); return getChangeDetail(result.getNumber(), monitor); }</code><technical_language>slightly fragile check if msg.toLowerCase().startsWith("cherry pick permitted")</technical_language>

Target:
private ChangeDetail cherryPickRest(Id id, String message, String destBranch, IProgressMonitor monitor) throws GerritException { String url = "/changes/" + id.getParentKey() + "/revisions/" + id.get() + "/cherrypick"; CherryPickInput input = new CherryPickInput(message, destBranch); ChangeInfo result = executePostRestRequest(url, input, ChangeInfo.class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { String errorMsg = getResponseBodyAsString(method); if (isNotPermitted(method, errorMsg)) { errorMsg = NLS.bind("Cannot cherry pick: {0}", errorMsg); } else if (isConflict(method)) { errorMsg = NLS.bind("Request Conflict: {0}", errorMsg); } else if (isBadRequest(method)) { errorMsg = NLS.bind("Bad Request: {0}", errorMsg); } throw new GerritException(errorMsg); } private String getResponseBodyAsString(HttpMethodBase method) { try { return method.getResponseBodyAsString(); } catch (IOException e) { return null; } } private boolean isNotPermitted(HttpMethodBase method, String msg) { return method.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN && msg.toLowerCase().startsWith("cherry pick not permitted"); } private boolean isConflict(HttpMethodBase method) { return method.getStatusCode() == HttpURLConnection.HTTP_CONFLICT; } private boolean isBadRequest(HttpMethodBase method) { return method.getStatusCode() == HttpURLConnection.HTTP_BAD_REQUEST; } }, monitor); return getChangeDetail(result.getNumber(), monitor); }
Source:
<code>public List<String> getBrokersForTable( @ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName, @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr, @ApiParam(value = "ONLINE|OFFLINE") @QueryParam("state") String state) { try { List<String> tableNamesWithType = _pinotHelixResourceManager .getExistingTableNamesWithType(tableName, Constants.validateTableType(tableTypeStr)); if (tableNamesWithType.isEmpty()) { <START> throw new ControllerApplicationException(LOGGER, String.format("Table [%s] not found.", tableName), <END> Response.Status.NOT_FOUND); } Set<String> tableBrokers = new HashSet<>(_pinotHelixResourceManager.getBrokerInstancesFor(tableNamesWithType.get(0))); applyStateChanges(tableBrokers, state); return ImmutableList.copyOf(tableBrokers); } catch (TableNotFoundException e) { throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.NOT_FOUND); } catch (IllegalArgumentException e) { throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.FORBIDDEN); } }</code><technical_language>nit: suggestion throw new ControllerApplicationException(LOGGER, String.format("Table '%s' found.", tableName),</technical_language>

Target:
public List<String> getBrokersForTable( @ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName, @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr, @ApiParam(value = "ONLINE|OFFLINE") @QueryParam("state") String state) { try { List<String> tableNamesWithType = _pinotHelixResourceManager .getExistingTableNamesWithType(tableName, Constants.validateTableType(tableTypeStr)); if (tableNamesWithType.isEmpty()) { throw new ControllerApplicationException(LOGGER, String.format("Table '%s' not found.", tableName), Response.Status.NOT_FOUND); } Set<String> tableBrokers = new HashSet<>(_pinotHelixResourceManager.getBrokerInstancesFor(tableNamesWithType.get(0))); applyStateChanges(tableBrokers, state); return ImmutableList.copyOf(tableBrokers); } catch (TableNotFoundException e) { throw new ControllerApplicationException(LOGGER, String.format("Table '%s' not found.", tableName), Response.Status.NOT_FOUND); } catch (IllegalArgumentException e) { throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.FORBIDDEN); } }
Source:
<code>private void cannedReply(String message) { final PatchLineComment newComment = newComment(); newComment.setMessage(message); <START> CommentEditorPanel p = createEditor(newComment, false); <END> if (p == null) { PatchUtil.DETAIL_SVC.saveDraft(newComment, new GerritCallback<PatchLineComment>() { public void onSuccess(final PatchLineComment result) { enableButtons(true); notifyDraftDelta(1); createEditor(result, true).setOpen(false); } @Override public void onFailure(Throwable caught) { enableButtons(true); super.onFailure(caught); } }); } else { if (!p.isOpen()) { p.setOpen(true); } p.setFocus(true); } }</code><technical_language>want a findEditor() method is in createEditor()</technical_language>

Target:
private void cannedReply(String message) { final PatchLineComment newComment = newComment(); newComment.setMessage(message); CommentEditorPanel p = createEditor(newComment, false); if (p == null) { enableButtons(false); PatchUtil.DETAIL_SVC.saveDraft(newComment, new GerritCallback<PatchLineComment>() { public void onSuccess(final PatchLineComment result) { enableButtons(true); notifyDraftDelta(1); createEditor(result, true).setOpen(false); } @Override public void onFailure(Throwable caught) { enableButtons(true); super.onFailure(caught); } }); } else { if (!p.isOpen()) { p.setOpen(true); } p.setFocus(true); } }
Source:
<code>public void cleanEnvironment() throws Exception { System.clearProperty("java.security.auth.login.config"); <START> try { <END> ArrayList<Starter<?>> reversedStarters = new ArrayList<>(STARTERS.values()); Collections.reverse(reversedStarters); for (Starter<?> starter : reversedStarters) { starter.stop(); } zookeeper.close(); logger.info("Environment cleaned"); } catch (Exception e) { logger.error("Exception during environment cleaning", e); } }</code><technical_language>here, I move KafkaStarter :></technical_language>

Target:
public void cleanEnvironment() throws Exception { try { ArrayList<Starter<?>> reversedStarters = new ArrayList<>(STARTERS.values()); Collections.reverse(reversedStarters); for (Starter<?> starter : reversedStarters) { starter.stop(); } zookeeper.close(); logger.info("Environment cleaned"); } catch (Exception e) { logger.error("Exception during environment cleaning", e); } }
Source:
<code>public static String bytesToHex(byte[] data) { if (data == null) { return null; } int len = data.length; String str = ""; for (int i = 0; i < len; i++) { if ((data[i] & 0xFF) < 16) { <START> str = str + "0" + java.lang.Integer.toHexString(data[i] & 0xFF); <END> } else { str = str + java.lang.Integer.toHexString(data[i] & 0xFF); } } return str; }</code><technical_language>"java.lang." prefix is needed</technical_language>

Target:
public static String bytesToHex(byte[] data) { if (data == null) { return null; } int len = data.length; String str = ""; for (int i = 0; i < len; i++) { if ((data[i] & 0xFF) < 16) { str = str + "0" + Integer.toHexString(data[i] & 0xFF); } else { str = str + Integer.toHexString(data[i] & 0xFF); } } return str; }
Source:
<code><START> public void start() <END> { ScheduledExecutors.scheduleAtFixedRate( processingExecutor, Period.ZERO.toStandardDuration(), Period.millis(100).toStandardDuration(), new Runnable() { @Override public void run() { processSegmentChangeRequest(); } } ); }</code><technical_language>started this up. need stop in stop method. do this calling scheduleAtFixedRate method a Callable instead of a Runnable. check some state return Signal.REPEAT Signal.STOP</technical_language>

Target:
public void start() { ScheduledExecutors.scheduleAtFixedRate( processingExecutor, config.getLoadQueuePeonRepeatDelay(), config.getLoadQueuePeonRepeatDelay(), new Callable<ScheduledExecutors.Signal>() { @Override public ScheduledExecutors.Signal call() { processSegmentChangeRequest(); if (stopped) { return ScheduledExecutors.Signal.STOP; } else { return ScheduledExecutors.Signal.REPEAT; } } } ); }
Source:
<code>private static AggregationConfiguration getAggregationConfigurationForSSP() { return AggregationConfiguration.newBuilder() .addAggregationClient(SynchronizationManager.AGGREGATION_CLIENT_NAME, SynchronizationManager.MessageHandler.class, WorkerSynchronizer.MessageHandler.class) .addAggregationClient(WorkerConstants.AGGREGATION_CLIENT_NAME, DriverSideMetricsMsgHandlerForWorker.class, EvalSideMetricsMsgHandlerForWorker.class) .addAggregationClient(ServerConstants.AGGREGATION_CLIENT_NAME, DriverSideMetricsMsgHandlerForServer.class, <START> EvalSideMetricsMsgHandlerForServer.class) <END> .addAggregationClient(ClockManager.AGGREGATION_CLIENT_NAME, ClockManager.MessageHandler.class, SSPWorkerClock.MessageHandler.class) .build(); }</code><technical_language>Line 374-383 388-397 same. remove duplicates? Incremental building of aggregation configuration solution</technical_language>

Target:
private static AggregationConfiguration getAggregationConfigurationForSSP() { return getAggregationConfigurationDefaultBuilder() .addAggregationClient(ClockManager.AGGREGATION_CLIENT_NAME, ClockManager.MessageHandler.class, SSPWorkerClock.MessageHandler.class) .build(); }
Source:
<code>private void initRenderGraph() { RenderGraph renderGraph = new RenderGraph(); addShadowMapNodes(renderGraph); addReflectionNodes(renderGraph); addSkyNodes(renderGraph); addWorldRenderingNodes(renderGraph); addLightingNodes(renderGraph); addRefractiveReflectiveNode(renderGraph); add3dDecorationNodes(renderGraph); addPrePostProcessingNodes(renderGraph); addPostProcessingNodes(renderGraph); <START> addImageToSceeenNodes(renderGraph); <END> renderTaskListGenerator = new RenderTaskListGenerator(); List<Node> orderedNodes = renderGraph.getNodesInTopologicalOrder(); renderPipelineTaskList = renderTaskListGenerator.generateFrom(orderedNodes); }</code><technical_language>I realize meant in terms of splitting render graph in smaller functions. =) ok did, I mind, for splitting render graph in smaller -nodes- do with, say, separating "vignette" functionality bloom functionality currently in shader. converting some of this functionality specialized operations simple compositing operations, compositing nodes, a bit done for blur nodes. for know. =)</technical_language>

Target:
private void initRenderGraph() { RenderGraph renderGraph = new RenderGraph(); addShadowMapNodes(renderGraph); addReflectionNodes(renderGraph); addSkyNodes(renderGraph); addWorldRenderingNodes(renderGraph); addLightingNodes(renderGraph); addRefractiveReflectiveNode(renderGraph); add3dDecorationNodes(renderGraph); addPrePostProcessingNodes(renderGraph); addPostProcessingNodes(renderGraph); addCopyOutputNodes(renderGraph); renderTaskListGenerator = new RenderTaskListGenerator(); List<Node> orderedNodes = renderGraph.getNodesInTopologicalOrder(); renderPipelineTaskList = renderTaskListGenerator.generateFrom(orderedNodes); }
Source:
<code>ConfigurationPanel(ExportConfiguration initialConfiguration, ConfigurationPanelForm form) { this.form = form; configuration = initialConfiguration.copy(); configuration.ifExportDirPresent(form::setExportDir); configuration.ifPemFilePresent(form::setPemFile); configuration.ifStartDatePresent(form::setStartDate); configuration.ifEndDatePresent(form::setEndDate); configuration.ifPullBeforePresent(form::setPullBefore); configuration.ifPullBeforeOverridePresent(form::setPullBeforeOverride); form.onSelectExportDir(path -> { configuration.setExportDir(path); triggerOnChange(); }); form.onSelectPemFile(path -> { <START> if (path == null) { <END> configuration.removePemFile(); } else { configuration.setPemFile(path); } triggerOnChange(); }); form.onSelectDateRangeStart(date -> { configuration.setStartDate(date); triggerOnChange(); }); form.onSelectDateRangeEnd(date -> { configuration.setEndDate(date); triggerOnChange(); }); form.onChangePullBefore(pullBefore -> { configuration.setPullBefore(pullBefore); triggerOnChange(); }); form.onChangePullBeforeOverride(pullBeforeOverrideOption -> { configuration.setPullBeforeOverride(pullBeforeOverrideOption); triggerOnChange(); }); }</code><technical_language>other callbacks conditionals... This null checks done setPemFile(path)</technical_language>

Target:
ConfigurationPanel(ExportConfiguration initialConfiguration, ConfigurationPanelForm form) { this.form = form; configuration = initialConfiguration.copy(); configuration.ifExportDirPresent(form::setExportDir); configuration.ifPemFilePresent(form::setPemFile); configuration.ifStartDatePresent(form::setStartDate); configuration.ifEndDatePresent(form::setEndDate); configuration.ifPullBeforePresent(form::setPullBefore); configuration.ifPullBeforeOverridePresent(form::setPullBeforeOverride); configuration.ifOverwriteExistingFilesPresent(form::setOverwriteExistingFiles); form.onSelectExportDir(path -> { configuration.setExportDir(path); triggerOnChange(); }); form.onSelectPemFile(path -> { configuration.setPemFile(path); triggerOnChange(); }); form.onSelectDateRangeStart(date -> { configuration.setStartDate(date); triggerOnChange(); }); form.onSelectDateRangeEnd(date -> { configuration.setEndDate(date); triggerOnChange(); }); form.onChangePullBefore(pullBefore -> { configuration.setPullBefore(pullBefore); triggerOnChange(); }); form.onChangePullBeforeOverride(pullBeforeOverrideOption -> { configuration.setPullBeforeOverride(pullBeforeOverrideOption); triggerOnChange(); }); form.onChangeOverwriteExistingFiles(overwriteExistingFiles -> { configuration.setOverwriteExistingFiles(overwriteExistingFiles); triggerOnChange(); }); }
Source:
<code><START> public PersonMetrics(PersonService personService) { <END> this.personService = personService; }</code><technical_language>muss dies public sein oder recht package private</technical_language>

Target:
PersonMetrics(PersonService personService) { this.personService = personService; }
Source:
<code>public static Type getReturnType(int functionId) { <START> for (FunctionDescriptor func : FunctionDescriptor.m_defined_functions.values()) { <END> if (func.getId() == functionId) { return func.getDataType(); } } return null; }</code><technical_language>search performance terrible, ways</technical_language>

Target:
public static Type getReturnType(int functionId) { return m_defined_functions_by_id.get(functionId).getDataType(); }
Source:
<code>public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve) throws AlgoliaException { try { JSONArray requests = new JSONArray(); for (String id : objectIDs) { JSONObject request = new JSONObject(); request.put("indexName", this.indexName); request.put("objectID", id); request.put("attributesToRetrieve", encodeAttributes(attributesToRetrieve, false)); requests.put(request); } JSONObject body = new JSONObject(); body.put("requests", requests); return client.postRequest("/1/indexes/*/objects", body.toString(), false, false); } catch (JSONException e) { throw new AlgoliaException(e.getMessage()); } catch (UnsupportedEncodingException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>put in AlgoliaException</technical_language>

Target:
public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve) throws AlgoliaException { try { JSONArray requests = new JSONArray(); for (String id : objectIDs) { JSONObject request = new JSONObject(); request.put("indexName", this.indexName); request.put("objectID", id); request.put("attributesToRetrieve", encodeAttributes(attributesToRetrieve, false)); requests.put(request); } JSONObject body = new JSONObject(); body.put("requests", requests); return client.postRequest("/1/indexes/*/objects", body.toString(), false, false); } catch (JSONException e) { throw new AlgoliaException(e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } }
Source:
<code>private SSLEngineResult.HandshakeStatus unwrap(SocketChannel socketChannel, SSLEngine engine) throws IOException { if (socketChannel.read(m_netEncData) < 0) { if (engine.isInboundDone() && engine.isOutboundDone()) { return null; } try { engine.closeInbound(); } catch (SSLException e) { } engine.closeOutbound(); return engine.getHandshakeStatus(); } m_netEncData.flip(); SSLEngineResult.HandshakeStatus hs; SSLEngineResult res; try { res = engine.unwrap(m_netEncData, m_netClearData); m_netEncData.compact(); hs = res.getHandshakeStatus(); } catch (SSLException e) { <START> System.err.println("unwrap: see ssl exception " + e.getMessage()); <END> engine.closeOutbound(); return engine.getHandshakeStatus(); } switch (res.getStatus()) { case OK: break; case BUFFER_OVERFLOW: m_netClearData = ByteBuffer.allocate(m_netClearData.capacity() * 2);; break; case BUFFER_UNDERFLOW: break; case CLOSED: if (engine.isOutboundDone()) { return null; } else { engine.closeOutbound(); hs = engine.getHandshakeStatus(); } break; } return hs; }</code><technical_language>system out please. log it</technical_language>

Target:
private SSLEngineResult.HandshakeStatus unwrap(SocketChannel socketChannel, SSLEngine engine) throws IOException { if (socketChannel.read(m_encrypted) < 0) { if (engine.isInboundDone() && engine.isOutboundDone()) { return null; } try { engine.closeInbound(); } catch (SSLException e) { } engine.closeOutbound(); return engine.getHandshakeStatus(); } m_encrypted.flip(); SSLEngineResult.HandshakeStatus hs; SSLEngineResult res; try { res = engine.unwrap(m_encrypted, m_clear); m_encrypted.compact(); hs = res.getHandshakeStatus(); } catch (SSLException e) { engine.closeOutbound(); throw e; } switch (res.getStatus()) { case OK: break; case BUFFER_OVERFLOW: m_clear = ByteBuffer.allocate(m_clear.capacity() << 1); break; case BUFFER_UNDERFLOW: break; case CLOSED: if (engine.isOutboundDone()) { return null; } else { engine.closeOutbound(); hs = engine.getHandshakeStatus(); } break; } return hs; }
Source:
<code>public List<Bitstream> getBitstreams(Context context, Process process, String type) { List<Bitstream> allBitstreams = process.getBitstreams(); if (type == null) { return allBitstreams; } else { List<Bitstream> filteredBitstreams = new ArrayList<>(); for (Bitstream bitstream : allBitstreams) { <START> if (StringUtils.equals(bitstreamService.getMetadata(bitstream, "dspace.process.type"), type)) { <END> filteredBitstreams.add(bitstream); } } return filteredBitstreams; } }</code><technical_language>Small thing, I if dspace.process.type a constant, remember this field is called. This is a required change though, PR proceed it</technical_language>

Target:
public List<Bitstream> getBitstreams(Context context, Process process, String type) { List<Bitstream> allBitstreams = process.getBitstreams(); if (type == null) { return allBitstreams; } else { List<Bitstream> filteredBitstreams = new ArrayList<>(); for (Bitstream bitstream : allBitstreams) { if (StringUtils.equals(bitstreamService.getMetadata(bitstream, Process.BITSTREAM_TYPE_METADATAFIELD), type)) { filteredBitstreams.add(bitstream); } } return filteredBitstreams; } }
Source:
<code>public void cache_instance_of_StorageFactory_in_production() { <START> Supplier<StorageFactory> productionSupplier = spy(inMemorySupplier); <END> storageFactorySwitch.init(productionSupplier, inMemorySupplier); Environment.getInstance().setToProduction(); storageFactorySwitch.get(); storageFactorySwitch.get(); verify(productionSupplier, times(1)).get(); }</code><technical_language>final</technical_language>

Target:
public void cache_instance_of_StorageFactory_in_production() { final Supplier<StorageFactory> productionSupplier = spy(inMemorySupplier); storageFactorySwitch.init(productionSupplier, inMemorySupplier); Environment.getInstance().setToProduction(); storageFactorySwitch.get(); storageFactorySwitch.get(); verify(productionSupplier, times(1)).get(); }
Source:
<code>public void getOnlyRequestedAttributes() { Set<String> requestedAttributes = new HashSet<>(); requestedAttributes.add("attribute1"); Set<AttributeDescriptor> onlyRequestedAttributes = CsvTransformer.getOnlyRequestedAttributes( metacardList, requestedAttributes, Collections.emptySet()); assertThat(onlyRequestedAttributes, hasSize(1)); <START> final String name = onlyRequestedAttributes.stream().findFirst().get().getName(); <END> assertThat(name, is("attribute1")); }</code><technical_language>This assertion result of findFirst() is present calling get() checking inside</technical_language>

Target:
public void getOnlyRequestedAttributes() { Set<String> requestedAttributes = new HashSet<>(); requestedAttributes.add("attribute1"); Set<AttributeDescriptor> onlyRequestedAttributes = CsvTransformer.getOnlyRequestedAttributes(metacardList, requestedAttributes); assertThat(onlyRequestedAttributes, hasSize(1)); final Optional<AttributeDescriptor> attributeDescriptorOptional = onlyRequestedAttributes.stream().findFirst(); assertThat(attributeDescriptorOptional.isPresent(), is(true)); final AttributeDescriptor attributeDescriptor = attributeDescriptorOptional.get(); assertThat(attributeDescriptor, notNullValue()); final String name = attributeDescriptor.getName(); assertThat(name, is("attribute1")); }