auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setBufferLineLimit(int bufferLines) { int chars = bufferLines * CHARS_PER_LINE_AVG; setWaterMarks(chars, chars + HIGH_WATERMARK_OFFSET_BYTES); <START> } <END></code><technical_language>Done in patchset 11</technical_language>

Target:
private void setBufferLineLimit(int bufferLines) { int chars = bufferLines * CHARS_PER_LINE_AVG; setWaterMarks(chars, chars + HIGH_WATERMARK_OFFSET_BYTES); }
Source:
<code>public static void copyFile(@Nonnull File src, @Nonnull File dst) throws BuildException { Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(dst); cp.setFile(src); cp.setOverwrite(true); cp.setPreserveLastModified(true); cp.execute(); try { copyFilePosixPermissions(src, dst); } catch (IOException e) { <START> throw new BuildException("Cannot copy file permissions from " + src + " to " + dst, e); <END> } }</code><technical_language>This function fail Windows PosixFilePermissions-related APIs throw UnsupportedOperationException. want Functions#isWindows avoid this code path in case</technical_language>

Target:
public static void copyFile(@Nonnull File src, @Nonnull File dst) throws BuildException { Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(dst); cp.setFile(src); cp.setOverwrite(true); cp.execute(); }
Source:
<code>public void tearDown() throws Exception { System.setSecurityManager(originalSecurityManager); FileUtils.delete(root, <START> FileUtils.RECURSIVE); <END> }</code><technical_language>add | FileUtils.RETRY this necessary Windows</technical_language>

Target:
public void tearDown() throws Exception { System.setSecurityManager(originalSecurityManager); FileUtils.delete(root, FileUtils.RECURSIVE | FileUtils.RETRY); }
Source:
<code>public void testViewInFormulaEditorAfterClone() { String userVariablename = "testvariable1"; String userVariablename2 = "testvariable2"; <START> <END> onBrickAtPosition(1).onFormulaTextField(R.id.brick_change_variable_edit_text) .performNewVariable(userVariablename); onBrickAtPosition(1) .performCopyBrick(); onBrickAtPosition(1).onFormulaTextField(R.id.brick_change_variable_edit_text) .performNewVariable(userVariablename2); onBrickAtPosition(1).performDragNDrop(BrickCoordinatesProvider.DOWN_ONE_POSITION); onBrickAtPosition(2).onVariableSpinner(R.id.change_variable_spinner) .checkHasVariable(userVariablename); onBrickAtPosition(2).onVariableSpinner(R.id.change_variable_spinner) .checkHasVariable(userVariablename2); }</code><technical_language>is supposed happnening here? is necessary move brick</technical_language>

Target:
public void testViewInFormulaEditorAfterClone() { String userVariableName = "testvariable1"; String userVariableName2 = "testvariable2"; performNewVariableFromFormulaEditor(1, userVariableName); onBrickAtPosition(1) .performCopyBrick(); performNewVariableFromFormulaEditor(1, userVariableName2); onBrickAtPosition(1).performDragNDrop(BrickCoordinatesProvider.DOWN_ONE_POSITION); onBrickAtPosition(1).onVariableSpinner(R.id.change_variable_spinner) .checkShowsVariableNamesInAdapter(Arrays.asList(userVariableName, userVariableName2)); }
Source:
<code>public VmPoolMap mapRow(ResultSet rs, int rowNum) throws SQLException { VmPoolMap entity = new VmPoolMap(); <START> entity.setvm_guid(getGuid(rs, "vm_guid")); <END> entity.setvm_pool_id(getGuid(rs, "vm_pool_id")); return entity; }</code><technical_language>default empty</technical_language>

Target:
public VmPoolMap mapRow(ResultSet rs, int rowNum) throws SQLException { VmPoolMap entity = new VmPoolMap(); entity.setvm_guid(getGuidDefaultEmpty(rs, "vm_guid")); entity.setvm_pool_id(getGuidDefaultEmpty(rs, "vm_pool_id")); return entity; }
Source:
<code>public void processLeftData(final MistDataEvent input) { dataUpdate((Map<String, Object>)input.getValue()); if (finalState.contains(state)) { <START> final Tuple2<Map<String, Object>, Object> output = new Tuple2(input.getValue(), state); <END> if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{this.getClass().getName(), getOperatorState(), input, output}); } input.setValue(output); outputEmitter.emitData(input); } }</code><technical_language>need a final state for output</technical_language>

Target:
public void processLeftData(final MistDataEvent input) { stateTransition((Map<String, Object>)input.getValue()); if (finalState.contains(currState)) { final Tuple2<Map<String, Object>, Object> output = new Tuple2(input.getValue(), currState); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "{0} updates the state to {1} with input {2}, and generates {3}", new Object[]{this.getClass().getName(), getOperatorState(), input, output}); } input.setValue(output); outputEmitter.emitData(input); } }
Source:
<code><START> private void dataCenterWithClusterSelectedItemChanged(Object sender, EventArgs args) <END> { behavior.dataCenterWithClusterSelectedItemChanged(); DataCenterWithCluster dataCenterWithCluster = (DataCenterWithCluster) getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster != null && dataCenterWithCluster.getDataCenter() != null) { getDisksAllocationModel().setQuotaEnforcementType(dataCenterWithCluster.getDataCenter() .getQuotaEnforcementType()); } updateMaximalVmMemSize(); }</code><technical_language>depends cluster level need handle handled in oSType_SelectedItemChanged</technical_language>

Target:
private void dataCenterWithClusterSelectedItemChanged(Object sender, EventArgs args) { behavior.dataCenterWithClusterSelectedItemChanged(); DataCenterWithCluster dataCenterWithCluster = (DataCenterWithCluster) getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster != null && dataCenterWithCluster.getDataCenter() != null) { getDisksAllocationModel().setQuotaEnforcementType(dataCenterWithCluster.getDataCenter() .getQuotaEnforcementType()); } updateMaximalVmMemSize(); handleQxlClusterLevel(); }
Source:
<code>public RelNode findBestExp() { ensureRootConverters(); registerMaterializations(); PLANNING: for (VolcanoPlannerPhase phase : VolcanoPlannerPhase.values()) { while (true) { LOGGER.debug("PLANNER = {}; PHASE = {}; COST = {}", this, phase.toString(), root.bestCost); VolcanoRuleMatch match = ruleQueue.popMatch(phase); if (match == null) { break; } assert match.getRule().matches(match); try { match.onMatch(); } catch (VolcanoTimeoutException e) { LOGGER.warn("Catch VolcanoTimeoutException, abort optimization."); <START> root = canonize(root); <END> ruleQueue.phaseCompleted(phase); break PLANNING; } root = canonize(root); } ruleQueue.phaseCompleted(phase); } if (topDownOpt) { tasks.push(OptimizeTask.create(root)); while (!tasks.isEmpty()) { OptimizeTask task = tasks.peek(); if (task.hasSubTask()) { tasks.push(task.nextSubTask()); continue; } task = tasks.pop(); task.execute(); } } if (LOGGER.isTraceEnabled()) { StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); dump(pw); pw.flush(); LOGGER.trace(sw.toString()); } dumpRuleAttemptsInfo(); RelNode cheapest = root.buildCheapestPlan(this); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Cheapest plan:\n{}", RelOptUtil.toString(cheapest, SqlExplainLevel.ALL_ATTRIBUTES)); if (!provenanceMap.isEmpty()) { LOGGER.debug("Provenance:\n{}", Dumpers.provenance(provenanceMap, cheapest)); } } return cheapest; }</code><technical_language>"Volcano planning times out, cancels subsequent optimization."</technical_language>

Target:
public RelNode findBestExp() { ensureRootConverters(); registerMaterializations(); PLANNING: for (VolcanoPlannerPhase phase : VolcanoPlannerPhase.values()) { while (true) { LOGGER.debug("PLANNER = {}; PHASE = {}; COST = {}", this, phase.toString(), root.bestCost); VolcanoRuleMatch match = ruleQueue.popMatch(phase); if (match == null) { break; } assert match.getRule().matches(match); try { match.onMatch(); } catch (VolcanoTimeoutException e) { LOGGER.warn("Volcano planning times out, cancels the subsequent optimization."); root = canonize(root); ruleQueue.phaseCompleted(phase); break PLANNING; } root = canonize(root); } ruleQueue.phaseCompleted(phase); } if (topDownOpt) { tasks.push(OptimizeTask.create(root)); while (!tasks.isEmpty()) { OptimizeTask task = tasks.peek(); if (task.hasSubTask()) { tasks.push(task.nextSubTask()); continue; } task = tasks.pop(); task.execute(); } } if (LOGGER.isTraceEnabled()) { StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); dump(pw); pw.flush(); LOGGER.trace(sw.toString()); } dumpRuleAttemptsInfo(); RelNode cheapest = root.buildCheapestPlan(this); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Cheapest plan:\n{}", RelOptUtil.toString(cheapest, SqlExplainLevel.ALL_ATTRIBUTES)); if (!provenanceMap.isEmpty()) { LOGGER.debug("Provenance:\n{}", Dumpers.provenance(provenanceMap, cheapest)); } } return cheapest; }
Source:
<code>private ClientRegistration azureClientRegistration() { String tenantId = aadAuthenticationProperties.getTenantId().trim(); Assert.hasText(tenantId, "azure.activedirectory.tenant-id should have text."); Assert.doesNotContain(tenantId, " ", "azure.activedirectory.tenant-id should not contain ' '."); Assert.doesNotContain(tenantId, "/", "azure.activedirectory.tenant-id should not contain '/'."); <START> return ClientRegistration.withRegistrationId("azure") <END> .clientId(aadAuthenticationProperties.getClientId()) .clientSecret(aadAuthenticationProperties.getClientSecret()) .clientAuthenticationMethod(ClientAuthenticationMethod.POST) .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) .redirectUriTemplate("{baseUrl}/login/oauth2/code/{registrationId}") .scope("openid", "<LINK_4>", "profile") .authorizationUri( String.format( "<LINK_2>", tenantId ) ) .tokenUri( String.format( "<LINK_0>", tenantId ) ) .userInfoUri("<LINK_3>") .userNameAttributeName(AADAccessTokenClaim.NAME) .jwkSetUri( String.format( "<LINK_1>", tenantId ) ) .clientName("Azure") .build(); }</code><technical_language>multi-tenant application function this change</technical_language>

Target:
private ClientRegistration azureClientRegistration() { String tenantId = aadAuthenticationProperties.getTenantId().trim(); Assert.hasText(tenantId, "azure.activedirectory.tenant-id should have text."); Assert.doesNotContain(tenantId, " ", "azure.activedirectory.tenant-id should not contain ' '."); Assert.doesNotContain(tenantId, "/", "azure.activedirectory.tenant-id should not contain '/'."); return ClientRegistration.withRegistrationId("azure") .clientId(aadAuthenticationProperties.getClientId()) .clientSecret(aadAuthenticationProperties.getClientSecret()) .clientAuthenticationMethod(ClientAuthenticationMethod.POST) .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) .redirectUriTemplate("{baseUrl}/login/oauth2/code/{registrationId}") .scope(aadAuthenticationProperties.getScope()) .authorizationUri( String.format( "<LINK_2>", tenantId ) ) .tokenUri( String.format( "<LINK_0>", tenantId ) ) .userInfoUri("<LINK_3>") .userNameAttributeName(AADAccessTokenClaim.NAME) .jwkSetUri( String.format( "<LINK_1>", tenantId ) ) .clientName("Azure") .build(); }
Source:
<code>public void validate() throws Exception { String command = getCommand(); Set<String> allowedText = new TreeSet<>(Arrays.asList("add", "delete", "list", "list-indexed", "indexed", "get-repos", "get-repos-type", "get", "set")); if (command == null) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!allowedText.contains(command)) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!command.startsWith("list") && getTags().isEmpty()) { throw new Exception("The message must contain a tag (project name(s))"); } <START> if (command.compareTo("get") == 0 && getTags().size() != 1) { <END> throw new Exception("The \"get\" command can take only one project."); } super.validate(); }</code><technical_language>command.equals("get")</technical_language>

Target:
public void validate() throws Exception { String command = getCommand(); Set<String> allowedText = new TreeSet<>(Arrays.asList("add", "delete", "list", "list-indexed", "indexed", "get-repos", "get-repos-type", "get", "set")); if (command == null) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!allowedText.contains(command)) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!command.startsWith("list") && getTags().isEmpty()) { throw new Exception("The message must contain a tag (project name(s))"); } if (command.equals("get") && getTags().size() != 1) { throw new Exception("The \"get\" command can take only one project."); } super.validate(); }
Source:
<code>private void copyProperties(Exchange newExchange){ ContextProxy context=new ContextProxy(); Context contextNew=newExchange.getContext(); for (org.switchyard.Property p: context.getProperties(Scope.EXCHANGE)) { <START> if(contextNew.getProperty(p.getName(),Scope.EXCHANGE)==null && !p.getName().startsWith("org.switchyard.bus.camel")){ <END> Property newProp=newExchange.getContext().setProperty(p.getName(), p.getValue(), Scope.EXCHANGE); if(p.getLabels()!=null && !p.getLabels().isEmpty()){ newProp.addLabels(p.getLabels()); } } } }</code><technical_language>is this checking if property name starts org.switchyard.bus.camel</technical_language>

Target:
private void copyProperties(Exchange newExchange) { ContextProxy context = new ContextProxy(); Context contextNew = newExchange.getContext(); String prefixPropagation = this.getPrefixPropertyPropagation(newExchange.getConsumer().getDomain()); try { for (org.switchyard.Property p : context.getProperties(Scope.EXCHANGE)) { if (prefixPropagation != null && !prefixPropagation.equals("")) { if (contextNew.getProperty(p.getName(), Scope.EXCHANGE) == null && p.getName().startsWith(prefixPropagation)) { Property newProp = newExchange.getContext().setProperty(p.getName(), p.getValue(), Scope.EXCHANGE); if (p.getLabels() != null && !p.getLabels().isEmpty()) { newProp.addLabels(p.getLabels()); } } } } } catch (Exception e) { _logger.warn("Unable to copy the properties: " + e.getMessage()); } }
Source:
<code>protected RowExpression visitInPredicate(InPredicate node, Void context) { ImmutableList.Builder<RowExpression> arguments = ImmutableList.builder(); arguments.add(process(node.getValue(), context)); if (node.getValueList() instanceof InListExpression) { InListExpression values = (InListExpression) node.getValueList(); for (Expression value : values.getValues()) { arguments.add(process(value, context)); } } <START> else { <END> arguments.add(process(node.getValueList(), context)); } return specialForm(IN, BOOLEAN, arguments.build()); }</code><technical_language>discussed offline, understand more testDoubleNestedCorrelatedSubqueries is do</technical_language>

Target:
protected RowExpression visitInPredicate(InPredicate node, Void context) { ImmutableList.Builder<RowExpression> arguments = ImmutableList.builder(); arguments.add(process(node.getValue(), context)); InListExpression values = (InListExpression) node.getValueList(); for (Expression value : values.getValues()) { arguments.add(process(value, context)); } return specialForm(IN, BOOLEAN, arguments.build()); }
Source:
<code>private void refresh(Collection<CustomizedView> customizedViewList) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); if (customizedViewList != null && !customizedViewList.isEmpty()) { for (InstanceConfig config : _instanceConfigs) { instanceConfigMap.put(config.getId(), config); } for (CustomizedView customView : customizedViewList) { String resourceName = customView.getId(); <START> for (String partitionName : customView.getPartitionSet()) { <END> Map<String, String> stateMap = customView.getStateMap(partitionName); for (String instanceName : stateMap.keySet()) { String currentState = stateMap.get(instanceName); if (instanceConfigMap.containsKey(instanceName)) { InstanceConfig instanceConfig = instanceConfigMap.get(instanceName); addEntry(resourceName, partitionName, currentState, instanceConfig); } else { logger.warn( "Participant is not found with proper configuration information. It might already be removed from the cluster. " + "Skip recording partition assignment entry: Partition {}, Participant {}, State {}.", instanceName, partitionName, instanceName, stateMap.get(instanceName)); } } } } } }</code><technical_language>This method "private void refresh(Collection<ExternalView> externalViewList)". do a template class here, ExternalView/CustomizedView template type</technical_language>

Target:
private void refresh(Collection<CustomizedView> customizedViewList) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); if (customizedViewList != null && !customizedViewList.isEmpty()) { for (InstanceConfig config : _instanceConfigs) { instanceConfigMap.put(config.getId(), config); } for (CustomizedView customizeView : customizedViewList) { String resourceName = customizeView.getId(); for (String partitionName : customizeView.getPartitionSet()) { Map<String, String> stateMap = customizeView.getStateMap(partitionName); for (String instanceName : stateMap.keySet()) { String customizedState = stateMap.get(instanceName); if (instanceConfigMap.containsKey(instanceName)) { InstanceConfig instanceConfig = instanceConfigMap.get(instanceName); addEntry(resourceName, partitionName, customizedState, instanceConfig); } else { logger.warn( "Participant is not found with proper configuration information. It might already be removed from the cluster. " + "Skip recording partition assignment entry: Partition {}, Participant {}, State {}.", instanceName, partitionName, instanceName, stateMap.get(instanceName)); } } } } } }
Source:
<code>static void analyzeSingle(final PsiElement element, AnnotationHolder holder) { if (element instanceof HaxePackageStatement) { PackageChecker.check((HaxePackageStatement)element, holder); } else if (element instanceof HaxeMethod) { MethodChecker.check((HaxeMethod)element, holder); } else if (element instanceof HaxeClass) { ClassChecker.check((HaxeClass)element, holder); } <START> if (element instanceof HaxeType) { <END> TypeChecker.check((HaxeType)element, holder); } if (element instanceof HaxeVarDeclaration) { FieldChecker.check((HaxeVarDeclaration)element, holder); } }</code><technical_language>clauses 'else if' while this line (line #60) 'if' statement. construct work types independent. else clause is better, though. consistent</technical_language>

Target:
static void analyzeSingle(final PsiElement element, AnnotationHolder holder) { if (element instanceof HaxePackageStatement) { PackageChecker.check((HaxePackageStatement)element, holder); } else if (element instanceof HaxeMethod) { MethodChecker.check((HaxeMethod)element, holder); } else if (element instanceof HaxeClass) { ClassChecker.check((HaxeClass)element, holder); } else if (element instanceof HaxeType) { TypeChecker.check((HaxeType)element, holder); } else if (element instanceof HaxeVarDeclaration) { FieldChecker.check((HaxeVarDeclaration)element, holder); } }
Source:
<code>public void testAddOneItemToBox() { final String position = "F06"; BoxPage page = getBoxPage(500L); BoxVisualization visualization = page.getVisualization(); assertTrue("empty position is empty", visualization.isEmptyPosition(position)); visualization.selectPosition(position); visualization.lookupBarcode("TIB_SamStock"); visualization.updatePosition(false); <START> <END> Box box = (Box) getSession().get(BoxImpl.class, 500L); BoxableView itemAtPosition = box.getBoxable(position); assertNotNull(itemAtPosition); }</code><technical_language>match precondition postcondition assertions (check visualization.isEmptyPosition box.getBoxable change) in other tests</technical_language>

Target:
public void testAddOneItemToBox() { final String position = "F06"; BoxPage page = getBoxPage(500L); BoxVisualization visualization = page.getVisualization(); assertTrue("empty position is empty", visualization.isEmptyPosition(position)); Box initial = (Box) getSession().get(BoxImpl.class, 500L); assertNull(initial.getBoxable(position)); visualization.selectPosition(position); visualization.lookupBarcode("TIB_SamStock"); visualization.updatePosition(false); BoxPage again = getBoxPage(500L); assertFalse("checking that position is no longer empty", again.getVisualization().isEmptyPosition(position)); Box box = (Box) getSession().get(BoxImpl.class, 500L); assertNotNull(box.getBoxable(position)); }
Source:
<code>public void testAvailableTargetTypes() { final ProjectInfo info = resolveProjectInfo("examples/src/scala/org/pantsbuild/example/hello/"); final List<String> availableTargetTypes = Arrays.asList(info.getAvailableTargetTypes()); <START> assertNotNull(availableTargetTypes); <END> assertNotEmpty(availableTargetTypes); assertContain(availableTargetTypes, "scala_library", "java_library"); }</code><technical_language>null asserted info.getAvailableTargetTypes() instead of availableTargetTypes, remove this assert probably, Arrays.asList fail null anyway</technical_language>

Target:
public void testAvailableTargetTypes() { final ProjectInfo info = resolveProjectInfo("examples/src/scala/org/pantsbuild/example/hello/"); if (PantsUtil.isCompatibleVersion(info.getVersion(), "1.0.13")) { final List<String> availableTargetTypes = Arrays.asList(info.getAvailableTargetTypes()); assertNotEmpty(availableTargetTypes); assertContain(availableTargetTypes, "scala_library", "java_library"); } }
Source:
<code><START> public static synchronized RawDSInputPanel createInstance(String context) { <END> RawDSInputPanel instance = new RawDSInputPanel(context); instance.postInit(); instance.createTimeZoneList(); return instance; }</code><technical_language>this method need public</technical_language>

Target:
static synchronized RawDSInputPanel createInstance(String context) { RawDSInputPanel instance = new RawDSInputPanel(context); instance.postInit(); instance.createTimeZoneList(); return instance; }
Source:
<code>public void async() throws Exception { CountDownLatch latch = new CountDownLatch(1); AMQP.Queue.Declare queueDeclare = new AMQImpl.Queue.Declare.Builder() .queue(queue) .durable(true) .exclusive(false) .autoDelete(false) .arguments(null) .build(); channel.asyncCompletableRpc(queueDeclare) .thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Exchange.Declare.Builder() .exchange(exchange) .type("fanout") .durable(false) .autoDelete(false) .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Queue.Bind.Builder() .queue(queue) .exchange(exchange) .routingKey("") .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync(action -> { try { <START> channel.basicPublish("", queue, null, "dummy".getBytes()); <END> } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync((whatever) -> { try { channel.basicConsume(queue, true, new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { latch.countDown(); } }); } catch (IOException e) { throw new RuntimeException(e); } }, executor); assertTrue(latch.await(1, TimeUnit.SECONDS)); }</code><technical_language>wait for a confirm here, a race condition a message send channel queue master process handling of basic.consume below</technical_language>

Target:
public void async() throws Exception { channel.confirmSelect(); CountDownLatch latch = new CountDownLatch(1); AMQP.Queue.Declare queueDeclare = new AMQImpl.Queue.Declare.Builder() .queue(queue) .durable(true) .exclusive(false) .autoDelete(false) .arguments(null) .build(); channel.asyncCompletableRpc(queueDeclare) .thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Exchange.Declare.Builder() .exchange(exchange) .type("fanout") .durable(false) .autoDelete(false) .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenComposeAsync(action -> { try { return channel.asyncCompletableRpc(new AMQImpl.Queue.Bind.Builder() .queue(queue) .exchange(exchange) .routingKey("") .arguments(null) .build()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync(action -> { try { channel.basicPublish("", queue, null, "dummy".getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }, executor).thenAcceptAsync((whatever) -> { try { channel.basicConsume(queue, true, new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { latch.countDown(); } }); } catch (IOException e) { throw new RuntimeException(e); } }, executor); channel.waitForConfirmsOrDie(1000); assertTrue(latch.await(2, TimeUnit.SECONDS)); }
Source:
<code>public AbstractEntityHydrator(List<Object> results, Query query, EntityDictionary entityDictionary) { this.stitchList = new StitchList(entityDictionary); <START> this.results = new ArrayList<>(results); <END> this.query = query; this.entityDictionary = entityDictionary; }</code><technical_language>In Fili, a concept of ResultRow in Fili is a **fileName-object** map represents row, design need cast result Object[]</technical_language>

Target:
public AbstractEntityHydrator(List<Object> results, Query query, EntityDictionary entityDictionary) { this.stitchList = new StitchList(entityDictionary); this.query = query; this.entityDictionary = entityDictionary; List<String> projections = this.query.getMetrics().keySet().stream() .map(Metric::getName) .collect(Collectors.toList()); projections.addAll(this.query.getDimensions().stream() .map(Dimension::getName) .collect(Collectors.toList())); results.forEach(result -> { Map<String, Object> row = new HashMap<>(); Object[] resultValues = result instanceof Object[] ? (Object[]) result : new Object[] { result }; Preconditions.checkArgument(projections.size() == resultValues.length); for (int idx = 0; idx < resultValues.length; idx++) { Object value = resultValues[idx]; String fieldName = projections.get(idx); row.put(fieldName, value); } this.results.add(row); }); }
Source:
<code>public boolean isValidAuthorizations(String user, List<ByteBuffer> auths) throws AccumuloSecurityException { <START> if (auths.size() == 0) { <END> return true; } Authorizations userauths = getCachedUserAuthorizations(user); for (ByteBuffer auth : auths) { if (!userauths.contains(ByteBufferUtil.toBytes(auth))) { return false; } } return true; }</code><technical_language>call .isEmpty()</technical_language>

Target:
public boolean isValidAuthorizations(String user, List<ByteBuffer> auths) throws AccumuloSecurityException { if (auths.isEmpty()) { return true; } Authorizations userauths = getCachedUserAuthorizations(user); for (ByteBuffer auth : auths) { if (!userauths.contains(ByteBufferUtil.toBytes(auth))) { return false; } } return true; }
Source:
<code>private void testCancelAddInstructor() { ______TS("Click cancel button upon new form created"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); ______TS("Click cancel button after filling some fields of the form"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.fillNewInstructorName("New Instructor Test"); <START> courseEditPage.fillNewInstructorEmail("newinstructortest@example.com"); <END> courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); }</code><technical_language>Do clear fields instead</technical_language>

Target:
private void testCancelAddInstructor() { ______TS("Click cancel button upon new form created"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); ______TS("Click cancel button after filling all fields of the form"); int newInstructorIndex = 8; courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.fillNewInstructorName(newInstructorName); courseEditPage.fillNewInstructorEmail(newInstructorEmail); courseEditPage.fillNewInstructorDisplayName("Test Display"); courseEditPage.selectRoleForNewInstructor(newInstructorIndex, "Observer"); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); ______TS("Confirm form is reset to default values"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); assertEquals("", courseEditPage.getNewInstructorName()); assertEquals("", courseEditPage.getNewInstructorEmail()); assertTrue(courseEditPage.verifyAddInstructorFormDefaultValues(newInstructorIndex)); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); }
Source:
<code>private Object wrapForEmbedding(HALResource<? extends RestAddressableModel> resource, Object linkedObject, Link link) { int childEmbedLevel = resource.getContent().getEmbedLevel() + 1; if (linkedObject instanceof RestAddressableModel) { RestAddressableModel restObject = (RestAddressableModel) linkedObject; restObject.setEmbedLevel(childEmbedLevel); <START> return converter.toResource(restObject); <END> } else if (linkedObject instanceof Page) { Page<RestAddressableModel> page = (Page<RestAddressableModel>) linkedObject; return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), null, link.getRel()); } else if (linkedObject instanceof List) { List<RestAddressableModel> list = (List<RestAddressableModel>) linkedObject; if (list.size() > 0) { PageImpl<RestAddressableModel> page = new PageImpl( list.subList(0, list.size() > EMBEDDED_PAGE_SIZE ? EMBEDDED_PAGE_SIZE : list.size()), new PageRequest(0, EMBEDDED_PAGE_SIZE), list.size()); return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), list, link.getRel()); } else { PageImpl<RestAddressableModel> page = new PageImpl(list); return new EmbeddedPage(link.getHref(), page, list, link.getRel()); } } else { return linkedObject; } }</code><technical_language>Jira ticket for latter, lose track of it</technical_language>

Target:
private Object wrapForEmbedding(HALResource<? extends RestAddressableModel> resource, Object linkedObject, Link link) { int childEmbedLevel = resource.getContent().getEmbedLevel() + 1; if (linkedObject instanceof RestAddressableModel) { RestAddressableModel restObject = (RestAddressableModel) linkedObject; restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); } else if (linkedObject instanceof Page) { Page<RestAddressableModel> page = (Page<RestAddressableModel>) linkedObject; return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), null, link.getRel()); } else if (linkedObject instanceof List) { List<RestAddressableModel> list = (List<RestAddressableModel>) linkedObject; if (list.size() > 0) { PageImpl<RestAddressableModel> page = new PageImpl( list.subList(0, list.size() > DEFAULT_PAGE_SIZE ? DEFAULT_PAGE_SIZE : list.size()), new PageRequest(0, DEFAULT_PAGE_SIZE), list.size()); return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), list, link.getRel()); } else { PageImpl<RestAddressableModel> page = new PageImpl(list); return new EmbeddedPage(link.getHref(), page, list, link.getRel()); } } else { return linkedObject; } }
Source:
<code>@Override protected String getResourceEntryName(Object source, int id) { final View view = (View) source; if (view.isInEditMode()) { <START> return "{ Names cannot be retrieved while in Edit Mode }"; <END> } return super.getResourceEntryName(source, id); }</code><technical_language>This is a long string. "<name unavailable>"</technical_language>

Target:
@Override protected String getResourceEntryName(Object source, int id) { final View view = (View) source; if (view.isInEditMode()) { return "<unavailable while editing>"; } return super.getResourceEntryName(source, id); }
Source:
<code>public HashSet<String> getRequiredColumns() { return Sets.newHashSet(dimensions.stream() .map(DimensionSpec::getDimension) <START> .collect(Collectors.toSet()) <END> ); }</code><technical_language>Please fix Sets.newHashSet(...collect(...)). opened #8241 fixing this generically</technical_language>

Target:
public Set<String> getRequiredColumns() { return dimensions.stream().map(DimensionSpec::getDimension).collect(Collectors.toSet()); }
Source:
<code>public void preprocess(DataSetLookup lookup) { if (identityProvider == null) { return; } final List<String> deploymentIds = deploymentRolesManager.getDeploymentsForUser(identityProvider); ColumnFilter columnFilter; <START> if(deploymentIds == null || deploymentIds.size()==0){ <END> columnFilter = equalsTo(impossibleConditionColumnId,-1); } else { columnFilter = in(columnId, deploymentIds); } LOGGER.debug("Adding column filter: {}", columnFilter); if (lookup.getFirstFilterOp() != null) { lookup.getFirstFilterOp().addFilterColumn(columnFilter); } else { DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(columnFilter); lookup.addOperation(filter); } }</code><technical_language>deploymentIds.isEmpty(), please. quicker check</technical_language>

Target:
public void preprocess(DataSetLookup lookup) { if (identityProvider == null) { return; } final List<String> deploymentIds = deploymentRolesManager.getDeploymentsForUser(identityProvider); ColumnFilter columnFilter; if(deploymentIds != null && !deploymentIds.isEmpty()){ columnFilter = in(columnId, deploymentIds); } else { columnFilter = equalsTo(impossibleConditionColumnId,-1); } LOGGER.debug("Adding column filter: {}", columnFilter); if (lookup.getFirstFilterOp() != null) { lookup.getFirstFilterOp().addFilterColumn(columnFilter); } else { DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(columnFilter); lookup.addOperation(filter); } }
Source:
<code>InstrumentedInterceptor(TaggedMetricRegistry registry, HostEventsSink hostEventsSink, String serviceName) { this.hostEventsSink = hostEventsSink; this.serviceName = serviceName; this.responseTimer = registry.timer(name()); this.ioExceptionMeter = registry.meter(MetricName.builder() <START> .safeName("client.response.failure") <END> .putSafeTags("reason", "IOException") .putSafeTags(SERVICE_NAME_TAG, serviceName) .build()); }</code><technical_language>estimating this cost $5875/month right</technical_language>

Target:
InstrumentedInterceptor(TaggedMetricRegistry registry, HostEventsSink hostEventsSink, String serviceName) { this.hostEventsSink = hostEventsSink; this.serviceName = serviceName; this.responseTimer = registry.timer(name()); this.ioExceptionMeter = registry.meter(MetricName.builder() .safeName("client.response.error") .putSafeTags("reason", "IOException") .putSafeTags(SERVICE_NAME_TAG, serviceName) .build()); }
Source:
<code>public NavigationView.OnNavigationItemSelectedListener getNewListener() { return new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.nav_item_today: page.displayMainPage(); break; case R.id.nav_item_history: page.pushFragment(new HistoryFragment()); break; case R.id.nav_item_saved_pages: page.pushFragment(new SavedPagesFragment()); break; case R.id.nav_item_nearby: page.pushFragment(new NearbyFragment()); break; case R.id.nav_item_more: launchSettingsActivity(); break; case R.id.nav_item_login: launchLoginActivity(); break; case R.id.nav_item_random: page.getRandomHandler().doVisitRandomArticle(); break; default: return false; <START> } <END> return true; } }; }</code><technical_language>If add a menuItem.setChecked(true); need highlightActiveMenuItem()</technical_language>

Target:
public NavigationView.OnNavigationItemSelectedListener getNewListener() { return new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.nav_item_today: page.displayMainPage(); break; case R.id.nav_item_history: page.pushFragment(new HistoryFragment()); break; case R.id.nav_item_saved_pages: page.pushFragment(new SavedPagesFragment()); break; case R.id.nav_item_nearby: page.pushFragment(new NearbyFragment()); break; case R.id.nav_item_more: launchSettingsActivity(); break; case R.id.nav_item_login: launchLoginActivity(); break; case R.id.nav_item_random: page.getRandomHandler().doVisitRandomArticle(); break; default: return false; } menuItem.setChecked(true); return true; } }; }
Source:
<code>private Diagram doTransformation(final String fileName, final String xml) { final String defSetId = getDefinitionSetId(backendService); final Metadata metadata = buildMetadataInstance(defSetId); final InputStream is = new ByteArrayInputStream(xml.getBytes()); try { final DiagramMarshaller marshaller = backendService.getDiagramMarshaller(); final Graph<DefinitionSet, ?> graph = marshaller.unmarshall(metadata, is); final Node<Definition<BPMNDiagram>, ?> diagramNode = GraphUtils.getFirstNode((Graph<?, Node>) graph, BPMNDiagramImpl.class); if (null == diagramNode) { throw new RuntimeException("No BPMN Diagram can be found."); } <START> diagramNode.getContent().getDefinition().getDiagramSet().getName().setValue(fileName); <END> diagramNode.getContent().getDefinition().getDiagramSet().getId().setValue(fileName); final String title = diagramNode.getContent().getDefinition().getDiagramSet().getName().getValue(); metadata.setTitle(title); return diagramFactory.build(title, metadata, graph); } catch (Exception e) { LOG.error("Error whilst converting XML to BPMN Diagram.", e); throw new DiagramParsingException(metadata, xml); } }</code><technical_language>here, I create a var..</technical_language>

Target:
private Diagram doTransformation(final String fileName, final String xml) { final String defSetId = getDefinitionSetId(backendService); final Metadata metadata = buildMetadataInstance(defSetId); final InputStream is = new ByteArrayInputStream(xml.getBytes()); try { final DiagramMarshaller marshaller = backendService.getDiagramMarshaller(); final Graph<DefinitionSet, ?> graph = marshaller.unmarshall(metadata, is); final Node<Definition<BPMNDiagram>, ?> diagramNode = GraphUtils.getFirstNode((Graph<?, Node>) graph, BPMNDiagramImpl.class); if (null == diagramNode) { throw new RuntimeException("No BPMN Diagram can be found."); } final BaseDiagramSet diagramSet = diagramNode.getContent().getDefinition().getDiagramSet(); diagramSet.getName().setValue(fileName); diagramSet.getId().setValue(fileName); final String title = diagramNode.getContent().getDefinition().getDiagramSet().getName().getValue(); metadata.setTitle(title); return diagramFactory.build(title, metadata, graph); } catch (Exception e) { LOG.error("Error whilst converting XML to BPMN Diagram.", e); throw new DiagramParsingException(metadata, xml); } }
Source:
<code>public Stream(byte[] key) { this.key = key; <START> checkLength(key, NaCl.Sodium.AES_128_CTR_KEYBYTES); <END> }</code><technical_language>of import static, please. this leave constant code</technical_language>

Target:
public Stream(byte[] key) { this.key = key; checkLength(key, AES_128_CTR_KEYBYTES); }
Source:
<code>public DbAdmin(DbModel model, String server, String user, String passwd, boolean write) throws WaarpDatabaseNoConnectionException { this.server = server; this.user = user; this.passwd = passwd; this.dbModel = model; this.typeDriver = model.getDbType(); if (typeDriver == null) { logger.error("Cannot find TypeDriver"); throw new WaarpDatabaseNoConnectionException( "Cannot find database driver"); } if (write) { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, false)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = false; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } else { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, true)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = true; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } setSession(null); <START> setActive(false); <END> logger.error("Cannot connect to Database!"); throw new WaarpDatabaseNoConnectionException( "Cannot connect to database"); }</code><technical_language>calls of setActive() in this class removed, is deprecated..</technical_language>

Target:
public DbAdmin(DbModel model, String server, String user, String passwd, boolean write) throws WaarpDatabaseNoConnectionException { this.server = server; this.user = user; this.passwd = passwd; this.dbModel = model; this.typeDriver = model.getDbType(); if (typeDriver == null) { logger.error("Cannot find TypeDriver"); throw new WaarpDatabaseNoConnectionException( "Cannot find database driver"); } if (write) { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, false)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = false; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } else { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, true)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = true; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } setSession(null); logger.error("Cannot connect to Database!"); throw new WaarpDatabaseNoConnectionException( "Cannot connect to database"); }
Source:
<code>private Protos.ExecutorInfo createExecutor() { final String jar = "crate-mesos.jar"; String hostIP; try { <START> hostIP = InetAddress.getLocalHost().getHostAddress(); <END> } catch (UnknownHostException e) { e.printStackTrace(); hostIP = "127.0.0.1"; } String path = String.format("http://%s:%d/static/%s", hostIP, configuration.apiPort, jar); Protos.CommandInfo cmd = Protos.CommandInfo.newBuilder() .addUris(Protos.CommandInfo.URI.newBuilder().setValue(path).setExtract(false).build()) .setValue(String.format("java -cp %s io.crate.frameworks.mesos.CrateExecutor", jar)) .build(); return Protos.ExecutorInfo.newBuilder() .setName("Crate Executor") .setExecutorId( Protos.ExecutorID.newBuilder() .setValue(UUID.randomUUID().toString()) .build() ) .setCommand(cmd) .addAllResources(configuration.getAllRequiredResources()) .build(); }</code><technical_language>masterInfo in registered call contains hostname ip, instead</technical_language>

Target:
private Protos.ExecutorInfo createExecutor() { final String jar = "crate-mesos.jar"; String path = String.format("http://%s:%d/static/%s", hostIP, configuration.apiPort, jar); Protos.CommandInfo cmd = Protos.CommandInfo.newBuilder() .addUris(Protos.CommandInfo.URI.newBuilder().setValue(path).setExtract(false).build()) .setValue(String.format("java -cp %s io.crate.frameworks.mesos.CrateExecutor", jar)) .build(); return Protos.ExecutorInfo.newBuilder() .setName("Crate Executor") .setExecutorId( Protos.ExecutorID.newBuilder() .setValue(UUID.randomUUID().toString()) .build() ) .setCommand(cmd) .addAllResources(configuration.getAllRequiredResources()) .build(); }
Source:
<code>public boolean equals(final Object o) { if (!super.equals(o)) { return false; } <START> final ArrayOfDoublesSketchToQuantilesSketchPostAggregator that = (ArrayOfDoublesSketchToQuantilesSketchPostAggregator) o; <END> if (column != that.column) { return false; } if (k != that.k) { return false; } return true; }</code><technical_language>Add instanceof check</technical_language>

Target:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } if (!(o instanceof ArrayOfDoublesSketchToQuantilesSketchPostAggregator)) { return false; } final ArrayOfDoublesSketchToQuantilesSketchPostAggregator that = (ArrayOfDoublesSketchToQuantilesSketchPostAggregator) o; if (column != that.column) { return false; } if (k != that.k) { return false; } return true; }
Source:
<code>public IAEItemStack injectItems( IAEItemStack iox, Actionable type, BaseActionSource src ) { ItemStack orgInput = iox.getItemStack(); ItemStack remaining = orgInput; if( type == Actionable.SIMULATE ) { for( int i = 0; i < itemHandler.getSlots(); i++ ) { remaining = itemHandler.insertItem( i, remaining, true ); if( remaining == null ) { break; } } } else { int slotCount = itemHandler.getSlots(); boolean[] retry = new boolean[slotCount]; for( int i = 0; i < slotCount; i++ ) { ItemStack stackInSlot = itemHandler.getStackInSlot( i ); if( stackInSlot == null ) { retry[i] = true; continue; } remaining = itemHandler.insertItem( i, remaining, false ); if( remaining == null ) { break; } } for( int i = 0; i < slotCount; i++ ) { if( retry[i] ) { <START> remaining = itemHandler.insertItem( i, remaining, false ); <END> if( remaining == null ) { break; } } } } if( remaining == orgInput ) { return iox; } if( type == Actionable.MODULATE ) { this.onTick(); } return AEItemStack.create( remaining ); }</code><technical_language>remaining null trigger NPE inventories</technical_language>

Target:
public IAEItemStack injectItems( IAEItemStack iox, Actionable type, BaseActionSource src ) { ItemStack orgInput = iox.getItemStack(); ItemStack remaining = orgInput; int slotCount = itemHandler.getSlots(); boolean simulate = ( type == Actionable.SIMULATE ); for( int i = 0; i < slotCount && remaining != null; i++ ) { remaining = itemHandler.insertItem( i, remaining, simulate ); } if( remaining == orgInput ) { return iox; } if( type == Actionable.MODULATE ) { this.onTick(); } return AEItemStack.create( remaining ); }
Source:
<code>protected void assertPutFromLoadLatches(CountDownLatch[] latches) { <START> if (!await(latches[0]) && !await(latches[1])) <END> throw new AssertionError(String.format( "One of the latches in %s should have at least completed", Arrays.toString(latches))); }</code><technical_language>assertTrue("One of...", await(latches[0]) || await(latches[1]));</technical_language>

Target:
protected void assertPutFromLoadLatches(CountDownLatch[] latches) { assertTrue(String.format( "One of the latches in %s should have at least completed", Arrays.toString(latches)), await(latches[0]) || await(latches[1])); }