auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ImmutableMap<K, V> getAllPresent(final Iterable<K> keys) { ImmutableMap.Builder builder = ImmutableMap.builder(); for (K key : keys ) { V value = getIfPresent(key); if (value != null) { builder.put(key, value); } } return builder.build(); }

Target:
public Map<K, V> getAllPresent(final Iterable<K> keys) { ImmutableMap.Builder builder = ImmutableMap.builder(); for (K key : keys ) { V value = getIfPresent(key); if (value != null) { builder.put(key, value); } } return builder.build(); }
Source:
public FormValidation doCheckAdminlist(@QueryParameter String value) throws ServletException { for (String admin : value.split("\\s")) { if (!admin.trim().isEmpty() && !adminlistPattern.matcher(admin).matches()) { return FormValidation.error("GitHub username may only contain alphanumeric characters or dashes " + "and cannot begin with a dash. Separate them with whitespaces."); } } return FormValidation.ok(); }

Target:
public FormValidation doCheckAdminlist(@QueryParameter String value) throws ServletException { for (String admin : value.split("\\p{Space}")) { if (!admin.trim().isEmpty() && !adminlistPattern.matcher(admin).matches()) { return FormValidation.error("GitHub username may only contain alphanumeric characters or dashes " + "and cannot begin with a dash. Separate them with whitespaces."); } } return FormValidation.ok(); }
Source:
private void UpdateVmNumaNodes() { VmNumaNodeDAO dao = DbFacade.getInstance().getVmNumaNodeDAO(); List<VdsNumaNode> addList = new ArrayList<VdsNumaNode>(); List<VdsNumaNode> updateList = new ArrayList<VdsNumaNode>(); List<Guid> removeList = new ArrayList<Guid>(); List<VmNumaNode> oldList = dao.getAllVmNumaNodeByVmId(getVmId()); for (VmNumaNode oldNode : oldList) { removeList.add(oldNode.getId()); } for (VmNumaNode newNode : getParameters().getVmStaticData().getvNumaNodeList()) { boolean found = false; Guid newId = newNode.getId(); for (VmNumaNode oldNode : oldList) { if (oldNode.getId().equals(newId)) { updateList.add(newNode); removeList.remove(oldNode.getId()); found = true; break; } } if (!found) { addList.add(newNode); } } dao.massSaveNumaNode(addList, null, getVmId()); dao.massUpdateNumaNode(updateList); dao.massRemoveNumaNodeByNumaNodeId(removeList); }

Target:
private void UpdateVmNumaNodes() { VmNumaNodeDAO dao = DbFacade.getInstance().getVmNumaNodeDAO(); List<VmNumaNode> addList = new ArrayList<>(); List<VmNumaNode> updateList = new ArrayList<>(); List<VmNumaNode> removeList = new ArrayList<>(); List<VmNumaNode> oldList = dao.getAllVmNumaNodeByVmId(getVmId()); List<VmNumaNode> newList = getParameters().getVmStaticData().getvNumaNodeList(); addList.addAll(newList); updateList.addAll(newList); removeList.addAll(oldList); updateList.retainAll(oldList); removeList.retainAll(newList); addList.retainAll(updateList); VmNumaNodeOperationParameters params = new VmNumaNodeOperationParameters(getVmId(), addList); getBackend().runInternalAction(VdcActionType.AddVmNumaNodes, params); params = new VmNumaNodeOperationParameters(getVmId(), updateList); getBackend().runInternalAction(VdcActionType.UpdateVmNumaNodes, params); params = new VmNumaNodeOperationParameters(getVmId(), removeList); getBackend().runInternalAction(VdcActionType.RemoveVmNumaNodes, params); }
Source:
static TestingSlotPoolImpl createAndSetUpSlotPool( final ResourceManagerGateway resourceManagerGateway) throws Exception { return SlotPoolUtils.createSlotPoolBuilder(resourceManagerGateway).build(); }

Target:
private static TestingSlotPoolImpl createAndSetUpSlotPool( final ResourceManagerGateway resourceManagerGateway) throws Exception { return new SlotPoolBuilder(mainThreadExecutor).setResourceManagerGateway(resourceManagerGateway).build(); }
Source:
public void updateAlertInTree(Alert originalAlert, Alert alert) { if (getView() == null || EventQueue.isDispatchThread()) { return; } if (EventQueue.isDispatchThread()) { updateAlertInTreeEventHandler(originalAlert, alert); } else { try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { updateAlertInTreeEventHandler(originalAlert, alert); } }); } catch (Exception e) { logger.error(e.getMessage(), e); } } }

Target:
public void updateAlertInTree(Alert originalAlert, Alert alert) { if (Constant.isLowMemoryOptionSet()) { return; } if (getView() == null || EventQueue.isDispatchThread()) { updateAlertInTreeEventHandler(originalAlert, alert); } else { try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { updateAlertInTreeEventHandler(originalAlert, alert); } }); } catch (Exception e) { logger.error(e.getMessage(), e); } } }
Source:
public void testAddMetadataStoreRealmNonLeader() { MockWriter mockWriter = new MockWriter(DUMMY_NAMESPACE, ZK_ADDR); mockWriter.addMetadataStoreRealm(DUMMY_REALM); Assert.assertEquals(mockWriter.calledRequest.getMethod(), "PUT"); List<String> expectedUrlParams = Arrays .asList(MetadataStoreRoutingConstants.MSDS_NAMESPACES_URL_PREFIX, DUMMY_NAMESPACE, MetadataStoreRoutingConstants.MSDS_GET_ALL_REALMS_ENDPOINT, DUMMY_REALM); String expectedUrl = getBaseUri().toString() + String.join("/", expectedUrlParams).replaceAll(" .substring(1); Assert.assertEquals(mockWriter.calledRequest.getURI().toString(), expectedUrl); mockWriter.close(); }

Target:
public void testAddMetadataStoreRealmNonLeader() { MockWriter mockWriter = new MockWriter(TEST_NAMESPACE, _zkAddrTestNS); mockWriter.addMetadataStoreRealm(DUMMY_REALM); Assert.assertEquals(mockWriter.calledRequest.getMethod(), HttpConstants.RestVerbs.PUT.name()); List<String> expectedUrlParams = Arrays .asList(MetadataStoreRoutingConstants.MSDS_NAMESPACES_URL_PREFIX, TEST_NAMESPACE, MetadataStoreRoutingConstants.MSDS_GET_ALL_REALMS_ENDPOINT, DUMMY_REALM); String expectedUrl = getBaseUri().toString() + String.join("/", expectedUrlParams).replaceAll(" .substring(1); Assert.assertEquals(mockWriter.calledRequest.getURI().toString(), expectedUrl); mockWriter.close(); }
Source:
private Optional<PlanNode> tryCreatingNewScanNode(PlanNode plan) { Optional<DruidQueryGenerator.DruidQueryGeneratorResult> dql = druidQueryGenerator.generate(plan, session); if (!dql.isPresent()) { return Optional.empty(); } DruidTableHandle druidTableHandle = getDruidTableHandle(tableScanNode).orElseThrow(() -> new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Expected to find a druid table handle")); DruidQueryGeneratorContext context = dql.get().getContext(); TableHandle oldTableHandle = tableScanNode.getTable(); LinkedHashMap<VariableReferenceExpression, DruidColumnHandle> assignments = context.getAssignments(); TableHandle newTableHandle = new TableHandle( oldTableHandle.getConnectorId(), new DruidTableHandle(druidTableHandle.getSchemaName(), druidTableHandle.getTableName(), Optional.of(dql.get().getGeneratedDql())), oldTableHandle.getTransaction(), oldTableHandle.getLayout()); return Optional.of( new TableScanNode( idAllocator.getNextId(), newTableHandle, ImmutableList.copyOf(assignments.keySet()), assignments.entrySet().stream().collect(toImmutableMap(Map.Entry::getKey, (e) -> (ColumnHandle) (e.getValue()))), tableScanNode.getCurrentConstraint(), tableScanNode.getEnforcedConstraint())); }

Target:
private Optional<PlanNode> tryCreatingNewScanNode(PlanNode plan) { Optional<DruidQueryGenerator.DruidQueryGeneratorResult> dql = druidQueryGenerator.generate(plan, session); if (!dql.isPresent()) { return Optional.empty(); } DruidTableHandle druidTableHandle = getDruidTableHandle(tableScanNode).orElseThrow(() -> new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Expected to find a druid table handle")); DruidQueryGeneratorContext context = dql.get().getContext(); TableHandle oldTableHandle = tableScanNode.getTable(); Map<VariableReferenceExpression, DruidColumnHandle> assignments = context.getAssignments(); TableHandle newTableHandle = new TableHandle( oldTableHandle.getConnectorId(), new DruidTableHandle(druidTableHandle.getSchemaName(), druidTableHandle.getTableName(), Optional.of(dql.get().getGeneratedDql())), oldTableHandle.getTransaction(), oldTableHandle.getLayout()); return Optional.of( new TableScanNode( idAllocator.getNextId(), newTableHandle, ImmutableList.copyOf(assignments.keySet()), assignments.entrySet().stream().collect(toImmutableMap(Map.Entry::getKey, (e) -> (ColumnHandle) (e.getValue()))), tableScanNode.getCurrentConstraint(), tableScanNode.getEnforcedConstraint())); }
Source:
public void roundTripEquivalence(IonDatagram input, boolean myExpectedEquality) throws IOException { IonDatagram[] data = roundTripDatagram(input); for(int i = 0; i < data.length - 1; i++){ runEquivalenceChecks(data[i], myExpectedEquality); for(int j = i + 1; j < data.length; j++) { for(int sexpIndice = 0; sexpIndice < data[i].size(); sexpIndice++) { for(int timestampIndice = 0; timestampIndice < ((IonSexp)data[i].get(sexpIndice)).size(); timestampIndice++) { checkEquivalence(((IonSexp)(data[i].get(sexpIndice))).get(timestampIndice), ((IonSexp)(data[j].get(sexpIndice))).get(timestampIndice), true); } } } } }

Target:
public void roundTripEquivalence(IonDatagram input, boolean myExpectedEquality) throws IOException { IonDatagram[] data = roundTripDatagram(input); for(int i = 0; i < data.length; i++) { runEquivalenceChecks(data[i], myExpectedEquality); for(int j = i + 1; j < data.length; j++) { for(int seqIndice = 0; seqIndice < data[i].size(); seqIndice++) { int maxTimeStampIndice = ((IonSequence)data[i].get(seqIndice)).size(); for(int timeStampIndice = 0; timeStampIndice < maxTimeStampIndice; timeStampIndice++) { IonValue timeStamp1 = ((IonSequence)(data[i].get(seqIndice))).get(timeStampIndice); IonValue timeStamp2 = ((IonSequence)(data[j].get(seqIndice))).get(timeStampIndice); checkEquivalence(timeStamp1, timeStamp2, true); } } } } }
Source:
public void onEvent(ArchetypeOutput event) { sendArchetypeNotification(event); }

Target:
public void onEvent(ArchetypeOutput event) { ArchetypeOutput archetypeOutput = DtoFactory.newDto(ArchetypeOutput.class); archetypeOutput.setOutput(event.getOutput()); archetypeOutput.setState(event.getState()); endpointIds.forEach(it -> transmitter.newRequest() .endpointId(it) .methodName(MAVEN_ARCHETYPE_CHANEL_OUTPUT) .paramsAsDto(archetypeOutput) .sendAndSkipResult()); }
Source:
private String buildProxyUrl(String sitemapName, Widget widget, URI uri) { String wId = itemUIRegistry.getWidgetId(widget); StringBuilder sb = new StringBuilder(); sb.append(uri.getScheme()).append("://").append(uri.getHost()); if (uri.getPort() >= 0 && uri.getPort() != 80) { sb.append(":").append(uri.getPort()); } sb.append("/proxy?sitemap=").append(sitemapName).append(".sitemap&widgetId=").append(wId); return sb.toString(); }

Target:
private String buildProxyUrl(String sitemapName, Widget widget, URI uri) { String wId = itemUIRegistry.getWidgetId(widget); StringBuilder sb = new StringBuilder(); sb.append(uri.getScheme()).append("://").append(uri.getHost()); if (uri.getPort() >= 0) { sb.append(":").append(uri.getPort()); } sb.append("/proxy?sitemap=").append(sitemapName).append(".sitemap&widgetId=").append(wId); return sb.toString(); }
Source:
public void searchChargesByFullCardHolderNameMatch() { Long chargeId = 12L; TestCharge testCharge = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestCharge() .withTestAccount(defaultTestAccount) .withCardDetails(defaultTestCardDetails.withChargeId(chargeId)) .withChargeId(chargeId) .insert(); ChargeSearchParams params = new ChargeSearchParams() .withCardHolderNameLike(CardHolderName.of(testCharge.cardDetails.getCardHolderName())); List<ChargeEntity> charges = chargeDao.findAllBy(params); assertThat(charges.size(), is(1)); assertCharge("visa", testCharge, charges.get(0)); }

Target:
public void searchChargesByFullCardHolderNameMatch() { Long chargeId = 12L; TestCharge testCharge = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestCharge() .withTestAccount(defaultTestAccount) .withCardDetails(defaultTestCardDetails.withChargeId(chargeId)) .withChargeId(chargeId) .insert(); ChargeSearchParams params = new ChargeSearchParams() .withCardHolderNameLike(CardHolderName.of(testCharge.cardDetails.getCardHolderName())); List<ChargeEntity> charges = chargeDao.findAllBy(params); assertThat(charges.size(), is(1)); ChargeEntity charge = charges.get(0); assertCharge("visa", testCharge, charge); assertThat(charge.getCardDetails().getCardHolderName(), is(testCharge.cardDetails.getCardHolderName())); assertThat(charge.getCardDetails().getLastDigitsCardNumber(), is(testCharge.cardDetails.getLastDigitsCardNumber())); }
Source:
private void validateLabelTemplate() { if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { addError("labelTemplate", LABEL_TEMPLATE_ERROR_MESSAGE); return; } if(validateLabelTemplateTruncation(labelTemplate)){ addError("labelTemplate", String.format("Invalid label. %s length of zero not allowed",labelTemplate)); return; } Set<String> templateVariables = getTemplateVariables(); List<String> materialNames = allowedTemplateVariables(); for (final String templateVariable : templateVariables) { if (!CollectionUtils.exists(materialNames, withNameSameAs(templateVariable))) { addError("labelTemplate", String.format(ERR_TEMPLATE, name(), templateVariable)); } } }

Target:
private void validateLabelTemplate() { if (XmlUtils.doesNotMatchUsingXsdRegex(LABEL_TEMPLATE_FORMAT_REGEX, labelTemplate)) { addError("labelTemplate", LABEL_TEMPLATE_ERROR_MESSAGE); return; } if(validateLabelTemplateTruncation(labelTemplate)){ addError("labelTemplate", String.format("Length of zero not allowed on label %s defined on pipeline %s.",labelTemplate,name)); return; } Set<String> templateVariables = getTemplateVariables(); List<String> materialNames = allowedTemplateVariables(); for (final String templateVariable : templateVariables) { if (!CollectionUtils.exists(materialNames, withNameSameAs(templateVariable))) { addError("labelTemplate", String.format(ERR_TEMPLATE, name(), templateVariable)); } } }
Source:
public void toSQL(ColumnResolver resolver, StringBuilder buf) { Preconditions.checkNotNull(buf); buf.append("SHOW SCHEMAS "); if (schemaPattern != null) { buf.append("LIKE "); buf.append("'" + schemaPattern + "'"); } }

Target:
public void toSQL(ColumnResolver resolver, StringBuilder buf) { Preconditions.checkNotNull(buf); buf.append("SHOW SCHEMAS"); if (schemaPattern != null) { buf.append(" LIKE "); buf.append("'").append(schemaPattern).append("'"); } }
Source:
protected void execute() { logger.debug("execute() method is called!"); try { if (!connect()) { logger.error("driver.K8055.accessHardware(): Unable to access hardware."); return; } long inputs = sysLibrary.ReadAllDigital(); if (inputs < 0){throw new Exception("Connection failure");} for (k8055BindingProvider provider : this.providers) { for (String itemName : provider.getItemNames()) { k8055BindingConfig config = provider.getItemConfig(itemName); if (IOType.DIGITAL_IN.equals(config.ioType)){ boolean newstate = (inputs & (1 << (config.ioNumber - 1))) != 0; boolean oldstate = (lastDigitalInputs & (1 << (config.ioNumber - 1))) != 0; if (lastDigitalInputs < 0 || newstate != oldstate) { if (newstate) { eventPublisher.postUpdate(itemName, OpenClosedType.CLOSED); } else { eventPublisher.postUpdate(itemName, OpenClosedType.OPEN); } } } else if (IOType.ANALOG_IN.equals(config.ioType)) { int state = sysLibrary.ReadAnalogChannel(config.ioNumber); eventPublisher.postUpdate(itemName, new DecimalType(state)); } } } lastDigitalInputs = inputs; } catch (Exception e){ logger.error("K8055 Connection failure"); connected = false; sysLibrary.CloseDevice(); } }

Target:
protected void execute() { logger.debug("execute() method is called!"); try { if (!connect()) { logger.error("Not connected to hardware. Skipping attempt to read inputs."); return; } long inputs = sysLibrary.ReadAllDigital(); if (inputs < 0) { throw new Exception( "Failed to read digital inputs from hardware"); } for (k8055BindingProvider provider : this.providers) { for (String itemName : provider.getItemNames()) { k8055BindingConfig config = provider .getItemConfig(itemName); if (IOType.DIGITAL_IN.equals(config.ioType)) { boolean newstate = (inputs & (1 << (config.ioNumber - 1))) != 0; boolean oldstate = (lastDigitalInputs & (1 << (config.ioNumber - 1))) != 0; if (lastDigitalInputs < 0 || newstate != oldstate) { if (newstate) { eventPublisher.postUpdate(itemName, OpenClosedType.CLOSED); } else { eventPublisher.postUpdate(itemName, OpenClosedType.OPEN); } } } else if (IOType.ANALOG_IN.equals(config.ioType)) { int state = sysLibrary .ReadAnalogChannel(config.ioNumber); if (inputs < 0) { throw new Exception( "Failed to read analog channel " + config.ioNumber + " from hardware"); } eventPublisher.postUpdate(itemName, new DecimalType( state)); } } } lastDigitalInputs = inputs; } catch (Exception e) { logger.error("Failed to read from hardware ", e); connected = false; sysLibrary.CloseDevice(); } }
Source:
protected void setUserUnlocked(int userId) { Log.i(TAG, "User unlocked, initializing the service"); if (!SystemProperties.getBoolean(AVRCP_ENABLE_PROPERTY, false)) { Log.w(TAG, "Skipping initialization of the new AVRCP Target Player List"); sInstance = null; return; } mMediaPlayerList.init(new ListCallback()); }

Target:
protected void setUserUnlocked(int userId) { Log.i(TAG, "User unlocked, initializing the service"); if (!SystemProperties.getBoolean(AVRCP_ENABLE_PROPERTY, false)) { Log.w(TAG, "Skipping initialization of the new AVRCP Target Player List"); sInstance = null; return; } if (mMediaPlayerList != null) { mMediaPlayerList.init(new ListCallback()); } }
Source:
private void verifyLinkExpansionButtons(StudentAttributes student, InstructorAttributes instructor) { WebElement studentRow = searchPage.getStudentRow(student); WebElement instructorRow = searchPage.getInstructorRow(instructor); searchPage.clickExpandStudentLinks(); searchPage.clickExpandInstructorLinks(); int numExpandedStudentRows = searchPage.getNumExpandedRows(studentRow); int numExpandedInstructorRows = searchPage.getNumExpandedRows(instructorRow); assertNotEquals(numExpandedStudentRows, 0); assertNotEquals(numExpandedInstructorRows, 0); searchPage.clickCollapseInstructorLinks(); numExpandedStudentRows = searchPage.getNumExpandedRows(studentRow); numExpandedInstructorRows = searchPage.getNumExpandedRows(instructorRow); assertNotEquals(numExpandedStudentRows, 0); assertEquals(numExpandedInstructorRows, 0); searchPage.clickExpandInstructorLinks(); searchPage.clickCollapseStudentLinks(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } numExpandedStudentRows = searchPage.getNumExpandedRows(studentRow); numExpandedInstructorRows = searchPage.getNumExpandedRows(instructorRow); assertEquals(numExpandedStudentRows, 0); assertNotEquals(numExpandedInstructorRows, 0); }

Target:
private void verifyLinkExpansionButtons(StudentAttributes student, InstructorAttributes instructor) { WebElement studentRow = searchPage.getStudentRow(student); WebElement instructorRow = searchPage.getInstructorRow(instructor); searchPage.clickExpandStudentLinks(); searchPage.clickExpandInstructorLinks(); int numExpandedStudentRows = searchPage.getNumExpandedRows(studentRow); int numExpandedInstructorRows = searchPage.getNumExpandedRows(instructorRow); assertNotEquals(numExpandedStudentRows, 0); assertNotEquals(numExpandedInstructorRows, 0); searchPage.clickCollapseInstructorLinks(); numExpandedStudentRows = searchPage.getNumExpandedRows(studentRow); numExpandedInstructorRows = searchPage.getNumExpandedRows(instructorRow); assertNotEquals(numExpandedStudentRows, 0); assertEquals(numExpandedInstructorRows, 0); searchPage.clickExpandInstructorLinks(); searchPage.clickCollapseStudentLinks(); searchPage.waitUntilAnimationFinish(); numExpandedStudentRows = searchPage.getNumExpandedRows(studentRow); numExpandedInstructorRows = searchPage.getNumExpandedRows(instructorRow); assertEquals(numExpandedStudentRows, 0); assertNotEquals(numExpandedInstructorRows, 0); }
Source:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { boolean isGet = request.getTargetCase() == ReadRowsRequest.TargetCase.ROW_KEY; int streamingBufferSize = retryOptions.getStreamingBufferSize(); int batchRequestSize; Channel channel; if (isGet) { batchRequestSize = 1; streamingBufferSize = 10; channel = channelPool; } else { batchRequestSize = retryOptions.getStreamingBatchSize(); streamingBufferSize = retryOptions.getStreamingBufferSize(); channel = channelPool.reserveChannel(); } ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channel.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); CancellationToken cancellationToken = createCancellationToken(channel, readRowsCall); int timeout = retryOptions.getReadPartialRowTimeoutMillis(); ResponseQueueReader responseQueueReader = new ResponseQueueReader(timeout, streamingBufferSize, batchRequestSize, batchRequestSize, readRowsCall); StreamingBigtableResultScanner resultScanner = new StreamingBigtableResultScanner(responseQueueReader, cancellationToken); clientCallService.asyncServerStreamingCall( readRowsCall, request, createClientCallListener(channel, resultScanner)); if (batchRequestSize > 1) { readRowsCall.request(batchRequestSize - 1); } return resultScanner; }

Target:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { boolean isGet = request.getTargetCase() == ReadRowsRequest.TargetCase.ROW_KEY; int streamingBufferSize; int batchRequestSize; Channel channel; if (isGet) { batchRequestSize = 1; streamingBufferSize = 10; channel = channelPool; } else { batchRequestSize = retryOptions.getStreamingBatchSize(); streamingBufferSize = retryOptions.getStreamingBufferSize(); channel = channelPool.reserveChannel(); } ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channel.newCall(BigtableServiceGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); CancellationToken cancellationToken = createCancellationToken(channel, readRowsCall); int timeout = retryOptions.getReadPartialRowTimeoutMillis(); ResponseQueueReader responseQueueReader = new ResponseQueueReader(timeout, streamingBufferSize, batchRequestSize, batchRequestSize, readRowsCall); StreamingBigtableResultScanner resultScanner = new StreamingBigtableResultScanner(responseQueueReader, cancellationToken); clientCallService.asyncServerStreamingCall( readRowsCall, request, createClientCallListener(channel, resultScanner)); if (batchRequestSize > 1) { readRowsCall.request(batchRequestSize - 1); } return resultScanner; }
Source:
String getViewId() { return fViewId; }

Target:
private String getViewId() { return fViewId; }
Source:
public CountsComputer( long lastCommittedTransactionId, NodeStore nodes, RelationshipStore relationships, int highLabelId, int highRelationshipTypeId ) { this( lastCommittedTransactionId, nodes, relationships, highLabelId, highRelationshipTypeId, new SilentMigrationProgressMonitor().startSection( "Counts" ) ); }

Target:
public CountsComputer( long lastCommittedTransactionId, NodeStore nodes, RelationshipStore relationships, int highLabelId, int highRelationshipTypeId ) { this( lastCommittedTransactionId, nodes, relationships, highLabelId, highRelationshipTypeId, SilentMigrationProgressMonitor.NO_OP_SECTION ); }
Source:
private void ensureAccessToken() { try { if(isMaterialized()) { Claims claims = Jwts.parser() .setSigningKey(getDataStore().getApiKey().getSecret().getBytes("UTF-8")) .parseClaimsJws(getString(JWT)).getBody(); Assert.isTrue(Strings.hasText((String) claims.get("rti"))); } } catch (Exception e) { throw new JwtException("JWT failed validation; it cannot be trusted."); } }

Target:
private void ensureAccessToken() { if(isMaterialized()) { try { Claims claims = Jwts.parser() .setSigningKey(getDataStore().getApiKey().getSecret().getBytes("UTF-8")) .parseClaimsJws(getString(JWT)).getBody(); Assert.isTrue(Strings.hasText((String) claims.get("rti"))); } catch (Exception e) { throw new JwtException("JWT failed validation; it cannot be trusted."); } } else { String href = getStringProperty(HREF_PROP_NAME); if (href != null) { Assert.isTrue(href.contains("/accessTokens/"), "href does not belong to an access token."); } } }
Source:
public void testWriteAndRead() throws IOException { Schema schema = Schema.create(Type.STRING); DataFileWriter<Utf8> w = new DataFileWriter<>(new GenericDatumWriter<>(schema)); w.setCodec(CodecFactory.deflateCodec(6)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); w.create(schema, baos); w.append(new Utf8("hello world")); w.append(new Utf8("hello moon")); w.sync(); w.append(new Utf8("bye bye world")); w.append(new Utf8("bye bye moon")); w.close(); DataFileStream<Utf8> r = new DataFileStream<>(new ByteArrayInputStream(baos.toByteArray()), new GenericDatumReader<>(schema)); assertEquals("hello world", r.next().toString()); assertEquals("hello moon", r.next().toString()); assertEquals("bye bye world", r.next().toString()); assertEquals("bye bye moon", r.next().toString()); assertFalse(r.hasNext()); r.close(); }

Target:
public void testWriteAndRead() throws IOException { Schema schema = Schema.create(Type.STRING); DataFileWriter<Utf8> w = new DataFileWriter<>(new GenericDatumWriter<>(schema)); w.setCodec(CodecFactory.deflateCodec(6)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); w.create(schema, baos); w.append(new Utf8("hello world")); w.append(new Utf8("hello moon")); w.sync(); w.append(new Utf8("bye bye world")); w.append(new Utf8("bye bye moon")); w.close(); try (DataFileStream<Utf8> r = new DataFileStream<>(new ByteArrayInputStream(baos.toByteArray()), new GenericDatumReader<>(schema))) { assertEquals("hello world", r.next().toString()); assertEquals("hello moon", r.next().toString()); assertEquals("bye bye world", r.next().toString()); assertEquals("bye bye moon", r.next().toString()); assertFalse(r.hasNext()); } }
Source:
private MutableConfiguration<Long, Product> createProductCacheConf() { MutableConfiguration<Long, Product> conf = new MutableConfiguration<Long, Product>(); conf.setTypes(Long.class, Product.class); return conf; }

Target:
private MutableConfiguration<Long, Product> createProductCacheConf() { return createMutableConfiguration(Long.class, Product.class); }
Source:
public boolean next() throws IOException { if (session.walk == null) throw new IllegalStateException( JGitText.get().blameHasNotBeenStarted); RevCommit commit = session.walk.next(); if (commit == null) { markSessionBound(); return false; } ObjectId blob = getBlob(commit); if (blob == null) { updatePath(commit); blob = getBlob(commit); } if (blob == null) { markSessionBound(); return false; } RawText text = getRawText(blob); EditList diffs = diffAlgorithm.diff(textComparator, text, session.text); merge(commit, text.size(), diffs); session.text = text; session.commit = commit; if (!session.merges) markSessionBound(); return session.merges; }

Target:
public boolean next() throws IOException { if (walk == null && !start()) { release(); return false; } curEdit++; if (remaining == 0) { release(); return false; } for (;;) { if (curEdit == editList.size()) { if (!nextCommit()) return false; continue; } Edit edit = editList.get(curEdit); int len = edit.getLengthB(); if (len == 0) { curEdit++; } else { remaining -= len; return true; } } }
Source:
public void testFindWorkingVersionContainer() throws Exception{ Container c = new Container(); c.setFriendlyName("Versionable Container Working"); c.setTitle("Versionable Container Working"); c.setMaxContentlets(2); c.setPreLoop("preloop code"); c.setPostLoop("postloop code"); Structure st=CacheLocator.getContentTypeCache().getStructureByVelocityVarName("host"); List<ContainerStructure> csList = new ArrayList<ContainerStructure>(); ContainerStructure cs = new ContainerStructure(); cs.setStructureId(st.getInode()); cs.setCode("this is the code"); csList.add(cs); c = APILocator.getContainerAPI().save(c, csList, host, user, false); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(c.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),c.getTitle()); assertEquals(verAPI.getInode(),c.getInode()); APILocator.getContainerAPI().delete(c, user, false); }

Target:
public void testFindWorkingVersionContainer() throws Exception{ Structure structure = new StructureDataGen().nextPersisted(); Container container = new ContainerDataGen().withStructure(structure, "").nextPersisted(); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(container.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),container.getTitle()); assertEquals(verAPI.getInode(),container.getInode()); APILocator.getContainerAPI().delete(container, user, false); APILocator.getStructureAPI().delete(structure, user); }
Source:
public List<InterpreterCompletion> completion(String buf, int cursor) { if (buf.length() < cursor) { cursor = buf.length(); } String completionString = getCompletionTargetString(buf, cursor); String completionCommand = "completion.getCompletion('" + completionString + "')"; SparkInterpreter sparkInterpreter = getSparkInterpreter(); if (sparkInterpreter.getSparkVersion().isUnsupportedVersion() == false && pythonscriptRunning == false) { return new LinkedList<>(); } pythonInterpretRequest = new PythonInterpretRequest(completionCommand, ""); statementOutput = null; synchronized (statementSetNotifier) { statementSetNotifier.notify(); } synchronized (statementFinishedNotifier) { long startTime = System.currentTimeMillis(); while (statementOutput == null && pythonScriptInitialized == false && pythonscriptRunning && System.currentTimeMillis() - startTime < 10 * 1000) { try { statementFinishedNotifier.wait(1000); } catch (InterruptedException e) { logger.info("wait drop"); return new LinkedList<>(); } } } if (statementError) { return new LinkedList<>(); } InterpreterResult completionResult = new InterpreterResult(Code.SUCCESS, statementOutput); Gson gson = new Gson(); String[] completionList = gson.fromJson(completionResult.message(), String[].class); List<InterpreterCompletion> results = new LinkedList<>(); for (String name: completionList) { results.add(new InterpreterCompletion(name, name)); } return results; }

Target:
public List<InterpreterCompletion> completion(String buf, int cursor) { if (buf.length() < cursor) { cursor = buf.length(); } String completionString = getCompletionTargetString(buf, cursor); String completionCommand = "completion.getCompletion('" + completionString + "')"; SparkInterpreter sparkInterpreter = getSparkInterpreter(); if (sparkInterpreter.getSparkVersion().isUnsupportedVersion() == false && pythonscriptRunning == false) { return new LinkedList<>(); } pythonInterpretRequest = new PythonInterpretRequest(completionCommand, ""); statementOutput = null; synchronized (statementSetNotifier) { statementSetNotifier.notify(); } synchronized (statementFinishedNotifier) { long startTime = System.currentTimeMillis(); while (statementOutput == null && pythonScriptInitialized == false && pythonscriptRunning) { try { if (System.currentTimeMillis() - startTime < MAX_TIMEOUT_SEC * 1000) { logger.error("pyspark completion didn't have response for {}sec.", MAX_TIMEOUT_SEC); break; } statementFinishedNotifier.wait(1000); } catch (InterruptedException e) { logger.info("wait drop"); return new LinkedList<>(); } } } if (statementError) { return new LinkedList<>(); } InterpreterResult completionResult = new InterpreterResult(Code.SUCCESS, statementOutput); Gson gson = new Gson(); String[] completionList = gson.fromJson(completionResult.message(), String[].class); List<InterpreterCompletion> results = new LinkedList<>(); for (String name: completionList) { results.add(new InterpreterCompletion(name, name)); } return results; }
Source:
public <T> T build(Class<T> aClass) { if (baseUri == null) { throw new IllegalStateException("baseUrl not set"); } Validator.checkValid(aClass); RegisterProvider[] providers = aClass.getAnnotationsByType(RegisterProvider.class); Configuration config = configImpl.getConfiguration(); if (providers != null) { for (RegisterProvider provider : providers) { if (!config.isRegistered(provider.value())) { if (provider.priority() == -1) { register(provider.value()); } else { register(provider.value(), provider.priority()); } } } } final String interfaceName = aClass.getName(); Optional<Long> timeout = ConfigFacade.getOptionalValue( String.format(REST_CONN_TIMEOUT_FORMAT, interfaceName), Long.class).map( timeoutValue -> { connectTimeout(timeoutValue, TimeUnit.MILLISECONDS); return timeoutValue; }); if (!timeout.isPresent() && LOG.isLoggable(Level.FINEST)) { LOG.finest("connectionTimeout set by MP Config: " + timeout.get()); } timeout = ConfigFacade.getOptionalValue( String.format(REST_READ_TIMEOUT_FORMAT, interfaceName), Long.class).map( timeoutValue -> { readTimeout(timeoutValue, TimeUnit.MILLISECONDS); return timeoutValue; }); if (!timeout.isPresent() && LOG.isLoggable(Level.FINEST)) { LOG.finest("readTimeout set by MP Config: " + timeout.get()); } for (RestClientListener listener : listeners()) { listener.onNewClient(aClass, this); } MicroProfileClientFactoryBean bean = new MicroProfileClientFactoryBean(configImpl, baseUri, aClass, executorService); return bean.create(aClass); }

Target:
public <T> T build(Class<T> aClass) { if (baseUri == null) { throw new IllegalStateException("baseUrl not set"); } Validator.checkValid(aClass); RegisterProvider[] providers = aClass.getAnnotationsByType(RegisterProvider.class); Configuration config = configImpl.getConfiguration(); if (providers != null) { for (RegisterProvider provider : providers) { if (!config.isRegistered(provider.value())) { if (provider.priority() == -1) { register(provider.value()); } else { register(provider.value(), provider.priority()); } } } } final String interfaceName = aClass.getName(); ConfigFacade.getOptionalLong(String.format(REST_CONN_TIMEOUT_FORMAT, interfaceName)).ifPresent( timeoutValue -> { connectTimeout(timeoutValue, TimeUnit.MILLISECONDS); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("readTimeout set by MP Config: " + timeoutValue); } }); ConfigFacade.getOptionalLong(String.format(REST_READ_TIMEOUT_FORMAT, interfaceName)).ifPresent( timeoutValue -> { readTimeout(timeoutValue, TimeUnit.MILLISECONDS); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("readTimeout set by MP Config: " + timeoutValue); } }); listeners().forEach(l -> l.onNewClient(aClass, this)); MicroProfileClientFactoryBean bean = new MicroProfileClientFactoryBean(configImpl, baseUri, aClass, executorService); return bean.create(aClass); }
Source:
public Map<String, String> getIdfFileAttributes(String experimentAccession, String cellId) { IdfParserOutput idfParserOutput = idfParser.parse(experimentAccession); if (idfParserOutput.getMetadataFieldsOfInterest().isEmpty()) { return emptyMap(); } SingleCellAnalyticsSchemaField[] attributeFields = idfParserOutput.getMetadataFieldsOfInterest() .stream() .map(attribute -> SingleCellAnalyticsCollectionProxy.characteristicAsSchemaField(attributeNameToFieldName((attribute)), attribute)) .toArray(SingleCellAnalyticsSchemaField[]::new); return getCellQueryResultForMultiValueFields(experimentAccession, cellId, attributeFields) .entrySet().stream() .collect(toMap( Map.Entry::getKey, entry -> entry.getValue().stream().map(Object::toString).collect(Collectors.joining(",")))); }

Target:
public Map<String, String> getIdfFileAttributes(String experimentAccession, String cellId) { IdfParserOutput idfParserOutput = idfParser.parse(experimentAccession); if (idfParserOutput.getMetadataFieldsOfInterest().isEmpty()) { return emptyMap(); } SingleCellAnalyticsSchemaField[] attributeFields = idfParserOutput.getMetadataFieldsOfInterest() .stream() .map(attribute -> SingleCellAnalyticsCollectionProxy.characteristicAsSchemaField(attributeNameToFieldName(attribute))) .toArray(SingleCellAnalyticsSchemaField[]::new); return getCellQueryResultForMultiValueFields(experimentAccession, cellId, attributeFields) .entrySet().stream() .collect(toMap( Map.Entry::getKey, entry -> entry.getValue().stream().map(Object::toString).collect(Collectors.joining(",")))); }
Source:
public static void setUserMetadataHeaders(Map<String, String> userMetadataMap, RestResponseChannel restResponseChannel) { Objects.requireNonNull(userMetadataMap, "user metadata must be supplied"); for (Map.Entry<String, String> entry : userMetadataMap.entrySet()) { String headerName = entry.getKey(); String headerValue = entry.getValue(); try { restResponseChannel.setHeader(headerName, headerValue); } catch (IllegalArgumentException iae) { try { headerName = headerName.replaceFirst(Headers.USER_META_DATA_HEADER_PREFIX, Headers.USER_META_DATA_ENCODED_HEADER_PREFIX); headerValue = URLEncoder.encode(headerValue, CHARSET.name()); restResponseChannel.setHeader(headerName, headerValue); logger.debug("Set encoded value in response header {}", headerName); } catch (Exception e) { logger.error("Unable to set response header to value {}", headerName, headerValue, e); } } } }

Target:
public static void setUserMetadataHeaders(Map<String, String> userMetadataMap, RestResponseChannel restResponseChannel) { Objects.requireNonNull(userMetadataMap, "user metadata must be supplied"); for (Map.Entry<String, String> entry : userMetadataMap.entrySet()) { String headerName = entry.getKey(); String headerValue = entry.getValue(); if (!headerName.startsWith(Headers.USER_META_DATA_HEADER_PREFIX)) { headerName = Headers.USER_META_DATA_HEADER_PREFIX + headerName; } try { restResponseChannel.setHeader(headerName, headerValue); } catch (IllegalArgumentException iae) { try { headerName = headerName.replaceFirst(Headers.USER_META_DATA_HEADER_PREFIX, Headers.USER_META_DATA_ENCODED_HEADER_PREFIX); headerValue = URLEncoder.encode(headerValue, CHARSET.name()); restResponseChannel.setHeader(headerName, headerValue); logger.debug("Set encoded value in response header {}", headerName); } catch (Exception e) { logger.error("Unable to set response header to value {}", headerName, headerValue, e); } } } }
Source:
protected void executeVmCommand() { addCustomValue("InterfaceType", VmInterfaceType.forValue(getInterface().getType()).getDescription().toString()); boolean succeeded = false; boolean macAddedToPool = false; String macAddress = getMacAddress(); try { if (isVnicProfileChanged(oldIface, getInterface())) { Network newNetwork = networkHelper.getNetworkByVnicProfileId(getInterface().getVnicProfileId()); Network oldNetwork = networkHelper.getNetworkByVnicProfileId(oldIface.getVnicProfileId()); if (!Objects.equals(oldNetwork, newNetwork)) { externalNetworkManagerFactory.create(oldIface).deallocateIfExternal(); } } macAddedToPool = macShouldBeChanged && !belongsToOriginalSnapshot(macAddress) && addMacToPool(macAddress); if (mustChangeAddress(oldIface.getType(), getInterface().getType())) { vmDeviceDao.clearDeviceAddress(getInterface().getId()); } getInterface().setSpeed(VmInterfaceType.forValue(getInterface().getType()).getSpeed()); TransactionSupport.executeInNewTransaction(() -> { bumpVmVersion(); updatePassthoughDeviceIfNeeded(); getCompensationContext().snapshotEntity(oldIface); vmNicDao.update(getInterface()); saveNetworkFilterParameters(); getCompensationContext().stateChanged(); return null; }); succeeded = updateHost(); } finally { setSucceeded(succeeded); MacPool macPool = getMacPool(); if (macAddedToPool) { if (succeeded) { String macToRelease = oldIface.getMacAddress(); boolean isRunningStatelessVm = getVm().isStateless() && getVm().isRunning(); boolean canReleaseOriginalMac = !isRunningStatelessVm || !belongsToOriginalSnapshot(macToRelease); if (canReleaseOriginalMac) { macPool.freeMac(macToRelease); } } else { macPool.freeMac(macAddress); } } } }

Target:
protected void executeVmCommand() { addCustomValue("InterfaceType", VmInterfaceType.forValue(getInterface().getType()).getDescription().toString()); boolean succeeded = false; boolean macAddedToPool = false; try { if (isVnicProfileChanged(oldIface, getInterface())) { Network newNetwork = networkHelper.getNetworkByVnicProfileId(getInterface().getVnicProfileId()); Network oldNetwork = networkHelper.getNetworkByVnicProfileId(oldIface.getVnicProfileId()); if (!Objects.equals(oldNetwork, newNetwork)) { externalNetworkManagerFactory.create(oldIface).deallocateIfExternal(); } } macAddedToPool = allocateMacFromRequest(); if (mustChangeAddress(oldIface.getType(), getInterface().getType())) { vmDeviceDao.clearDeviceAddress(getInterface().getId()); } getInterface().setSpeed(VmInterfaceType.forValue(getInterface().getType()).getSpeed()); succeeded = Boolean.TRUE.equals(TransactionSupport.executeInNewTransaction(() -> { bumpVmVersion(); updatePassthoughDeviceIfNeeded(); getCompensationContext().snapshotEntity(oldIface); vmNicDao.update(getInterface()); saveNetworkFilterParameters(); getCompensationContext().stateChanged(); return true; })); succeeded &= updateHost(); } finally { setSucceeded(succeeded); macPoolCleanupAfterExecution(macAddedToPool); } }
Source:
public synchronized void executeSensorIncr(String sensor) { executeSensorCount.scope(sensor); }

Target:
public synchronized void executeSensorIncr(String sensor) { executeSensorCount.scope(sensor).incr(); }
Source:
private void addRemotePropertiesConfigurationSources(ConfigurationRegistry configuration, CorePlugin corePlugin) { final ArrayList<URL> configurationUrls = new ArrayList<URL>(corePlugin.getRemotePropertiesConfigUrls()); if (corePlugin.isDeactivateStagemonitorIfRemotePropertyServerIsDown()) { assertRemotePropertiesServerIsAvailable(configurationUrls.get(0)); } logger.debug("Loading RemotePropertiesConfigurationSources with: configurationUrls = " + configurationUrls); final HttpClient sharedHttpClient = new HttpClient(); for (URL configUrl : configurationUrls) { final RemotePropertiesConfigurationSource source = new RemotePropertiesConfigurationSource( sharedHttpClient, configUrl); configuration.addConfigurationSourceAfter(source, SimpleSource.class); } configuration.reloadAllConfigurationOptions(); }

Target:
private void addRemotePropertiesConfigurationSources(ConfigurationRegistry configuration, CorePlugin corePlugin) { final List<URL> configurationUrls = corePlugin.getRemotePropertiesConfigUrls(); if (corePlugin.isDeactivateStagemonitorIfRemotePropertyServerIsDown()) { assertRemotePropertiesServerIsAvailable(configurationUrls.get(0)); } logger.debug("Loading RemotePropertiesConfigurationSources with: configurationUrls = " + configurationUrls); final HttpClient sharedHttpClient = new HttpClient(); for (URL configUrl : configurationUrls) { final RemotePropertiesConfigurationSource source = new RemotePropertiesConfigurationSource( sharedHttpClient, configUrl); configuration.addConfigurationSourceAfter(source, SimpleSource.class); } configuration.reloadAllConfigurationOptions(); }
Source:
public boolean studyEntryHasSamples(final Integer studyId, final Integer entryId) { final List queryResults; try { final SQLQuery query = this.getSession().createSQLQuery(SQL_STUDY_ENTRY_HAS_SAMPLES); query.setParameter("studyId", studyId); query.setParameter("entryId", entryId); queryResults = query.list(); } catch (final HibernateException he) { throw new MiddlewareException( "Unexpected error in executing hasSamples(studyId = " + studyId + ") query: " + he.getMessage(), he); } return queryResults.isEmpty() ? false : true; }

Target:
public boolean studyEntryHasSamples(final Integer studyId, final Integer entryId) { final List queryResults; try { final SQLQuery query = this.getSession().createSQLQuery(SQL_STUDY_ENTRY_HAS_SAMPLES); query.setParameter("studyId", studyId); query.setParameter("entryId", entryId); queryResults = query.list(); } catch (final HibernateException he) { throw new MiddlewareException( "Unexpected error in executing studyEntryHasSamples(studyId = " + studyId + ",entryId=" + entryId + ") query: " + he.getMessage(), he); } return queryResults.isEmpty() ? false : true; }
Source:
public void testDynamicPropertyFilterIncludeNestedProperty() { DynamicFilterData filterData = new DynamicFilterData(); filterData.includeAttribute("owner.id"); filterData.setWhitelistMode(true); ResteasyProviderFactory.pushContext(DynamicFilterData.class, filterData); ActivationKeyDTO keyDTO = new ActivationKeyDTO(); NestedOwnerDTO ownerDTO = new NestedOwnerDTO() .key("owner_key") .id("owner_id"); keyDTO.setOwner(ownerDTO); String serializedKey = ""; try { serializedKey = ourMapper.writeValueAsString(keyDTO); } catch (JsonProcessingException e) { fail("Serializing ActivationKeyDTO failed!"); } ObjectMapper mapper = new ObjectMapper(); JsonNode akNode = null; try { akNode = mapper.readTree(serializedKey); } catch (JsonProcessingException e) { fail("Parsing serialized ActivationKeyDTO failed!"); } assertEquals(1, akNode.size()); assertTrue(akNode.has("owner"), "The 'owner' field should have been included!"); assertTrue(akNode.get("owner").has("id"), "The 'owner.id' field should have been included!"); }

Target:
public void testDynamicPropertyFilterIncludeNestedProperty() { DynamicFilterData filterData = new DynamicFilterData(); filterData.includeAttribute("owner.id"); filterData.setWhitelistMode(true); ResteasyProviderFactory.pushContext(DynamicFilterData.class, filterData); ActivationKeyDTO keyDTO = new ActivationKeyDTO(); NestedOwnerDTO ownerDTO = new NestedOwnerDTO() .key("owner_key") .id("owner_id"); keyDTO.setOwner(ownerDTO); String serializedKey = ""; try { serializedKey = ourMapper.writeValueAsString(keyDTO); } catch (JsonProcessingException e) { fail("Serializing ActivationKeyDTO failed!"); } ObjectMapper mapper = new ObjectMapper(); JsonNode akNode = null; try { akNode = mapper.readTree(serializedKey); } catch (JsonProcessingException e) { fail("Parsing serialized ActivationKeyDTO failed!"); } assertEquals(1, akNode.size()); assertTrue(akNode.has("owner"), "The 'owner' field should have been included!"); assertEquals(1, akNode.get("owner").size()); assertTrue(akNode.get("owner").has("id"), "The 'owner.id' field should have been included!"); }
Source:
protected static int findMaxLandMassSize(final GamePlayer player) { final GameData data = player.getData(); final Predicate<Territory> cond = ProMatches.territoryCanPotentiallyMoveLandUnits(player, data); class LandMassFinder extends BreadthFirstSearch { int landMassSize = 0; LandMassFinder(final Territory startTerritory) { super(startTerritory, cond); } @Override public void visit(final Territory territory) { landMassSize++; } } int maxLandMassSize = 1; final var fullVisited = new HashSet<Territory>(); for (final Territory t : data.getMap().getTerritories()) { if (!t.isWater() && !fullVisited.contains(t)) { final LandMassFinder finder = new LandMassFinder(t); finder.search(); fullVisited.addAll(finder.getVisited()); if (finder.landMassSize > maxLandMassSize) { maxLandMassSize = finder.landMassSize; } } } return maxLandMassSize; }

Target:
protected static int findMaxLandMassSize(final GamePlayer player) { final GameData data = player.getData(); final Predicate<Territory> cond = ProMatches.territoryCanPotentiallyMoveLandUnits(player, data); final var visited = new HashSet<Territory>(); int maxLandMassSize = 1; for (final Territory t : data.getMap().getTerritories()) { if (!t.isWater() && !visited.contains(t)) { visited.add(t); final int[] landMassSize = new int[1]; new BreadthFirstSearch(t, cond) .traverse( new BreadthFirstSearch.Visitor() { @Override public void visit(final Territory territory) { visited.add(territory); landMassSize[0]++; } }); if (landMassSize[0] > maxLandMassSize) { maxLandMassSize = landMassSize[0]; } } } return maxLandMassSize; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ThreadMeta that = (ThreadMeta) o; return Objects.equals(threadName, that.threadName) && Objects.equals(threadId, that.threadId); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ThreadMeta that = (ThreadMeta) o; return Objects.equals(threadName, that.threadName) && Objects.equals(threadId, that.threadId); }
Source:
public String getLogEntryActionsButtonClass() { String className = ""; if (message.toLowerCase(Locale.ENGLISH).contains( Const.ACTION_RESULT_FAILURE.toLowerCase(Locale.ENGLISH))) { className = "btn-warning"; } else if (message.toLowerCase(Locale.ENGLISH).contains( Const.ACTION_RESULT_SYSTEM_ERROR_REPORT.toLowerCase(Locale.ENGLISH))) { className = "btn-danger"; } else { className = "btn-info"; } return className; }

Target:
public String getLogEntryActionsButtonClass() { String className = ""; if (message.toLowerCase().contains(Const.ACTION_RESULT_FAILURE.toLowerCase())) { className = "btn-warning"; } else if (message.toLowerCase().contains(Const.ACTION_RESULT_SYSTEM_ERROR_REPORT.toLowerCase())) { className = "btn-danger"; } else { className = "btn-info"; } return className; }