auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<AuthzDecisionStatement> createAuthorizationDecisionStatements(final CallbackProperties properties, final Subject subject) { final List<AuthzDecisionStatement> authDecisionStatements = new ArrayList<>(); final Boolean hasAuthzStmt = properties.getAuthorizationStatementExists(); if (hasAuthzStmt) { <START> final String resource = properties.getAuthnicationResource(); <END> String decision = properties.getAuthorizationDecision(); if (decision == null) { decision = AUTHZ_DECISION_PERMIT; } if (!isValidAuthenicationDescision(decision)) { decision = AUTHZ_DECISION_PERMIT; } final Evidence evidence = createEvidence(properties, subject); authDecisionStatements.add(OpenSAML2ComponentBuilder.getInstance().createAuthzDecisionStatement(resource, decision, AUTHZ_DECISION_ACTION_EXECUTE, evidence)); } return authDecisionStatements; }</code><technical_language>methos getAuthorizationResource</technical_language>

Target:
public List<AuthzDecisionStatement> createAuthorizationDecisionStatements(final CallbackProperties properties, final Subject subject) { final List<AuthzDecisionStatement> authDecisionStatements = new ArrayList<>(); final Boolean hasAuthzStmt = properties.getAuthorizationStatementExists(); if (hasAuthzStmt) { final String resource = properties.getAuthorizationResource(); String decision = properties.getAuthorizationDecision(); if (decision == null) { decision = AUTHZ_DECISION_PERMIT; } if (!isValidAuthorizationDecision(decision)) { decision = AUTHZ_DECISION_PERMIT; } final Evidence evidence = createEvidence(properties, subject); authDecisionStatements.add(OpenSAML2ComponentBuilder.getInstance().createAuthzDecisionStatement(resource, decision, AUTHZ_DECISION_ACTION_EXECUTE, evidence)); } return authDecisionStatements; }
Source:
<code>public T parse(String value) { <START> if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) return null; <END> if (!Strings.isQuoted(value)) throw new IllegalArgumentException("JSON strings must be enclosed by single quotes"); String json = Strings.unquote(value); try { return (T) objectMapper.readValue(json, toJacksonJavaType()); } catch (IOException e) { throw new IllegalArgumentException(e.getMessage(), e); } }</code><technical_language>In driver 4 contribution guidelines mandate if/for/while blocks enclosed braces. for line below</technical_language>

Target:
public T parse(String value) { if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) { return null; } if (!Strings.isQuoted(value)) { throw new IllegalArgumentException("JSON strings must be enclosed by single quotes"); } String json = Strings.unquote(value); try { return (T) objectMapper.readValue(json, toJacksonJavaType()); } catch (IOException e) { throw new IllegalArgumentException(e.getMessage(), e); } }
Source:
<code>@Override public void setMasterKeyName(String masterKeyName) { <START> if (!started()) { <END> masterKey = new T2<>(masterKeyName, null); return; } loadMasterKey(masterKeyName); }</code><technical_language>more clear: masterKey = ...; if (started()) loadMasterKey();</technical_language>

Target:
@Override public void setMasterKeyName(String masterKeyName) { this.masterKeyName = masterKeyName; if (started()) loadMasterKey(masterKeyName); }
Source:
<code>private Menu createSortMenu() { Menu submenu = new Menu(shell, SWT.DROP_DOWN); MenuItem subitem; for(int i = 0; i < columnNames.length; i++) { subitem = new MenuItem (submenu, SWT.NONE); subitem.setText(columnNames [i]); final int column = i; subitem.addSelectionListener(widgetSelectedAdapter( e -> { <START> sort(column); <END> })); } return submenu; }</code><technical_language>Put in line</technical_language>

Target:
private Menu createSortMenu() { Menu submenu = new Menu(shell, SWT.DROP_DOWN); MenuItem subitem; for(int i = 0; i < columnNames.length; i++) { subitem = new MenuItem (submenu, SWT.NONE); subitem.setText(columnNames [i]); final int column = i; subitem.addSelectionListener(widgetSelectedAdapter( e -> sort(column))); } return submenu; }
Source:
<code>public void tearDown() { <START> fLogger.removeAllAppenders(); <END> fBot.closeAllEditors(); }</code><technical_language>this is @After, in a new @AfterClass (or else lose logging test)</technical_language>

Target:
public void tearDown() { fBot.closeAllEditors(); }
Source:
<code>protected void firstListenerAdded() { <START> if (!isDisposed()) { if (listener == null) { <END> listener = property .adaptListener(new ISimplePropertyListener<MapDiff<K, V>>() { @Override public void handleEvent( final SimplePropertyEvent<MapDiff<K, V>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { modCount++; notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedMap = new HashMap<>(getMap()); stale = false; if (listener != null) listener.addTo(source); } }); } }</code><technical_language>combine conditions of 'if' statements</technical_language>

Target:
protected void firstListenerAdded() { if (!isDisposed() && listener == null) { listener = property.adaptListener(new ISimplePropertyListener<MapDiff<K, V>>() { @Override public void handleEvent(final SimplePropertyEvent<MapDiff<K, V>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { modCount++; notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedMap = new HashMap<>(getMap()); stale = false; if (listener != null) listener.addTo(source); } }); }
Source:
<code>private boolean moveChunkInside(Chunk chunkToMove, long boundary) { <START> return chunkToMove.block >= boundary && <END> fileStore.predictAllocation(chunkToMove.len) + chunkToMove.len < chunkToMove.block && moveChunk(chunkToMove, 0, 0); }</code><technical_language>@andreitokar is a bug existing here, block compared size of file</technical_language>

Target:
private boolean moveChunkInside(Chunk chunkToMove, long boundary) { boolean res = chunkToMove.block >= boundary && fileStore.predictAllocation(chunkToMove.len, boundary, -1) < boundary && moveChunk(chunkToMove, boundary, -1); assert !res || chunkToMove.block + chunkToMove.len <= boundary; return res; }
Source:
<code>private static Class<?> loadClassWithNodeClassloader(final TypeNode n, final String clazzName) { if (n.getType() != null) { try { ClassLoader classLoader = n.getType().getClassLoader(); if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } <START> return classLoader.loadClass(clazzName); <END> } catch (final ClassNotFoundException ignored) { } catch (final LinkageError expected) { } } return null; }</code><technical_language>this support array types ? pass a name pairs of brackets this method, binary name of array. [ClassUtils.getClass(classLoader, clazzName)](<LINK_0> more robust</technical_language>

Target:
private static Class<?> loadClassWithNodeClassloader(final TypeNode n, final String clazzName) { if (n.getType() != null) { try { ClassLoader classLoader = n.getType().getClassLoader(); if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } return ClassUtils.getClass(classLoader, clazzName); } catch (final ClassNotFoundException ignored) { } catch (final LinkageError expected) { } } return null; }
Source:
<code>public BigDecimal getExchangeRateForSell(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency) || !getCryptoCurrencies().contains(cryptoCurrency)) { log.warn("{}-{} pair not supported", cryptoCurrency, fiatCurrency); return null; } try { <START> log.info("{}-{} pair SET getExchangeRateLast", cryptoCurrency, fiatCurrency); <END> setTicker(cryptoCurrency, fiatCurrency); return rateInfo.getLowestAsk(); } catch (Exception e) { log.error("", e); } return null; }</code><technical_language>this trace level</technical_language>

Target:
public BigDecimal getExchangeRateForSell(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency) || !getCryptoCurrencies().contains(cryptoCurrency)) { log.warn("{}-{} pair not supported", cryptoCurrency, fiatCurrency); return null; } try { log.info("{}-{} pair SET getExchangeRateLast", cryptoCurrency, fiatCurrency); setTicker(cryptoCurrency, fiatCurrency); return bitKubRateInfo.getLowestAsk(); } catch (Exception e) { log.error("", e); } return null; }
Source:
<code>private Set<String> validateTopics(final Set<String> topicsToValidate, final Map<String, InternalTopicConfig> topicsMap) { <START> if (!topicsMap.keySet().containsAll(topicsToValidate)) { <END> throw new IllegalStateException("The topics map " + topicsMap + " does not contain all the topics " + topicsToValidate + " trying to validate."); } final Map<String, Integer> existedTopicPartition = getNumPartitions(topicsToValidate); final Set<String> topicsToCreate = new HashSet<>(); for (final String topicName : topicsToValidate) { final Optional<Integer> numberOfPartitions = topicsMap.get(topicName).numberOfPartitions(); if (existedTopicPartition.containsKey(topicName) && numberOfPartitions.isPresent()) { if (!existedTopicPartition.get(topicName).equals(numberOfPartitions.get())) { final String errorMsg = String.format("Existing internal topic %s has invalid partitions: " + "expected: %d; actual: %d. " + "Use 'kafka.tools.StreamsResetter' tool to clean up invalid topics before processing.", topicName, numberOfPartitions.get(), existedTopicPartition.get(topicName)); log.error(errorMsg); throw new StreamsException(errorMsg); } } else { topicsToCreate.add(topicName); } } return topicsToCreate; }</code><technical_language>Do need pass in topicsMap, longer looping it</technical_language>

Target:
private Set<String> validateTopics(final Set<String> topicsToValidate, final Map<String, InternalTopicConfig> topicsMap) { if (!topicsMap.keySet().containsAll(topicsToValidate)) { throw new IllegalStateException("The topics map " + topicsMap.keySet() + " does not contain all the topics " + topicsToValidate + " trying to validate."); } final Map<String, Integer> existedTopicPartition = getNumPartitions(topicsToValidate); final Set<String> topicsToCreate = new HashSet<>(); for (final String topicName : topicsToValidate) { final Optional<Integer> numberOfPartitions = topicsMap.get(topicName).numberOfPartitions(); if (existedTopicPartition.containsKey(topicName) && numberOfPartitions.isPresent()) { if (!existedTopicPartition.get(topicName).equals(numberOfPartitions.get())) { final String errorMsg = String.format("Existing internal topic %s has invalid partitions: " + "expected: %d; actual: %d. " + "Use 'kafka.tools.StreamsResetter' tool to clean up invalid topics before processing.", topicName, numberOfPartitions.get(), existedTopicPartition.get(topicName)); log.error(errorMsg); throw new StreamsException(errorMsg); } } else { topicsToCreate.add(topicName); } } return topicsToCreate; }
Source:
<code>public RdfRepository(UrisScheme uris, RdfClient rdfClient, long maxPostSize, UpdateMode updateMode) { this.uris = uris; this.rdfClient = rdfClient; updateLeftOffTimeBody = <START> loadBody("updateLeftOffTime"); <END> getValues = loadBody("GetValues"); getRefs = loadBody("GetRefs"); getRevisions = loadBody("GetRevisions"); verifyExtra = loadBody("verifyExtra"); verifyMissing = loadBody("verifyMissing"); getLexemes = loadBody("GetLexemes"); maxStatementsPerBatch = maxPostSize / 400; maxPostDataSize = (maxPostSize - 1024 * 1024) / 2; this.updateMode = updateMode; }</code><technical_language>planning extract other queries? slightly uncomfortable loss of symmetry</technical_language>

Target:
public RdfRepository(UrisScheme uris, RdfClient rdfClient, long maxPostSize, UpdateMode updateMode) { this.uris = uris; this.rdfClient = rdfClient; updateLeftOffTimeBody = loadBody("updateLeftOffTime"); getValues = loadBody("GetValues"); getRefs = loadBody("GetRefs"); getRevisions = loadBody("GetRevisions"); verifyExtra = loadBody("verifyExtra"); verifyMissing = loadBody("verifyMissing"); getLexemes = loadBody("GetLexemes"); maxStatementsPerBatch = maxPostSize / 400; maxPostDataSize = (maxPostSize - 1024 * 1024) / 2; this.updateMode = updateMode; updateQueryFactory = new UpdateQueryFactory(uris); }
Source:
<code>public void loadUserWhenUserRequestIsNullThenThrowIllegalArgumentException() { DelegatingOAuth2UserService<OAuth2UserRequest, OAuth2User> delegatingUserService = new DelegatingOAuth2UserService<>( <START> Arrays.asList(mock(DefaultOAuth2UserService.class), mock(DefaultOAuth2UserService.class))); <END> delegatingUserService.loadUser(null); }</code><technical_language>purpose of this test is ensure OAuth2UserRequest passed loadUser is **not** null else throw IllegalArgumentException. Changing List of OAuth2UserService mocks DefaultOAuth2UserService apply is tested here. Please revert this. Thank you</technical_language>

Target:
public void loadUserWhenUserRequestIsNullThenThrowIllegalArgumentException() { DelegatingOAuth2UserService<OAuth2UserRequest, OAuth2User> delegatingUserService = new DelegatingOAuth2UserService(Arrays.asList(mock(OAuth2UserService.class), mock(OAuth2UserService.class))); delegatingUserService.loadUser(null); }
Source:
<code>public void sendResponse(Operation operation, Object obj) { Address target = operation.getCallerAddress(); boolean send; if (obj == null) { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), null); } else if (obj.getClass() == NormalResponse.class) { NormalResponse response = (NormalResponse) obj; send = sendNormalResponse( target, response.getCallId(), response.getBackupAcks(), response.isUrgent(), response.getValue()); } else if (obj.getClass() == ErrorResponse.class || obj.getClass() == CallTimeoutResponse.class) { send = send(target, (Response) obj); } else if (obj instanceof Throwable) { send = send(target, new ErrorResponse((Throwable) obj, operation.getCallId(), operation.isUrgent())); } else { try { <START> send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), obj); <END> } catch (HazelcastSerializationException e) { send = send(target, new ErrorResponse(e, operation.getCallId(), operation.isUrgent())); } } if (!send) { logger.warning("Cannot send response: " + obj + " to " + target + ". " + operation); } }</code><technical_language>else if (obj.getClass() == NormalResponse.class) path</technical_language>

Target:
public void sendResponse(Operation operation, Object obj) { Address target = operation.getCallerAddress(); boolean send; if (obj == null) { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), null); } else if (obj.getClass() == NormalResponse.class) { NormalResponse response = (NormalResponse) obj; send = sendNormalResponse( target, response.getCallId(), response.getBackupAcks(), response.isUrgent(), response.getValue()); } else if (obj.getClass() == ErrorResponse.class || obj.getClass() == CallTimeoutResponse.class) { send = send(target, (Response) obj); } else if (obj instanceof Throwable) { send = send(target, new ErrorResponse((Throwable) obj, operation.getCallId(), operation.isUrgent())); } else { send = sendNormalResponse(target, operation.getCallId(), 0, operation.isUrgent(), obj); } if (!send) { logger.warning("Cannot send response: " + obj + " to " + target + ". " + operation); } }
Source:
<code>public ElasticsearchClient(Map<SchemaTableName, ElasticsearchTableDescription> descriptions, Duration requestTimeout) <START> throws IOException <END> { tableDescriptions = requireNonNull(descriptions, "Elasticsearch Table Description is null"); timeout = requireNonNull(requestTimeout, "Elasticsearch request timeout is null"); for (Map.Entry<SchemaTableName, ElasticsearchTableDescription> entry : tableDescriptions.entrySet()) { ElasticsearchTableDescription tableDescription = entry.getValue(); if (!clients.containsKey(tableDescription.getClusterName())) { Settings settings = Settings.builder().put("cluster.name", tableDescription.getClusterName()).build(); TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(tableDescription.getHostAddress()), tableDescription.getPort())); clients.put(tableDescription.getClusterName(), client); } } }</code><technical_language>private final Map<String, Client> clients = new HashMap<>();</technical_language>

Target:
public ElasticsearchClient(Map<SchemaTableName, ElasticsearchTableDescription> descriptions, Duration requestTimeout) throws IOException { tableDescriptions = requireNonNull(descriptions, "description is null"); timeout = requireNonNull(requestTimeout, "requestTimeout is null"); for (Entry<SchemaTableName, ElasticsearchTableDescription> entry : tableDescriptions.entrySet()) { ElasticsearchTableDescription tableDescription = entry.getValue(); if (!clients.containsKey(tableDescription.getClusterName())) { Settings settings = Settings.builder().put("cluster.name", tableDescription.getClusterName()).build(); TransportAddress address = new TransportAddress(InetAddress.getByName(tableDescription.getHostAddress()), tableDescription.getPort()); TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(address); clients.put(tableDescription.getClusterName(), client); } } }
Source:
<code>public Group removeAccount(String hrefOrEmailOrUsername) { Assert.hasText(hrefOrEmailOrUsername, "hrefOrEmailOrUsername cannot be null or empty"); GroupMembership groupMembership = null; for (GroupMembership aGroupMembership : getAccountMemberships()) { <START> if (aGroupMembership.getAccount().getHref().equalsIgnoreCase(hrefOrEmailOrUsername) <END> || aGroupMembership.getAccount().getEmail().equalsIgnoreCase(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getUsername().equalsIgnoreCase(hrefOrEmailOrUsername)) { groupMembership = aGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }</code><technical_language>hrefs case sensitive. Please equals(String) instead of equalsIgnoreCase(String)</technical_language>

Target:
public Group removeAccount(String hrefOrEmailOrUsername) { Assert.hasText(hrefOrEmailOrUsername, "hrefOrEmailOrUsername cannot be null or empty"); GroupMembership groupMembership = null; for (GroupMembership aGroupMembership : getAccountMemberships()) { if (aGroupMembership.getAccount().getHref().equals(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getEmail().equals(hrefOrEmailOrUsername) || aGroupMembership.getAccount().getUsername().equals(hrefOrEmailOrUsername)) { groupMembership = aGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }
Source:
<code>protected Void createDatadiskTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, <START> CreateDataDiskTemplateContext<TemplateApiResult> context) { <END> if (s_logger.isDebugEnabled()) { s_logger.debug("MDOVA createDatadiskTemplateCallback Performing create datadisk template cross callback after completion"); } DataObject dataDiskTemplate = context.dataDiskTemplate; AsyncCallFuture<TemplateApiResult> future = context.getFuture(); CreateCmdResult result = callback.getResult(); TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate); try { if (result.isSuccess()) { dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer()); } else { dataDiskTemplate.processEvent(Event.OperationFailed); dataDiskTemplateResult.setResult(result.getResult()); } } catch (Exception e) { s_logger.debug("Failed to process create template callback", e); dataDiskTemplateResult.setResult(e.toString()); } future.complete(dataDiskTemplateResult); return null; }</code><technical_language>Do need catch here</technical_language>

Target:
protected Void createDatadiskTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, CreateDataDiskTemplateContext<TemplateApiResult> context) { DataObject dataDiskTemplate = context.dataDiskTemplate; AsyncCallFuture<TemplateApiResult> future = context.getFuture(); CreateCmdResult result = callback.getResult(); TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate); try { if (result.isSuccess()) { dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer()); } else { dataDiskTemplate.processEvent(Event.OperationFailed); dataDiskTemplateResult.setResult(result.getResult()); } } catch (CloudRuntimeException e) { s_logger.debug("Failed to process create template callback", e); dataDiskTemplateResult.setResult(e.toString()); } future.complete(dataDiskTemplateResult); return null; }
Source:
<code>private void evalState() { String location = editFileLocation.getText().toString(); if ("".equals(location)) { txtInteractiveMessages.setText(Localization.get("archive.install.state.empty")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(false); return; } <START> if (!(location.startsWith("content://") || (new File(location)).exists())) { <END> txtInteractiveMessages.setText(Localization.get("archive.install.state.invalid.path")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem); btnInstallArchive.setEnabled(false); } else { txtInteractiveMessages.setText(Localization.get("archive.install.state.ready")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(true); } }</code><technical_language>change this !location.startsWith("content://") && !(new File(location)).exists()? I a lot more readable (I trouble understanding this)</technical_language>

Target:
private void evalState() { String location = editFileLocation.getText().toString(); if ("".equals(location)) { txtInteractiveMessages.setText(Localization.get("archive.install.state.empty")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(false); return; } if (!location.startsWith("content://") && !(new File(location)).exists()) { txtInteractiveMessages.setText(Localization.get("archive.install.state.invalid.path")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem); btnInstallArchive.setEnabled(false); } else { txtInteractiveMessages.setText(Localization.get("archive.install.state.ready")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallArchive.setEnabled(true); } }
Source:
<code>public boolean isEnabledFor(ISelection selection) { selectionChanged(null, selection); <START> ICElement[] project = getSelectedCElements(); <END> return project.length > 0; }</code><technical_language>Please rename variable elements</technical_language>

Target:
public boolean isEnabledFor(ISelection selection) { selectionChanged(null, selection); ICElement[] elements = getSelectedCElements(); return elements.length > 0; }
Source:
<code>public SystemAccessControl create(Map<String, String> config) { requireNonNull(config, "config is null"); String configFileName = config.get(CONFIG_FILE_NAME); checkState( configFileName != null, "Security configuration must contain the '%s' property", CONFIG_FILE_NAME); try { Path path = Paths.get(configFileName); if (!path.isAbsolute()) { path = path.toAbsolutePath(); } path.toFile().canRead(); FileBasedSystemAccessControlRules rules = jsonCodec(FileBasedSystemAccessControlRules.class) .fromJson(Files.readAllBytes(path)); ImmutableList.Builder<CatalogAccessControlRule> catalogRulesBuilder = ImmutableList.builder(); catalogRulesBuilder.addAll(rules.getCatalogRules()); <START> ImmutableList.Builder<PrincipalUserMatchRule> principleUserMatchRulesBuilder = ImmutableList.builder(); <END> principleUserMatchRulesBuilder.addAll(rules.getPrincipalUserMatchRules()); catalogRulesBuilder.add(new CatalogAccessControlRule( true, Optional.of(Pattern.compile(".*")), Optional.of(Pattern.compile("system")))); return new FileBasedSystemAccessControl(catalogRulesBuilder.build(), principleUserMatchRulesBuilder.build()); } catch (SecurityException | IOException | InvalidPathException e) { throw new RuntimeException(e); } }</code><technical_language>need this builder. ImmutableList.copyOf(rules.getPrincipalUserMatchRules()) pass rules.getPrincipalUserMatchRules() FileBasedSystemAccessControl constructor do ImmutableList.copyOf own</technical_language>

Target:
public SystemAccessControl create(Map<String, String> config) { requireNonNull(config, "config is null"); String configFileName = config.get(CONFIG_FILE_NAME); checkState( configFileName != null, "Security configuration must contain the '%s' property", CONFIG_FILE_NAME); try { Path path = Paths.get(configFileName); if (!path.isAbsolute()) { path = path.toAbsolutePath(); } path.toFile().canRead(); FileBasedSystemAccessControlRules rules = jsonCodec(FileBasedSystemAccessControlRules.class) .fromJson(Files.readAllBytes(path)); ImmutableList.Builder<CatalogAccessControlRule> catalogRulesBuilder = ImmutableList.builder(); catalogRulesBuilder.addAll(rules.getCatalogRules()); catalogRulesBuilder.add(new CatalogAccessControlRule( true, Optional.of(Pattern.compile(".*")), Optional.of(Pattern.compile("system")))); return new FileBasedSystemAccessControl(catalogRulesBuilder.build(), rules.getPrincipalUserMatchRules()); } catch (SecurityException | IOException | InvalidPathException e) { throw new RuntimeException(e); } }
Source:
<code>private void calculateMinimumScaleToFit() { if (mMinimumScaleMode != MinimumScaleMode.NONE) { float minimumScaleX = getWidth() / (float) mBaseWidth; float minimumScaleY = getHeight() / (float) mBaseHeight; <START> float recalculatedMinScale = mMinimumScaleMode == MinimumScaleMode.FILL ? Math.max( minimumScaleX, minimumScaleY ) : Math.min( minimumScaleX, minimumScaleY ); <END> if( recalculatedMinScale != mEffectiveMinScale ) { mEffectiveMinScale = recalculatedMinScale; if( mScale < mEffectiveMinScale ){ setScale( mEffectiveMinScale ); } } } }</code><technical_language>if in FIT mode, mMinimumScaleMode is set Math.min( minimumScaleX, minimumScaleY ) more explicit here, understand in mode NONE, in FILL, in FIT mode</technical_language>

Target:
private void calculateMinimumScaleToFit() { float minimumScaleX = getWidth() / (float) mBaseWidth; float minimumScaleY = getHeight() / (float) mBaseHeight; float recalculatedMinScale = calculatedMinScale(minimumScaleX, minimumScaleY); if( recalculatedMinScale != mEffectiveMinScale ) { mEffectiveMinScale = recalculatedMinScale; if( mScale < mEffectiveMinScale ){ setScale( mEffectiveMinScale ); } } }
Source:
<code><START> public @Nullable Set<HttpCookie> getCookies(boolean refresh) { <END> if (cookies == null || (refresh && snapshot.isModified(file.toFile()))) { try { for (int retryCount = 0; retryCount < MAX_STALE_FILEHANDLE_RETRIES; retryCount++) { try { snapshot = FileSnapshot.save(file.toFile()); Set<HttpCookie> newCookies = read(file, creationDate); if (cookies != null) { cookies = mergeCookies(newCookies, cookies); } else { cookies = newCookies; } return cookies; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e)) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retryCount)), e); } continue; } else { throw e; } } } } catch (IOException | IllegalArgumentException e) { LOG.warn( MessageFormat.format( JGitText.get().couldNotReadCookieFile, file), e); } } return cookies; }</code><technical_language>skipping checking content hash updating snapshot properly. start a copy of FileBasedConfig.load(), skip UTF8 handling in else replace fromText(decoded) method parsing cookie file content</technical_language>

Target:
public Set<HttpCookie> getCookies(boolean refresh) { if (cookies == null || (refresh && snapshot.isModified(file.toFile()))) { try { for (int retryCount = 0; retryCount < MAX_STALE_FILEHANDLE_RETRIES; retryCount++) { try { snapshot = FileSnapshot.save(file.toFile()); Set<HttpCookie> newCookies = read(file, creationDate); if (cookies != null) { cookies = mergeCookies(newCookies, cookies); } else { cookies = newCookies; } return cookies; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e)) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retryCount)), e); } continue; } else { throw e; } } } } catch (IOException | IllegalArgumentException e) { LOG.warn( MessageFormat.format( JGitText.get().couldNotReadCookieFile, file), e); if (cookies == null) { cookies = new LinkedHashSet<>(); } } } return cookies; }
Source:
<code>private Server setUpServer() { Server server = new Server(0); ResourceHandler handler = new ResourceHandler(); handler.setDirectoriesListed(true); handler.setWelcomeFiles(new String[]{"index.html"}); handler.setResourceBase(getReportDirectoryPath().toAbsolutePath().toString()); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[]{handler, new DefaultHandler()}); server.setHandler(handlers); <START> return server; <END> }</code><technical_language>add server.setStopAtShutdown(true); prevent leaks <LINK_0></technical_language>

Target:
private Server setUpServer() { Server server = new Server(0); ResourceHandler handler = new ResourceHandler(); handler.setDirectoriesListed(true); handler.setWelcomeFiles(new String[]{"index.html"}); handler.setResourceBase(getReportDirectoryPath().toAbsolutePath().toString()); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[]{handler, new DefaultHandler()}); server.setStopAtShutdown(true); server.setHandler(handlers); return server; }
Source:
<code>public void testFail() throws Exception { Connector c = getConnector(); String tableName = getUniqueNames(1)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); ntc.setProperties( Collections.singletonMap(Property.TABLE_DELETE_BEHAVIOR.getKey(), Behavior.FAIL.name())); c.tableOperations().create(tableName, ntc); try (BatchWriter writer = c.createBatchWriter(tableName)) { Mutation m = new Mutation("1234"); m.putDelete("f1", "q1", 2L); writer.addMutation(m); } Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY); try { scanner.forEach(e -> {}); Assert.fail(); <START> } catch (RuntimeException e) <END> }</code><technical_language>Yuck</technical_language>

Target:
public void testFail() throws Exception { Connector c = getConnector(); String tableName = getUniqueNames(1)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); ntc.setProperties( Collections.singletonMap(Property.TABLE_DELETE_BEHAVIOR.getKey(), Behavior.FAIL.name())); c.tableOperations().create(tableName, ntc); try (BatchWriter writer = c.createBatchWriter(tableName)) { Mutation m = new Mutation("1234"); m.putDelete("f1", "q1", 2L); writer.addMutation(m); } Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY); try { scanner.forEach(e -> {}); Assert.fail("Expected scan to fail because deletes are present."); } catch (RuntimeException e) }
Source:
<code>public void testMiddleOfByteArrayConversion() { ByteBuffer bytes = ByteBuffer.wrap(new byte[]{'a', 'b', 'c', 'd'}); <START> bytes.position(1).mark().limit(3); <END> Assert.assertEquals("bc", StringUtils.fromUtf8(bytes, 2)); bytes.reset(); Assert.assertEquals("bc", StringUtils.fromUtf8(bytes)); }</code><technical_language>test succeed undefined mark</technical_language>

Target:
public void testMiddleOfByteArrayConversion() { ByteBuffer bytes = ByteBuffer.wrap(new byte[]{'a', 'b', 'c', 'd'}); bytes.position(1).limit(3); Assert.assertEquals("bc", StringUtils.fromUtf8(bytes, 2)); bytes.position(1); Assert.assertEquals("bc", StringUtils.fromUtf8(bytes)); }
Source:
<code>private int multiSync(String entityId, Collection<org.openrdf.model.Statement> <START> statements, Collection<String> <END> valueList) { Change change = new Change(entityId, -1, Instant.now(), -1); change.setStatements(statements); change.setValueCleanupList(valueList != null ? valueList : Collections.emptyList()); change.setRefCleanupList(valueList != null ? valueList : Collections.emptyList()); int res = syncFromChanges(Collections.singleton(change), false); int ts = rdfClient.update("DELETE { ?x wikibase:timestamp ?y } WHERE { ?x wikibase:timestamp ?y }").intValue(); return res - ts; }</code><technical_language>nullable parameters explicit (@Nullable)</technical_language>

Target:
private int multiSync(String entityId, Collection<org.openrdf.model.Statement> statements, Collection<String> valueList) { Change change = new Change(entityId, -1, Instant.now(), -1); change.setStatements(statements); change.setValueCleanupList(valueList); change.setRefCleanupList(valueList); int res = syncFromChanges(Collections.singleton(change), false); int ts = rdfClient.update("DELETE { ?x wikibase:timestamp ?y } WHERE { ?x wikibase:timestamp ?y }").intValue(); return res - ts; }
Source:
<code>public String getString(final ByteBuffer byteBuffer) { if (byteBuffer == null) return null; <START> return AsciiType.instance.getString(byteBuffer); <END> }</code><technical_language>Missing .duplicate() byteBuffer</technical_language>

Target:
public String getString(final ByteBuffer byteBuffer) { if (byteBuffer == null) return null; return AsciiType.instance.getString(byteBuffer.duplicate()); }
Source:
<code>public ItemSetView getView(ArticleIngestion ingestion) { <START> Collection<ArticleFile> files = (List<ArticleFile>) hibernateTemplate.find("SELECT file FROM ArticleFile file LEFT JOIN FETCH file.item WHERE file.ingestion = ?", ingestion); <END> return new ItemSetView(ingestion, files); }</code><technical_language>wrong fetch = FetchType.EAGER totally useless. a references getFiles() in code: <LINK_1> <LINK_0> is ok longer eagerly loading files</technical_language>

Target:
public ItemSetView getView(ArticleIngestion ingestion) { return new ItemSetView(ingestion, ingestion.getFiles()); }
Source:
<code>public Control createControl(IUiContext context, Composite parent, FormToolkit toolkit) { ImageHyperlink removeLink = toolkit.createImageHyperlink(parent, SWT.TOP); removeLink.setImage(CommonImages.getImage(CommonImages.REMOVE)); <START> removeLink.addHyperlinkListener(new HyperlinkAdapter() { <END> @Override public void linkActivated(HyperlinkEvent e) { new RemoveReviewerDialog(getShell(), getTask(), getModelObject()).open(getEditor()); } }); removeLink.setEnabled(!isExecutableStateKnown() || isExecutable()); return removeLink; }</code><technical_language>set some tooltip text hyperlink? eg. Remove this viewer, Remove {reviewer name}</technical_language>

Target:
public Control createControl(IUiContext context, Composite parent, FormToolkit toolkit) { ImageHyperlink removeLink = toolkit.createImageHyperlink(parent, SWT.TOP); removeLink.setToolTipText( NLS.bind(Messages.RemoveReviewerUiFactory_Remove_Reviewer_Name, getModelObject().getDisplayName())); removeLink.setImage(CommonImages.getImage(CommonImages.REMOVE)); removeLink.addHyperlinkListener(new ObjectHyperlinkAdapter(this) { @Override public void linkActivated(HyperlinkEvent e) { RemoveReviewerUiFactory factory = (RemoveReviewerUiFactory) this.getObject(); factory.execute(); } }); removeLink.setEnabled(!isExecutableStateKnown() || isExecutable()); return removeLink; }
Source:
<code>private boolean mediaBelongsToAPost(MediaModel media) { PostModel postToCancel = mPostStore.getPostByLocalPostId(media.getLocalPostId()); <START> if (postToCancel == null) return false; <END> if (!mUploadStore.isRegisteredPostModel(postToCancel)) { return false; } return true; }</code><technical_language>This simplified return (postToCancel != null && mUploadStore.isRegisteredPostModel(postToCancel));</technical_language>

Target:
private boolean mediaBelongsToAPost(MediaModel media) { PostModel postToCancel = mPostStore.getPostByLocalPostId(media.getLocalPostId()); return (postToCancel != null && mUploadStore.isRegisteredPostModel(postToCancel)); }
Source:
<code><START> public Job getJob(int row, int column) throws NoSuchElementException, MalformedURLException { <END> getPage().open(); WebElement tableElement = getTable().findElement(By.xpath(" try { WebElement link = getTable().findElement(By.xpath(" String name = link.getText(); URL url = new URL(link.getAttribute("href")); return new Job(injector, url, name); } catch (NoSuchElementException e) { return null; } }</code><technical_language>@CheckForNull</technical_language>

Target:
public Job getJob(int row, int column) throws NoSuchElementException { getPage().open(); getTable().findElement(By.xpath(" try { WebElement link = getTable().findElement(By.xpath(" String name = link.getText(); URL url = new URL(link.getAttribute("href")); return new Job(injector, url, name); } catch (NoSuchElementException e) { return null; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
Source:
<code>public void testConstructor(){ <START> Integer expectParallelism = 100; <END> Boolean expectIsParallel = true; StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); MockSource mockSource = new MockSource(Boundedness.BOUNDED, 10); DataStreamSource<Integer> stream = new DataStreamSource<Integer>( env, mockSource, WatermarkStrategy.noWatermarks() , null, "TestingSource"); stream.setParallelism(100); assertEquals(expectIsParallel, stream.isParallel); Integer actual = Integer.valueOf(stream.getParallelism()); assertEquals(expectParallelism, actual); }</code><technical_language>int is OK</technical_language>

Target:
public void testConstructor() { int expectParallelism = 100; boolean expectIsParallel = true; StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); MockSource mockSource = new MockSource(Boundedness.BOUNDED, 10); DataStreamSource<Integer> stream = env.fromSource( mockSource, WatermarkStrategy.noWatermarks(), "TestingSource"); stream.setParallelism(expectParallelism); assertEquals(expectIsParallel, stream.isParallel); assertEquals(expectParallelism, stream.getParallelism()); }
Source:
<code>public void should_be_able_to_new_access_token_after_expiry_on_silent() { givenThat(james).wasAbleTo( acquireToken, clickDone, readCache); <START> then(james).should(seeThat(TokenCacheItemCount.displayed(), is(6))); <END> String accessToken1 = james.asksFor(AccessToken.displayed()); james.attemptsTo(clickDone, expireAccessToken, clickDone); when(james).attemptsTo( acquireToken .tokenExists(true) .withUserIdentifier(james.getCacheResult().displayableId), clickDone, readCache); then(james).should(seeThat(AccessToken.displayed(), not(accessToken1))); }</code><technical_language>consider a class for returning number of tokens returned in cache based unified cache is enabled not. I Unified cache 8 tokens in cache while legacy ADAL cache 6</technical_language>

Target:
public void should_be_able_to_new_access_token_after_expiry_on_silent() { givenThat(james).wasAbleTo( acquireToken, clickDone, readCache); int expectedCacheCount = james.asksFor(ExpectedCacheItemCount.displayed()); then(james).should(seeThat(TokenCacheItemCount.displayed(), is(expectedCacheCount))); String accessToken1 = james.asksFor(AccessToken.displayed()); james.attemptsTo(clickDone, expireAccessToken, clickDone); when(james).attemptsTo( acquireToken .tokenExists(true) .withUserIdentifier(james.getCacheResult().displayableId), clickDone, readCache); then(james).should(seeThat(AccessToken.displayed(), not(accessToken1))); }
Source:
<code>public void validateFreeSpace() { List<LUNs> allLuns = blockStorageDomainHelper.getVgLUNsInfo(getStorageDomain().getStorageStaticData(), getVdsId()); if (allLuns == null) { getAuditLogDirector().log(this, AuditLogType.USER_REDUCE_DOMAIN_DEVICES_FAILED_TO_GET_DOMAIN_INFO); throw new EngineException(EngineError.GeneralException, "Failed to get the vg info"); } Long <START> freeExtants = <END> allLuns.stream() .filter(l -> getParameters().getDstDevices().contains(l.getLUNId())) .mapToLong(l -> l.getPeCount() - l.getPeAllocatedCount()) .sum(); Long neededExtants = allLuns.stream() .filter(l -> getParameters().getDevicesToReduce().contains(l.getLUNId())) .mapToLong(LUNs::getPeAllocatedCount) .sum(); if (neededExtants > freeExtants) { getAuditLogDirector().log(this, AuditLogType.USER_REDUCE_DOMAIN_DEVICES_FAILED_NO_FREE_SPACE); throw new EngineException(EngineError.GeneralException, "Not enough free space on the destination devices"); } }</code><technical_language>> freeExtents</technical_language>

Target:
public void validateFreeSpace() { List<LUNs> allLuns = blockStorageDomainHelper.getVgLUNsInfo(getStorageDomain().getStorageStaticData(), getVdsId()); if (allLuns == null) { getAuditLogDirector().log(this, AuditLogType.USER_REDUCE_DOMAIN_DEVICES_FAILED_TO_GET_DOMAIN_INFO); throw new EngineException(EngineError.GeneralException, "Failed to get the vg info"); } Long freeExtents = allLuns.stream() .filter(l -> getParameters().getDstDevices().contains(l.getLUNId())) .mapToLong(l -> l.getPeCount() - l.getPeAllocatedCount()) .sum(); Long neededExtents = allLuns.stream() .filter(l -> getParameters().getDevicesToReduce().contains(l.getLUNId())) .mapToLong(LUNs::getPeAllocatedCount) .sum(); if (neededExtents > freeExtents) { getAuditLogDirector().log(this, AuditLogType.USER_REDUCE_DOMAIN_DEVICES_FAILED_NO_FREE_SPACE); throw new EngineException(EngineError.GeneralException, "Not enough free space on the destination devices"); } }
Source:
<code>public static long fromUnixTime(@SqlType(StandardTypes.DOUBLE) double unixTime, @SqlType(StandardTypes.BIGINT) long hoursOffset, @SqlType(StandardTypes.BIGINT) long minutesOffset) { int offset = toIntExact(hoursOffset * 60 + minutesOffset); TimeZoneKey timeZoneKey; try { timeZoneKey = getTimeZoneKeyForOffset(offset); } catch (IllegalArgumentException e) { <START> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid offset: %d", offset), e); <END> } return packDateTimeWithZone(Math.round(unixTime * 1000), timeZoneKey); }</code><technical_language>do format here: "Invalid offset: " + offset</technical_language>

Target:
public static long fromUnixTime(@SqlType(StandardTypes.DOUBLE) double unixTime, @SqlType(StandardTypes.BIGINT) long hoursOffset, @SqlType(StandardTypes.BIGINT) long minutesOffset) { TimeZoneKey timeZoneKey; try { timeZoneKey = getTimeZoneKeyForOffset((int) (hoursOffset * 60 + minutesOffset)); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } return packDateTimeWithZone(Math.round(unixTime * 1000), timeZoneKey); }
Source:
<code>public void evalBatch( final List<TupleBatch> ltb, final AppendableTable result, final ReadableTable state) throws DbException, IOException { <START> if (pyWorker == null) { <END> pyWorker = new PythonWorker(); initEvaluator(); } int resultcol = -1; for (int i = 0; i < tupleSize; i++) { if (isStateColumn[i]) { resultcol = columnIdxs[i]; } break; } try { DataOutputStream dOut = pyWorker.getDataOutputStream(); int numTuples = 0; for (int j = 0; j < ltb.size(); j++) { numTuples += ltb.get(j).numTuples(); } pyWorker.sendNumTuples(numTuples); for (int tbIdx = 0; tbIdx < ltb.size(); tbIdx++) { TupleBatch tb = ltb.get(tbIdx); for (int tup = 0; tup < tb.numTuples(); tup++) { for (int col = 0; col < tupleSize; col++) { writeToStream(tb, tup, columnIdxs[col], dOut); } } } Object obj = readFromStream(null); switch (outputType) { case DOUBLE_TYPE: result.putDouble(resultcol, (Double) obj); break; case BLOB_TYPE: result.putBlob(resultcol, (ByteBuffer.wrap((byte[]) obj))); break; case FLOAT_TYPE: result.putFloat(resultcol, (float) obj); break; case INT_TYPE: result.putInt(resultcol, (int) obj); break; case LONG_TYPE: result.putLong(resultcol, (long) obj); break; default: LOGGER.info("type not supported as Python Output"); break; } } catch (Exception e) { throw new DbException(e); } }</code><technical_language>create pyWorker in constructor some initialization get rid of this null check? (There is another null check else)</technical_language>

Target:
public void evalBatch( final List<TupleBatch> ltb, final AppendableTable result, final ReadableTable state) throws DbException, IOException { if (pyWorker == null) { pyWorker = new PythonWorker(); initEvaluator(); } int resultcol = -1; for (int i = 0; i < numColumns; i++) { if (isStateColumn[i]) { resultcol = columnIdxs[i]; } break; } try { DataOutputStream dOut = pyWorker.getDataOutputStream(); int numTuples = 0; for (int j = 0; j < ltb.size(); j++) { numTuples += ltb.get(j).numTuples(); } pyWorker.sendNumTuples(numTuples); for (int tbIdx = 0; tbIdx < ltb.size(); tbIdx++) { TupleBatch tb = ltb.get(tbIdx); for (int tup = 0; tup < tb.numTuples(); tup++) { for (int col = 0; col < numColumns; col++) { writeToStream(tb, tup, columnIdxs[col], dOut); } } } readFromStream(null, null, result, resultcol); } catch (Exception e) { throw new DbException(e); } }
Source:
<code>public void handleError(CommandEnvelope envelope, RuntimeException exception) { checkNotNull(envelope); checkNotNull(exception); if (causedByRejection(exception)) { final Rejection rejection = rejectWithCause(envelope.getCommand(), exception); rejectionBus.post(rejection); } else { log().error(format("Error dispatching command (class: %s id: %s).", envelope.getMessage().getClass(), <START> envelope.getId().getUuid()), <END> exception); throw exception; } }</code><technical_language>please Stringifiers it? cool a type well, a UUID value</technical_language>

Target:
public void handleError(CommandEnvelope envelope, RuntimeException exception) { checkNotNull(envelope); checkNotNull(exception); if (causedByRejection(exception)) { final Rejection rejection = rejectWithCause(envelope.getCommand(), exception); rejectionBus.post(rejection); } else { log().error(format("Error dispatching command (class: %s id: %s).", envelope.getMessage().getClass(), Stringifiers.toString(envelope.getId())), exception); throw exception; } }
Source:
<code>public ValiantRescuer(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{1}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SOLDIER); this.power = new MageInt(3); this.toughness = new MageInt(1); <START> this.addAbility(new CycleControllerTriggeredAbility( <END> new CreateTokenEffect(new HumanSoldierToken()))); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); }</code><technical_language>This needs trigger time cycles in a turn</technical_language>

Target:
public ValiantRescuer(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{1}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SOLDIER); this.power = new MageInt(3); this.toughness = new MageInt(1); this.addAbility(new ValiantRescuerTriggeredAbility()); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); }
Source:
<code>private void initComponents(SquareConfig squareConfig) { mTeamInfos.forEach(teamInfo -> { createTeamPanel(squareConfig, teamInfo); }); JButton addTeam = new JButton(Messages.getString("TeamCreationPanel.addTeam")); addTeam.addActionListener(event -> { TeamInfo newTeam = new TeamInfo(); newTeam.teamId = mTeamIDCounter; newTeam.color = Color.gray; newTeam.teamName = Messages.getString("TeamCreationPanel.team", mTeamIDCounter++); mTeamInfos.add(newTeam); createTeamPanel(squareConfig, newTeam); remove(addTeam); <START> if (mTeamIDCounter <= 4) <END> add(addTeam); validate(); repaint(); }); add(addTeam); }</code><technical_language>Missing braces</technical_language>

Target:
private void initComponents(SquareConfig squareConfig) { mTeamInfos.forEach(teamInfo -> { createTeamPanel(squareConfig, teamInfo); }); JButton addTeam = new JButton(Messages.getString("TeamCreationPanel.addTeam")); addTeam.addActionListener(event -> { TeamInfo newTeam = new TeamInfo(); newTeam.teamId = mTeamIDCounter; newTeam.color = Color.gray; newTeam.teamName = Messages.getString("TeamCreationPanel.team", mTeamIDCounter++); mTeamInfos.add(newTeam); createTeamPanel(squareConfig, newTeam); remove(addTeam); if (mTeamIDCounter <= 4) { add(addTeam); } validate(); repaint(); }); add(addTeam); }