auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<FormattedExpression> interpolatedExpressions(StringElementImpl se) { String literalValue = se.trimmedQuotesValue(); Token token = se.firstToken(); int startOfLiteral = token.value().indexOf(literalValue); LineOffsetCounter lineOffsetCounter = new LineOffsetCounter(literalValue); List<FormattedExpression> res = new ArrayList<>(); parser.setRootRule(parser.getGrammar().rule(PythonGrammar.FORMATTED_EXPR)); Matcher matcher = INTERPOLATED_EXPR_START_PATTERN.matcher(literalValue); int index = 0; while (matcher.find(index)) { int end = matcher.end(); AstNode parse = parser.parse(literalValue.substring(end)); Expression exp = expression(parse.getFirstChild(PythonGrammar.EXPR)); <START> Token equalToken = parse.getFirstChild(PythonPunctuator.ASSIGN) == null ? null : toPyToken(parse.getFirstChild(PythonPunctuator.ASSIGN).getToken()); <END> FormattedExpression formattedExpression = new FormattedExpressionImpl(exp, equalToken); setParents(formattedExpression); updateTokensLineAndColumn(token, startOfLiteral, lineOffsetCounter, exp, end); res.add(formattedExpression); com.sonar.sslr.api.Token lastToken = parse.getLastToken(); index = end + lastToken.getColumn() + lastToken.getValue().length(); } return res; }</code><technical_language>I create a variable for parse.getFirstChild(PythonPunctuator.ASSIGN)</technical_language>

Target:
private List<FormattedExpression> interpolatedExpressions(StringElementImpl se) { String literalValue = se.trimmedQuotesValue(); Token token = se.firstToken(); int startOfLiteral = token.value().indexOf(literalValue); LineOffsetCounter lineOffsetCounter = new LineOffsetCounter(literalValue); List<FormattedExpression> res = new ArrayList<>(); parser.setRootRule(parser.getGrammar().rule(PythonGrammar.FORMATTED_EXPR)); Matcher matcher = INTERPOLATED_EXPR_START_PATTERN.matcher(literalValue); int index = 0; while (matcher.find(index)) { int end = matcher.end(); AstNode parse = parser.parse(literalValue.substring(end)); Expression exp = expression(parse.getFirstChild(PythonGrammar.EXPR)); AstNode equalNode = parse.getFirstChild(PythonPunctuator.ASSIGN); Token equalToken = equalNode == null ? null : toPyToken(equalNode.getToken()); FormattedExpression formattedExpression = new FormattedExpressionImpl(exp, equalToken); setParents(formattedExpression); updateTokensLineAndColumn(token, startOfLiteral, lineOffsetCounter, exp, end); res.add(formattedExpression); com.sonar.sslr.api.Token lastToken = parse.getLastToken(); index = end + lastToken.getColumn() + lastToken.getValue().length(); } return res; }
Source:
<code>public TaskletStep build() { Assert.notNull(applicationContext, "A GenericApplicationContext must be provided"); Assert.notNull(stepBuilder, "A SimpleStepBuilder must be provided"); if (!applicationContext.containsBean(inputChannelName)) { BeanDefinition requestsBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class).getBeanDefinition(); applicationContext.registerBeanDefinition(inputChannelName, requestsBeanDefinition); } if (!applicationContext.containsBean(outputChannelName)) { BeanDefinition repliesBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(QueueChannel.class).getBeanDefinition(); applicationContext.registerBeanDefinition(outputChannelName, repliesBeanDefinition); } <START> MessagingTemplate messagingTemplate = new MessagingTemplate(); <END> messagingTemplate.setDefaultChannel((MessageChannel) applicationContext.getBean(inputChannelName)); ChunkMessageChannelItemWriter<O> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>(); chunkMessageChannelItemWriter.setMessagingOperations(messagingTemplate); chunkMessageChannelItemWriter.setReplyChannel((PollableChannel) applicationContext.getBean(outputChannelName)); TaskletStep step = stepBuilder.writer(chunkMessageChannelItemWriter).build(); BeanDefinition remoteChunkHandlerFactoryBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(RemoteChunkHandlerFactoryBean.class) .addPropertyValue("chunkWriter", chunkMessageChannelItemWriter) .addPropertyValue("step", step) .getBeanDefinition(); applicationContext.registerBeanDefinition(step.getName() + "_chunkHandler", remoteChunkHandlerFactoryBeanDefinition); return step; }</code><technical_language>want allow users inject MessagingTemplate. a _lot_ of options configured want a user</technical_language>

Target:
public TaskletStep build() { Assert.notNull(this.inputChannel, "An InputChannel must be provided"); Assert.notNull(this.outputChannel, "An OutputChannel must be provided"); if (this.messagingTemplate == null) { this.messagingTemplate = new MessagingTemplate(); } this.messagingTemplate.setDefaultChannel(this.outputChannel); ChunkMessageChannelItemWriter<O> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>(); chunkMessageChannelItemWriter.setMessagingOperations(this.messagingTemplate); chunkMessageChannelItemWriter.setMaxWaitTimeouts(this.maxWaitTimeouts); chunkMessageChannelItemWriter.setThrottleLimit(this.throttleLimit); chunkMessageChannelItemWriter.setReplyChannel(this.inputChannel); super.writer(chunkMessageChannelItemWriter); return super.build(); }
Source:
<code><START> private Object valueConversionFunction(Object val) <END> { if (val instanceof Integer) { return Long.valueOf((Integer) val); } if (val instanceof BigInteger) { return Double.valueOf(((BigInteger) val).doubleValue()); } if (val instanceof String) { return charsetFix((String) val); } return val; }</code><technical_language>For Lists this applied element of list. Please include unit tests for stuff {"toomany":[1234567890000000000000]} {"funkyCoding":["foo\uD900"]}</technical_language>

Target:
private Object valueConversionFunction(Object val) { if (val instanceof Integer) { return Long.valueOf((Integer) val); } if (val instanceof BigInteger) { return Double.valueOf(((BigInteger) val).doubleValue()); } if (val instanceof String) { return charsetFix((String) val); } if (val instanceof List) { List<Object> newList = new ArrayList<>(); for(Object entry : ((List) val)) { newList.add(valueConversionFunction(entry)); } return newList; } if (val instanceof Map) { Map<String, Object> newMap = new LinkedHashMap<>(); Map<String, Object> valMap = (Map<String, Object>) val; for(Map.Entry<String, Object> entry : valMap.entrySet()) { newMap.put(entry.getKey(), valueConversionFunction(entry.getValue())); } return newMap; } return val; }
Source:
<code>private Set<String> computeRoles(U user, T tenant, boolean isSystemTenant) { Set<String> roles = Sets.newTreeSet(); roles.addAll(user.getUserAccountData().getPermissions().getPermissions()); roles.addAll(tenant.getTenantData().getPermissions().getPermissions()); roles.add(UserInfo.PERMISSION_LOGGED_IN); if (Strings.isFilled(tenant.getTenantData().getAccountNumber())) { roles.add("tenant-" + tenant.getTenantData().getAccountNumber()); } Set<String> transformedRoles = transformRoles(roles); if (isSystemTenant && transformedRoles.contains(PERMISSION_MANAGE_SYSTEM)) { roles.add(PERMISSION_SYSTEM_TENANT); <START> return applyAdditionalRolesProvider(user, tenant, transformRoles(roles)); <END> } return applyAdditionalRolesProvider(user, tenant, transformedRoles); }</code><technical_language>applyAdditionalRoles(...., roles::add)</technical_language>

Target:
private Set<String> computeRoles(U user, T tenant, boolean isSystemTenant) { Set<String> roles = Sets.newTreeSet(); roles.addAll(user.getUserAccountData().getPermissions().getPermissions()); roles.addAll(tenant.getTenantData().getPermissions().getPermissions()); roles.add(UserInfo.PERMISSION_LOGGED_IN); if (Strings.isFilled(tenant.getTenantData().getAccountNumber())) { roles.add("tenant-" + tenant.getTenantData().getAccountNumber()); } Set<String> transformedRoles = transformRoles(roles); if (isSystemTenant && transformedRoles.contains(PERMISSION_MANAGE_SYSTEM)) { roles.add(PERMISSION_SYSTEM_TENANT); return transformRoles(roles); } return transformedRoles; }
Source:
<code>public static <T> T fromJson(String jsonStr, Class<T> valueType) throws ParseJsonException { try { return mapper.readValue(jsonStr, valueType); } catch (Exception e) { <START> e.printStackTrace(); <END> throw new ParseJsonException("Failed to deserialize Object from Json string"); } }</code><technical_language>remove</technical_language>

Target:
public static <T> T fromJson(String jsonStr, Class<T> valueType) throws ParseJsonException { try { return mapper.readValue(jsonStr, valueType); } catch (Exception e) { throw new ParseJsonException("Failed to deserialize Object from Json string"); } }
Source:
<code>public ValueHolder<V> compute(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) { checkKeyType(key); return map.compute(key, new BiFunction<K, ValueHolder<V>, ValueHolder<V>>() { @Override public ValueHolder<V> apply(final K k, final ValueHolder<V> vValueHolder) { V computedValue = remappingFunction.apply(k, vValueHolder == null ? null : vValueHolder.value()); checkValueType(computedValue); <START> return nullSafeValueHolder(computedValue); <END> } }); }</code><technical_language>I a bit cleaner move type check nullSafeValueHolder</technical_language>

Target:
public ValueHolder<V> compute(final K key, final BiFunction<? super K, ? super V, ? extends V> remappingFunction) { checkKey(key); final long now = timeSource.getTimeMillis(); return map.compute(key, new BiFunction<K, OnHeapValueHolder<V>, OnHeapValueHolder<V>>() { @Override public OnHeapValueHolder<V> apply(final K mappedKey, OnHeapValueHolder<V> mappedValue) { if (mappedValue != null && mappedValue.isExpired(now)) { mappedValue = null; } V computedValue = remappingFunction.apply(k, vValueHolder == null ? null : vValueHolder.value()); checkValue(computedValue); return nullSafeValueHolder(computedValue); } }); }
Source:
<code>private Button button( final String text, final Command command, final ButtonType type ) { <START> Button button = new Button( text, new ClickHandler() { <END> @Override public void onClick( ClickEvent event ) { command.execute(); } } ); button.setType( type ); return button; }</code><technical_language>here... re: @karreiro mention of lamdas :-)</technical_language>

Target:
Button button( final String text, final Command command, final ButtonType type ) { Button button = new Button( text, event -> command.execute() ); button.setType( type ); return button; }
Source:
<code>public void testAccessTimeParam() { final AccessTimeParam p = new AccessTimeParam(AccessTimeParam.DEFAULT); <START> assertEquals(-1L, p.getValue().longValue()); <END> new AccessTimeParam(-1L); try { new AccessTimeParam(-2L); Assert.fail(); } catch(IllegalArgumentException e) { LOG.info("EXPECTED: " + e); } }</code><technical_language>avoid churn, do assertEquals in new methods leave this for rest for now. do a followup JIRA for if so</technical_language>

Target:
public void testAccessTimeParam() { final AccessTimeParam p = new AccessTimeParam(AccessTimeParam.DEFAULT); Assert.assertEquals(-1L, p.getValue().longValue()); new AccessTimeParam(-1L); try { new AccessTimeParam(-2L); Assert.fail(); } catch(IllegalArgumentException e) { LOG.info("EXPECTED: " + e); } }
Source:
<code>private String getGeolocationsUrl(String deploymentUrl, String accountSid, Boolean xml) { <START> if (deploymentUrl.endsWith("/")) { <END> deploymentUrl = deploymentUrl.substring(0, deploymentUrl.length() - 1); } geolocationsUrl = deploymentUrl + "/2012-04-24/Accounts/" + accountSid + "/Geolocation"; if (!xml) { geolocationsUrl += ".json"; } return geolocationsUrl; }</code><technical_language>this removeSlahAtTheEnd logic is duplicated, create a private method this logic...</technical_language>

Target:
private String getGeolocationsUrl(String deploymentUrl, String accountSid, Boolean xml) { deploymentUrl = evaluateDeploymentUrl(deploymentUrl); geolocationsUrl = deploymentUrl + apiVersionAccounts + accountSid + "/Geolocation"; if (!xml) { geolocationsUrl += ".json"; } return geolocationsUrl; }
Source:
<code>public void visitEnd() { if (_containsSyntheticLambda) { String classToVisit = _methodInsnOwner.replace('/', '.'); SyntheticLambdaAnalyzer syntheticLambdaAnalyzer = new SyntheticLambdaAnalyzer(api, classToVisit, _methodInsnName); ClassReader cr = getClassReader(classToVisit); if (cr != null) { cr.accept(syntheticLambdaAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(syntheticLambdaAnalyzer.getInferredOperation())); <START> _lineNumberConsumer.accept(syntheticLambdaAnalyzer.getLineNumber()); <END> } } else { if (_methodInsnOpcode == Opcodes.INVOKESTATIC) { String functionName = Util.extractSimpleName(_methodInsnOwner, "/") + "::" + _methodInsnName; _inferredOperationConsumer.accept(new InferredOperation(functionName)); } else { String classToVisit = _lambdaSourcePointer._className.replace('/', '.'); FindMethodCallAnalyzer methodCallAnalyzer = new FindMethodCallAnalyzer(api, classToVisit, _lambdaSourcePointer, _methodInsnName); ClassReader cr = getClassReader(classToVisit); if (cr != null) { cr.accept(methodCallAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(methodCallAnalyzer.getInferredOperation())); } } } super.visitEnd(); }</code><technical_language>For safety is check if syntheticLambdaAnalyzer.getLineNumber() != -1 invoke _lineNumberConsumer.accept() if is != -1. This a fallback of super accurate existing line number coming stack trace</technical_language>

Target:
public void visitEnd() { if (_containsSyntheticLambda) { String classToVisit = _methodInsnOwner.replace('/', '.'); SyntheticLambdaAnalyzer syntheticLambdaAnalyzer = new SyntheticLambdaAnalyzer(api, classToVisit, _methodInsnName); ClassReader cr = getClassReader(classToVisit); if (cr != null) { cr.accept(syntheticLambdaAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(syntheticLambdaAnalyzer.getInferredOperation())); int inferredLineNumber = syntheticLambdaAnalyzer.getLineNumber(); if (inferredLineNumber != -1) { _lineNumberConsumer.accept(inferredLineNumber); } } } else { if (_methodInsnOpcode == Opcodes.INVOKESTATIC) { String functionName = Util.extractSimpleName(_methodInsnOwner, "/") + "::" + _methodInsnName; _inferredOperationConsumer.accept(new InferredOperation(functionName)); } else { String classToVisit = _lambdaSourcePointer._className.replace('/', '.'); FindMethodCallAnalyzer methodCallAnalyzer = new FindMethodCallAnalyzer(api, classToVisit, _lambdaSourcePointer, _methodInsnName); ClassReader cr = getClassReader(classToVisit); if (cr != null) { cr.accept(methodCallAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(methodCallAnalyzer.getInferredOperation())); } } } super.visitEnd(); }
Source:
<code>public Optional<String> switchBoard() { if (getLastOpenBoard().isPresent() && getAllBoards().size() > 1) { List<String> boardNames = getAllBoardNames(); int lastBoard = boardNames.indexOf(getLastOpenBoard().get()); int index = (lastBoard + 1) % boardNames.size(); setLastOpenBoard(boardNames.get(index)); } <START> save(); <END> return getLastOpenBoard(); }</code><technical_language>this if clause above? I need save if change anything</technical_language>

Target:
public Optional<String> switchBoard() { if (getLastOpenBoard().isPresent() && getAllBoards().size() > 1) { List<String> boardNames = getAllBoardNames(); int lastBoard = boardNames.indexOf(getLastOpenBoard().get()); int index = (lastBoard + 1) % boardNames.size(); setLastOpenBoard(boardNames.get(index)); } return getLastOpenBoard(); }
Source:
<code>public CasAssertionSecurityContext() { applicationContext = ApplicationContextLocator.getApplicationContext(); String propertyVal = applicationContext.getBean(CAS_COPY_ASSERT_ATTR_TO_USER_ATTR_BEAN, String.class); copyAssertionAttributesToUserAttributes = "true".equalsIgnoreCase(propertyVal); propertyVal = applicationContext.getBean(DECRYPT_CRED_TO_PWD, String.class); <START> decryptCredentialToPassword = "true".equalsIgnoreCase(propertyVal); <END> if (decryptCredentialToPassword) { String decryptCredentialToPasswordPrivateKey = applicationContext.getBean(DECRYPT_CRED_TO_PWD_KEY, String.class); if (key == null) { try { key = getPrivateKeyFromFile(decryptCredentialToPasswordPrivateKey); } catch (Exception e) { log.error("Cannot load key from file: {}", decryptCredentialToPasswordPrivateKey); e.printStackTrace(); } } if (cipher == null) { try { cipher = Cipher.getInstance(key.getAlgorithm()); } catch (Exception e) { log.error("Cannot create cipher for key from file: {}", decryptCredentialToPasswordPrivateKey); e.printStackTrace(); } } algorithm = applicationContext.getBean(DECRYPT_CRED_TO_PWD_ALG, String.class); } }</code><technical_language>I Boolean.valueOf(propertyVale)</technical_language>

Target:
public CasAssertionSecurityContext() { applicationContext = ApplicationContextLocator.getApplicationContext(); String propertyVal = applicationContext.getBean(CAS_COPY_ASSERT_ATTR_TO_USER_ATTR_BEAN, String.class); copyAssertionAttributesToUserAttributes = Boolean.valueOf(propertyVal); propertyVal = applicationContext.getBean(DECRYPT_CRED_TO_PWD, String.class); decryptCredentialToPassword = Boolean.valueOf(propertyVal); if (decryptCredentialToPassword) { String decryptCredentialToPasswordPrivateKey = applicationContext.getBean(DECRYPT_CRED_TO_PWD_KEY, String.class); if (key == null) { try { key = getPrivateKeyFromFile(decryptCredentialToPasswordPrivateKey); } catch (Exception e) { log.error("Cannot load key from file: {}", decryptCredentialToPasswordPrivateKey, e); } } if (cipher == null) { try { cipher = Cipher.getInstance(key.getAlgorithm()); } catch (Exception e) { log.error("Cannot create cipher for key from file: {}", decryptCredentialToPasswordPrivateKey, e); } } algorithm = applicationContext.getBean(DECRYPT_CRED_TO_PWD_ALG, String.class); } }
Source:
<code><START> private String dropTableIndex() { <END> if (DbConnectionFactory.isMySql()) { return MYSQL_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else if (DbConnectionFactory.isPostgres()) { return POSTGRES_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else if (DbConnectionFactory.isMsSql()) { return MSSQL_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else if (DbConnectionFactory.isOracle()) { return ORACLE_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else { return null; } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Reduce number of returns of this method 5, maximum allowed 3. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private String dropTableIndex() { String sql = null; if (DbConnectionFactory.isMySql()) { sql = MYSQL_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else if (DbConnectionFactory.isPostgres()) { sql = POSTGRES_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else if (DbConnectionFactory.isMsSql()) { sql = MSSQL_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } else if (DbConnectionFactory.isOracle()) { sql = ORACLE_DROP_WORKFLOW_SCHEME_X_STRUCTURE_INDEX; } return sql; }
Source:
<code>protected String[] updateEnvironment(String[] envp, IProject project) { if (project == null) return envp; if (envp == null) envp = new String[0]; String ltPath = LinuxtoolsPathProperty.getInstance().getLinuxtoolsPath(project); String envpPath = getEnvpPath(envp); String systemPath = null; Map<String, String> systemEnvMap = null; try { systemEnvMap = RemoteProxyManager.getInstance().getEnv(project); String pathValue = systemEnvMap.get(PATH); if(pathValue != null) systemPath = PATH + "=" + pathValue; } catch (CoreException e) { <START> e.printStackTrace(); <END> } StringBuffer newPath = new StringBuffer(); newPath.append(PATH_EQUAL); if (ltPath != null && ltPath.length() > 0) { newPath.append(ltPath); newPath.append(SEPARATOR); } if (envpPath != null && envpPath.length() > 0) { newPath.append(envpPath); newPath.append(SEPARATOR); } if (systemPath != null && systemPath.length() > 0) { newPath.append(systemPath); newPath.append(SEPARATOR); } if (newPath.length() == PATH_EQUAL.length()) return envp; String[] newEnvp; if (envpPath != null) { newEnvp = new String[envp.length]; for (int i = 0; i < envp.length; i++) if (envp[i].startsWith(PATH_EQUAL)) newEnvp[i] = newPath.toString(); else newEnvp[i] = envp[i]; } else if(systemEnvMap != null) { Map<String, String> envVars = systemEnvMap; Set<String> keySet = envVars.keySet(); newEnvp = new String[envVars.size()]; int i = 0; for (String key : keySet) { newEnvp[i] = key + "=" + envVars.get(key); i++; } } else { newEnvp = new String[] {}; } return newEnvp; }</code><technical_language>This exception handled properly</technical_language>

Target:
protected String[] updateEnvironment(String[] envp, IProject project) { if (project == null) return envp; if (envp == null) envp = new String[0]; String ltPath = LinuxtoolsPathProperty.getInstance().getLinuxtoolsPath(project); String envpPath = getEnvpPath(envp); String systemPath = null; Map<String, String> systemEnvMap = null; try { systemEnvMap = RemoteProxyManager.getInstance().getEnv(project); systemPath = systemEnvMap.get(PATH); } catch (CoreException e) { e.printStackTrace(); } StringBuffer newPath = new StringBuffer(); newPath.append(PATH_EQUAL); if (ltPath != null && ltPath.length() > 0) { newPath.append(ltPath); newPath.append(SEPARATOR); } if (envpPath != null && envpPath.length() > 0) { newPath.append(envpPath); newPath.append(SEPARATOR); } if (systemPath != null && systemPath.length() > 0) { newPath.append(systemPath); newPath.append(SEPARATOR); } if (newPath.length() == PATH_EQUAL.length()) return envp; String[] newEnvp; if (envpPath != null) { newEnvp = new String[envp.length]; for (int i = 0; i < envp.length; i++) if (envp[i].startsWith(PATH_EQUAL)) newEnvp[i] = newPath.toString(); else newEnvp[i] = envp[i]; } else if(systemEnvMap != null) { Map<String, String> envVars = systemEnvMap; Set<String> keySet = envVars.keySet(); newEnvp = new String[envVars.size()]; int i = 0; for (String key : keySet) { newEnvp[i] = key + "=" + envVars.get(key); i++; } } else { newEnvp = new String[] {}; } return newEnvp; }
Source:
<code>public void repeatBrickTest() throws InterpretationException { checkSetUpBrickArrangement(); deleteBrickAtPosition(brickPosition); checkIfBrickAtPositionShowsString(1, R.string.brick_change_y_by); onView(withText(R.string.brick_loop_end)) .check(doesNotExist()); addLoopAtPosition(R.string.brick_repeat, brickPosition); <START> onScriptList().atPosition(2) <END> .perform(longClick()).perform(new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER, new CoordinatesProvider() { @Override public float[] calculateCoordinates(View view) { float[] coordinates = GeneralLocation.CENTER.calculateCoordinates(view); coordinates[1] = view.getContext().getResources().getDisplayMetrics().heightPixels; return coordinates; } }, Press.FINGER)); checkSetUpBrickArrangement(); }</code><technical_language>please put a function name dragBrickAtPositionToBottom</technical_language>

Target:
public void repeatBrickTest() throws InterpretationException { checkSetUpBrickArrangement(); deleteBrickAtPosition(1); checkIfBrickAtPositionShowsString(1, R.string.brick_change_y_by); onView(withText(R.string.brick_loop_end)) .check(doesNotExist()); addBrickAtPosition(RepeatBrick.class, 1, R.string.category_control); dragBrickAtPositionToBottom(2); checkSetUpBrickArrangement(); }
Source:
<code>void updateOrCreateDefaultStatefulBeanSessionTimeoutService(final OperationContext context, final ModelNode model) throws OperationFailedException { final long defaultSessionTimeout = EJB3SubsystemRootResourceDefinition.DEFAULT_STATEFUL_BEAN_SESSION_TIMEOUT.resolveModelAttribute(context, model).asLong(); <START> final ServiceController<?> sc = context.getServiceRegistry(true).getService(SERVICE_NAME); <END> if (sc != null) { final AtomicLong existingValue = (AtomicLong) sc.getValue(); existingValue.set(defaultSessionTimeout); } else { context.getServiceTarget().addService(SERVICE_NAME, new ValueService<>(new ImmediateValue<>(new AtomicLong(defaultSessionTimeout)))).install(); } }</code><technical_language>ServiceRegistry.getRequiredService(...) here, is impossible service exist</technical_language>

Target:
void updateOrCreateDefaultStatefulBeanSessionTimeoutService(final OperationContext context, final ModelNode model) throws OperationFailedException { final long defaultSessionTimeout = EJB3SubsystemRootResourceDefinition.DEFAULT_STATEFUL_BEAN_SESSION_TIMEOUT.resolveModelAttribute(context, model).asLong(); final ServiceController<?> sc = context.getServiceRegistry(true).getRequiredService(SERVICE_NAME); final AtomicLong existingValue = (AtomicLong) sc.getValue(); existingValue.set(defaultSessionTimeout); }
Source:
<code>private void handleVersion2(String name, Attributes attributes) throws SAXException { if (name.equals(TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY) && currentRepository == null) { currentRepository = createRepository(attributes); } else if (name.equals(TaskRepositoriesExternalizer.ELEMENT_PROPERTY) && currentRepository != null) { String key = org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertXmlToString(attributes.getValue(TaskRepositoriesExternalizer.PROPERTY_KEY)); String value = org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertXmlToString(attributes.getValue(TaskRepositoriesExternalizer.PROPERTY_VALUE)); <START> currentRepository.setProperty(key, value); <END> } }</code><technical_language>do some check key present, I suppose importantly key</technical_language>

Target:
private void handleVersion2(String name, Attributes attributes) throws SAXException { if (name.equals(TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY) && currentRepository == null) { currentRepository = createRepository(attributes); } else if (name.equals(TaskRepositoriesExternalizer.ELEMENT_PROPERTY) && currentRepository != null) { String key = attributes.getValue(TaskRepositoriesExternalizer.PROPERTY_KEY); String value = attributes.getValue(TaskRepositoriesExternalizer.PROPERTY_VALUE); if (key != null && value != null) { currentRepository.setProperty(key, value); } } }
Source:
<code>public void copy() throws IOException { File srcFile = new File(repo.getWorkTree(), path + "/" + src); File destFile = new File(repo.getWorkTree(), dest); try (FileInputStream input = new FileInputStream(srcFile); FileOutputStream output = new FileOutputStream(destFile)) { FileChannel channel = input.getChannel(); output.getChannel().transferFrom(channel, 0, channel.size()); <START> destFile.setExecutable(srcFile.canExecute()); <END> } }</code><technical_language>optional: this try{} block</technical_language>

Target:
public void copy() throws IOException { File srcFile = new File(repo.getWorkTree(), path + "/" + src); File destFile = new File(repo.getWorkTree(), dest); try (FileInputStream input = new FileInputStream(srcFile); FileOutputStream output = new FileOutputStream(destFile)) { FileChannel channel = input.getChannel(); output.getChannel().transferFrom(channel, 0, channel.size()); } destFile.setExecutable(srcFile.canExecute()); }
Source:
<code>public void testRemove() { MemoryNode node = new MemoryNode(Mods.NAME); node.add(new MemoryNode("http://names.example/alice")); MemoryNode bob = new MemoryNode("http://names.example/bob"); <START> node.add(bob); <END> node.add(new MemoryNode("http://names.example/charlie")); assertThat(node.getEnumerated().stream().mapToInt(r -> r.isAny() ? 1 : 0).sum(), is(3)); assertThat(node.remove(bob), is(true)); assertThat(node.getEnumerated().stream().mapToInt(r -> r.isAny() ? 1 : 0).sum(), is(2)); assertThat(node.remove(bob), is(false)); assertThat(node.getEnumerated().stream().mapToInt(r -> r.isAny() ? 1 : 0).sum(), is(2)); }</code><technical_language>testing here</technical_language>

Target:
public void testRemove() { MemoryNode node = new MemoryNode(MODS_NAME); node.add(new MemoryNode("http://names.example/alice")); MemoryNode bob = new MemoryNode("http://names.example/bob"); node.add(bob); node.add(new MemoryNode("http://names.example/charlie")); assertThat(node.getEnumerated().stream().mapToInt(r -> r.isAny() ? 1 : 0).sum(), is(3)); assertThat(node.remove(bob), is(true)); assertThat(node.getEnumerated().stream().mapToInt(r -> r.isAny() ? 1 : 0).sum(), is(2)); assertThat(node.remove(bob), is(false)); assertThat(node.getEnumerated().stream().mapToInt(r -> r.isAny() ? 1 : 0).sum(), is(2)); }
Source:
<code>public void testEjbClassAvailableInServlet(@ArquillianResource(HelloWorldServlet.class) URL baseUrl) throws Exception { <START> final HttpClient httpClient = HttpClientBuilder.create().build(); <END> final String message = "JBossAS7"; final String requestURL = baseUrl.toURI() + HelloWorldServlet.URL_PATTERN + "?" + HelloWorldServlet.PARAMETER_NAME + "=" + message; final HttpGet request = new HttpGet(requestURL); final HttpResponse response = httpClient.execute(request); final HttpEntity entity = response.getEntity(); Assert.assertNotNull("Response message from servlet was null", entity); final String responseMessage = EntityUtils.toString(entity); Assert.assertEquals("Unexpected echo message from servlet", message, responseMessage); }</code><technical_language>try (final CloseableHttpClient httpClient = HttpClients.createDefault()){... if fixing this lets fix properly..</technical_language>

Target:
public void testEjbClassAvailableInServlet(@ArquillianResource(HelloWorldServlet.class) URL baseUrl) throws Exception { try (final CloseableHttpClient httpClient = HttpClients.createDefault()) { final String message = "JBossAS7"; final String requestURL = baseUrl.toURI() + HelloWorldServlet.URL_PATTERN + "?" + HelloWorldServlet.PARAMETER_NAME + "=" + message; final HttpGet request = new HttpGet(requestURL); final HttpResponse response = httpClient.execute(request); final HttpEntity entity = response.getEntity(); Assert.assertNotNull("Response message from servlet was null", entity); final String responseMessage = EntityUtils.toString(entity); Assert.assertEquals("Unexpected echo message from servlet", message, responseMessage); } }
Source:
<code>public void setConstraints(int constraints) { <START> this.constraints = constraints; <END> }</code><technical_language>print a "not implemented" message in getConstraints</technical_language>

Target:
public void setConstraints(int constraints) { System.out.println("TextEditor::setConstraints(int) not implemented"); }
Source:
<code>public void stop() { <START> System.gc(); <END> }</code><technical_language>is this necessary</technical_language>

Target:
public void stop() { }
Source:
<code>private org.wso2.carbon.mediator.bam.BamMediator createBAMMediator( EsbNode subject, TransformationInfo information) throws Exception { Assert.isTrue(subject instanceof BAMMediator, "Invalid subject."); BAMMediator visualBAMMediator = (BAMMediator) subject; org.wso2.carbon.mediator.bam.BamMediator bamMediator = new org.wso2.carbon.mediator.bam.BamMediator(); setCommonProperties(bamMediator, visualBAMMediator); if (StringUtils.isNotEmpty(visualBAMMediator.getServerProfile())) { bamMediator.setServerProfile(visualBAMMediator.getServerProfile()); } else { throw new IllegalArgumentException("BAM Mediator Error : Server Profile Name is required"); } if (StringUtils.isNotEmpty(visualBAMMediator.getStreamName())) { if (StringUtils.isNotEmpty(visualBAMMediator.getStreamVersion())) { StreamConfiguration streamConfiguration = new StreamConfiguration(); streamConfiguration.setName(visualBAMMediator.getStreamName()); streamConfiguration.setVersion(visualBAMMediator.getStreamVersion()); bamMediator.getStream().setStreamConfiguration(streamConfiguration); } else { throw new IllegalArgumentException("BAM Mediator Error : Stream Version is required"); } } else { throw new IllegalArgumentException("BAM Mediator Error : Stream Name is required"); <START> } <END> return bamMediator; }</code><technical_language>line of codes properly formatted</technical_language>

Target:
private org.wso2.carbon.mediator.bam.BamMediator createBAMMediator( EsbNode subject, TransformationInfo information) throws Exception { Assert.isTrue(subject instanceof BAMMediator, "Invalid subject."); BAMMediator visualBAMMediator = (BAMMediator) subject; org.wso2.carbon.mediator.bam.BamMediator bamMediator = new org.wso2.carbon.mediator.bam.BamMediator(); setCommonProperties(bamMediator, visualBAMMediator); bamMediator.setServerProfile(visualBAMMediator.getServerProfile()); StreamConfiguration streamConfiguration = new StreamConfiguration(); streamConfiguration.setName(visualBAMMediator.getStreamName()); streamConfiguration.setVersion(visualBAMMediator.getStreamVersion()); bamMediator.getStream().setStreamConfiguration(streamConfiguration); return bamMediator; }
Source:
<code>private static void writeDates(JsonWriter writer, ProjectAnalysis analysis, System2 system2) { analysis.getAnalysis().ifPresent(a -> writer.propDateTime("analysedAt", a.getDate())); if (analysis.getAnalysis().isPresent()) { <START> writer.propDateTime("changedAt", analysis.getAnalysis().get().getDate()); <END> } else { writer.propDateTime("changedAt", new Date(system2.now())); } }</code><technical_language>FP. fixed writing: writer.propDateTime("changedAt", analysis.getAnalysis().map(Analysis::getDate).orElseGet(() -> new Date(system2.now())));</technical_language>

Target:
private static void writeDates(JsonWriter writer, ProjectAnalysis analysis, System2 system2) { analysis.getAnalysis().ifPresent(a -> writer.propDateTime("analysedAt", a.getDate())); writer.propDateTime("changedAt", analysis.getAnalysis().map(Analysis::getDate).orElseGet(() -> new Date(system2.now()))); }
Source:
<code>private static boolean cleanlyDelete(FileSystem fs, Path root, Path path, boolean useTrash) { Preconditions.checkNotNull(fs, "File system cannot be null"); Preconditions.checkNotNull(root, "Root path cannot be null"); Preconditions.checkNotNull(path, "Path to delete cannot be null"); try { boolean deleted; Path relativePath; if (path.isAbsolute()) { relativePath = new Path(root.toUri().relativize(path.toUri())); } else { relativePath = path; } if (relativePath.isAbsolute()) { LOG.debug("Deleting path {}", path); deleted = useTrash ? Trash.moveToAppropriateTrash(fs, path, fs.getConf()) : fs.delete(path, true ); } else { Path absolute = new Path(root, relativePath); LOG.debug("Deleting path {}", absolute); deleted = useTrash ? Trash.moveToAppropriateTrash(fs, absolute, fs.getConf()) : fs.delete(absolute, true ); for (Path current = absolute.getParent(); !current.equals(root) && !(current.getParent() == null); current = current.getParent()) { final FileStatus[] stats = fs.listStatus(current); if (stats == null || stats.length == 0) { LOG.debug("Deleting empty path {}", current); <START> deleted = (useTrash ? Trash.moveToAppropriateTrash(fs, current, fs.getConf()) : fs.delete(current, true)) || deleted; <END> } else { break; } } } return deleted; } catch (IOException ex) { throw new DatasetIOException("Could not cleanly delete path:" + path, ex); } }</code><technical_language>I moving trash is this line. a child directory of pending-trashed directory is in trash, line 231 (because stats is empty, if deleted = false of line 231 stats.length > 0), moving a now-empty parent directory create a timestamp-suffixed duplicate empty directory in trash, level of path hierarchy. Reverting original code completely safe a lot cleaner</technical_language>

Target:
private static boolean cleanlyDelete(FileSystem fs, Path root, Path path, boolean useTrash) { Preconditions.checkNotNull(fs, "File system cannot be null"); Preconditions.checkNotNull(root, "Root path cannot be null"); Preconditions.checkNotNull(path, "Path to delete cannot be null"); try { boolean deleted; Path relativePath; if (path.isAbsolute()) { relativePath = new Path(root.toUri().relativize(path.toUri())); } else { relativePath = path; } if (relativePath.isAbsolute()) { LOG.debug("Deleting path {}", path); deleted = useTrash ? Trash.moveToAppropriateTrash(fs, path, fs.getConf()) : fs.delete(path, true ); } else { Path absolute = new Path(root, relativePath); LOG.debug("Deleting path {}", absolute); deleted = useTrash ? Trash.moveToAppropriateTrash(fs, absolute, fs.getConf()) : fs.delete(absolute, true ); for (Path current = absolute.getParent(); !current.equals(root) && !(current.getParent() == null); current = current.getParent()) { final FileStatus[] stats = fs.listStatus(current); if (stats == null || stats.length == 0) { LOG.debug("Deleting empty path {}", current); deleted = fs.delete(current, true) || deleted; } else { break; } } } return deleted; } catch (IOException ex) { throw new DatasetIOException("Could not cleanly delete path:" + path, ex); } }
Source:
<code>public void clear() { <START> timeStamps = null; <END> values = null; }</code><technical_language>call clear() timeStamps values ... this null pointer exceptions calling add clear</technical_language>

Target:
public void clear() { timeStamps.clear(); values.clear(); key = null; }
Source:
<code>public void testRestoreWithTrustedEmptySnapFiles() throws Exception { <START> FileTxnSnapLog.setTrustEmptySnapshotFlag(true); <END> runTest(false, true); assertFalse("Trust empty snapshot flag should be reset after first use.", FileTxnSnapLog.getTrustEmptySnapshotFlag()); }</code><technical_language>resetting "false" in a finally block, this if test fails rest of tests executed default</technical_language>

Target:
public void testRestoreWithTrustedEmptySnapFiles() throws Exception { runTest(false, true); }
Source:
<code>private QueryParams buildQueryParams(GridSettings settings, List<Order> orderList) { int page = (settings.getPage() == null) ? 1 : settings.getPage(); <START> int pageSize = (settings.getPage() == null) ? 10 : settings.getRows(); <END> return new QueryParams(page, pageSize, orderList); }</code><technical_language>getRows(), I suppose</technical_language>

Target:
private QueryParams buildQueryParams(GridSettings settings, List<Order> orderList) { int page = (settings.getPage() == null) ? 1 : settings.getPage(); int pageSize = (settings.getRows() == null) ? 10 : settings.getRows(); return new QueryParams(page, pageSize, orderList); }
Source:
<code>private boolean checkAggregates(Offer offer, NodeTask taskToLaunch, int ports, double cpus, double mem) { final ServiceResourceProfile profile = taskToLaunch.getProfile(); final String taskPrefix = taskToLaunch.getTaskPrefix(); final double aggrCpu = profile.getAggregateCpu() + profile.getExecutorCpu(); final double aggrMem = profile.getAggregateMemory() + profile.getExecutorMemory(); final TaskConstraints taskConstraints = taskConstraintsManager.getConstraints(taskPrefix); if (aggrCpu <= cpus && aggrMem <= mem && taskConstraints.portsCount() <= ports) { return true; } else { <START> LOGGER.error("Offer not sufficient for task with, cpu: {}, memory: {}, ports: {}", aggrCpu, aggrMem, ports); <END> return false; } }</code><technical_language>This error condition. expected some mesos resources needed</technical_language>

Target:
private boolean checkAggregates(Offer offer, NodeTask taskToLaunch, int ports, double cpus, double mem) { final ServiceResourceProfile profile = taskToLaunch.getProfile(); final String taskPrefix = taskToLaunch.getTaskPrefix(); final double aggrCpu = profile.getAggregateCpu() + profile.getExecutorCpu(); final double aggrMem = profile.getAggregateMemory() + profile.getExecutorMemory(); final TaskConstraints taskConstraints = taskConstraintsManager.getConstraints(taskPrefix); if (aggrCpu <= cpus && aggrMem <= mem && taskConstraints.portsCount() <= ports) { return true; } else { LOGGER.debug("Offer insufficient for task with, cpu: {}, memory: {}, ports: {}", aggrCpu, aggrMem, ports); return false; } }
Source:
<code>public void testLayerDisabledServiceResponse() throws Exception { enableWMS(); String layerName = "cite:RoadSegments"; <START> LayerInfo linfo = getCatalog().getLayerByName(layerName); <END> ResourceInfo ri = linfo.getResource(); ri.setServiceConfiguration(true); ri.setDisabledServices(new ArrayList<>(Arrays.asList("WMS"))); getCatalog().save(ri); getCatalog().save(linfo); Document doc = getAsDOM( "wms?bbox=" + "-180,-90,180,90" + "&layers=" + layerName + "&Format=image/png" + "&request=GetMap" + "&width=550" + "&height=250" + "&srs=EPSG:4326"); assertEquals("ServiceExceptionReport", doc.getDocumentElement().getNodeName()); }</code><technical_language>observation WCS WFS tests</technical_language>

Target:
public void testLayerDisabledServiceResponse() throws Exception { enableWMS(); String layerName = "cite:RoadSegments"; FeatureTypeInfo ftinfo = getCatalog().getFeatureTypeByName(layerName); ftinfo.setServiceConfiguration(true); ftinfo.setDisabledServices(new ArrayList<>(Arrays.asList("WMS"))); getCatalog().save(ftinfo); Document doc = getAsDOM( "wms?bbox=" + "-180,-90,180,90" + "&layers=" + layerName + "&Format=image/png" + "&request=GetMap" + "&width=550" + "&height=250" + "&srs=EPSG:4326"); assertEquals("ServiceExceptionReport", doc.getDocumentElement().getNodeName()); }
Source:
<code>protected void clearErrorMessage() { errorContainer.setVisibility(View.GONE); <START> notificationButtonView.setVisibility(View.GONE); <END> }</code><technical_language>errorContainer.setVisibility(View.GONE) takes care of notificationButtonView a child of errorContainer (Not putting this for other cases, get corrected for install update if do here)</technical_language>

Target:
protected void clearErrorMessage() { errorContainer.setVisibility(View.GONE); }
Source:
<code>private void decorateResourceMapping(Object element, IDecoration decoration) throws CoreException { @SuppressWarnings("restriction") <START> ResourceMapping mapping = Utils.getResourceMapping(element); <END> boolean isWorkingSet = mapping.getModelObject() instanceof IWorkingSet; IDecoratableResource decoRes; try { if (isWorkingSet) { decoRes = new DecoratableWorkingSet(mapping); } else { decoRes = new DecoratableResourceMapping(mapping); } } catch (IOException e) { throw new CoreException(Activator.createErrorStatus( NLS.bind(UIText.Decorator_exceptionMessage, element), e)); } if (!decoRes.isTracked() && isWorkingSet) return; final DecorationHelper helper = new DecorationHelper( Activator.getDefault().getPreferenceStore()); helper.decorate(decoration, decoRes); }</code><technical_language>Do need a null check here? if (mapping == null) { return; }</technical_language>

Target:
private void decorateResourceMapping(Object element, IDecoration decoration) throws CoreException { @SuppressWarnings("restriction") ResourceMapping mapping = Utils.getResourceMapping(element); if (mapping == null) { return; } boolean isWorkingSet = mapping.getModelObject() instanceof IWorkingSet; IDecoratableResource decoRes; try { if (isWorkingSet) { decoRes = new DecoratableWorkingSet(mapping); } else { decoRes = new DecoratableResourceMapping(mapping); } } catch (IOException e) { throw new CoreException(Activator.createErrorStatus( NLS.bind(UIText.Decorator_exceptionMessage, element), e)); } if (!decoRes.isTracked() && isWorkingSet) { return; } final DecorationHelper helper = new DecorationHelper( Activator.getDefault().getPreferenceStore()); helper.decorate(decoration, decoRes); }
Source:
<code>private Map<String, String> createMigrationInfo() { Map<String, String> migrationInfo = new HashMap<>(); P parameters = getParameters(); migrationInfo.put(VdsProperties.vm_guid, parameters.getVmId().toString()); migrationInfo.put(VdsProperties.src, String.format("%1$s", parameters.getSrcHost())); migrationInfo.put(VdsProperties.dst, String.format("%1$s", parameters.getDstHost())); migrationInfo.put(VdsProperties.method, VdsProperties.migrationMethodtoString(parameters.getMigrationMethod())); migrationInfo.put("abortOnError", Boolean.TRUE.toString()); <START> migrationInfo.put(VdsProperties.TUNNELED, Boolean.toString(parameters.isTunnelMigration())); <END> if (StringUtils.isNotBlank(parameters.getDstQemu())) { migrationInfo.put(VdsProperties.DST_QEMU, parameters.getDstQemu()); } if (parameters.getMigrationDowntime() != 0) { migrationInfo.put(VdsProperties.MIGRATION_DOWNTIME, Integer.toString(parameters.getMigrationDowntime())); } if (parameters.getAutoConverge() != null) { migrationInfo.put(VdsProperties.AUTO_CONVERGE, parameters.getAutoConverge().toString()); } if (parameters.getMigrateCompressed() != null) { migrationInfo.put(VdsProperties.MIGRATE_COMPRESSED, parameters.getMigrateCompressed().toString()); } if (parameters.getConsoleAddress() != null) { migrationInfo.put(VdsProperties.CONSOLE_ADDRESS, parameters.getConsoleAddress()); } return migrationInfo; }</code><technical_language>important order of code twisted , I this is matter</technical_language>

Target:
private Map<String, String> createMigrationInfo() { Map<String, String> migrationInfo = new HashMap<>(); P parameters = getParameters(); migrationInfo.put(VdsProperties.vm_guid, parameters.getVmId().toString()); migrationInfo.put(VdsProperties.src, String.format("%1$s", parameters.getSrcHost())); migrationInfo.put(VdsProperties.dst, String.format("%1$s", parameters.getDstHost())); migrationInfo.put(VdsProperties.method, VdsProperties.migrationMethodtoString(parameters.getMigrationMethod())); migrationInfo.put(VdsProperties.TUNNELED, Boolean.toString(parameters.isTunnelMigration())); migrationInfo.put("abortOnError", Boolean.TRUE.toString()); if (StringUtils.isNotBlank(parameters.getDstQemu())) { migrationInfo.put(VdsProperties.DST_QEMU, parameters.getDstQemu()); } if (parameters.getMigrationDowntime() != 0) { migrationInfo.put(VdsProperties.MIGRATION_DOWNTIME, Integer.toString(parameters.getMigrationDowntime())); } if (parameters.getAutoConverge() != null) { migrationInfo.put(VdsProperties.AUTO_CONVERGE, parameters.getAutoConverge().toString()); } if (parameters.getMigrateCompressed() != null) { migrationInfo.put(VdsProperties.MIGRATE_COMPRESSED, parameters.getMigrateCompressed().toString()); } if (parameters.getConsoleAddress() != null) { migrationInfo.put(VdsProperties.CONSOLE_ADDRESS, parameters.getConsoleAddress()); } return migrationInfo; }
Source:
<code>public void testRoundRobinBalancer() { RandomLoadBalancerStrategyFactory lbFactory = new RandomLoadBalancerStrategyFactory(); RandomLoadBalancerStrategy rrLoadBalancer = lbFactory.newLoadBalancer(null); Map<Integer, PartitionData> partitionDataMap = new HashMap<Integer, PartitionData>(2); partitionDataMap.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(1d)); TrackerClient trackerClient1 = Mockito.mock(TrackerClient.class); TrackerClient trackerClient2 = Mockito.mock(TrackerClient.class); Map<URI, TrackerClient> trackerClients = new HashMap<>(); <START> URI uri1 = URI.create("http://cluster-1/test"); URI uri2 = URI.create("http://cluster-1/test"); <END> trackerClients.put(uri1, trackerClient1); trackerClients.put(uri2, trackerClient2); for (int i = 0; i < 100; ++i) { assertNotNull(rrLoadBalancer.getTrackerClient(null, new RequestContext(), 0, DefaultPartitionAccessor.DEFAULT_PARTITION_ID, trackerClients)); } }</code><technical_language>Do set uri 2 trackerClients purpose? explicitly verify choose trackerClient2</technical_language>

Target:
public void testRoundRobinBalancer() { RandomLoadBalancerStrategyFactory lbFactory = new RandomLoadBalancerStrategyFactory(); RandomLoadBalancerStrategy rrLoadBalancer = lbFactory.newLoadBalancer(null); Map<Integer, PartitionData> partitionDataMap = new HashMap<Integer, PartitionData>(2); partitionDataMap.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(1d)); TrackerClient trackerClient1 = Mockito.mock(TrackerClient.class); TrackerClient trackerClient2 = Mockito.mock(TrackerClient.class); Map<URI, TrackerClient> trackerClients = new HashMap<>(); URI uri1 = URI.create("http://cluster-1/test"); URI uri2 = URI.create("http://cluster-2/test"); trackerClients.put(uri1, trackerClient1); trackerClients.put(uri2, trackerClient2); for (int i = 0; i < 100; ++i) { assertNotNull(rrLoadBalancer.getTrackerClient(null, new RequestContext(), 0, DefaultPartitionAccessor.DEFAULT_PARTITION_ID, trackerClients)); } }
Source:
<code><START> public String get(String name, ParcelableProxy proxy) throws QueryFailedException { <END> throw new UnsupportedOperationException("Returning armored key from Web Key Directory not supported"); }</code><technical_language>want return empty entry array</technical_language>

Target:
public String get(String name, ParcelableProxy proxy) { throw new UnsupportedOperationException("Returning armored key from Web Key Directory not supported"); }