auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testHolderLoad() throws Exception { File directory = folder.newFolder("testLoad"); String holderName = "myHolder"; StateHolder<Long, String> map = new TransientStateHolder<>(); map.putIfAbsent(42L, "Again? That's not even funny anymore!!"); try (FileOutputStream fos = new FileOutputStream(new File(directory, HOLDER_FILE_NAME))) { try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(holderName); oos.writeObject(new FileBasedStateRepository.Tuple(0, map)); } } FileBasedStateRepository stateRepository = new FileBasedStateRepository(directory); StateHolder<Long, String> myHolder = stateRepository.getPersistentStateHolder(holderName, Long.class, String.class); assertThat(myHolder, is(map)); }

Target:
public void testHolderLoad() throws Exception { File directory = folder.newFolder("testLoad"); String holderName = "myHolder"; StateHolder<Long, String> map = new TransientStateHolder<>(); map.putIfAbsent(42L, "Again? That's not even funny anymore!!"); try (FileOutputStream fos = new FileOutputStream(new File(directory, HOLDER_FILE_NAME)); ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(holderName); oos.writeObject(new FileBasedStateRepository.Tuple(0, map)); } FileBasedStateRepository stateRepository = new FileBasedStateRepository(directory); StateHolder<Long, String> myHolder = stateRepository.getPersistentStateHolder(holderName, Long.class, String.class); assertThat(myHolder, is(map)); }
Source:
protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select one of the last five recently loaded configuration:"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL | extraListOptions, true); String[] names; names = recentConfigs.toArray(new String[0]); String[] timestamps; timestamps = recentTimestamps.toArray(new String[0]); for (int i = 0; i < timestamps.length; i++) { timestamps[i] = "Last modified: " + timestamps[i]; } setMultipleColumnItems(names, timestamps); }

Target:
protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select configuration:"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL | extraListOptions); setMultipleColumnItems(configNamesToArray(), timestampsToArray()); }
Source:
public static void serializeHeader(ByteBuffer outputBuffer, long totalSize, int blobPropertiesRecordRelativeOffset, int deleteRecordRelativeOffset, int userMetadataRecordRelativeOffset, int blobRecordRelativeOffset) throws MessageFormatException { checkHeaderConstraints(totalSize, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobRecordRelativeOffset); int startOffset = outputBuffer.position(); outputBuffer.putShort(Message_Header_Version_V1); outputBuffer.putLong(totalSize); outputBuffer.putInt(blobPropertiesRecordRelativeOffset); outputBuffer.putInt(deleteRecordRelativeOffset); outputBuffer.putInt(userMetadataRecordRelativeOffset); outputBuffer.putInt(blobRecordRelativeOffset); Crc32 crc = new Crc32(); crc.update(outputBuffer.array(), startOffset, getHeaderSize() - Crc_Size); outputBuffer.putLong(crc.getValue()); Logger logger = LoggerFactory.getLogger("MessageHeader_Format_V1"); logger.trace("serializing header : version size blobpropertiesrecordrelativeoffset " + "deleterecordrelativeoffset " + "usermetadatarecordrelativeoffset blobrecordrelativeoffset crc {}", Message_Header_Version_V1, totalSize, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobPropertiesRecordRelativeOffset, crc.getValue()); }

Target:
public static void serializeHeader(ByteBuffer outputBuffer, long totalSize, int blobPropertiesRecordRelativeOffset, int deleteRecordRelativeOffset, int userMetadataRecordRelativeOffset, int blobRecordRelativeOffset) throws MessageFormatException { checkHeaderConstraints(totalSize, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobRecordRelativeOffset); int startOffset = outputBuffer.position(); outputBuffer.putShort(Message_Header_Version_V1); outputBuffer.putLong(totalSize); outputBuffer.putInt(blobPropertiesRecordRelativeOffset); outputBuffer.putInt(deleteRecordRelativeOffset); outputBuffer.putInt(userMetadataRecordRelativeOffset); outputBuffer.putInt(blobRecordRelativeOffset); Crc32 crc = new Crc32(); crc.update(outputBuffer.array(), startOffset, getHeaderSize() - Crc_Size); outputBuffer.putLong(crc.getValue()); Logger logger = LoggerFactory.getLogger("MessageHeader_Format_V1"); logger.trace("serializing header : version size blobpropertiesrecordrelativeoffset " + "deleterecordrelativeoffset usermetadatarecordrelativeoffset blobrecordrelativeoffset crc {}", Message_Header_Version_V1, totalSize, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobPropertiesRecordRelativeOffset, crc.getValue()); }
Source:
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(GridLayoutFactory.swtDefaults().create()); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2); new Label(composite, SWT.WRAP) .setText(UIText.SelectSynchronizeResourceDialog_srcRef); srcRefCombo = new RemoteSelectionCombo(composite, syncRepos); srcRefCombo.setDefautlValue(UIText.SynchronizeWithAction_localRepoName, HEAD); srcRefCombo.setLayoutData(data); srcRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); shouldIncludeLocalButton = new Button(composite, SWT.CHECK | SWT.WRAP); shouldIncludeLocalButton .setText(UIText.SelectSynchronizeResourceDialog_includeUncommitedChnages); new Label(composite, SWT.WRAP) .setText(UIText.SelectSynchronizeResourceDialog_dstRef); dstRefCombo = new RemoteSelectionCombo(composite, syncRepos); dstRefCombo.setDefautlValue(getDefaultRemoteName(), MASTER); dstRefCombo.setLayoutData(data); dstRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); setTitle(NLS.bind(UIText.SelectSynchronizeResourceDialog_selectProject, repoName)); setMessage(UIText.SelectSynchronizeResourceDialog_header); setTitleImage(UIIcons.WIZBAN_CONNECT_REPO.createImage()); return composite; }

Target:
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(GridLayoutFactory.swtDefaults().create()); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2); new Label(composite, SWT.WRAP) .setText(UIText.SelectSynchronizeResourceDialog_srcRef); srcRefCombo = new RemoteSelectionCombo(composite, syncRepos); srcRefCombo.setDefaultValue(UIText.SynchronizeWithAction_localRepoName, HEAD); srcRefCombo.setLayoutData(data); srcRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); shouldIncludeLocalButton = new Button(composite, SWT.CHECK | SWT.WRAP); shouldIncludeLocalButton .setText(UIText.SelectSynchronizeResourceDialog_includeUncommitedChnages); new Label(composite, SWT.WRAP) .setText(UIText.SelectSynchronizeResourceDialog_dstRef); dstRefCombo = new RemoteSelectionCombo(composite, syncRepos); dstRefCombo.setDefaultValue(getDefaultRemoteName(), MASTER); dstRefCombo.setLayoutData(data); dstRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); setTitle(NLS.bind(UIText.SelectSynchronizeResourceDialog_selectProject, repoName)); setMessage(UIText.SelectSynchronizeResourceDialog_header); setTitleImage(UIIcons.WIZBAN_CONNECT_REPO.createImage()); return composite; }
Source:
public void onRatingTypeChange() { CompletableFuture<Void> statisicsFuture = switch (ratingTypeComboBox.getItems().indexOf(ratingTypeComboBox.getValue())) { default -> loadStatistics(KnownFeaturedMod.FAF); case 1 -> loadStatistics(KnownFeaturedMod.LADDER_1V1); }; statisicsFuture.thenRun(() -> Platform.runLater(this::plotPlayerRatingGraph)); }

Target:
public void onRatingTypeChange() { CompletableFuture<Void> statisticsFuture = loadStatistics(ratingTypeComboBox.getValue().getFeaturedMod()); statisticsFuture.thenRun(() -> Platform.runLater(this::plotPlayerRatingGraph)); }
Source:
public void checkPagingOneByOneThroughReferenceSets() throws AvroRemoteException { final List<ReferenceSet> listOfReferenceSets = Utils.getAllReferenceSets(client); assertThat(listOfReferenceSets).isNotEmpty(); final Set<ReferenceSet> setOfReferenceSets = new HashSet<>(listOfReferenceSets); assertThat(listOfReferenceSets).hasSize(setOfReferenceSets.size()); String pageToken = null; for (ReferenceSet ignored : listOfReferenceSets) { final SearchReferenceSetsRequest pageReq = SearchReferenceSetsRequest.newBuilder() .setPageSize(1) .setPageToken(pageToken) .build(); final SearchReferenceSetsResponse pageResp = client.references.searchReferenceSets(pageReq); final List<ReferenceSet> pageOfReferenceSets = pageResp.getReferenceSets(); pageToken = pageResp.getNextPageToken(); assertThat(pageOfReferenceSets).hasSize(1); assertThat(setOfReferenceSets).contains(pageOfReferenceSets.get(0)); setOfReferenceSets.remove(pageOfReferenceSets.get(0)); } assertThat(pageToken).isNull(); assertThat(setOfReferenceSets).isEmpty(); }

Target:
public void checkPagingOneByOneThroughReferenceSets() throws AvroRemoteException { final List<ReferenceSet> listOfReferenceSets = Utils.getAllReferenceSets(client); assertThat(listOfReferenceSets).isNotEmpty(); final Set<ReferenceSet> setOfExpectedReferenceSets = new HashSet<>(listOfReferenceSets); assertThat(listOfReferenceSets).hasSize(setOfExpectedReferenceSets.size()); final Set<ReferenceSet> setOfReferenceSetsGathered1By1 = new HashSet<>(setOfExpectedReferenceSets.size()); String pageToken = null; do { final SearchReferenceSetsRequest pageReq = SearchReferenceSetsRequest.newBuilder() .setPageSize(1) .setPageToken(pageToken) .build(); final SearchReferenceSetsResponse pageResp = client.references.searchReferenceSets(pageReq); final List<ReferenceSet> pageOfReferenceSets = pageResp.getReferenceSets(); pageToken = pageResp.getNextPageToken(); assertThat(pageOfReferenceSets).hasSize(1); setOfReferenceSetsGathered1By1.add(pageOfReferenceSets.get(0)); } while (pageToken != null); assertThat(setOfReferenceSetsGathered1By1).containsAll(setOfExpectedReferenceSets); }
Source:
public void validate(FailureCollector collector) { IdUtils.validateReferenceName(referenceName, collector); try { getSchema(); } catch (IllegalArgumentException e) { collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_SCHEMA).withStacktrace(e.getStackTrace()); } if (fileEncoding != null && !fileEncoding.isEmpty()) { fileEncoding = cleanFileEncodingName(fileEncoding); if (!fileEncoding.equalsIgnoreCase(DEFAULT_FILE_ENCODING) && !FixedLengthCharset.isValidEncoding(fileEncoding)) { collector.addFailure("Specified file encoding is not valid.", "Use one of the supported file encodings."); } } if (collector.getValidationFailures().isEmpty()) { try { validate(); } catch (Exception e) { collector.addFailure(e.getMessage(), null).withStacktrace(e.getStackTrace()); } } }

Target:
public void validate(FailureCollector collector) { IdUtils.validateReferenceName(referenceName, collector); try { getSchema(); } catch (IllegalArgumentException e) { collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_SCHEMA).withStacktrace(e.getStackTrace()); } if (getFileEncoding() != null && !getFileEncoding().equals(getDefaultFileEncoding())) { if (!FixedLengthCharset.isValidEncoding(getFileEncoding())) { collector.addFailure("Specified file encoding is not valid.", "Use one of the supported file encodings."); } } if (collector.getValidationFailures().isEmpty()) { try { validate(); } catch (Exception e) { collector.addFailure(e.getMessage(), null).withStacktrace(e.getStackTrace()); } } }
Source:
public SitePluginModel getSitePluginFromSlug(String slug) { return mPluginStore.getSitePluginBySlug(getSite(), slug); }

Target:
public SitePluginModel getSitePluginFromSlug(String slug) { List<SitePluginModel> sitePlugins = getSitePlugins().getValue(); if (sitePlugins != null) { for (SitePluginModel plugin : sitePlugins) { if (plugin.getSlug().equals(slug)) { return plugin; } } } return mPluginStore.getSitePluginBySlug(getSite(), slug); }
Source:
public static HashMap createCenter(final String name, final int officeId, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) { final String CREATE_CENTER_URL = CENTERS_URL + "?" + Utils.TENANT_IDENTIFIER; HashMap hm = new HashMap(); hm.put("name", name); hm.put("officeId", officeId); hm.put("active", false); System.out.println("------------------------CREATING CENTER-------------------------"); return Utils.performServerPost(requestSpec, responseSpec, CREATE_CENTER_URL, new Gson().toJson(hm), ""); }

Target:
public static int createCenter(final String name, final int officeId, final RequestSpecification requestSpec, final ResponseSpecification responseSpec) { return createCenter(name, officeId, null, -1, null, null, requestSpec, responseSpec); }
Source:
public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(); setContentView(R.layout.cacheslist_activity); Bundle extras = getIntent().getExtras(); if (extras != null) { type = Intents.getListType(getIntent()); coords = extras.getParcelable(Intents.EXTRA_COORDS); } else { extras = new Bundle(); } if (isInvokedFromAttachment()) { type = CacheListType.OFFLINE; if (coords == null) { coords = Geopoint.ZERO; } } if (type == CacheListType.NEAREST) { coords = Sensors.getInstance().currentGeo().getCoords(); } setTitle(title); if (savedInstanceState != null) { currentFilter = savedInstanceState.getParcelable(STATE_FILTER); currentInverseSort = savedInstanceState.getBoolean(STATE_INVERSE_SORT); type = CacheListType.values()[savedInstanceState.getInt(STATE_LIST_TYPE, type.ordinal())]; listId = savedInstanceState.getInt(STATE_LIST_ID); markerId = savedInstanceState.getInt(STATE_MARKER_ID); } initAdapter(); prepareFilterBar(); if (type.canSwitch) { initActionBarSpinner(); } try { currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(type.getLoaderId(), extras, this); } catch (final NullPointerException e) { Log.e("CacheListActivity.onCreate", e); } if (CollectionUtils.isNotEmpty(cacheList)) { if (currentLoader != null && currentLoader.isStarted()) { showFooterLoadingCaches(); } else { showFooterMoreCaches(); } } if (isInvokedFromAttachment()) { listNameMemento.rememberTerm(extras.getString(Intents.EXTRA_NAME)); importGpxAttachement(); } }

Target:
public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(); setContentView(R.layout.cacheslist_activity); Bundle extras = getIntent().getExtras(); if (extras != null) { type = Intents.getListType(getIntent()); coords = extras.getParcelable(Intents.EXTRA_COORDS); } else { extras = new Bundle(); } if (isInvokedFromAttachment()) { type = CacheListType.OFFLINE; if (coords == null) { coords = Geopoint.ZERO; } } if (type == CacheListType.NEAREST) { coords = Sensors.getInstance().currentGeo().getCoords(); } setTitle(title); if (savedInstanceState != null) { currentFilter = savedInstanceState.getParcelable(STATE_FILTER); currentInverseSort = savedInstanceState.getBoolean(STATE_INVERSE_SORT); type = CacheListType.values()[savedInstanceState.getInt(STATE_LIST_TYPE, type.ordinal())]; listId = savedInstanceState.getInt(STATE_LIST_ID); markerId = savedInstanceState.getInt(STATE_MARKER_ID); } initAdapter(); prepareFilterBar(); if (type.canSwitch) { initActionBarSpinner(); } currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(type.getLoaderId(), extras, this); if (CollectionUtils.isNotEmpty(cacheList)) { if (currentLoader != null && currentLoader.isStarted()) { showFooterLoadingCaches(); } else { showFooterMoreCaches(); } } if (isInvokedFromAttachment()) { listNameMemento.rememberTerm(extras.getString(Intents.EXTRA_NAME)); importGpxAttachement(); } }
Source:
public String toString() { return getClass().getSimpleName() + "@" + this.id + "#" + this.version + " " + toJson(); }

Target:
public String toString() { return getClass().getSimpleName() + '@' + this.id + '#' + this.version + ' ' + toJson(); }
Source:
private void cancel(UUID nodeId) { synchronized (this) { if (isDone()) return; U.log(log, ("Cancelled rebalancing [grp=" + grp.cacheOrGroupName() + ", supplier=" + nodeId + ", topVer=" + topologyVersion() + ']')); cleanupRemoteContexts(nodeId); IgniteDhtDemandedPartitionsMap rmvd = remaining.remove(nodeId); if (rmvd != null) grp.metrics().cancelRebalancingPartitions(rmvd.size()); onDone(false); checkIsDone(); } }

Target:
private void cancel(UUID nodeId) { synchronized (this) { if (isDone()) return; U.log(log, ("Cancelled rebalancing [grp=" + grp.cacheOrGroupName() + ", supplier=" + nodeId + ", topVer=" + topologyVersion() + ']')); cleanupRemoteContexts(nodeId); remaining.remove(nodeId); onDone(false); checkIsDone(); } }
Source:
public MockResponse handleCreate(String path, String s) { Serialization.unmarshal(s, KubernetesResource.class); MockResponse response = new MockResponse(); AttributeSet features = AttributeSet.merge(attributeExtractor.fromPath(path), attributeExtractor.fromResource(s)); map.put(features, s); for (Map.Entry<AttributeSet, Set<WatchEventsListener>> entry: watchEventListenerMapping.entrySet()) { if (features.matches(entry.getKey())) { for (WatchEventsListener listener: entry.getValue()) { listener.sendWebSocketResponse(doGet(path), "ADDED"); } } } response.setBody(s); response.setResponseCode(202); return response; }

Target:
public MockResponse handleCreate(String path, String s) { return new MockResponse().setResponseCode(doCreate(path, s, "ADDED")).setBody(s); }
Source:
private ArrayDeque<TokenCredential> getCredentialsChain() { ArrayDeque<TokenCredential> output = new ArrayDeque<>(5); if (!excludeEnvironmentCredential) { output.add(new EnvironmentCredential(identityClientOptions)); } if (!excludeManagedIdentityCredential) { output.add(new ManagedIdentityCredential(null, identityClientOptions)); } if (!excludeSharedTokenCacheCredential) { output.add(new SharedTokenCacheCredential(null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", null, identityClientOptions)); } if (!excludeAzureCliCredential) { output.add(new AzureCliCredential(identityClientOptions)); } if (!excludeIntelliJCredential) { output.add(new IntelliJCredential(identityClientOptions)); } if (output.size() == 0) { throw logger.logExceptionAsError(new IllegalArgumentException("At least one credential type must be" + " included in the authentication flow.")); } return output; }

Target:
private ArrayDeque<TokenCredential> getCredentialsChain() { ArrayDeque<TokenCredential> output = new ArrayDeque<>(6); if (!excludeEnvironmentCredential) { output.add(new EnvironmentCredential(identityClientOptions)); } if (!excludeManagedIdentityCredential) { output.add(new ManagedIdentityCredential(null, identityClientOptions)); } if (!excludeSharedTokenCacheCredential) { output.add(new SharedTokenCacheCredential(null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", null, identityClientOptions)); } if (!excludeIntelliJCredential) { output.add(new IntelliJCredential(tenantId, identityClientOptions)); } if (!excludeVsCodeCredential) { output.add(new VisualStudioCodeCredential(tenantId, identityClientOptions)); } if (!excludeAzureCliCredential) { output.add(new AzureCliCredential(identityClientOptions)); } if (output.size() == 0) { throw logger.logExceptionAsError(new IllegalArgumentException("At least one credential type must be" + " included in the authentication flow.")); } return output; }
Source:
private void buildBlobIdAndAssert(short version, byte flag, byte datacenterId, short accountId, short containerId, PartitionId partitionId) throws Exception { BlobId blobId; switch (version) { case BLOB_ID_V1: blobId = new BlobId(flag, datacenterId, accountId, containerId, partitionId); break; case BLOB_ID_V2: blobId = new BlobIdV2(flag, datacenterId, accountId, containerId, partitionId); break; default: throw new IllegalArgumentException("Invalid version number blob" + version); } assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); assertBlobIdFieldValues(version, blobId, flag, datacenterId, accountId, containerId, partitionId); }

Target:
private void buildBlobIdAndAssert(short version, byte flag, byte datacenterId, short accountId, short containerId, PartitionId partitionId) throws Exception { BlobId blobId; switch (version) { case BLOB_ID_V1: blobId = new BlobId(flag, datacenterId, accountId, containerId, partitionId); break; case BLOB_ID_V2: blobId = new BlobIdV2(flag, datacenterId, accountId, containerId, partitionId); break; default: throw new Exception("Invalid version number blob" + version); } assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); assertBlobIdFieldValues(version, blobId, flag, datacenterId, accountId, containerId, partitionId); }
Source:
private void commonSectionFetchOnCatch(Throwable caught, int sequenceNum) { if (!isAdded() || sequenceNum != pageSequenceNum) { return; } tocDrawer.closeDrawers(); ((PageActivity) getActivity()).updateProgressBar(false, true, 0); refreshView.setRefreshing(false); if (caught instanceof SectionsFetchException) { if (((SectionsFetchException) caught).getCode().equals("missingtitle") || ((SectionsFetchException) caught).getCode().equals("invalidtitle")) { ViewAnimations.fadeIn(pageDoesNotExistError); } } else if (Utils.throwableContainsSpecificType(caught, SSLException.class)) { if (WikipediaApp.getInstance().incSslFailCount() < 2) { WikipediaApp.getInstance().setSslFallback(true); showNetworkError(null); try { connectionIssueFunnel.logConnectionIssue("mdot", "commonSectionFetchOnCatch"); } catch (Exception e) { } } else { showNetworkError(null); try { connectionIssueFunnel.logConnectionIssue("desktop", "commonSectionFetchOnCatch"); } catch (Exception e) { } } } else if (Utils.throwableContainsSpecificType(caught, JSONException.class)) { Log.d(TAG, "Caught JSONException"); Log.d(TAG, "Message: " + caught.getMessage()); Pattern p = Pattern.compile(" \\d{3} "); Matcher m = p.matcher(caught.getMessage()); if (m.find()) { statusCode = m.group(0).trim(); Log.d(TAG, "Found probable server response code " + statusCode); showNetworkError(statusCode); } else { showNetworkError(null); } } else if (caught instanceof ApiException) { showNetworkError(null); } else { throw new RuntimeException(caught); } }

Target:
private void commonSectionFetchOnCatch(Throwable caught, int sequenceNum) { if (!isAdded() || sequenceNum != pageSequenceNum) { return; } tocDrawer.closeDrawers(); ((PageActivity) getActivity()).updateProgressBar(false, true, 0); refreshView.setRefreshing(false); if (caught instanceof SectionsFetchException) { if (((SectionsFetchException) caught).getCode().equals("missingtitle") || ((SectionsFetchException) caught).getCode().equals("invalidtitle")) { ViewAnimations.fadeIn(pageDoesNotExistError); } } else if (Utils.throwableContainsSpecificType(caught, SSLException.class)) { if (WikipediaApp.getInstance().incSslFailCount() < 2) { WikipediaApp.getInstance().setSslFallback(true); showNetworkError(null); try { connectionIssueFunnel.logConnectionIssue("mdot", "commonSectionFetchOnCatch"); } catch (Exception e) { } } else { showNetworkError(null); try { connectionIssueFunnel.logConnectionIssue("desktop", "commonSectionFetchOnCatch"); } catch (Exception e) { } } } else if (Utils.throwableContainsSpecificType(caught, JSONException.class)) { Log.d(TAG, "Caught JSONException. Message: " + caught.getMessage()); Pattern p = Pattern.compile(" \\d{3} "); Matcher m = p.matcher(caught.getMessage()); if (m.find()) { String statusCode = m.group(0).trim(); Log.d(TAG, "Found probable server response code " + statusCode); showNetworkError(statusCode); } else { showNetworkError(null); } } else if (caught instanceof ApiException) { showNetworkError(null); } else { throw new RuntimeException(caught); } }
Source:
public ClangTidyParser() { super(Messages._Warnings_ClangTidy_ParserName(), Messages._Warnings_ClangTidy_LinkName(), Messages._Warnings_ClangTidy_TrendName(), CLANG_TIDY_WARNING_PATTERN, false); }

Target:
public ClangTidyParser() { super(Messages._Warnings_ClangTidy_ParserName(), Messages._Warnings_ClangTidy_LinkName(), Messages._Warnings_ClangTidy_TrendName(), CLANG_TIDY_WARNING_PATTERN); }
Source:
private void buildGroupToLeafWriterMap(PrimitiveColumnIO primitive, ColumnWriter writer) { GroupColumnIO parent = primitive.getParent(); do { getLeafWriters(parent).add(writer); } while ((parent = parent.getParent()) != null); }

Target:
private void buildGroupToLeafWriterMap(PrimitiveColumnIO primitive, ColumnWriter writer) { GroupColumnIO parent = primitive.getParent(); do { getLeafWriters(parent).add(writer); parent = parent.getParent(); } while (parent != null); }
Source:
public static WikibaseUris getURISystem() { if (uriSystem == null) { String wikibaseUriProperty = System.getProperty(WIKIBASE_CONCEPT_URI); if (wikibaseUriProperty != null) { String commonsUriProperty = System.getProperty(COMMONS_CONCEPT_URI); try { if (commonsUriProperty != null) { uriSystem = new SDCUris(new URI(commonsUriProperty), new URI(wikibaseUriProperty)); } else { uriSystem = new WikibaseUris(new URI(wikibaseUriProperty)); } } catch (URISyntaxException e) { throw new RuntimeException("Bad URI: " + wikibaseUriProperty + (commonsUriProperty != null ? ", " + commonsUriProperty : ""), e); } return uriSystem; } String wikibaseHostProperty = System.getProperty(WIKIBASE_HOST_PROPERTY); if (wikibaseHostProperty != null) { uriSystem = WikibaseUris.forHost(wikibaseHostProperty); } else { uriSystem = WIKIDATA; } } return uriSystem; }

Target:
private static WikibaseUris getURISystem() { return uriSystem; }
Source:
public String getVerify() { return verify; }

Target:
public String getVerify() { return this.verify; }
Source:
public SimulatorSettings(HostInfo info, String sdkVersion, boolean is64bit, DeviceType device, DeviceVariation variation) throws NotActiveException { this.exactSdkVersion = sdkVersion; this.is64bit = is64bit; this.info = info; this.instrumentsVersion = info.getInstrumentsVersion(); setVariation(device, variation, sdkVersion); if (instrumentsVersion.getMajor() >= 6) { deviceUUID = determineDeviceUUID(); } this.contentAndSettingsFolder = getContentAndSettingsFolder(); this.globalPreferencePlist = getGlobalPreferenceFile(); }

Target:
public SimulatorSettings(HostInfo info, String sdkVersion, boolean is64bit, DeviceType device, DeviceVariation variation) { this.exactSdkVersion = sdkVersion; this.is64bit = is64bit; this.info = info; this.instrumentsVersion = info.getInstrumentsVersion(); setVariation(device, variation, sdkVersion); if (instrumentsVersion.getMajor() >= 6) { deviceUUID = determineDeviceUUID(); } this.contentAndSettingsFolder = getContentAndSettingsFolder(); this.globalPreferencePlist = getGlobalPreferenceFile(); }
Source:
protected void resultSelect(Event e) { super.resultSelect(e); searchResultsMouseOver(e); GQuery high = getResultHighlight(); resultClearHighlight(); high.removeClass(getCss().resultSelected()); if(isMobileAnimated()) { final String paddingTop = high.css("padding-top"); final String paddingBottom = high.css("padding-bottom"); final int speed = getMobileAnimationSpeed(); high.animate("height: 0, padding-top: 0, padding-bottom: 0", speed, new Function() { public void f() { $(this).animate("height: auto, padding-top: " + paddingTop + ", padding-bottom: " + paddingBottom, speed); $(this).addClass(getCss().resultSelected()); } }); } else { high.addClass(getCss().resultSelected()); } }

Target:
protected void resultSelect(Event e) { super.resultSelect(e); searchResultsMouseOver(e); GQuery high = getResultHighlight(); resultClearHighlight(); high.removeClass(getCss().resultSelected()); if (getOptions().isMobileAnimation()) { final String paddingTop = high.css("padding-top"); final String paddingBottom = high.css("padding-bottom"); final int speed = getOptions().getMobileAnimationSpeed(); high.animate("height: 0, padding-top: 0, padding-bottom: 0", speed, new Function() { public void f() { $(this).animate("height: auto, padding-top: " + paddingTop + ", padding-bottom: " + paddingBottom, speed); $(this).addClass(getCss().resultSelected()); } }); } else { high.addClass(getCss().resultSelected()); } }
Source:
public AccountDetailsPanel(AccountInfoDialog dialog, ProtocolProviderService protocolProvider) { this.dialog = dialog; this.R = AccountInfoActivator.R; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setOpaque(false); this.setPreferredSize(new Dimension(600, 400)); this.protocolProvider = protocolProvider; this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); if (OSUtils.IS_MAC) { fontColor = "FFFFFF"; } else { fontColor = "000000"; } infoTextPane = createGeneralInfoPane(); SIPCommTabbedPane tabbedPane = new SIPCommTabbedPane(); accountInfoOpSet = protocolProvider .getOperationSet(OperationSetServerStoredAccountInfo.class); final JComponent contactPanel; if (accountInfoOpSet == null) { contactPanel = createUnsupportedPanel(); } else { contactPanel = createSummaryPanel(); if (protocolProvider.isRegistered()) { loadDetails(); } } tabbedPane.add(R.getI18NString("plugin.accountinfo.CONTACT_INFO"), contactPanel); tabbedPane.add(R.getI18NString("service.gui.OTHER"), infoTextPane); this.add(tabbedPane); }

Target:
public AccountDetailsPanel(AccountInfoDialog dialog, ProtocolProviderService protocolProvider) { this.dialog = dialog; this.R = AccountInfoActivator.R; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setOpaque(false); this.setPreferredSize(new Dimension(600, 400)); this.protocolProvider = protocolProvider; this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); infoTextPane = createGeneralInfoPane(); SIPCommTabbedPane tabbedPane = new SIPCommTabbedPane(); accountInfoOpSet = protocolProvider .getOperationSet(OperationSetServerStoredAccountInfo.class); final JComponent contactPanel; if (accountInfoOpSet == null) { contactPanel = createUnsupportedPanel(); } else { contactPanel = createSummaryPanel(); if (protocolProvider.isRegistered()) { loadDetails(); } } tabbedPane.add(R.getI18NString("plugin.accountinfo.CONTACT_INFO"), contactPanel); tabbedPane.add(R.getI18NString("service.gui.OTHER"), infoTextPane); this.add(tabbedPane); }
Source:
public void canRetrieveEmptyValuesFromStudyParticipant() { Account emptyAccount = new GenericAccount(); assertNull(ParticipantOption.DATA_GROUPS.fromAccount(emptyAccount)); assertEquals("true",ParticipantOption.EMAIL_NOTIFICATIONS.fromAccount(emptyAccount)); assertNull(ParticipantOption.EXTERNAL_IDENTIFIER.fromAccount(emptyAccount)); assertNull(ParticipantOption.LANGUAGES.fromAccount(emptyAccount)); assertNull(ParticipantOption.SHARING_SCOPE.fromAccount(emptyAccount)); assertNull(ParticipantOption.TIME_ZONE.fromAccount(emptyAccount)); }

Target:
public void canRetrieveEmptyValuesFromStudyParticipant() { StudyParticipant emptyParticipant = new StudyParticipant.Builder().build(); assertNull(ParticipantOption.DATA_GROUPS.fromParticipant(emptyParticipant)); assertEquals("true",ParticipantOption.EMAIL_NOTIFICATIONS.fromParticipant(emptyParticipant)); assertNull(ParticipantOption.EXTERNAL_IDENTIFIER.fromParticipant(emptyParticipant)); assertNull(ParticipantOption.LANGUAGES.fromParticipant(emptyParticipant)); assertNull(ParticipantOption.SHARING_SCOPE.fromParticipant(emptyParticipant)); assertNull(ParticipantOption.TIME_ZONE.fromParticipant(emptyParticipant)); }
Source:
private PreviousPeriodDateDataSet copyWithUriQualifier(final PreviousPeriodDateDataSet dataSet, final ObjQualifierConverter objQualifierConverter) { if (dataSet.getDataSet() instanceof IdentifierObjQualifier) { final IdentifierObjQualifier dataSetIdentifier = (IdentifierObjQualifier) dataSet.getDataSet(); return objQualifierConverter.convertToUriQualifier(dataSetIdentifier) .map(uriObjQualifier -> new PreviousPeriodDateDataSet(uriObjQualifier, dataSet.getPeriodsAgo())) .orElseThrow(() -> new IllegalArgumentException(format("The converter cannot convert identifier '%s'!", dataSetIdentifier))); } return dataSet; }

Target:
private PreviousPeriodDateDataSet copyWithUriQualifier(final PreviousPeriodDateDataSet dataSet, final ObjQualifierConverter objQualifierConverter) { return ObjIdentifierUtilities.copyIfNecessary( dataSet, dataSet.getDataSet(), uriObjQualifier -> new PreviousPeriodDateDataSet(uriObjQualifier, dataSet.getPeriodsAgo()), objQualifierConverter ); }
Source:
public Response saveRule(RuleDTO ruleDTO) { final Rule rule = convert(ruleDTO); rule.setId(null); rule.setPosition(0); final int ruleId = classificationService.saveRule(rule); final UriBuilder builder = UriBuilder.fromResource(ClassificationRestService.class); final URI uri = builder.path(ClassificationRestService.class, "getRule").build(ruleId); return Response.created(uri).build(); }

Target:
public Response saveRule(RuleDTO ruleDTO) { final Rule rule = convert(ruleDTO); rule.setId(null); final int ruleId = classificationService.saveRule(rule); final UriBuilder builder = UriBuilder.fromResource(ClassificationRestService.class); final URI uri = builder.path(ClassificationRestService.class, "getRule").build(ruleId); return Response.created(uri).build(); }
Source:
public void populateViewHolder(@NonNull Config config, @NonNull IAuthorData authorData, @NonNull ProfileImageProvider provider, long initialTimeStampMs, @NonNull final Runnable listener) { final Context context = profileImageView.getContext(); final ProfileImage profileImage; { if (provider.getProfileImage() != null) { profileImage = provider.getProfileImage(); } else { ProfileModel profileModel = userPrefs.getProfile(); if (profileModel != null && authorData.getAuthor().equals(profileModel.username)) { profileImage = userPrefs.getProfileImage(); } else { profileImage = null; } } if (profileImage != null && profileImage.hasImage()) { Glide.with(context).load(profileImage.getImageUrlMedium()) .into(profileImageView); } else { profileImageView.setImageResource(R.drawable.xsie); } } DiscussionTextUtils.setAuthorText(authorTextView, authorData); if (authorData.getCreatedAt() != null) { CharSequence relativeTime = DiscussionTextUtils.getRelativeTimeSpanString(context, initialTimeStampMs, authorData.getCreatedAt().getTime()); dateTextView.setText(relativeTime); } else { dateTextView.setVisibility(View.GONE); } if (config.isUserProfilesEnabled() && !authorData.isAuthorAnonymous()) { profileRow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.run(); } }); } }

Target:
public void populateViewHolder(@NonNull Config config, @NonNull IAuthorData authorData, @NonNull ProfileImageProvider provider, long initialTimeStampMs, @NonNull final Runnable listener) { final Context context = profileImageView.getContext(); final ProfileImage profileImage; { if (provider.getProfileImage() != null && provider.getProfileImage().hasImage()) { profileImage = provider.getProfileImage(); } else { ProfileModel profileModel = userPrefs.getProfile(); if (profileModel != null && authorData.getAuthor().equals(profileModel.username)) { profileImage = userPrefs.getProfileImage(); } else { profileImage = null; } } if (profileImage != null && profileImage.hasImage()) { Glide.with(context) .load(profileImage.getImageUrlMedium()) .into(profileImageView); } else { profileImageView.setImageResource(R.drawable.profile_photo_placeholder); } } DiscussionTextUtils.setAuthorText(authorTextView, authorData); if (authorData.getCreatedAt() != null) { CharSequence relativeTime = DiscussionTextUtils.getRelativeTimeSpanString(context, initialTimeStampMs, authorData.getCreatedAt().getTime()); dateTextView.setText(relativeTime); } else { dateTextView.setVisibility(View.GONE); } if (config.isUserProfilesEnabled() && !authorData.isAuthorAnonymous()) { profileRow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.run(); } }); } }
Source:
private void migratePatchSetApprovals(ReviewDb db, LegacyLabelTypes labelTypes) throws SQLException { PreparedStatement stmt = ((JdbcSchema) db).getConnection().prepareStatement( "UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?"); try { for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) { stmt.clearParameters(); stmt.setString(1, type.getName()); stmt.setString(2, type.getId()); stmt.addBatch(); } stmt.executeBatch(); } finally { stmt.close(); } }

Target:
private void migratePatchSetApprovals(ReviewDb db, LegacyLabelTypes labelTypes) throws SQLException { PreparedStatement stmt = ((JdbcSchema) db).getConnection().prepareStatement( "UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?"); try { for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) { stmt.setString(1, type.getName()); stmt.setString(2, type.getId()); stmt.addBatch(); } stmt.executeBatch(); } finally { stmt.close(); } }
Source:
public boolean performOk() { boolean result = super.performOk(); if (coreFields != null) { Iterator<FieldEditor> e = coreFields.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.store(); } } return result; }

Target:
public boolean performOk() { boolean result = super.performOk(); if (coreFields != null) { Iterator<FieldEditor> e = coreFields.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.store(); if (pe instanceof SpecificFieldEditor) { ((SpecificFieldEditor) pe).setPresentsDefaultValue(false); } } } return result; }
Source:
protected boolean isCPOEValid() { for (String crit : CPOE_CRITERIA_OR) { if (null != criteriaMet.get(crit)) { this.counts.put("criteriaCpoeRequiredMet", 1); return true; } } SortedSet<String> missing1 = new TreeSet<String>(); missing1.addAll(CPOE_CRITERIA_OR); missingOr.add(missing1); return false; }

Target:
protected boolean isCPOEValid() { for (String crit : CPOE_CRITERIA_OR) { if (null != criteriaMet.get(crit)) { this.counts.put("criteriaCpoeRequiredMet", 1); return true; } } ArrayList<String> missing = new ArrayList<String>(); missing.addAll(CPOE_CRITERIA_OR); missingOr.add(missing); return false; }
Source:
public boolean saveOrAppendFile(File dest, InputStream stream) { String destPath = dest.getAbsolutePath(); try { LOGGER.trace("Appending file [" + destPath + "]"); systemService.streamToFile(stream, dest); LOGGER.trace("File [" + destPath + "] appended."); return true; } catch (IOException e) { LOGGER.error("Failed to save the file to : [" + destPath + "]", e); return false; } }

Target:
public boolean saveOrAppendFile(File dest, InputStream stream) { String destPath = dest.getAbsolutePath(); try { LOGGER.trace("Appending file [{}]", destPath); systemService.streamToFile(stream, dest); LOGGER.trace("File appended.", destPath); return true; } catch (IOException e) { LOGGER.error("Failed to save the file to : [{}]", destPath, e); return false; } }
Source:
public IEventBus receive(IMessage message) { CheckUtil.checkArg(message instanceof BaseMessage, "Accepts only BaseMessage instances"); receiveMessage((BaseMessage) message); queue(message); return this; }

Target:
public IEventBus receive(IMessage message) { CheckUtil.checkArg(message instanceof BaseMessage, "Accepts only BaseMessage instances"); receiveMessage((BaseMessage) message); return this; }
Source:
public void dragStart(DragSourceEvent event) { event.doit = !((event.data instanceof IPath) || (event.data instanceof Variable)); final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); LocalSelectionTransfer.getTransfer().setSelection(selection); }

Target:
public void dragStart(DragSourceEvent event) { final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); LocalSelectionTransfer.getTransfer().setSelection(selection); }
Source:
public static <E extends Endpoints<E>> E resolveWriteConflictsInPending(E natural, E pending) { return pending.without(natural.endpoints()); }

Target:
private static <E extends Endpoints<E>> E resolveWriteConflictsInPending(E natural, E pending) { return pending.without(natural.endpoints()); }
Source:
public void stop() { for (TestContextManager contextManager : contextManagerMap.values()) { try { contextManager.afterTestClass(); } catch (Exception e) { throw new CucumberException(e.getMessage(), e); } } contextManagerMap.clear(); GlueCodeContext.INSTANCE.stop(); applicationContext.getBeanFactory().destroySingletons(); }

Target:
public void stop() { notifyContextManagersAboutTestClassFinished(); GlueCodeContext.INSTANCE.stop(); applicationContext.getBeanFactory().destroySingletons(); }
Source:
public Status validateProjectResolverHandle(IProjectHandleResolver resolver, boolean setResolverValidation) { String resolvedHandle = resolver.buildResolvedHandle(resolver.getHandleExample()); if ((resolver.getResolvedHandleExample()).equals(resolvedHandle)) { setResolverStatus(resolver, setResolverValidation, Status.PASSED); return Status.PASSED; } else { setResolverStatus(resolver, setResolverValidation, Status.FAILED); return Status.FAILED; } }

Target:
public Status validateProjectResolverHandle(IProjectHandleResolver resolver, boolean setResolverValidation) { String resolvedHandle; try { resolvedHandle = resolver.buildResolvedHandle(resolver.getHandleExample()); } catch (PatternSyntaxException e) { return Status.FAILED; } Status status = (resolver.getResolvedHandleExample()).equals(resolvedHandle) ? Status.PASSED : Status.FAILED; if (setResolverValidation) { resolver.setValidation(status); saveProjectHandleResolver(resolver, resolver.getUsername()); } return status; }
Source:
protected AbstractTreeIterator[] mergeBases() throws IOException { final int numsourceTrees = sourceTrees.length; int commitIdx = 0; RevTree tempTrees[] = new RevTree[MAX_BASES]; AbstractTreeIterator tempIterators[] = new AbstractTreeIterator[MAX_BASES]; if (baseTrees == null) { baseTrees = new RevTree[MAX_BASES]; baseTreeIterators = new AbstractTreeIterator[MAX_BASES]; } for (int aIdx = 0; aIdx < numsourceTrees; aIdx++) { for (int bIdx = aIdx + 1; bIdx < numsourceTrees; bIdx++) { List<RevCommit> baseCommits = getBaseCommits(aIdx, bIdx); for (RevCommit baseCommit : baseCommits) { if (commitIdx < MAX_BASES) { tempTrees[commitIdx] = baseCommit.getTree(); tempIterators[commitIdx] = openTree(baseCommit .getTree()); commitIdx++; } else { throw new IOException( MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, "TOO_MANY_BASES", sourceCommits[aIdx].name(), sourceCommits[bIdx].name(), Integer.valueOf(commitIdx), baseCommit.name())); } } } } if (commitIdx == 0) { baseTreeIterators[commitIdx] = new EmptyTreeIterator(); commitIdx++; } else { baseTrees = copyOf(tempTrees, commitIdx); baseTreeIterators = copyOf(tempIterators, commitIdx); } return copyOf(baseTreeIterators, baseTreeIterators.length); }

Target:
protected AbstractTreeIterator[] mergeBases() throws IOException { final int numsourceTrees = sourceTrees.length; int commitIdx = 0; RevTree tempTrees[] = new RevTree[MAX_BASES]; AbstractTreeIterator tempIterators[] = new AbstractTreeIterator[MAX_BASES]; if (baseTrees == null) { baseTrees = new RevTree[MAX_BASES]; baseTreeIterators = new AbstractTreeIterator[MAX_BASES]; } for (int aIdx = 0; aIdx < numsourceTrees; aIdx++) { for (int bIdx = aIdx + 1; bIdx < numsourceTrees; bIdx++) { List<RevCommit> baseCommits = getBaseCommits(aIdx, bIdx); for (RevCommit baseCommit : baseCommits) { if (commitIdx < MAX_BASES) { tempTrees[commitIdx] = baseCommit.getTree(); tempIterators[commitIdx] = openTree(baseCommit .getTree()); commitIdx++; } else { throw new IOException( MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, Integer.valueOf(MAX_BASES), sourceCommits[aIdx].name(), sourceCommits[bIdx].name(), Integer.valueOf(commitIdx), baseCommit.name())); } } } } if (commitIdx == 0) { baseTreeIterators[commitIdx] = new EmptyTreeIterator(); commitIdx++; } else { baseTrees = copyOf(tempTrees, commitIdx); baseTreeIterators = copyOf(tempIterators, commitIdx); } return copyOf(baseTreeIterators, baseTreeIterators.length); }
Source:
private boolean doAccept() { boolean accepted = false; SocketChannel sc = null; try { sc = acceptSocket.accept(); accepted = true; if (limitTotalNumberOfCnxns()) { accepted = false; return accepted; } InetAddress ia = sc.socket().getInetAddress(); int cnxncount = getClientCnxnCount(ia); if (maxClientCnxns > 0 && cnxncount >= maxClientCnxns) { throw new IOException("Too many connections from " + ia + " - max is " + maxClientCnxns); } LOG.debug("Accepted socket connection from {}", sc.socket().getRemoteSocketAddress()); sc.configureBlocking(false); if (!selectorIterator.hasNext()) { selectorIterator = selectorThreads.iterator(); } SelectorThread selectorThread = selectorIterator.next(); if (!selectorThread.addAcceptedConnection(sc)) { throw new IOException("Unable to add connection to selector queue" + (stopped ? " (shutdown in progress)" : "")); } acceptErrorLogger.flush(); } catch (IOException e) { ServerMetrics.getMetrics().CONNECTION_REJECTED.add(1); acceptErrorLogger.rateLimitLog("Error accepting new connection: " + e.getMessage()); fastCloseSock(sc); } return accepted; }

Target:
private boolean doAccept() { boolean accepted = false; SocketChannel sc = null; try { sc = acceptSocket.accept(); accepted = true; if (limitTotalNumberOfCnxns()) { throw new IOException("Too many connections max allowed is " + maxCnxns); } InetAddress ia = sc.socket().getInetAddress(); int cnxncount = getClientCnxnCount(ia); if (maxClientCnxns > 0 && cnxncount >= maxClientCnxns) { throw new IOException("Too many connections from " + ia + " - max is " + maxClientCnxns); } LOG.debug("Accepted socket connection from {}", sc.socket().getRemoteSocketAddress()); sc.configureBlocking(false); if (!selectorIterator.hasNext()) { selectorIterator = selectorThreads.iterator(); } SelectorThread selectorThread = selectorIterator.next(); if (!selectorThread.addAcceptedConnection(sc)) { throw new IOException("Unable to add connection to selector queue" + (stopped ? " (shutdown in progress)" : "")); } acceptErrorLogger.flush(); } catch (IOException e) { ServerMetrics.getMetrics().CONNECTION_REJECTED.add(1); acceptErrorLogger.rateLimitLog("Error accepting new connection: " + e.getMessage()); fastCloseSock(sc); } return accepted; }
Source:
public void testCopyDirectoryTree() throws IOException { final Path copyToDir = Files.createTempDirectory("copyToDir"); copyToDir.toFile().deleteOnExit(); IOUtil.copyDirectoryTree(TEST_VARIANT_DIR.toFile(), copyToDir.toFile()); final Stream<Path> fileStream = Files.walk(TEST_VARIANT_DIR); final Stream<Path> copyFileStream = Files.walk(copyToDir); final Iterator<Path> itFileStream = fileStream.iterator(); final Iterator<Path> itCopyFileStream = copyFileStream.iterator(); final List<String> listFiles = new ArrayList<String>(); final List<String> listCopyFiles = new ArrayList<String>(); while (itFileStream.hasNext()) { final Path thisPath = itFileStream.next(); if (!thisPath.equals(TEST_VARIANT_DIR)) { listFiles.add(thisPath.getFileName().toString()); } } while (itCopyFileStream.hasNext()) { final Path thisPath = itCopyFileStream.next(); thisPath.toFile().deleteOnExit(); if (!thisPath.equals(copyToDir)) { listCopyFiles.add(thisPath.getFileName().toString()); } } Assert.assertEqualsNoOrder(listFiles.toArray(new String[listFiles.size()]), listCopyFiles.toArray(new String[listCopyFiles.size()])); }

Target:
public void testCopyDirectoryTree() throws IOException { final Path copyToDir = Files.createTempDirectory("copyToDir"); copyToDir.toFile().deleteOnExit(); IOUtil.copyDirectoryTree(TEST_VARIANT_DIR.toFile(), copyToDir.toFile()); final List<Path> collect = Files.walk(TEST_VARIANT_DIR).filter(f -> !f.equals(TEST_VARIANT_DIR)).map(p -> p.getFileName()).collect(Collectors.toList()); final List<Path> collectCopy = Files.walk(copyToDir).filter(f -> !f.equals(copyToDir)).map(p -> p.getFileName()).collect(Collectors.toList()); Assert.assertEqualsNoOrder(collect.toArray(), collectCopy.toArray()); }
Source:
public boolean equals(@Nullable Object object) { if (!(object instanceof IntegerStateValue)) { return false; } IntegerStateValue other = (IntegerStateValue) object; return this.unboxInt() == other.unboxInt(); }

Target:
public boolean equals(@Nullable Object object) { if (!(object instanceof IntegerStateValue)) { return false; } IntegerStateValue other = (IntegerStateValue) object; return this.value == other.value; }