auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void hasActiveMembership_shouldFindAnActiveMemberCorrectly() throws Exception{ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endDateEarlier = dateFormat.parse("2007-02-01 00:00:00"); <START> Date endDateLater = dateFormat.parse("2100-02-01 00:00:00"); <END> Cohort cohort = new Cohort(3); CohortMembership membershipOne = new CohortMembership(7); membershipOne.setVoided(false); membershipOne.setEndDate(endDateLater); cohort.addMembership(membershipOne); CohortMembership membershipTwo = new CohortMembership(8); membershipTwo.setVoided(true); cohort.addMembership(membershipTwo); CohortMembership cohortMembershipThree = new CohortMembership(9); cohortMembershipThree.setEndDate(endDateEarlier); cohort.addMembership(cohortMembershipThree); CohortMembership membershipFour = new CohortMembership(10); cohort.addMembership(membershipFour); assertTrue(cohort.hasActiveMembership(7)); assertFalse(cohort.hasActiveMembership(9)); assertFalse(cohort.hasActiveMembership(8)); assertTrue(cohort.hasActiveMembership(10)); }</code><technical_language>this test pass year 2100</technical_language>

Target:
public void hasActiveMembership_shouldFindAnActiveMemberCorrectly() throws Exception{ Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date endDateLater = calendar.getTime(); calendar.add(Calendar.DAY_OF_YEAR, -2); Date endDateEarlier = calendar.getTime(); Cohort cohort = new Cohort(3); CohortMembership membershipOne = new CohortMembership(7); membershipOne.setVoided(false); membershipOne.setEndDate(endDateLater); cohort.addMembership(membershipOne); CohortMembership membershipTwo = new CohortMembership(8); membershipTwo.setVoided(true); cohort.addMembership(membershipTwo); CohortMembership cohortMembershipThree = new CohortMembership(9); cohortMembershipThree.setEndDate(endDateEarlier); cohort.addMembership(cohortMembershipThree); CohortMembership membershipFour = new CohortMembership(10); cohort.addMembership(membershipFour); assertTrue(cohort.hasActiveMembership(7)); assertFalse(cohort.hasActiveMembership(9)); assertFalse(cohort.hasActiveMembership(8)); assertTrue(cohort.hasActiveMembership(10)); }
Source:
<code>public synchronized boolean commitSession(long id, int sessionTimeout) { LOG.info("Committing global session 0X" + Long.toHexString(id)); <START> sessionsWithTimeout.put(id, sessionTimeout); <END> return true; }</code><technical_language>sessionsWithTimeout is a Map ZKdb, adding sessions is equivalent persisting them. I remove addGlobalSession() method completely, do special forwarding call addSession()</technical_language>

Target:
public synchronized boolean commitSession(long id, int sessionTimeout) { return sessionsWithTimeout.put(id, sessionTimeout) == null; }
Source:
<code>protected String getPackageLocation() { return "com/puppycrawl/tools/" <START> + "checkstyle/xpath"; <END> }</code><technical_language>this fit 1 line</technical_language>

Target:
protected String getPackageLocation() { return "com/puppycrawl/tools/checkstyle/xpath/xpathquerygenerator"; }
Source:
<code>public boolean deleteIdentifier() { <START> if (selectedIdentifier != null) { <END> return loadTestDataService.deleteIdentifier(selectedIdentifier); } else { addPatientErrorMessages("Identifer have to be select to be deleted"); } return false; }</code><technical_language>Refactor save code GenericDAO remove redundant logic</technical_language>

Target:
public boolean deleteIdentifier() { boolean result = false; if (selectedIdentifier != null) { result = loadTestDataService.deleteIdentifier(selectedIdentifier); } else { addPatientErrorMessages(msgForSelectDelete("identifer")); } return result; }
Source:
<code>private static StoragePool cloneStorage_pool(StoragePool instance) { StoragePool obj = new StoragePool(); obj.setdescription(instance.getdescription()); obj.setComment(instance.getComment()); obj.setId(instance.getId()); <START> obj.setName(instance.getName()); <END> obj.setStatus(instance.getStatus()); obj.setmaster_domain_version(instance.getmaster_domain_version()); obj.setLVER(instance.getLVER()); obj.setrecovery_mode(instance.getrecovery_mode()); obj.setspm_vds_id(instance.getspm_vds_id()); obj.setcompatibility_version(instance.getcompatibility_version()); return obj; }</code><technical_language>clone isLocal property</technical_language>

Target:
private static StoragePool cloneStorage_pool(StoragePool instance) { StoragePool obj = new StoragePool(); obj.setdescription(instance.getdescription()); obj.setComment(instance.getComment()); obj.setId(instance.getId()); obj.setName(instance.getName()); obj.setIsLocal(instance.isLocal()); obj.setStatus(instance.getStatus()); obj.setmaster_domain_version(instance.getmaster_domain_version()); obj.setLVER(instance.getLVER()); obj.setrecovery_mode(instance.getrecovery_mode()); obj.setspm_vds_id(instance.getspm_vds_id()); obj.setcompatibility_version(instance.getcompatibility_version()); return obj; }
Source:
<code>protected void onPostExecute(Boolean success) { <START> AlertDialog.Builder builder = new AlertDialog.Builder(context); <END> if (success) { String replayURL = "<LINK_0>" + roomId; builder.setMessage(String.format(context.getResources().getString(R.string.replay_exported), replayURL)); } else { builder.setMessage(R.string.replay_exporting_failure); } builder.setPositiveButton(R.string.dialog_ok, null); final AlertDialog alert = builder.create(); waitingDialog.dismiss(); alert.show(); }</code><technical_language>surprised this run UI Thread</technical_language>

Target:
protected void onPostExecute(Boolean success) { AlertDialog.Builder builder = new AlertDialog.Builder(context); if (success) { String replayURL = "<LINK_0>" + roomId; builder.setMessage(String.format(context.getResources().getString(R.string.replay_exported), replayURL)); } else { builder.setMessage(R.string.replay_exporting_failure); } builder.setPositiveButton(R.string.dialog_ok, null); final AlertDialog alert = builder.create(); mWaitingDialog.dismiss(); alert.show(); }
Source:
<code>public boolean isCashAdvanceLine(ConcurStandardAccountingExtractDetailLine line) { <START> return StringUtils.isNotEmpty(line.getCashAdvanceCaKey()); <END> }</code><technical_language>isNotBlank here</technical_language>

Target:
public boolean isCashAdvanceLine(ConcurStandardAccountingExtractDetailLine line) { return StringUtils.isNotBlank(line.getCashAdvanceKey()); }
Source:
<code>public void consume() { MentionsData data = null; try { <START> data = DefaultMentionsEventExecutor.this.queue.poll(10, SECONDS); <END> if (data != null) { DefaultMentionsEventExecutor.this.logger .debug("[{}] - consumed. Queue size [{}]", data.getDocumentReference(), data.getVersion(), DefaultMentionsEventExecutor.this.queue.size()); DefaultMentionsEventExecutor.this.dataConsumer.consume(data); } } catch (Exception e) { DefaultMentionsEventExecutor.this.logger .warn("Error during mention analysis of task [{}]. Cause [{}].", data, getRootCauseMessage(e)); if (data != null) { try { DefaultMentionsEventExecutor.this.queue.put(data); } catch (InterruptedException interruptedException) { DefaultMentionsEventExecutor.this.logger .error("Error when adding back a fail failed task [{}]. Cause [{}].", data, getRootCauseMessage(e)); } } } }</code><technical_language>Doc 10 seconds</technical_language>

Target:
public void consume() { MentionsData data = null; try { data = DefaultMentionsEventExecutor.this.queue.poll(); if (data != null) { if (data.isStop()) { this.halt = true; } else if (!data.isDeprecated()) { DefaultMentionsEventExecutor.this.logger .debug("[{}] - consumed. Queue size [{}]", data.getDocumentReference(), data.getVersion(), DefaultMentionsEventExecutor.this.queue.size()); DefaultMentionsEventExecutor.this.dataConsumer.consume(data); } } } catch (Exception e) { DefaultMentionsEventExecutor.this.logger .warn("Error during mention analysis of task [{}]. Cause [{}].", data, getRootCauseMessage(e)); if (data != null) { try { DefaultMentionsEventExecutor.this.queue.put(data); } catch (InterruptedException interruptedException) { DefaultMentionsEventExecutor.this.logger .error("Error when adding back a fail failed task [{}]. Cause [{}].", data, getRootCauseMessage(e)); } } } }
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); config.validateConfig(); pipelineConfigurer.getStageConfigurer().setOutputSchema(DEFAULT_XML_SCHEMA); <START> if (StringUtils.isNotEmpty(config.tableName)) { <END> pipelineConfigurer.createDataset(config.tableName, KeyValueTable.class.getName()); } }</code><technical_language>this check redundant? done in validateConfig()</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); config.validateConfig(); pipelineConfigurer.getStageConfigurer().setOutputSchema(DEFAULT_XML_SCHEMA); pipelineConfigurer.createDataset(config.tableName, KeyValueTable.class.getName()); }
Source:
<code>private StorageDir(StorageTier tier, int dirIndex, long capacityBytes, long reservedBytes, String dirPath, String dirMedium) { mTier = Preconditions.checkNotNull(tier, "tier"); mDirIndex = dirIndex; mCapacityBytes = capacityBytes; if (capacityBytes < reservedBytes) { reservedBytes = capacityBytes / 20; } mReservedBytes = new AtomicLong(reservedBytes); mUsedReservedBytes = new AtomicLong(0); mAvailableBytes = new AtomicLong(capacityBytes - reservedBytes); <START> mCommittedBytes = new AtomicLong(0); <END> mDirPath = dirPath; mDirMedium = dirMedium; mBlockIdToBlockMap = new HashMap<>(200); mBlockIdToTempBlockMap = new HashMap<>(200); mSessionIdToTempBlockIdsMap = new HashMap<>(200); }</code><technical_language>Do need is small either</technical_language>

Target:
private StorageDir(StorageTier tier, int dirIndex, long capacityBytes, long reservedBytes, String dirPath, String dirMedium) { mTier = Preconditions.checkNotNull(tier, "tier"); mDirIndex = dirIndex; mCapacityBytes = capacityBytes; if (capacityBytes < reservedBytes) { reservedBytes = capacityBytes / 20; } mReservedBytes = new AtomicLong(reservedBytes); mAvailableBytes = new AtomicLong(capacityBytes - reservedBytes); mCommittedBytes = new AtomicLong(0); mDirPath = dirPath; mDirMedium = dirMedium; mBlockIdToBlockMap = new HashMap<>(200); mBlockIdToTempBlockMap = new HashMap<>(200); mSessionIdToTempBlockIdsMap = new HashMap<>(200); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ColumnMetadata other = (ColumnMetadata) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type) && Objects.equals(this.comment, other.comment) && Objects.equals(this.extraInfo, other.extraInfo) && Objects.equals(this.hidden, other.hidden) && <START> this.nullable == other.nullable; <END> }</code><technical_language>Objects.equals() consistent hidden (or change hidden ==)</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ColumnMetadata other = (ColumnMetadata) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type) && Objects.equals(this.nullable, other.nullable) && Objects.equals(this.comment, other.comment) && Objects.equals(this.extraInfo, other.extraInfo) && Objects.equals(this.hidden, other.hidden); }
Source:
<code>private synchronized void changeServer(ClientChannel oldCh) { if (oldCh == ch && ch != null) { if (!backups.isEmpty()) { backups.addLast(primary); primary = backups.removeFirst(); } try { <START> ch.close(); <END> } catch (Exception ignored) { } ch = null; } }</code><technical_language>U.closeQuiet</technical_language>

Target:
private synchronized void changeServer(ClientChannel oldCh) { if (oldCh == ch && ch != null) { rollAddress(); U.closeQuiet(ch); ch = null; } }
Source:
<code>public String encrypt(String plaintext, String passphrase, Version cryptoVersion) { <START> Preconditions.checkArgument(Version.V1_1.equals(cryptoVersion)); <END> Preconditions.checkNotNull(plaintext); Preconditions.checkNotNull(passphrase); String cipheredText = newEncryptor(passphrase).encrypt(plaintext); ObjectNode node = MAPPER.createObjectNode(); node.put(CIPHERED_TEXT_KEY, cipheredText); node.put(ICrypto.VERSION_IDENTIFIER, Version.V1_1.versionStr()); return ICrypto.encode(node.toString()); }</code><technical_language>This method identical CryptoV1.encrypt version.v1 version.v1_1 parameter</technical_language>

Target:
public String encrypt(String plaintext, String passphrase, Version cryptoVersion) { Preconditions.checkArgument(Version.V1_1.equals(cryptoVersion)); String cipheredText = newEncryptor(passphrase).encrypt(plaintext); ObjectNode node = MAPPER.createObjectNode(); node.put(CIPHERED_TEXT_KEY, cipheredText); node.put(ICrypto.VERSION_IDENTIFIER, Version.V1_1.versionStr()); return Crypto.encode(node.toString()); }
Source:
<code><START> public boolean isMissingData() { <END> return getCacheTopology() != null && getCacheTopology().isDegradedMode(); }</code><technical_language>I prefer "isDegradedMode" for consistency, in non-public API</technical_language>

Target:
public boolean isMissingData() { return getCacheTopology() != null && getCacheTopology().isMissingData(); }
Source:
<code>public String process(String query) { LOG.info("Processing query: {}", query); try { URI uri = new URI(query); <START> String path = getPath(query, LOG); <END> if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.POSITION.toString())) { return processDatastreamPositionRequest(uri); } else if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.DATASTREAM_STATE.toString())) { throw new UnsupportedOperationException("FileConnector does not support querying for datastream state"); } else { LOG.error("Could not process query with path {}", query, path); } } catch (Exception e) { LOG.error("Failed to process query {}", query, e); } return null; }</code><technical_language>right a connector is diagnostics aware, is a lot of boiler plate connector needs do parse out commands parameters. consider creating a library utils helps diagnostic aware connectors reduce this boiler plate. need do this right now. consider for future enhancements</technical_language>

Target:
public String process(String query) { LOG.info("Processing query: {}", query); try { URI uri = new URI(query); String path = getPath(query, LOG); if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.POSITION.toString())) { return processDatastreamPositionRequest(uri); } else if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.DATASTREAM_STATE.toString())) { throw new UnsupportedOperationException("FileConnector does not support querying for datastream state"); } else { LOG.error("Could not process query with path {}", query, path); } } catch (Exception e) { throw new DatastreamRuntimeException(String.format("Failed to process query %s", query), e); } return null; }
Source:
<code>public CompletableFuture<CoordinationResponse> deliverCoordinationRequestToCoordinator( OperatorID operator, CoordinationRequest request) throws FlinkException { OperatorCoordinator coordinator = coordinatorMap.get(operator); if (coordinator instanceof CoordinationResponser) { return CompletableFuture.completedFuture( ((CoordinationResponser) coordinator).handleCoordinationRequest(request)); } else if (coordinator != null) { return FutureUtils.completedExceptionally( <START> new IllegalArgumentException("Coordinator of operator " + operator + " cannot handle client event")); <END> } else { throw new FlinkException("Coordinator of operator " + operator + " does not exist"); } }</code><technical_language>I throw FlinkException, this situation is operation exist</technical_language>

Target:
public CompletableFuture<CoordinationResponse> deliverCoordinationRequestToCoordinator( OperatorID operator, CoordinationRequest request) throws FlinkException { OperatorCoordinator coordinator = coordinatorMap.get(operator); if (coordinator instanceof CoordinationRequestHandler) { return ((CoordinationRequestHandler) coordinator).handleCoordinationRequest(request); } else if (coordinator != null) { throw new FlinkException("Coordinator of operator " + operator + " cannot handle client event"); } else { throw new FlinkException("Coordinator of operator " + operator + " does not exist"); } }
Source:
<code>public void testVerifyMissingToken() { Header header = new Header("X-Auth-Token", ""); given(). header(header). when(). post("/token/verify"). then(). <START> statusCode(HttpStatus.SC_FORBIDDEN); <END> }</code><technical_language>I a expect a bad request here</technical_language>

Target:
public void testVerifyMissingToken() { Header header = new Header(AUTH_HEADER, ""); given(). header(header). when(). post("/token/verify"). then(). statusCode(HttpStatus.SC_FORBIDDEN); }
Source:
<code>public boolean isProviderFor(CSSDiagram diagram) { if(diagram.getElement() instanceof Element){ <START> Element element = (Element)diagram.getElement(); if (SysMLResource.isSysMLProfileApplied(element)){ return true; } <END> } return false; }</code><technical_language>return result if</technical_language>

Target:
public boolean isProviderFor(CSSDiagram diagram) { if(diagram.getElement() instanceof Element){ Element element = (Element)diagram.getElement(); return SysMLResource.isSysMLProfileApplied(element); } return false; }
Source:
<code>public void onSizeLimitReached(final Checkpoint cp) throws IOException { LOG.info("Reached size {}", cp); scheduler.execute(new Runnable() { @Override public void run() { try { LOG.info("Started flushing mem table."); <START> long prevAllocLogIdBeforeFlush = entryLogger.getPreviousAllocatedEntryLogId(); <END> memTable.flush(SortedLedgerStorage.this); long afterAllocLogIdBeforeFlush = entryLogger.getPreviousAllocatedEntryLogId(); if (entryLogger.rollLogsIfEntryLogLimitReached()) { checkpointer.startCheckpoint(cp); } else if ((prevAllocLogIdBeforeFlush != afterAllocLogIdBeforeFlush) && !isTransactionalCompactionEnabled) { entryLogger.rollLogs(); checkpointer.startCheckpoint(cp); } } catch (IOException e) { stateManager.transitionToReadOnlyMode(); LOG.error("Exception thrown while flushing skip list cache.", e); } } }); }</code><technical_language>@reddycharan > behavior preallocation enabled disabled? Is of async nature of preallocation? yeah preallocation is in background, preallocation advance entry log id. if does, logic is correct. > I add "getCurrentLogId" EntryLogManager Interface. For EntryLogManagerForSingleEntryLog implementation give logId of current activelog (which is current behavior). work for now. I if is possibility produce a cleaner interface exposing log ids. a bit more back</technical_language>

Target:
public void onSizeLimitReached(final Checkpoint cp) throws IOException { LOG.info("Reached size {}", cp); scheduler.execute(new Runnable() { @Override public void run() { try { LOG.info("Started flushing mem table."); entryLogger.prepareEntryMemTableFlush(); memTable.flush(SortedLedgerStorage.this); if (entryLogger.commitEntryMemTableFlush()) { checkpointer.startCheckpoint(cp); } } catch (Exception e) { stateManager.transitionToReadOnlyMode(); LOG.error("Exception thrown while flushing skip list cache.", e); } } }); }
Source:
<code>public ResourceData[] getResource(String destinationPath) throws ResourceAdminServiceExceptionException, RemoteException { ResourceData[] rs; rs = resourceAdminServiceStub.getResourceData(new String[]{destinationPath}); <START> return rs; <END> }</code><technical_language>return rs object</technical_language>

Target:
public ResourceData[] getResource(String destinationPath) throws ResourceAdminServiceExceptionException, RemoteException { return resourceAdminServiceStub.getResourceData(new String[]{destinationPath}); }
Source:
<code>public <T extends Service> T get(Class<T> serviceType) { <START> if (services == null) { <END> return null; } return (T) services.get(serviceType); }</code><technical_language>this happen</technical_language>

Target:
public <T extends Service> T get(Class<T> serviceType) { return (T) services.get(serviceType); }
Source:
<code>private void parseFrame(IByteProvider byteProvider) { try { byte currentByte = byteProvider.getByte(); if (currentByte == Frame.START_BYTE) { int length = byteProvider.getByte(); if (length > 0) { byte[] data = byteProvider.getBytes(length + 1); ReceiveFrame frame = new ReceiveFrame(); frame.parse(data); receiveFrames.add(frame); } } } catch (Exception e) { <START> logger.error("Error while parsing ReceiveFrame", e); <END> } }</code><technical_language>Please change this WARN instead of ERROR</technical_language>

Target:
private void parseFrame(IByteProvider byteProvider) { try { byte currentByte = byteProvider.getByte(); if (currentByte == Frame.START_BYTE) { int length = byteProvider.getByte(); if (length > 0) { byte[] data = byteProvider.getBytes(length + 1); ReceiveFrame frame = new ReceiveFrame(); frame.parse(data); receiveFrames.add(frame); } } } catch (Exception e) { logger.warn("Error while parsing ReceiveFrame", e); } }
Source:
<code>private void addReportedIpv4Configuration(ReportedConfigurations result) { if (!isIpv4PrimaryAddressExist()) { return; } Ipv4BootProtocol definedIpv4BootProtocol = getIpv4PrimaryAddress().getBootProtocol(); result.add(ReportedConfigurationType.IPV4_BOOT_PROTOCOL, iface.getIpv4BootProtocol(), definedIpv4BootProtocol); if (definedIpv4BootProtocol == Ipv4BootProtocol.STATIC_IP && iface.getIpv4BootProtocol() == definedIpv4BootProtocol) { result.add(ReportedConfigurationType.IPV4_NETMASK, iface.getIpv4Subnet(), getIpv4PrimaryAddress().getNetmask(), isIpv4NetworkSubnetInSync()); result.add(ReportedConfigurationType.IPV4_ADDRESS, iface.getIpv4Address(), getIpv4PrimaryAddress().getAddress()); result.add(ReportedConfigurationType.IPV4_GATEWAY, iface.getIpv4Gateway(), getIpv4PrimaryAddress().getGateway(), <START> !isDefaultRouteNetwork || <END> isIpv4GatewayInSync()); } }</code><technical_language>why? defaultRoute networks gateway. Please refer -<LINK_0></technical_language>

Target:
private void addReportedIpv4Configuration(ReportedConfigurations result) { if (!isIpv4PrimaryAddressExist()) { return; } Ipv4BootProtocol definedIpv4BootProtocol = getIpv4PrimaryAddress().getBootProtocol(); result.add(ReportedConfigurationType.IPV4_BOOT_PROTOCOL, iface.getIpv4BootProtocol(), definedIpv4BootProtocol); if (definedIpv4BootProtocol == Ipv4BootProtocol.STATIC_IP && iface.getIpv4BootProtocol() == definedIpv4BootProtocol) { result.add(ReportedConfigurationType.IPV4_NETMASK, iface.getIpv4Subnet(), getIpv4PrimaryAddress().getNetmask(), isIpv4NetworkSubnetInSync()); result.add(ReportedConfigurationType.IPV4_ADDRESS, iface.getIpv4Address(), getIpv4PrimaryAddress().getAddress()); result.add(ReportedConfigurationType.IPV4_GATEWAY, iface.getIpv4Gateway(), getIpv4PrimaryAddress().getGateway(), isIpv4GatewayInSync()); } }
Source:
<code><START> protected View getView() { <END> if (getHost().getModel() instanceof View) { if (((View) getHost().getModel()) instanceof View) { return (View) ((View) getHost().getModel()); } return null; } return null; }</code><technical_language>Multi return is forbidden</technical_language>

Target:
protected View getView() { View view = null; if (getHost().getModel() instanceof View) { if (((View) getHost().getModel()) instanceof View) { view = (View) ((View) getHost().getModel()); } } return view; }
Source:
<code>public Bundle[] getBundles(String symbolicName, String versionRange) { <START> PlatformAdmin platformAdmin = getPlatformAdmin(); <END> if (platformAdmin == null) return null; State state = platformAdmin.getState(false); BundleDescription[] bundleDescriptions = state.getBundles(symbolicName); if (bundleDescriptions.length == 1) { if ((bundleDescriptions[0].getBundle().getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { return new Bundle[] { bundleDescriptions[0].getBundle() }; } } Bundle[] results = Arrays.stream(bundleDescriptions).map(bd -> bd.getBundle()) .filter(bundle -> (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) .toArray(Bundle[]::new); return results; }</code><technical_language>equinox state/resolver api. need a this is implemented in org.eclipse.osgi.internal.framework.legacy.PackageAdminImpl.getBundles(String, String) guide</technical_language>

Target:
public Bundle[] getBundles(String symbolicName, String versionRange) { ModuleContainer container = getModuleContainer(); if (container == null) return null; FrameworkWiring wiring = container.getFrameworkWiring(); Map<String, String> directives = Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, getRequirementFilter(symbolicName, null)); Collection<BundleCapability> matchingBundleCapabilities = wiring.findProviders(ModuleContainer .createRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.emptyMap())); if (matchingBundleCapabilities.isEmpty()) { return null; } Bundle[] results = matchingBundleCapabilities.stream().map(c -> c.getRevision().getBundle()) .filter(bundle -> (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) .toArray(Bundle[]::new); return results; }
Source:
<code>public int getEntryCount() { <START> return valueBlockBuilder.getPositionCount(); <END> }</code><technical_language>nit: valueBlockBuilder instead of keyBlockBuilder here? consistent code easier understand maintain</technical_language>

Target:
public int getEntryCount() { return keyBlockBuilder.getPositionCount(); }
Source:
<code>public void actionPerformed(ActionEvent e) { if (selectedVariable != null) { changeValuePresenter.showDialog(); } <START> if (selectedExpression != null) { <END> editWatchExpressionPresenter.showDialog(); } }</code><technical_language>else if</technical_language>

Target:
public void actionPerformed(ActionEvent e) { if (debuggerPresenter.getSelectedWatchExpression() != null) { editWatchExpressionPresenter.showDialog(); } else if (debuggerPresenter.getSelectedVariable() != null) { changeValuePresenter.showDialog(); } }
Source:
<code>public static boolean isPageview(String uriHost, String uriPath, String uriQuery, String httpStatus, String contentType, String userAgent) { return ( httpStatus.equals("200") && ( (contentTypesSet.contains(contentType) && !stringContains(uriPath, apiHit)) <START> || (contentType.equals(appContentType) && isAppPageRequest(uriPath, uriQuery, userAgent)) <END> ) && ( uriHostWikimediaDomainPattern.matcher(uriHost).find() || uriHostProjectDomainPattern.matcher(uriHost).find() ) && !uriPathUnwantedSpecialPagesPattern.matcher(uriPath).find() && !uriQueryUnwantedSpecialPagesPattern.matcher(uriQuery).find() && uriPathPattern.matcher(uriPath).find() ); }</code><technical_language>is userAgent a parameter isAppPageRequest, contentType is checked outside</technical_language>

Target:
public static boolean isPageview( String uriHost, String uriPath, String uriQuery, String httpStatus, String contentType, String userAgent ) { return ( httpStatus.equals("200") && ( (contentTypesSet.contains(contentType) && !stringContains(uriPath, apiHit)) || (contentType.equals(appContentType) && isAppPageRequest(uriPath, uriQuery, userAgent)) ) && ( patternIsFound(uriHostWikimediaDomainPattern, uriHost) || patternIsFound(uriHostProjectDomainPattern, uriHost) ) && patternIsFound(uriPathPattern, uriPath) && !patternIsFound(uriPathUnwantedSpecialPagesPattern, uriPath) && !patternIsFound(uriQueryUnwantedSpecialPagesPattern, uriQuery) ); }
Source:
<code>private static boolean isLanguageBlacklisted(@NonNull String lang) { try { List<String> blacklist = GsonUtil.getDefaultGson().fromJson(WikipediaApp.getInstance() .getRemoteConfig().getConfig() <START> .optString("descriptionEditLangBlacklist", <END> "['en','de','it','fr','es','ja','nl','pt','tr','zh-hant']"), new TypeToken<List<String>>() {}.getType()); return blacklist.contains(lang); } catch (JsonSyntaxException e) { L.logRemoteErrorIfProd(e); } return true; }</code><technical_language>This kind of depends config patch optJSONArray() instead</technical_language>

Target:
private static boolean isLanguageBlacklisted(@NonNull String lang) { JSONArray blacklist = WikipediaApp.getInstance().getRemoteConfig().getConfig() .optJSONArray("descriptionEditLangBlacklist"); if (blacklist != null) { for (int i = 0; i < blacklist.length(); i++) { if (lang.equals(blacklist.optString(i))) { return true; } } return false; } else { return Arrays.asList("en", "de", "it", "fr", "es", "ja", "nl", "pt", "tr", "zh-hant") .contains(lang); } }
Source:
<code>public void createEnvironment(@Observes(precedence = 10) BeforeClass event, OpenShiftAdapter client, <START> CECubeConfiguration configuration, OpenShiftClient openshiftClient) throws Exception { <END> final TestClass testClass = event.getTestClass(); log.info(String.format("Creating environment for %s", testClass.getName())); OpenShiftResourceFactory.createResources(testClass.getName(), client, null, testClass.getJavaClass(), configuration.getProperties()); processTemplateResources(testClass, client, configuration); registerRoutes(configuration, openshiftClient); }</code><technical_language>throwing a generic Exception is a good practice in Java. Is a strong reason for that</technical_language>

Target:
public void createEnvironment(@Observes(precedence = 10) BeforeClass event, OpenShiftAdapter client, CECubeConfiguration configuration, OpenShiftClient openshiftClient) throws DeploymentException { final TestClass testClass = event.getTestClass(); log.info(String.format("Creating environment for %s", testClass.getName())); OpenShiftResourceFactory.createResources(testClass.getName(), client, null, testClass.getJavaClass(), configuration.getProperties()); processTemplateResources(testClass, client, configuration); registerRoutes(configuration, openshiftClient); }
Source:
<code>void stopEvent(final String requestId, final IEvents events, final String eventName) { if (mDispatcher == null) { return; } final String startTime = mEventTracking.get(new Pair<>(requestId, eventName)); if (StringExtensions.isNullOrBlank(startTime)) { <START> Logger.v(TAG, "Stop Event called without a corresponding start_event"); <END> return; } long startTimeLong = Long.parseLong(startTime); long stopTimeLong = System.currentTimeMillis(); long diffTime = stopTimeLong - startTimeLong; final String stopTime = Long.toString(stopTimeLong); events.setProperty(EventStrings.START_TIME, startTime); events.setProperty(EventStrings.STOP_TIME, stopTime); events.setProperty(EventStrings.RESPONSE_TIME, Long.toString(diffTime)); mDispatcher.receive(requestId, events); }</code><technical_language>do a warning log</technical_language>

Target:
void stopEvent(final String requestId, final IEvents events, final String eventName) { if (mDispatcher == null) { return; } final String startTime = mEventTracking.get(new Pair<>(requestId, eventName)); if (StringExtensions.isNullOrBlank(startTime)) { Logger.w(TAG, "Stop Event called without a corresponding start_event", "", null); return; } long startTimeLong = Long.parseLong(startTime); long stopTimeLong = System.currentTimeMillis(); long diffTime = stopTimeLong - startTimeLong; final String stopTime = Long.toString(stopTimeLong); events.setProperty(EventStrings.START_TIME, startTime); events.setProperty(EventStrings.STOP_TIME, stopTime); events.setProperty(EventStrings.RESPONSE_TIME, Long.toString(diffTime)); mDispatcher.receive(requestId, events); }
Source:
<code>public void testContainerIdAsAlias() throws Exception { Long oldPid = processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_EVALUATION); assertNotNull(oldPid); assertTrue(oldPid > 0); ProcessInstance processInstance = processClient.getProcessInstance(CONTAINER_ALIAS, oldPid); assertNotNull(processInstance); assertEquals(CONTAINER_ID, processInstance.getContainerId()); KieContainerResource containerResource = new KieContainerResource(CONTAINER_ID_101, releaseId101); containerResource.setContainerAlias(CONTAINER_ID); client.createContainer(CONTAINER_ID_101, containerResource); try { <START> processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION_2); <END> fail("It shouldn't be possible to start this process"); } catch (KieServicesException ex) { assertTrue(ex.getMessage().contains("No process available with given id")); } oldPid = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION); assertNotNull(oldPid); assertTrue(oldPid > 0); processInstance = processClient.getProcessInstance(CONTAINER_ALIAS, oldPid); assertNotNull(processInstance); assertEquals(CONTAINER_ID, processInstance.getContainerId()); }</code><technical_language>Please RestJmsSharedBaseIntegrationTest.assertClientException for negative tests check response HTTP status error messages</technical_language>

Target:
public void testContainerIdAsAlias() throws Exception { Long oldPid = processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_EVALUATION); assertThat(oldPid).isNotNull().isGreaterThan(0); ProcessInstance processInstance = processClient.getProcessInstance(CONTAINER_ALIAS, oldPid); assertThat(processInstance).isNotNull(); assertThat(processInstance.getContainerId()).isEqualTo(CONTAINER_ID); KieContainerResource containerResource = new KieContainerResource(CONTAINER_ID_101, releaseId101); containerResource.setContainerAlias(CONTAINER_ID); client.createContainer(CONTAINER_ID_101, containerResource); assertClientException(() -> processClient.startProcess(CONTAINER_ALIAS, PROCESS_ID_EVALUATION_2), 404, MessageFormat.format(PROCESS_DEFINITION_NOT_FOUND, PROCESS_ID_EVALUATION_2, CONTAINER_ALIAS), MessageFormat.format(NO_PROCESS_AVAILABLE_WITH_ID, PROCESS_ID_EVALUATION_2)); oldPid = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION); assertThat(oldPid).isNotNull().isGreaterThan(0); processInstance = processClient.getProcessInstance(CONTAINER_ALIAS, oldPid); assertThat(processInstance).isNotNull(); assertThat(processInstance.getContainerId()).isEqualTo(CONTAINER_ID); }
Source:
<code>public void update(ViewerCell cell) { KeyValueFilter filter = filterObservable.getValue(); IResource resource = (IResource) cell.getElement(); Map<String, String> filteredLabels = ResourceUtils.getMatchingLabels(filter, resource); createCellLabel(filter, filteredLabels, cell); cell.getControl().redraw(); <START> } <END></code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') This class 6 parents is greater 5 authorized. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public void update(ViewerCell cell) { KeyValueFilter filter = filterObservable.getValue(); IResource resource = (IResource) cell.getElement(); Map<String, String> filteredLabels = ResourceUtils.getMatchingLabels(filter, resource); createCellLabel(filter, filteredLabels, cell); ((Table) cell.getControl()).getColumn(cell.getColumnIndex()).pack(); }
Source:
<code>public boolean equals(Object obj) { if (obj == this) { return true; } <START> if (obj instanceof Country) { <END> return code.equals(((Country) obj).code); } return false; }</code><technical_language>Non-standard equals</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Country other = (Country) obj; return code.equals(other.code); }
Source:
<code>private static ProgramState handleNumericalConstant(CheckerContext context, IdentifierTree syntaxNode) { ProgramState programState = context.getState(); Symbol identifier = syntaxNode.symbol(); if (!isNumericalConstant(identifier)) { return programState; } SymbolicValue constant = programState.getValue(identifier); if (constant == null) { return programState; } NumericalConstraint numericalConstraint = programState.getConstraint(constant, NumericalConstraint.class); Optional<Object> constantValue = ((JavaSymbol.VariableJavaSymbol) identifier).constantValue(); if (numericalConstraint == null && constantValue.isPresent()) { Object value = constantValue.get(); if (value instanceof Number) { <START> return programState.addConstraint(constant, new NumericalConstraint((Number) value)); <END> } } return programState; }</code><technical_language>this functional style if w e optional : if (numericalConstraint == null) { return constantValue.filter(v -> v instance of Number) .map( v -> programState.addConstraint(constant, new NumericalConstraint((Number) v))) .orElse(programState); }</technical_language>

Target:
private static ProgramState handleNumericalConstant(CheckerContext context, IdentifierTree syntaxNode) { ProgramState programState = context.getState(); Symbol identifier = syntaxNode.symbol(); if (!isNumericalConstant(identifier)) { return programState; } SymbolicValue constant = programState.getValue(identifier); if (constant == null) { return programState; } NumericalConstraint numericalConstraint = programState.getConstraint(constant, NumericalConstraint.class); if (numericalConstraint == null) { return ((JavaSymbol.VariableJavaSymbol) identifier).constantValue() .filter(Number.class::isInstance) .map(Number.class::cast) .map(value -> programState.addConstraint(constant, new NumericalConstraint(value))) .orElse(programState); } return programState; }
Source:
<code>private List<CRConfigurationProperty> configurationToCRConfiguration(Configuration config) { ArrayList<CRConfigurationProperty> properties = new ArrayList(); if (config != null) { for (ConfigurationProperty p : config) { CRConfigurationProperty crProp = new CRConfigurationProperty(p.getKey().getName()); <START> if (p.getValue() != null) <END> crProp.setValue(p.getValue()); else crProp.setEncryptedValue(p.getEncryptedValue()); properties.add(crProp); } } return properties; }</code><technical_language>check isSecure, instead of getValue. getValue decrypts fly is null. getConfigValue work, is more readable check isSecure</technical_language>

Target:
private List<CRConfigurationProperty> configurationToCRConfiguration(Configuration config) { ArrayList<CRConfigurationProperty> properties = new ArrayList(); if (config != null) { for (ConfigurationProperty p : config) { CRConfigurationProperty crProp = new CRConfigurationProperty(p.getKey().getName()); if (p.isSecure()) crProp.setEncryptedValue(p.getEncryptedValue()); else crProp.setValue(p.getValue()); properties.add(crProp); } } return properties; }
Source:
<code>private static File getDefaultFile() { <START> File home = new File(System.getProperty("user.home")); END> File netrc = new File(home, ".netrc"); if (netrc.exists()) return netrc; netrc = new File(home, "_netrc"); if (netrc.exists()) return netrc; return null; }</code><technical_language>some quirks home directory in a C Git compatible way. FS.userHome instead, is a specific reason to</technical_language>

Target:
private static File getDefaultFile() { File home = FS.DETECTED.userHome(); File netrc = new File(home, ".netrc"); if (netrc.exists()) return netrc; netrc = new File(home, "_netrc"); if (netrc.exists()) return netrc; return null; }
Source:
<code><START> public BrowserWebDriverContainer(DockerImageName dockerImageName) { <END> super(dockerImageName); final WaitStrategy logWaitStrategy = new LogMessageWaitStrategy() .withRegEx(".*(RemoteWebDriver instances should connect to|Selenium Server is up and running).*\n") .withStartupTimeout(Duration.of(15, SECONDS)); this.waitStrategy = new WaitAllStrategy() .withStrategy(logWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(15, SECONDS)); this.withRecordingFileFactory(new DefaultRecordingFileFactory()); }</code><technical_language>this.customImageNameIsSet = true; recordingMode = VncRecordingMode.SKIP; BrowserWebDriverContainer(String) missing</technical_language>

Target:
public BrowserWebDriverContainer(DockerImageName dockerImageName) { super(dockerImageName); final WaitStrategy logWaitStrategy = new LogMessageWaitStrategy() .withRegEx(".*(RemoteWebDriver instances should connect to|Selenium Server is up and running).*\n") .withStartupTimeout(Duration.of(15, SECONDS)); this.waitStrategy = new WaitAllStrategy() .withStrategy(logWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(15, SECONDS)); this.withRecordingFileFactory(new DefaultRecordingFileFactory()); this.customImageNameIsSet = true; recordingMode = VncRecordingMode.SKIP; }
Source:
<code>public void aboutToBeShown() { super.aboutToBeShown(); <START> getOnClickExpression().ifPresent(expression -> { <END> this.hyperlinkListener = new EEFHyperlinkListener(this, this.text, this.container, this.controller); text.addMouseListener(hyperlinkListener); }); }</code><technical_language>complicated</technical_language>

Target:
public void aboutToBeShown() { super.aboutToBeShown(); String onClickExpression = Optional.ofNullable(this.description.getOnClickExpression()).orElse(""); if (!onClickExpression.isEmpty()) { this.hyperlinkListener = new EEFHyperlinkListener(this, this.text, this.container, this.controller); text.addMouseListener(hyperlinkListener); } }
Source:
<code>public double getBuyScale() { <START> double scale = config.getDouble("buy-scale", BUYSCALE) ; <END> if (scale < 0.0 || scale > 1000.0) scale = BUYSCALE ; return scale ; }</code><technical_language>This in a category, added config.yml. (this applies "sell-scale")</technical_language>

Target:
public double getBuyScale() { double scale = config.getDouble("worth-scale-factor.buy", BUYSCALE) ; if (scale < 0.0 || scale > 1000.0) scale = BUYSCALE ; return scale ; }
Source:
<code>private void startKetchLeader(org.eclipse.jgit.transport.Daemon daemon) { KetchSystem system = new KetchSystem(); final KetchLeaderCache leaders = new KetchLeaderCache(system); final ReceivePackFactory<DaemonClient> factory; factory = daemon.getReceivePackFactory(); daemon.setReceivePackFactory(new ReceivePackFactory<DaemonClient>() { @Override public ReceivePack create(DaemonClient req, Repository repo) throws ServiceNotEnabledException, ServiceNotAuthorizedException { ReceivePack rp = factory.create(req, repo); KetchLeader leader; try { leader = leaders.get(null, repo); } catch (URISyntaxException err) { throw new ServiceNotEnabledException( <START> KetchText.get().invalidFollowerUri, err); <END> } rp.setPreReceiveHook(new KetchPreReceive(leader)); return rp; } }); }</code><technical_language>this LeaderUri</technical_language>

Target:
private void startKetchLeader(org.eclipse.jgit.transport.Daemon daemon) { KetchSystem system = new KetchSystem(); final KetchLeaderCache leaders = new KetchLeaderCache(system); final ReceivePackFactory<DaemonClient> factory; factory = daemon.getReceivePackFactory(); daemon.setReceivePackFactory(new ReceivePackFactory<DaemonClient>() { @Override public ReceivePack create(DaemonClient req, Repository repo) throws ServiceNotEnabledException, ServiceNotAuthorizedException { ReceivePack rp = factory.create(req, repo); KetchLeader leader; try { leader = leaders.get(repo); } catch (URISyntaxException err) { throw new ServiceNotEnabledException( KetchText.get().invalidFollowerUri, err); } rp.setPreReceiveHook(new KetchPreReceive(leader)); return rp; } }); }
Source:
<code>public static final <T> Observable<T> create(final T t) { OnSubscribe<T> onSubscribe = new OnSubscribe<T>() { @Override public void call(Subscriber<? super T> s) { s.onNext(t); if (!s.isUnsubscribed()) s.onCompleted(); } }; ScalarSynchronousObservable<T> o = new ScalarSynchronousObservable<T>(t, onSubscribe); <START> if (o.onSubscribe == onSubscribe) { <END> return o; } else { return Observable.create(onSubscribe); } }</code><technical_language>discussion @abersnaze I, want explore type define debug hook is synchronous asynchronous retain SynchronousObservable type here. This is tracing is done, retain code paths merge others SynchronousObservable optimizations, observing debug hooks change execution flow</technical_language>

Target:
public static final <T> Observable<T> create(final T t) { OnSubscribe<T> onSubscribe = new ScalarSynchronousOnSubscribe<T>(t); ScalarSynchronousObservable<T> o = new ScalarSynchronousObservable<T>(t, onSubscribe); if (o.onSubscribe instanceof ScalarSynchronousOnSubscribe) { return o; } else { return Observable.create(o.onSubscribe); } }
Source:
<code>void showSource(Source source) { actionLabel.setText(action + ": " + source.toString()); sourceLabel.setText(source.getDescription()); <START> reloadButton.setVisible(source instanceof Source.Aggregate); <END> }</code><technical_language>checking subtype of Source breaking encapsulation of this class hierarchy. alternative, add a boolean canBeReloaded() method Source interface. Also, is this missing check Operation? show button push tab target is Aggregate server. If this is true, bring need for a new member of this class remember (pun intended) if want show reload button</technical_language>

Target:
void showSource(Source source) { actionLabel.setText(action + ": " + source.toString()); sourceLabel.setText(source.getDescription()); reloadButton.setVisible(source.canBeReloaded() && showReloadButton); markReloadOperationCompleted(); }
Source:
<code>@Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); srvs = new ArrayList<>(); for (int i = 0; i < SERVER_NODE_CNT; i++) srvs.add(grid(i)); <START> System.out.println("CancelCommandCommandShTest.beforeTestsStarted"); <END> IgniteCache<Object, Object> cache = client.getOrCreateCache( new CacheConfiguration<>(DEFAULT_CACHE_NAME).setIndexedTypes(Integer.class, Integer.class) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); awaitPartitionMapExchange(); for (int i = 0; i < PAGE_SZ * PAGE_SZ; i++) cache.put(i, i); }</code><technical_language>Debugging artifact</technical_language>

Target:
@Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); srvs = new ArrayList<>(); for (int i = 0; i < SERVER_NODE_CNT; i++) srvs.add(grid(i)); IgniteCache<Object, Object> cache = client.getOrCreateCache( new CacheConfiguration<>(DEFAULT_CACHE_NAME).setIndexedTypes(Integer.class, Integer.class) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); awaitPartitionMapExchange(); for (int i = 0; i < PAGE_SZ * PAGE_SZ; i++) cache.put(i, i); }
Source:
<code>public SplitPane(final AggregateConfigProvider manager, final Orientation orientation, final Component leftComponent, final Component rightComponent) { super(orientation == Orientation.HORIZONTAL ? HORIZONTAL_SPLIT : VERTICAL_SPLIT, true, leftComponent, rightComponent); setContinuousLayout(true); getActionMap().setParent(null); getActionMap().clear(); <START> new ConfigBinder(manager).bind(this, SplitPane.class); <END> }</code><technical_language>manager.getBinder() instead of creating a new</technical_language>

Target:
public SplitPane(final AggregateConfigProvider manager, final Orientation orientation, final Component leftComponent, final Component rightComponent) { super(orientation == Orientation.HORIZONTAL ? HORIZONTAL_SPLIT : VERTICAL_SPLIT, true, leftComponent, rightComponent); setContinuousLayout(true); getActionMap().setParent(null); getActionMap().clear(); manager.getBinder().bind(this, SplitPane.class); }