auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<HostNetwork> calculateNetworksToConfigure(Network managementNetworkOfThisCluster) { List<HostNetwork> networksToConfigure = new ArrayList<>(getParameters().getNetworkAttachments().size()); BusinessEntityMap<VdsNetworkInterface> nics = getExistingNicsBusinessEntityMap(); Guid managementNetworkId = managementNetworkOfThisCluster.getId(); for (NetworkAttachment attachment : getParameters().getNetworkAttachments()) { Network network = existingNetworkRelatedToAttachment(attachment); HostNetwork networkToConfigure = new HostNetwork(network, attachment); networkToConfigure.setBonding(isBonding(attachment, nics)); boolean <START> attachmentOfManagementNetwork = <END> attachment.getNetworkId().equals(managementNetworkId); if (attachmentOfManagementNetwork) { DnsResolverConfiguration dnsResolverConfiguration = calculateDnsConfigurationToUse(attachment, network); if (dnsResolverConfiguration != null) { networkToConfigure.setNameServers(dnsResolverConfiguration.getNameServers()); } } if (defaultRouteSupported() && defaultRouteRequired(network, attachment.getIpConfiguration())) { networkToConfigure.setDefaultRoute(true); } if (NetworkUtils.qosConfiguredOnInterface(attachment, network)) { networkToConfigure.setQosConfiguredOnInterface(true); HostNetworkQos hostNetworkQos = effectiveHostNetworkQos.getQos(attachment, network); networkToConfigure.setQos(hostNetworkQos); } networksToConfigure.add(networkToConfigure); } return networksToConfigure; }</code><technical_language>a matter of personal preference: isAttachmentOfManagementNetwork feel free is if prefer</technical_language>

Target:
private List<HostNetwork> calculateNetworksToConfigure(Network managementNetworkOfThisCluster) { List<HostNetwork> networksToConfigure = new ArrayList<>(getParameters().getNetworkAttachments().size()); BusinessEntityMap<VdsNetworkInterface> nics = getExistingNicsBusinessEntityMap(); Guid managementNetworkId = managementNetworkOfThisCluster.getId(); for (NetworkAttachment attachment : getParameters().getNetworkAttachments()) { Network network = existingNetworkRelatedToAttachment(attachment); HostNetwork networkToConfigure = new HostNetwork(network, attachment); networkToConfigure.setBonding(isBonding(attachment, nics)); boolean isAttachmentOfManagementNetwork = attachment.getNetworkId().equals(managementNetworkId); if (shouldIncludeDnsConfigurationData(isAttachmentOfManagementNetwork, attachment)) { DnsResolverConfiguration dnsResolverConfiguration = calculateDnsConfigurationToUse(attachment, network); if (dnsResolverConfiguration != null) { networkToConfigure.setNameServers(dnsResolverConfiguration.getNameServers()); } } if (defaultRouteSupported() && defaultRouteRequired(isAttachmentOfManagementNetwork, attachment.getIpConfiguration())) { networkToConfigure.setDefaultRoute(true); } if (NetworkUtils.qosConfiguredOnInterface(attachment, network)) { networkToConfigure.setQosConfiguredOnInterface(true); HostNetworkQos hostNetworkQos = effectiveHostNetworkQos.getQos(attachment, network); networkToConfigure.setQos(hostNetworkQos); } networksToConfigure.add(networkToConfigure); } return networksToConfigure; }
Source:
<code>public BrokerEnvironmentFactory( String cheWebsocketEndpoint, String brokerPullPolicy, AgentAuthEnableEnvVarProvider authEnableEnvVarProvider, MachineTokenEnvVarProvider machineTokenEnvVarProvider, String artifactsBrokerImage, String metadataBrokerImage, String pluginRegistryUrl, String pluginRegistryInternalUrl, CertificateProvisioner certProvisioner) { this.cheWebsocketEndpoint = cheWebsocketEndpoint; this.brokerPullPolicy = brokerPullPolicy; this.authEnableEnvVarProvider = authEnableEnvVarProvider; this.machineTokenEnvVarProvider = machineTokenEnvVarProvider; this.artifactsBrokerImage = artifactsBrokerImage; this.metadataBrokerImage = metadataBrokerImage; if (!isNullOrEmpty(pluginRegistryInternalUrl)) { pluginRegistryUrl = pluginRegistryInternalUrl; } <START> LOGGER.info("Plugin registry url: {}", pluginRegistryUrl); <END> this.pluginRegistryUrl = pluginRegistryUrl; this.certProvisioner = certProvisioner; }</code><technical_language>is print a row LOGGER.info("Plugin registry url: {}", this.pluginRegistryUrl);</technical_language>

Target:
public BrokerEnvironmentFactory( String cheWebsocketEndpoint, String brokerPullPolicy, AgentAuthEnableEnvVarProvider authEnableEnvVarProvider, MachineTokenEnvVarProvider machineTokenEnvVarProvider, String artifactsBrokerImage, String metadataBrokerImage, String pluginRegistryUrl, String pluginRegistryInternalUrl, CertificateProvisioner certProvisioner) { this.cheWebsocketEndpoint = cheWebsocketEndpoint; this.brokerPullPolicy = brokerPullPolicy; this.authEnableEnvVarProvider = authEnableEnvVarProvider; this.machineTokenEnvVarProvider = machineTokenEnvVarProvider; this.artifactsBrokerImage = artifactsBrokerImage; this.metadataBrokerImage = metadataBrokerImage; this.pluginRegistryUrl = isNullOrEmpty(pluginRegistryInternalUrl) ? pluginRegistryUrl : pluginRegistryInternalUrl; this.certProvisioner = certProvisioner; }
Source:
<code>private void initializeZkStructure() throws InterruptedException { LOG.info("Starting initialization"); if (!checkZkStructureInited()) { try { zooKeeperHolder.get().create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT) .forPath(toZkPath("/version"), "0".getBytes(Charsets.UTF_8)); zooKeeperHolder.get().create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT) .forPath(toZkPath("/locked_et"), "[]".getBytes(Charsets.UTF_8)); zooKeeperHolder.get().create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT) .forPath(toZkPath("/nodes"), "[]".getBytes(Charsets.UTF_8)); <START> } catch (final KeeperException.NodeExistsException ignore) { <END> } catch (final Exception e) { LOG.error("Failed to check zk structures", e); throw new RuntimeException(e); } } runLocked(() -> { try { LOG.info("Registering node in zk"); updateSelfVersionTo(0); } catch (final Exception e) { LOG.error("Failed to initialize timeline synchronization", e); throw new RuntimeException(e); } }); reactOnEventTypesChange(); }</code><technical_language>If creation of a node /version fails due NodeExistsException, potential creation of other persistent nodes (/locked_et /nodes) skipped (and happen for other newly launching instances) I agree this happen in case of a bad setup of a new zookeeper, fix this if this scenario deleting (already) created nodes. related changes in PR, do a good idea handle creation of node exception NodeExistsException atomically for path checkZkStructureInitied checks for existence of nodes</technical_language>

Target:
private void initializeZkStructure() throws InterruptedException, RuntimeException { LOG.info("Starting initialization"); checkAndCreateZkNode("version", "0"); checkAndCreateZkNode("locked_et", "[]"); checkAndCreateZkNode("nodes", "[]"); runLocked(() -> { try { LOG.info("Registering node in zk"); updateSelfVersionTo(0); } catch (final Exception e) { LOG.error("Failed to initialize timeline synchronization", e); throw new RuntimeException(e); } }); reactOnEventTypesChange(); }
Source:
<code><START> public int approveUserRequest(String sUserId, String sRoles, String sAdminId) throws QuadrigaStorageException { <END> QuadrigaUserRequestsDTO userRequestDTO = (QuadrigaUserRequestsDTO) sessionFactory.getCurrentSession().get( QuadrigaUserRequestsDTO.class, sUserId); if (userRequestDTO != null) { QuadrigaUserDTO userDTO = new QuadrigaUserDTO(); userDTO.setFullname(userRequestDTO.getFullname()); userDTO.setUsername(userRequestDTO.getUsername()); userDTO.setPasswd(userRequestDTO.getPasswd()); userDTO.setEmail(userRequestDTO.getEmail()); userDTO.setQuadrigarole(sRoles); userDTO.setCreatedby(sAdminId); userDTO.setCreateddate(new Date()); userDTO.setUpdatedby(sAdminId); userDTO.setUpdateddate(new Date()); userDTO.setProvider(userRequestDTO.getProvider()); userDTO.setUserIdOfProvider(userRequestDTO.getUserIdOfProvider()); Session session = sessionFactory.getCurrentSession(); session.save(userDTO); session.delete(userRequestDTO); return SUCCESS; } else return FAILURE; }</code><technical_language>this throw QuadrigaStorageException</technical_language>

Target:
public int approveUserRequest(String sUserId, String sRoles, String sAdminId) throws QuadrigaStorageException { try { QuadrigaUserRequestsDTO userRequestDTO = (QuadrigaUserRequestsDTO) sessionFactory.getCurrentSession() .get(QuadrigaUserRequestsDTO.class, sUserId); if (userRequestDTO != null) { QuadrigaUserDTO userDTO = new QuadrigaUserDTO(); userDTO.setFullname(userRequestDTO.getFullname()); userDTO.setUsername(userRequestDTO.getUsername()); userDTO.setPasswd(userRequestDTO.getPasswd()); userDTO.setEmail(userRequestDTO.getEmail()); userDTO.setQuadrigarole(sRoles); userDTO.setCreatedby(sAdminId); userDTO.setCreateddate(new Date()); userDTO.setUpdatedby(sAdminId); userDTO.setUpdateddate(new Date()); userDTO.setProvider(userRequestDTO.getProvider()); userDTO.setUserIdOfProvider(userRequestDTO.getUserIdOfProvider()); Session session = sessionFactory.getCurrentSession(); session.save(userDTO); session.delete(userRequestDTO); return SUCCESS; } else return FAILURE; } catch (HibernateException e) { throw new QuadrigaStorageException(e); } }
Source:
<code>private TOTPSharedSecret createCredentials(final TOTPSharedSecret credsToSave) throws SegueDatabaseException { PreparedStatement pst; try (Connection conn = database.getDatabaseConnection()) { pst = conn .prepareStatement( <START> "INSERT INTO user_totp(user_id, shared_secret, created) " <END> + "VALUES (?, ?, ?);", Statement.RETURN_GENERATED_KEYS); setValueHelper(pst, 1, credsToSave.getUserId()); setValueHelper(pst, 2, credsToSave.getSharedSecret()); setValueHelper(pst, 3, credsToSave.getCreated()); if (pst.executeUpdate() == 0) { throw new SegueDatabaseException("Unable to save user."); } return credsToSave; } catch (SQLException e) { throw new SegueDatabaseException("Postgres exception", e); } }</code><technical_language>I a last_updated useful here, too</technical_language>

Target:
private TOTPSharedSecret createCredentials(final TOTPSharedSecret credsToSave) throws SegueDatabaseException { PreparedStatement pst; try (Connection conn = database.getDatabaseConnection()) { pst = conn .prepareStatement( "INSERT INTO user_totp(user_id, shared_secret, created, last_updated) " + "VALUES (?, ?, ?,?);", Statement.RETURN_GENERATED_KEYS); setValueHelper(pst, 1, credsToSave.getUserId()); setValueHelper(pst, 2, credsToSave.getSharedSecret()); setValueHelper(pst, 3, credsToSave.getCreated()); setValueHelper(pst, 4, credsToSave.getLastUpdated()); if (pst.executeUpdate() == 0) { throw new SegueDatabaseException("Unable to save totp secret."); } return credsToSave; } catch (SQLException e) { throw new SegueDatabaseException("Postgres exception", e); } }
Source:
<code><START> private String sanitizeLabel(String input) { <END> String label = input; int max = 63; if (label.length() > max) { label = label.substring(label.length() - max); } label = label.replaceAll("[^_.a-zA-Z0-9-]", "_").replaceFirst("^[^a-zA-Z0-9]", "x"); return label; }</code><technical_language>IIRC a similar utility method in this plugin</technical_language>

Target:
static String sanitizeLabel(String input) { String label = input; int max = 63; if (label.length() > max) { label = label.substring(label.length() - max); } label = label.replaceAll("[^_.a-zA-Z0-9-]", "_").replaceFirst("^[^a-zA-Z0-9]", "x"); return label; }
Source:
<code>public void createPartControl(@Nullable Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { fViewInfo.setName(name); } super.createPartControl(parent); <START> TmfViewer tree = getLeftChildViewer(); TmfXYChartViewer chart = getChartViewer(); if (tree instanceof AbstractSegmentStoreScatterChartTreeViewer && chart instanceof AbstractSegmentStoreScatterChartViewer) { ILegendImageProvider legendImageProvider = new XYChartLegendImageProvider((TmfCommonXAxisChartViewer) chart); AbstractSegmentStoreScatterChartTreeViewer diskTree = (AbstractSegmentStoreScatterChartTreeViewer) tree; diskTree.setTreeListener((AbstractSegmentStoreScatterChartViewer) chart); diskTree.setLegendImageProvider(legendImageProvider); } <END> Display.getDefault().asyncExec(new Runnable() { @Override public void run() { setPartName(fViewInfo.getLabel()); } }); }</code><technical_language>ditto parent class</technical_language>

Target:
public void createPartControl(@Nullable Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { fViewInfo.setName(name); } super.createPartControl(parent); Display.getDefault().asyncExec(() -> setPartName(fViewInfo.getLabel())); }
Source:
<code>public void resetPrintHistory() { for (Vertex vertex : graph) { <START> Iterator it = vertex.getEdges() .entrySet() .iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); ((Edge) pair.getValue()).setPrinted(false); } <END> } }</code><technical_language>a typed Iterator do casting loop</technical_language>

Target:
public void resetPrintHistory(){ for (Vertex vertex : graph){ Iterator<Map.Entry<Vertex,Edge>> it = vertex.getEdges().entrySet().iterator(); while (it.hasNext()) { Map.Entry<Vertex,Edge> pair = it.next(); pair.getValue().setPrinted(false); } } }
Source:
<code><START> public GroupLocation(boolean isCircular, Location... subLocations) { <END> this(Arrays.asList(subLocations)); }</code><technical_language>new parameter isCircular is used</technical_language>

Target:
public GroupLocation(boolean isCircular, Location... subLocations) { this(Arrays.asList(subLocations)); setCircular(isCircular); }
Source:
<code>public ReferenceCountingSegment getIncrementedSegment() { ReferenceCountingSegment segment = adapter.get(); while (true) { if (segment.increment()) { return segment; } ReferenceCountingSegment newSegment = adapter.get(); <START> if (segment == newSegment) { <END> throw new ISE("segment.close() is called somewhere outside FireHydrant.swapSegment()"); } segment = newSegment; } }</code><technical_language>nm, I wrong, correct :thumbsup:</technical_language>

Target:
public ReferenceCountingSegment getIncrementedSegment() { ReferenceCountingSegment segment = adapter.get(); while (true) { if (segment.increment()) { return segment; } ReferenceCountingSegment newSegment = adapter.get(); if (segment == newSegment) { throw new ISE("segment.close() is called somewhere outside FireHydrant.swapSegment()"); } if (newSegment == null) { throw new ISE("FireHydrant was 'closed' by swapping segment to null while acquiring a segment"); } segment = newSegment; } }
Source:
<code>public DataCenterNetworkPopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants, ApplicationTemplates templates) { super(eventBus, resources); isVmNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT); hasMtuEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.clustersTable = new EntityModelCellTable<ListModel>(SelectionMode.NONE, true){ @Override public void setRowData(int start, List<? extends EntityModel> values) { super.setRowData(start, values); <START> redraw(); <END> } @Override public void setSelectionModel(SelectionModel<? super EntityModel> selectionModel) { super.setSelectionModel(new NoSelectionModel<EntityModel>()); } }; initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); initEntityModelCellTable(constants, templates); updateVisibility(); localize(constants); addStyles(); Driver.driver.initialize(this); }</code><technical_language>please remove this. table need get data setting edit method. @Override public void edit(DataCenterNetworkModel object) { Driver.driver.edit(object); table.edit(object.getList()); } forget flush :-)</technical_language>

Target:
public DataCenterNetworkPopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants, ApplicationTemplates templates) { super(eventBus, resources); isVmNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT); hasMtuEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.clustersTable = new EntityModelCellTable<ListModel>(SelectionMode.NONE, true){ @Override public void setRowData(int start, List<? extends EntityModel> values) { super.setRowData(start, values); redraw(); } }; initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); initEntityModelCellTable(constants, templates); updateVisibility(); localize(constants); addStyles(); Driver.driver.initialize(this); }
Source:
<code>private static Qualifier buildQualifierWithClassId(String classId) { <START> Qualifier.Builder builder = Qualifier.newBuilder(); builder.setClassid(classId); return builder.build(); <END> }</code><technical_language>Pseud-one-liner :) java return Qualifier.newBuilder() .setClassid(classId) .build();</technical_language>

Target:
private static Qualifier buildQualifierWithClassId(String classId) { return Qualifier.newBuilder().setClassid(classId).build(); }
Source:
<code>public void run() { try { <START> InputStream inputStream = TestDataCreationHelper.createRandomInputStream(options.getSize()); <END> BlobOutputStream outputStream = cloudBlockBlob.openOutputStream(); TestDataCreationHelper.copyStream(inputStream, outputStream, DEFAULT_BUFFER_SIZE); outputStream.close(); } catch (StorageException | IOException e) { throw new RuntimeException(e); } }</code><technical_language>Cache input stream</technical_language>

Target:
public void run() { try { BlobOutputStream outputStream = cloudBlockBlob.openOutputStream(); TestDataCreationHelper.writeBytesToOutputStream(outputStream, options.getSize()); outputStream.close(); } catch (StorageException | IOException e) { throw new RuntimeException(e); } }
Source:
<code>public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass().equals(o.getClass())) { return false; } if (!super.equals(o)) { return false; } final ArrayOfDoublesSketchAggregatorFactory that = (ArrayOfDoublesSketchAggregatorFactory) o; if (!name.equals(that.name)) { return false; } if (!fieldName.equals(that.fieldName)) { return false; } if (nominalEntries != that.nominalEntries) { return false; } <START> if (!metricColumns.equals(that.metricColumns)) { <END> return false; } return numberOfValues != that.numberOfValues; }</code><technical_language>Null-aware Objects.equals()</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof ArrayOfDoublesSketchAggregatorFactory)) { return false; } final ArrayOfDoublesSketchAggregatorFactory that = (ArrayOfDoublesSketchAggregatorFactory) o; if (!name.equals(that.name)) { return false; } if (!fieldName.equals(that.fieldName)) { return false; } if (nominalEntries != that.nominalEntries) { return false; } if (!Objects.equals(metricColumns, that.metricColumns)) { return false; } return numberOfValues != that.numberOfValues; }
Source:
<code>public void setDefaultPoolWidth(final int defaultWidth) { final IPreferenceStore store = (IPreferenceStore) ProcessDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT.getPreferenceStore(); <START> store.setDefault("poolDefaultWidth", defaultWidth); <END> }</code><technical_language>a constant</technical_language>

Target:
public void setDefaultPoolWidth(final int defaultWidth) { final IPreferenceStore store = (IPreferenceStore) ProcessDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT.getPreferenceStore(); store.setDefault(POOL_DEFAULT_WIDTH, defaultWidth); }
Source:
<code>private void readEntriesAndValidateDataArray(LedgerHandle lh, List<byte[]> entries) throws InterruptedException, BKException { ls = lh.readEntries(0, entries.size() - 1); int index = 0; while (ls.hasMoreElements()) { byte[] originalData = entries.get(index++); byte[] receivedData = ls.nextElement().getEntry(); <START> LOG.debug("Length of originalData: " + originalData.length); <END> LOG.debug("Length of receivedData: " + receivedData.length); assertTrue( String.format("LedgerID: %d EntryID: %d OriginalDataLength: %d ReceivedDataLength: %d", lh.getId(), (index - 1), originalData.length, receivedData.length), originalData.length == receivedData.length); assertTrue(String.format("Checking LedgerID: %d EntryID: %d for equality", lh.getId(), (index - 1)), Arrays.equals(originalData, receivedData)); } }</code><technical_language>'{}'</technical_language>

Target:
private void readEntriesAndValidateDataArray(LedgerHandle lh, List<byte[]> entries) throws InterruptedException, BKException { ls = lh.readEntries(0, entries.size() - 1); int index = 0; while (ls.hasMoreElements()) { byte[] originalData = entries.get(index++); byte[] receivedData = ls.nextElement().getEntry(); LOG.debug("Length of originalData: {}", originalData.length); LOG.debug("Length of receivedData: {}", receivedData.length); assertEquals( String.format("LedgerID: %d EntryID: %d OriginalDataLength: %d ReceivedDataLength: %d", lh.getId(), (index - 1), originalData.length, receivedData.length), originalData.length, receivedData.length); Assert.assertArrayEquals( String.format("Checking LedgerID: %d EntryID: %d for equality", lh.getId(), (index - 1)), originalData, receivedData); } }
Source:
<code>public void setUp() throws Exception { super.setUp(); iProject = project.project; if (!gitDir.exists()) new FileRepository(gitDir).create(); <START> new ConnectProviderOperation(iProject, gitDir).execute(null); <END> testRepo = new TestRepository(gitDir); testRepo.connect(iProject); repo = RepositoryMapping.getMapping(iProject).getRepository(); }</code><technical_language>I get error next statement: java.lang.IllegalStateException: Repository exists new TestRepository(Repository repository) instead? created instance of FileRepository before</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); iProject = project.project; testRepo = new TestRepository(gitDir); testRepo.connect(iProject); repo = RepositoryMapping.getMapping(iProject).getRepository(); }
Source:
<code>private void recordValues() { currentFateOps.set(metricSnapshot.getCurrentFateOps()); zkChildFateOpsTotal.set(metricSnapshot.getZkFateChildOpsTotal()); zkConnectionErrorsTotal.set(metricSnapshot.getZkConnectionErrors()); Map<String,Long> states = metricSnapshot.getTxStateCounters(); states.forEach((key, value) -> { MutableGaugeLong v = fateTypeCounts.get(key); if (v != null) { v.set(value); } else { v = registry.newGauge(metricNameHelper(FATE_TX_STATE_METRIC_PREFIX, key), "By transaction state count for " + key, value); <START> fateTypeCounts.put(key, v); <END> } }); fateOpCounts.forEach((key, value) -> value.set(0)); Map<String,Long> opTypes = metricSnapshot.getOpTypeCounters(); log.trace("OP Counts Before: prev {}, updates {}", fateOpCounts, opTypes); opTypes.forEach((key, value) -> { MutableGaugeLong g = fateOpCounts.get(key); if (g != null) { g.set(value); } else { g = registry.newGauge(metricNameHelper(FATE_OP_TYPE_METRIC_PREFIX, key), "By transaction op type count for " + key, value); fateOpCounts.put(key, g); } }); log.trace("OP Counts After: prev {}, updates {}", fateOpCounts, opTypes); }</code><technical_language>I this simplified a computeIfAbsent()</technical_language>

Target:
private void recordValues() { currentFateOps.set(metricSnapshot.getCurrentFateOps()); zkChildFateOpsTotal.set(metricSnapshot.getZkFateChildOpsTotal()); zkConnectionErrorsTotal.set(metricSnapshot.getZkConnectionErrors()); Map<String,Long> states = metricSnapshot.getTxStateCounters(); states.forEach((key, value) -> { fateTypeCounts.computeIfAbsent(key, v -> registry.newGauge(metricNameHelper(FATE_TX_STATE_METRIC_PREFIX, key), "By transaction state count for " + key, value)) .set(value); }); fateOpCounts.forEach((key, value) -> value.set(0)); Map<String,Long> opTypes = metricSnapshot.getOpTypeCounters(); log.trace("OP Counts Before: prev {}, updates {}", fateOpCounts, opTypes); opTypes.forEach((key, value) -> { fateOpCounts.computeIfAbsent(key, guage -> registry.newGauge(metricNameHelper(FATE_OP_TYPE_METRIC_PREFIX, key), "By transaction op type count for " + key, value)) .set(value); }); log.trace("OP Counts After: prev {}, updates {}", fateOpCounts, opTypes); }
Source:
<code>private String generateDigest(boolean passwordAlreadyEncoded, String username, String realm, String password, String httpMethod, String uri, String qop, String nonce, String nc, String cnonce) throws IllegalArgumentException { String ha1; String a2 = httpMethod + ":" + uri; String ha2 = CredentialUtil.H(a2); if (passwordAlreadyEncoded) { ha1 = password; } else { ha1 = CredentialUtil.H(username + ":" + realm + ":" +password); } String digest; if (qop == null) { digest = CredentialUtil.KD(ha1, nonce + ":" + ha2); } <START> else if ("auth".equals(qop)) { <END> digest = CredentialUtil.KD(ha1, nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2); } else { throw new IllegalArgumentException("Invalid qop: '" + qop + "'"); } return digest; }</code><technical_language>move else clauses preceding }</technical_language>

Target:
private String generateDigest(boolean passwordAlreadyEncoded, String username, String realm, String password, String httpMethod, String uri, String qop, String nonce, String nc, String cnonce) throws IllegalArgumentException { String ha1; String a2 = httpMethod + ":" + uri; String ha2 = CredentialUtil.encryptMD5(a2); if (passwordAlreadyEncoded) { ha1 = password; } else { ha1 = CredentialUtil.encryptMD5(username + ":" + realm + ":" +password); } String digest; if (qop == null) { digest = CredentialUtil.encryptMD5(ha1, nonce + ":" + ha2); } else if ("auth".equals(qop)) { digest = CredentialUtil.encryptMD5(ha1, nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + ha2); } else { throw new IllegalArgumentException("Invalid qop: '" + qop + "'"); } return digest; }
Source:
<code>@Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { for (DiscoveryHook hook : hooks) hook.beforeDiscovery(spiCustomMsg); IgniteFuture<?> fut = delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); for (DiscoveryHook hook : hooks) <START> hook.afterDiscovery(spiCustomMsg); <END> return fut; }</code><technical_language>afterDiscovery called discovery notifing listeners. delegate.onDiscovery is async</technical_language>

Target:
@Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { hook.beforeDiscovery(spiCustomMsg); IgniteFuture<?> fut = delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); fut.listen(f -> hook.afterDiscovery(spiCustomMsg)); return fut; }
Source:
<code>public void testCloseCq() throws Exception { gfsh.executeAndAssertThat("create region --name=region --type=PARTITION") .statusIsSuccess(); qs.newCq("Select * from /region r where r.ID = 1", cqa).execute(); server1.invoke(() -> populateRegion(0, 100)); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); <START> await().untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(2)); <END> }); qs.closeCqs(); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(0)); }); }</code><technical_language>Please provide a timeout. I tested timeout(30, TimeUnit.SECONDS). This way, this test terminate in a "reasonable" time</technical_language>

Target:
public void testCloseCq() throws Exception { gfsh.executeAndAssertThat("create region --name=region --type=PARTITION") .statusIsSuccess(); queryService.newCq("Select * from /region r where r.ID = 1", cqAttributes).execute(); server1.invoke(() -> populateRegion(0, 100)); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().atMost(30, TimeUnit.SECONDS) .untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(2)); }); queryService.closeCqs(); locator.invoke(() -> { Cache cache = getCache(); ManagementService service = ManagementService.getManagementService(cache); DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean(); await().atMost(30, TimeUnit.SECONDS) .untilAsserted(() -> assertThat(dsmbean.getActiveCQCount()).isEqualTo(0)); }); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) <START> && ObjectUtils.objectsEqual(cpu_idle, other.cpu_idle) <END> && ObjectUtils.objectsEqual(cpu_load, other.cpu_load) && ObjectUtils.objectsEqual(cpu_sys, other.cpu_sys) && ObjectUtils.objectsEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free)); }</code><technical_language>problem is new BigDecimal("0").equals(new BigDecimal("0.0")) return false. persist DB read will, original 0 jdbc is 0.0, breaks junit test</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free)); }
Source:
<code><START> public void testExceedingSpecifiedOperationTimeout() { <END> final Long operationTimeoutInSeconds = 10l; WinRmTool winRmTool = WinRmTool.Builder.builder(VM_HOST + ":" + VM_PORT, VM_USER, VM_PASSWORD).build(); winRmTool.setOperationTimeout(operationTimeoutInSeconds * 1000l); try { winRmTool.executePs(String.format("Start-Sleep -s %d\r\nWrite-Host Test Completed", operationTimeoutInSeconds + 5)); fail("Command should fail to complete on time."); } catch (WebServiceException e) { assertTrue(e.getMessage().contains("The WS-Management service cannot complete the operation within the time specified in OperationTimeout")); } }</code><technical_language>failure for test (testSpecifiedRequestTimeout)? Weird fail</technical_language>

Target:
public void testExceedingSpecifiedOperationTimeout() throws Exception { final Long operationTimeoutInSeconds = 10l; WinRmTool winRmTool = WINRM_TOOL.call(); winRmTool.setOperationTimeout(operationTimeoutInSeconds * 1000l); try { winRmTool.executePs(String.format("Start-Sleep -s %d\r\nWrite-Host Test Completed", operationTimeoutInSeconds + 5)); fail("Command should fail to complete on time."); } catch (WebServiceException e) { assertTrue(e.getMessage().contains("The WS-Management service cannot complete the operation within the time specified in OperationTimeout")); } }
Source:
<code>public ConsumerDTO clone() { ConsumerDTO copy = super.clone(); OwnerDTO owner = this.getOwner(); copy.setOwner(owner != null ? owner.clone() : null); EnvironmentDTO environment = this.getEnvironment(); copy.setEnvironment(environment != null ? environment.clone() : null); HypervisorIdDTO hid = this.getHypervisorId(); copy.setHypervisorId(hid != null ? hid.clone() : null); ConsumerTypeDTO ctype = this.getType(); copy.setType(ctype != null ? ctype.clone() : null); CertificateDTO idCert = this.getIdCertificate(); copy.setIdCertificate(idCert != null ? idCert.clone() : null); copy.setFacts(this.getFacts()); copy.setInstalledProducts(this.getInstalledProducts()); copy.setCapabilities(this.getCapabilities()); copy.setContentTags(this.getContentTags()); copy.setServiceLevel(this.getServiceLevel()); copy.setRole(this.getRole()); copy.setUsage(this.getUsage()); copy.setAddOns(this.getAddOns()); <START> copy.setSystemPurposeStatus(this.getSystemPurposeStatus()); <END> return copy; }</code><technical_language>need explicitly assign Strings role, usage, servicelevel, systempurposestatus etc. in clone method, copy ConsumerDTO copy = super.clone(); is called, immutable, safely shared original cloned objects. setAddons() is required a collection</technical_language>

Target:
public ConsumerDTO clone() { ConsumerDTO copy = super.clone(); OwnerDTO owner = this.getOwner(); copy.setOwner(owner != null ? owner.clone() : null); EnvironmentDTO environment = this.getEnvironment(); copy.setEnvironment(environment != null ? environment.clone() : null); HypervisorIdDTO hid = this.getHypervisorId(); copy.setHypervisorId(hid != null ? hid.clone() : null); ConsumerTypeDTO ctype = this.getType(); copy.setType(ctype != null ? ctype.clone() : null); CertificateDTO idCert = this.getIdCertificate(); copy.setIdCertificate(idCert != null ? idCert.clone() : null); copy.setFacts(this.getFacts()); copy.setInstalledProducts(this.getInstalledProducts()); copy.setCapabilities(this.getCapabilities()); copy.setContentTags(this.getContentTags()); copy.setAddOns(this.getAddOns()); return copy; }
Source:
<code>Map<String, String> getErrorApiHeaders() { Map<String, String> map = new HashMap<String, String>(); <START> map.put(HEADER_API_PAYLOAD_VERSION, "4.0"); <END> map.put(HEADER_API_KEY, apiKey); map.put(HEADER_BUGSNAG_SENT_AT, DateUtils.toIso8601(new Date())); return map; }</code><technical_language>[this](<LINK_0> 4 is preferred</technical_language>

Target:
Map<String, String> getErrorApiHeaders() { Map<String, String> map = new HashMap<String, String>(); map.put(HEADER_API_PAYLOAD_VERSION, Report.PAYLOAD_VERSION); map.put(HEADER_API_KEY, apiKey); map.put(HEADER_BUGSNAG_SENT_AT, DateUtils.toIso8601(new Date())); return map; }
Source:
<code>public void populateDocumentForRouting() { CuDisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail(); if (payeeDetail.isVendor()) { payeeDetail.setDisbVchrPayeeEmployeeCode( getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); payeeDetail.setDvPayeeSubjectPaymentCode( getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); <START> } else if (payeeDetail.isEmployee()) { <END> ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext .getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM, payeeDetail.getDisbVchrPaymentReasonCode()); if (researchPaymentReasonCodeEvaluator.evaluationSucceeds() && getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) { String researchPayLimit = getParameterService() .getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM); if (StringUtils.isNotBlank(researchPayLimit)) { KualiDecimal payLimit = new KualiDecimal(researchPayLimit); if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) { payeeDetail.setDvPayeeSubjectPaymentCode(true); } } } } super.populateDocumentForRouting(); }</code><technical_language>older code allowing this block execute if payee is a student alumni. preserve customization here</technical_language>

Target:
public void populateDocumentForRouting() { CuDisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail(); if (payeeDetail.isVendor()) { payeeDetail.setDisbVchrPayeeEmployeeCode( getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); payeeDetail.setDvPayeeSubjectPaymentCode( getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger())); } else if (payeeDetail.isEmployee() || payeeDetail.isStudent() || payeeDetail.isAlumni()) { ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext .getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM, payeeDetail.getDisbVchrPaymentReasonCode()); if (researchPaymentReasonCodeEvaluator.evaluationSucceeds() && getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) { String researchPayLimit = getParameterService() .getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM); if (StringUtils.isNotBlank(researchPayLimit)) { KualiDecimal payLimit = new KualiDecimal(researchPayLimit); if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) { payeeDetail.setDvPayeeSubjectPaymentCode(true); } } } } super.populateDocumentForRouting(); }
Source:
<code>private Disposable testDistinct() { Flowable<Person> personFlowable = realm.asFlowable().map(new Function<Realm, Person>() { @Override public Person apply(Realm realm) throws Exception { return realm.where(Person.class).findAllSorted("name").get(0); } }); <START> new Function<Realm, Person>() { <END> @Override public Person apply(Realm realm) throws Exception { return realm.where(Person.class).findAllSorted("name").get(0); } }; Disposable distinctItemTest = personFlowable .distinct() .subscribe(new Consumer<Person>() { @Override public void accept(Person person) throws Exception { showStatus("distinct(): " + person.getName() + ":" + person.getAge()); } }); Disposable distinctKeySelectorItemTest = personFlowable .distinct(new Function<Person, Object>() { @Override public Object apply(Person person) throws Exception { return person.getAge(); } }) .subscribe(new Consumer<Person>() { @Override public void accept(Person person) throws Exception { showStatus("distinct(keySelector): " + person.getName() + ":" + person.getAge()); } }); return new CompositeDisposable(distinctItemTest, distinctKeySelectorItemTest); }</code><technical_language>this out of place</technical_language>

Target:
private void testDistinct() { Flowable<Person> personFlowable = realm.asFlowable().map(realm -> realm.where(Person.class).findAllSorted("name").get(0)); Disposable distinctDisposable = personFlowable .distinct() .subscribe(person -> showStatus("distinct(): " + person.getName() + ":" + person.getAge())); compositeDisposable.add(distinctDisposable); Disposable distinctKeySelectorDisposable = personFlowable .distinct(person -> person.getAge()) .subscribe(person -> showStatus("distinct(keySelector): " + person.getName() + ":" + person.getAge())); compositeDisposable.add(distinctKeySelectorDisposable); }
Source:
<code>private CheckedLocking sameFieldAlreadyOnStack(CheckedLocking nestedIf) { Iterator<CheckedLocking> stackIterator = ifConditionSymbolStack.descendingIterator(); <START> return Iterators.tryFind(stackIterator, parentIf -> parentIf.field == nestedIf.field) <END> .or(nestedIf); }</code><technical_language>ifConditionSymbolStack.stream().findFirst().orElse ? relying java 8 stream guava's</technical_language>

Target:
private CheckedLocking sameFieldAlreadyOnStack(CheckedLocking nestedIf) { return ifConditionSymbolStack.stream() .skip(1) .filter(parentIf -> parentIf.field == nestedIf.field) .findFirst() .orElse(nestedIf); }
Source:
<code><START> public View getView(final ViewType viewType) { <END> if (viewType == ViewType.JSON) { return this.jsonView; } return this.cliView; }</code><technical_language>getView return View<T></technical_language>

Target:
public View<T> getView(final ViewType viewType) { if (viewType == ViewType.JSON) { return (View<T>) new com.spectralogic.ds3cli.views.json.DefaultView(); } return (View<T>) new DefaultView(); }
Source:
<code>private List<String> detectSourceFolders(HasProjectConfig projectNode) { List<String> sourceFolders = new ArrayList<>(); String projectBuilder = getProjectBuilder(projectNode); Map<String, List<String>> attributes = projectNode.getProjectConfig().getAttributes(); <START> sourceFolders.addAll(attributes.containsKey("java.source.folder") ? attributes.get("java.source.folder") <END> : Collections.<String>emptyList()); sourceFolders.addAll(attributes.containsKey(projectBuilder + ".test.source.folder") ? attributes.get(projectBuilder + ".test.source.folder") : Collections.<String>emptyList()); return sourceFolders; }</code><technical_language>special constant contains this attribute's name org.eclipse.che.ide.ext.java.shared.Constants#SOURCE_FOLDER</technical_language>

Target:
private List<String> detectSourceFolders(HasProjectConfig projectNode) { List<String> sourceFolders = new ArrayList<>(); String projectBuilder = getProjectBuilder(projectNode); Map<String, List<String>> attributes = projectNode.getProjectConfig().getAttributes(); sourceFolders.addAll(attributes.containsKey(SOURCE_FOLDER) ? attributes.get(SOURCE_FOLDER) : Collections.<String>emptyList()); sourceFolders.addAll(attributes.containsKey(projectBuilder + ".test.source.folder") ? attributes.get(projectBuilder + ".test.source.folder") : Collections.<String>emptyList()); return sourceFolders; }
Source:
<code>private String typeAheadNameDescriptionTemplateNullSafe(String name, String description) { return applicationTemplates.typeAheadNameDescription( <START> name != null ? name : "", <END> description != null ? description : "") .asString(); }</code><technical_language>'constants.empty()' (btw, adding //$NON-NLS-1$ is mandatory hard-coded strings)</technical_language>

Target:
private String typeAheadNameDescriptionTemplateNullSafe(String name, String description) { return applicationTemplates.typeAheadNameDescription( name != null ? name : constants.empty(), description != null ? description : constants.empty()) .asString(); }
Source:
<code><START> public BeanDeploymentArchive getBeanDeploymentArchive(final Class<?> beanClass) { <END> ClassLoader moduleClassLoader = WildFlySecurityManager.getClassLoaderPrivileged(beanClass); if (moduleClassLoader != null) { for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) { if (bda.getBeanClasses().contains(beanClass.getName()) && moduleClassLoader.equals(bda.getClassLoader())) { return bda; } } } if (additionalBeanDeploymentArchivesByClassloader.containsKey(moduleClassLoader)) { return additionalBeanDeploymentArchivesByClassloader.get(moduleClassLoader); } return null; }</code><technical_language>line 240 (containsKey), check if key is null NullPointerException</technical_language>

Target:
public BeanDeploymentArchive getBeanDeploymentArchive(final Class<?> beanClass) { ClassLoader moduleClassLoader = WildFlySecurityManager.getClassLoaderPrivileged(beanClass); if (moduleClassLoader != null) { for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) { if (bda.getBeanClasses().contains(beanClass.getName()) && moduleClassLoader.equals(bda.getClassLoader())) { return bda; } } } if (moduleClassLoader != null && additionalBeanDeploymentArchivesByClassloader.containsKey(moduleClassLoader)) { return additionalBeanDeploymentArchivesByClassloader.get(moduleClassLoader); } return null; }
Source:
<code>public static final AbstractFullDateTimeColumn<Disk> getDateCreatedColumn(String sortBy) { AbstractFullDateTimeColumn<Disk> column = new AbstractFullDateTimeColumn<Disk>() { @Override protected Date getRawValue(Disk object) { return object.getDiskStorageType() == DiskStorageType.IMAGE || object.getDiskStorageType() == DiskStorageType.CINDER || object.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE ? ((DiskImage) object).getCreationDate() : null; } }; if (sortBy != null) { column.makeSortable(sortBy); } else { column.makeSortable(); <START> } <END> return column; }</code><technical_language>need this change? makeSortable(column, sortBy) thing</technical_language>

Target:
public static final AbstractFullDateTimeColumn<Disk> getDateCreatedColumn(String sortBy) { AbstractFullDateTimeColumn<Disk> column = new AbstractFullDateTimeColumn<Disk>() { @Override protected Date getRawValue(Disk object) { return object.getDiskStorageType() == DiskStorageType.IMAGE || object.getDiskStorageType() == DiskStorageType.CINDER || object.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE ? ((DiskImage) object).getCreationDate() : null; } }; return makeSortable(column, sortBy); }
Source:
<code><START> private static Integer getPlaceholders(@Nullable GoExpression argument) { <END> if (argument == null) { return 0; } Matcher m = placeholderPattern.matcher(argument.getText()); Matcher cm; Integer indexCount = 0; Integer maxIndexCount = 0; while (m.find()) { indexCount++; cm = indexedPlaceholderPattern.matcher(m.group()); while (cm.find()) { Integer index = Integer.parseInt(cm.group().replaceAll("\\[|\\]", "")); if (index > 0 && !index.equals(indexCount)) { indexCount = index; } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } return maxIndexCount; }</code><technical_language>set int return type</technical_language>

Target:
private static int getPlaceholders(@Nullable GoExpression argument) { if (argument == null) return -1; String placeholderText = resolve(argument); if (placeholderText == null) return -1; Matcher placeholders = PLACEHOLDER_PATTERN.matcher(placeholderText); Matcher countPlaceholders; int indexCount = 0; int maxIndexCount = 0; while (placeholders.find()) { indexCount++; countPlaceholders = INDEXED_PLACEHOLDER_PATTERN.matcher(placeholders.group()); while (countPlaceholders.find()) { int index = StringUtil.parseInt(countPlaceholders.group().replaceAll("\\[|\\]", ""), -1); if (index > 0 && index != indexCount) { indexCount = index; } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } if (maxIndexCount < indexCount) { maxIndexCount = indexCount; } } return maxIndexCount; }
Source:
<code>public void setTransform(Transform transform) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (transform != null && transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (data.cairo == 0 && transform == null) return; initCairo(); long cairo = data.cairo; double[] identity = identity(); if (transform != null) { Cairo.cairo_matrix_multiply(identity, transform.handle, identity); } if (hasTransform) { Cairo.cairo_restore(cairo); } <START> hasTransform = true; <END> Cairo.cairo_save(cairo); Cairo.cairo_transform(cairo, identity); data.state &= ~DRAW_OFFSET; }</code><technical_language>This set false. setTransfer(null)? special if/else handling for this</technical_language>

Target:
public void setTransform(Transform transform) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (transform != null && transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (data.cairo == 0 && transform == null) return; initCairo(); long cairo = data.cairo; double[] identity = identity(); identity[4] += ctm_dx; identity[5] += ctm_dy; if (transform != null) { Cairo.cairo_matrix_multiply(identity, transform.handle, identity); } Cairo.cairo_set_matrix(cairo, identity); data.state &= ~DRAW_OFFSET; }