auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void process(final SonarLintJob job, ProgressIndicator indicator, final Collection<Issue> rawIssues, Collection<ClientInputFile> failedAnalysisFiles) { long start = System.currentTimeMillis(); Map<VirtualFile, Collection<LiveIssue>> transformedIssues = ReadAction.compute(() -> { Map<VirtualFile, Collection<LiveIssue>> issues = transformIssues(rawIssues, job.allFiles(), failedAnalysisFiles); manager.store(issues); return issues; }); Set<VirtualFile> failedVirtualFiles = asVirtualFiles(failedAnalysisFiles); if (failedVirtualFiles.containsAll(job.allFiles())) { console.debug(""); } else { logFoundIssuesIfAny(rawIssues, start, transformedIssues); } if (shouldUpdateServerIssues(job.trigger())) { Map<Module, Collection<VirtualFile>> filesWithIssuesPerModule = new LinkedHashMap<>(); for (Map.Entry<Module, Collection<VirtualFile>> e : job.filesPerModule().entrySet()) { Collection<VirtualFile> moduleFilesWithIssues = e.getValue().stream() .filter(f -> !transformedIssues.getOrDefault(f, Collections.emptyList()).isEmpty()) .collect(Collectors.toList()); if (!moduleFilesWithIssues.isEmpty()) { filesWithIssuesPerModule.put(e.getKey(), moduleFilesWithIssues); } } if (!filesWithIssuesPerModule.isEmpty()) { serverIssueUpdater.fetchAndMatchServerIssues(filesWithIssuesPerModule, indicator, job.waitForServerIssues()); } } AnalysisCallback callback = job.callback(); if (callback != null) { callback.onSuccess(failedVirtualFiles); } }

Target:
public void process(final SonarLintJob job, ProgressIndicator indicator, final Collection<Issue> rawIssues, Collection<ClientInputFile> failedAnalysisFiles) { long start = System.currentTimeMillis(); Map<VirtualFile, Collection<LiveIssue>> transformedIssues = ReadAction.compute(() -> { Map<VirtualFile, Collection<LiveIssue>> issues = transformIssues(rawIssues, job.allFiles(), failedAnalysisFiles); manager.store(issues); return issues; }); Set<VirtualFile> failedVirtualFiles = asVirtualFiles(failedAnalysisFiles); if (! failedVirtualFiles.containsAll(job.allFiles())) { logFoundIssuesIfAny(rawIssues, start, transformedIssues); } if (shouldUpdateServerIssues(job.trigger())) { Map<Module, Collection<VirtualFile>> filesWithIssuesPerModule = new LinkedHashMap<>(); for (Map.Entry<Module, Collection<VirtualFile>> e : job.filesPerModule().entrySet()) { Collection<VirtualFile> moduleFilesWithIssues = e.getValue().stream() .filter(f -> !transformedIssues.getOrDefault(f, Collections.emptyList()).isEmpty()) .collect(Collectors.toList()); if (!moduleFilesWithIssues.isEmpty()) { filesWithIssuesPerModule.put(e.getKey(), moduleFilesWithIssues); } } if (!filesWithIssuesPerModule.isEmpty()) { serverIssueUpdater.fetchAndMatchServerIssues(filesWithIssuesPerModule, indicator, job.waitForServerIssues()); } } AnalysisCallback callback = job.callback(); if (callback != null) { callback.onSuccess(failedVirtualFiles); } }
Source:
AggregateMetricSenderSessionWrapper( AggregateMetricSender.Session metricSenderSession, Set<SignalFxReporter.MetricDetails> detailsToAdd, MetricMetadata metricMetadata, String defaultSourceName, String sourceDimension) { this(metricSenderSession, detailsToAdd, metricMetadata, defaultSourceName, sourceDimension, false, ImmutableMap.<String, String> of()); }

Target:
AggregateMetricSenderSessionWrapper( AggregateMetricSender.Session metricSenderSession, Set<SignalFxReporter.MetricDetails> detailsToAdd, MetricMetadata metricMetadata, String defaultSourceName, String sourceDimension) { this(metricSenderSession, detailsToAdd, metricMetadata, defaultSourceName, sourceDimension, false, Collections.<String, DimensionInclusion> emptyMap()); }
Source:
private void checkProgramRecords() { final SamReader in = SamReaderFactory .makeDefault() .referenceSequence(REFERENCE_SEQUENCE) .open(INPUT); for (final SAMProgramRecord pg : in.getFileHeader().getProgramRecords()) { if (pg.getProgramName() != null && pg.getProgramName().equals(PG_PROGRAM_NAME)) { String outText = "Found previous Program Record that indicates that this BAM has been downsampled already with this program. Operation not supported! Previous PG: " + pg.toString(); if (ALLOW_MULTIPLE_DOWNSAMPLING_DESPITE_WARNINGS) { log.warn(outText); } else { log.error(outText); throw new PicardException(outText); } } } CloserUtil.close(in); }

Target:
private void checkProgramRecords() { final SamReader in = SamReaderFactory .makeDefault() .referenceSequence(REFERENCE_SEQUENCE) .open(INPUT); for (final SAMProgramRecord pg : in.getFileHeader().getProgramRecords()) { if (pg.getProgramName() != null && pg.getProgramName().equals(PG_PROGRAM_NAME)) { final String outText = "Found previous Program Record that indicates that this BAM has been downsampled already with this program. Operation not supported! Previous PG: " + pg.toString(); if (ALLOW_MULTIPLE_DOWNSAMPLING_DESPITE_WARNINGS) { log.warn(outText); } else { log.error(outText); throw new PicardException(outText); } } } CloserUtil.close(in); }
Source:
public void testDeleteRelationInCatalog() throws Exception { ingestTestDataset(); Set<Integer> workers = server.getWorkersForRelation(relationKey, null); assertTrue(workers.size() == workerIDs.length); JsonAPIUtils.deleteDataset("localhost", masterDaemonPort, relationKey.getUserName(), relationKey.getProgramName(), relationKey.getRelationName()); workers = server.getWorkersForRelation(relationKey, null); assertTrue(workers == null); }

Target:
public void testDeleteRelationInCatalog() throws Exception { ingestTestDataset(); JsonAPIUtils.deleteDataset("localhost", masterDaemonPort, relationKey.getUserName(), relationKey.getProgramName(), relationKey.getRelationName()); assertTrue(server.getDatasetStatus(relationKey) == null); }
Source:
private void expire(String correlationId) { final SettableListenableFuture<Message<?>> future = JmsOutboundGateway.this.futures .remove(correlationId); if (future != null) { try { if (getRequiresReply()) { future.setException(new JmsTimeoutException("No reply in " + this.receiveTimeout + " ms")); } else { if (logger.isDebugEnabled()) { logger.debug("Reply expired and reply not required for " + correlationId); } } } catch (Exception e) { logger.error("Exception while expiring future"); } } }

Target:
private void expire(String correlationId) { final SettableListenableFuture<AbstractIntegrationMessageBuilder<?>> future = this.futures.remove(correlationId); if (future != null) { try { if (getRequiresReply()) { future.setException(new JmsTimeoutException("No reply in " + this.receiveTimeout + " ms")); } else { if (logger.isDebugEnabled()) { logger.debug("Reply expired and reply not required for " + correlationId); } } } catch (Exception e) { logger.error("Exception while expiring future"); } } }
Source:
public void close() throws IOException { if (closed) { return; } closed = true; if (!bufferedPages.isEmpty()) { dataSink.write(bufferedPages); addStripeOffset(bufferedBytes); } dataSink.write(ImmutableList.of(new PageFileFooterOutput(stripeOffsets))); dataSink.close(); }

Target:
public void close() throws IOException { if (closed) { return; } closed = true; if (!bufferedPages.isEmpty()) { flushStripe(); } dataSink.write(ImmutableList.of(new PageFileFooterOutput(stripeOffsets))); dataSink.close(); }
Source:
private RowMapper<?> rowMapperFor(Type type) throws SQLException { if (rowMappers.containsKey(type)) { return rowMappers.get(type); } RowMapper<?> mapper = ctx.findRowMapperFor(type) .orElseThrow(() -> new UnableToExecuteStatementException("No row mapper for " + type, ctx)) .memoize(rs, ctx); rowMappers.put(type, mapper); return mapper; }

Target:
private RowMapper<?> rowMapperFor(Type type) throws SQLException { if (rowMappers.containsKey(type)) { return rowMappers.get(type); } RowMapper<?> mapper = ctx.findRowMapperFor(type) .orElseThrow(() -> new UnableToExecuteStatementException("No row mapper for " + type, ctx)) .specialize(rs, ctx); rowMappers.put(type, mapper); return mapper; }
Source:
public void testStore() throws Exception { Checkpoint mockCheckpoint = mock(Checkpoint.class); PowerMockito.mockStatic(CheckpointManager.SaveInstanceStateRequest.class); CheckpointManager.SaveInstanceStateRequest mockSaveInstanceStateRequest = mock(CheckpointManager.SaveInstanceStateRequest.class); when(mockCheckpoint.checkpoint()).thenReturn(mockSaveInstanceStateRequest); FSDataOutputStream mockFSDateOutpurStream = mock(FSDataOutputStream.class); when(mockFileSystem.create(any(Path.class))).thenReturn(mockFSDateOutpurStream); doReturn(true).when(hdfsStorage).createDirs(anyString()); hdfsStorage.store(mockCheckpoint); verify(mockSaveInstanceStateRequest).writeTo(mockFSDateOutpurStream); }

Target:
public void testStore() throws Exception { PowerMockito.mockStatic(CheckpointManager.InstanceStateCheckpoint.class); CheckpointManager.InstanceStateCheckpoint mockCheckpointState = mock(CheckpointManager.InstanceStateCheckpoint.class); Checkpoint checkpoint = new Checkpoint(StatefulStorageTestContext.TOPOLOGY_NAME, instance, mockCheckpointState); FSDataOutputStream mockFSDateOutputStream = mock(FSDataOutputStream.class); when(mockFileSystem.create(any(Path.class))).thenReturn(mockFSDateOutputStream); doNothing().when(hdfsStorage).createDir(anyString()); hdfsStorage.store(checkpoint); verify(mockCheckpointState).writeTo(mockFSDateOutputStream); }
Source:
private synchronized void startPolling(final long pollIntervalMinutes) { validPollIntervalMinutes(pollIntervalMinutes); if (scheduledPollingFuture != null) { scheduledPollingFuture.cancel(true); LOGGER.debug( "Stopped the scheduled process to poll all of the current sources at a fixed rate"); } try { scheduledPollingFuture = scheduledExecutorService.scheduleAtFixedRate( () -> poll(pollIntervalMinutes), 0, pollIntervalMinutes, TimeUnit.MINUTES); } catch (final RejectedExecutionException e) { final String message = "Unable to schedule polling at at a fixed rate of " + pollIntervalMinutes + " minute(s)"; LOGGER.warn("{}. Try restarting.", message); throw new IllegalStateException(message, e); } LOGGER.debug( "Successfully scheduled a process to poll all of the current sources at a fixed rate of minute(s), where polls will time out at minute(s)", pollIntervalMinutes, pollIntervalMinutes); }

Target:
private void startPolling(final long pollIntervalMinutes) { if (!startPollingLock.tryLock()) { final String message = "Unable to start the schedule. Multiple threads may not start the schedule at the same time."; LOGGER.warn("{} The Poller will not be periodically updated. Try restarting the system."); throw new IllegalStateException(message); } try { doStartPolling(pollIntervalMinutes); } finally { startPollingLock.unlock(); } }
Source:
public static String appendPrefixHomeCommunityID(final String homeCommunityId) { return checkPrefixBeforeAppend(homeCommunityId, "urn:oid:"); }

Target:
public static String appendPrefixHomeCommunityID(final String homeCommunityId) { return checkPrefixBeforeAppend(homeCommunityId, NhincConstants.HCID_PREFIX); }
Source:
public boolean applies(Permanent permanent, Ability source, Game game) { boolean apply = false; if (permanent.getId().equals(source.getSourceId())) { apply = true; } return apply; }

Target:
public boolean applies(Permanent permanent, Ability source, Game game) { return Objects.equals(permanent.getId(), source.getSourceId()); }
Source:
String basicToString(int tab) { StringBuilder sb = new StringBuilder("\n"); for (int i = tab; --i >= 0;) { sb.append("\t"); } sb.append("--- Block Scope ---"); sb.append("\t"); sb.append("locals:"); for (int i = 0; i < this.localIndex; i++) { sb.append("\t"); sb.append(this.locals[i].toString()); } sb.append("startIndex = "); sb.append(this.startIndex); return sb.toString(); }

Target:
String basicToString(int tab) { StringBuilder sb = new StringBuilder("\n"); for (int i = tab; --i >= 0;) { sb.append("\t"); } sb.append("--- Block Scope ---"); sb.append("\t"); sb.append("locals:"); for (int i = 0; i < this.localIndex; i++) { sb.append("\t"); sb.append(this.locals[i]); } sb.append("startIndex = "); sb.append(this.startIndex); return sb.toString(); }
Source:
public void testRegexpForPackagesDefault() { String[] inputConfig = new String[]{"*"}; List<String> config = convertAllToPkgRegExps(inputConfig); logger.info(Arrays.asList(config).toString()); assertTrue(isPackageNameIncluded(Object.class.getPackage().getName(), config)); assertTrue(isPackageNameIncluded(ReactiveObject.class.getPackage().getName(), config)); assertTrue(isPackageNameIncluded("xyz.my", config)); }

Target:
public void testRegexpForPackagesDefault() { String[] inputConfig = new String[]{"*"}; List<String> config = convertAllToPkgRegExps(inputConfig); logger.info(config.toString()); assertTrue(isPackageNameIncluded(Object.class.getPackage().getName(), config)); assertTrue(isPackageNameIncluded(ReactiveObject.class.getPackage().getName(), config)); assertTrue(isPackageNameIncluded("xyz.my", config)); }
Source:
public TimestampIncrementingTableQuerier(DatabaseDialect dialect, QueryMode mode, String name, String topicPrefix, List<String> timestampColumnNames, String incrementingColumnName, Map<String, Object> offsetMap, Long timestampDelay, TimeZone timeZone, String suffix) { super(dialect, mode, name, topicPrefix); this.incrementingColumnName = incrementingColumnName; this.timestampColumnNames = timestampColumnNames != null ? timestampColumnNames : Collections.<String>emptyList(); this.timestampDelay = timestampDelay; this.offset = TimestampIncrementingOffset.fromMap(offsetMap); this.timestampColumns = new ArrayList<>(); for (String timestampColumn : this.timestampColumnNames) { if (timestampColumn != null && !timestampColumn.isEmpty()) { timestampColumns.add(new ColumnId(tableId, timestampColumn)); } } switch (mode) { case TABLE: String tableName = tableId.tableName(); topic = topicPrefix + tableName; partition = OffsetProtocols.sourcePartitionForProtocolV1(tableId); break; case QUERY: partition = Collections.singletonMap(JdbcSourceConnectorConstants.QUERY_NAME_KEY, JdbcSourceConnectorConstants.QUERY_NAME_VALUE); topic = topicPrefix; break; default: throw new ConnectException("Unexpected query mode: " + mode); } this.timeZone = timeZone; this.suffix = suffix; }

Target:
public TimestampIncrementingTableQuerier(DatabaseDialect dialect, QueryMode mode, String name, String topicPrefix, List<String> timestampColumnNames, String incrementingColumnName, Map<String, Object> offsetMap, Long timestampDelay, TimeZone timeZone, String suffix) { super(dialect, mode, name, topicPrefix, suffix); this.incrementingColumnName = incrementingColumnName; this.timestampColumnNames = timestampColumnNames != null ? timestampColumnNames : Collections.<String>emptyList(); this.timestampDelay = timestampDelay; this.offset = TimestampIncrementingOffset.fromMap(offsetMap); this.timestampColumns = new ArrayList<>(); for (String timestampColumn : this.timestampColumnNames) { if (timestampColumn != null && !timestampColumn.isEmpty()) { timestampColumns.add(new ColumnId(tableId, timestampColumn)); } } switch (mode) { case TABLE: String tableName = tableId.tableName(); topic = topicPrefix + tableName; partition = OffsetProtocols.sourcePartitionForProtocolV1(tableId); break; case QUERY: partition = Collections.singletonMap(JdbcSourceConnectorConstants.QUERY_NAME_KEY, JdbcSourceConnectorConstants.QUERY_NAME_VALUE); topic = topicPrefix; break; default: throw new ConnectException("Unexpected query mode: " + mode); } this.timeZone = timeZone; }
Source:
private boolean handleLogin(HttpServletRequest httpRequest, HttpServletResponse httpResponse) { String baseURL = service.getBaseURL(httpRequest); for (String pluginName : service.getAuthChain(httpRequest)) { NuxeoAuthenticationPlugin plugin = service.getPlugin(pluginName); AuthenticationPluginDescriptor descriptor = service.getDescriptor(pluginName); if (Boolean.TRUE.equals(plugin.needLoginPrompt(httpRequest))) { if (descriptor.getNeedStartingURLSaving()) { saveRequestedURLBeforeRedirect(httpRequest, httpResponse); } HttpServletResponse response = new HttpServletResponseWrapper(httpResponse) { @Override public void sendRedirect(String location) throws IOException { HttpServletResponse response = (HttpServletResponse) getResponse(); StringBuilder sb = new StringBuilder(); sb.append("<script type=\"text/javascript\">\n"); sb.append("document.cookie = '" + NXAuthConstants.START_PAGE_FRAGMENT_KEY + "=' + window.location.hash.substring(1) + '; path=/';\n"); sb.append("window.location = '" + location + "';\n"); sb.append("</script>"); String script = sb.toString(); response.setStatus(SC_UNAUTHORIZED); response.setContentType("text/html;charset=UTF-8"); response.setContentLength(script.length()); response.getWriter().write(script); } }; return Boolean.TRUE.equals(plugin.handleLoginPrompt(httpRequest, response, baseURL)); } } log.warn("No auth plugin can be found to do the Login Prompt"); return false; }

Target:
private boolean handleLogin(HttpServletRequest httpRequest, HttpServletResponse httpResponse) { String baseURL = service.getBaseURL(httpRequest); for (String pluginName : service.getAuthChain(httpRequest)) { NuxeoAuthenticationPlugin plugin = service.getPlugin(pluginName); AuthenticationPluginDescriptor descriptor = service.getDescriptor(pluginName); if (Boolean.TRUE.equals(plugin.needLoginPrompt(httpRequest))) { if (descriptor.getNeedStartingURLSaving()) { saveRequestedURLBeforeRedirect(httpRequest, httpResponse); } HttpServletResponse response = new HttpServletResponseWrapper(httpResponse) { @Override public void sendRedirect(String location) throws IOException { HttpServletResponse response = (HttpServletResponse) getResponse(); StringBuilder sb = new StringBuilder(); sb.append("<script type=\"text/javascript\">\n"); sb.append("var h = window.location.hash.substring(1) || '';"); sb.append("document.cookie = '" + NXAuthConstants.START_PAGE_FRAGMENT_KEY + "=' + h.replace(/'/g, '\\\''); + '; path=/';\n"); sb.append("window.location = '" + location + "';\n"); sb.append("</script>"); String script = sb.toString(); response.setStatus(SC_UNAUTHORIZED); response.setContentType("text/html;charset=UTF-8"); response.setContentLength(script.length()); response.getWriter().write(script); } }; return Boolean.TRUE.equals(plugin.handleLoginPrompt(httpRequest, response, baseURL)); } } log.warn("No auth plugin can be found to do the Login Prompt"); return false; }
Source:
public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); delete( "/forms/:id", APPLICATION_JSON, (req, res) -> { String id = req.params(":id"); catalogFramework.delete(new DeleteRequestImpl(id)); return ImmutableMap.of("message", "Successfully deleted."); }, util::getJson); }

Target:
public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); delete( "/forms/:id", APPLICATION_JSON, (req, res) -> { String id = req.params(":id"); DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(id)); if (!deleteResponse.getProcessingErrors().isEmpty()) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of("message", "Failed to delete."); } return ImmutableMap.of("message", "Successfully deleted."); }, util::getJson); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((actionType == null) ? 0 : actionType.hashCode()); result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + (isVisible ? 1231 : 1237); result = prime * result + ((jobSubjectEntities == null) ? 0 : jobSubjectEntities.hashCode()); result = prime * result + ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode()); result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((steps == null) ? 0 : steps.hashCode()); result = prime * result + (external ? 1231 : 1237); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((actionType == null) ? 0 : actionType.hashCode()); result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + (isVisible ? 1231 : 1237); result = prime * result + ((jobSubjectEntities == null) ? 0 : jobSubjectEntities.hashCode()); result = prime * result + ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode()); result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((steps == null) ? 0 : steps.hashCode()); result = prime * result + (external ? 1231 : 1237); result = prime * result + (autoCleared ? 1231 : 1237); return result; }
Source:
protected Intent buildIntentForUri(Uri uri) { return new Intent(Intent.ACTION_VIEW, uri); }

Target:
Intent buildIntentForUri(Uri uri) { return new Intent(Intent.ACTION_VIEW, uri); }
Source:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); vmDeviceDao.update(vmDevice); }

Target:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); getCompensationContext().snapshotEntity(vmDevice); vmDeviceDao.update(vmDevice); getCompensationContext().stateChanged(); }
Source:
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); xml.optAttribute("height", height) .optAttribute("width", width) .rightAngleBracket(); if (!xmlEnvironment.getNamespace().contentEquals(NAMESPACE)) { xmlEnvironment = XmlEnvironment.builder() .withNamespace(MediaElement.NAMESPACE) .withNext(null) .build(); } xml.append(uris, xmlEnvironment); xml.closeElement(this); return xml; }

Target:
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); xml.optAttribute("height", height) .optAttribute("width", width) .rightAngleBracket(); if (!NAMESPACE.contentEquals(xmlEnvironment.getNamespace())) { xmlEnvironment = XmlEnvironment.builder() .withNamespace(MediaElement.NAMESPACE) .withNext(null) .build(); } xml.append(uris, xmlEnvironment); xml.closeElement(this); return xml; }
Source:
public void getAltNetwork() { class AltNetwork extends MainNetParams { private AltNetwork() { super(); id = "alt.network"; addressHeader = 48; p2shHeader = 5; } } AltNetwork altNetwork = new AltNetwork(); Networks.register(altNetwork); NetworkParameters params = LegacyAddress.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); assertEquals(altNetwork.getId(), params.getId()); params = LegacyAddress.getParametersFromAddress("17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL"); assertEquals(MAINNET.getId(), params.getId()); Networks.unregister(altNetwork); try { LegacyAddress.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); fail(); } catch (AddressFormatException e) { } }

Target:
public void getAltNetwork() { class AltNetwork extends MainNetParams { AltNetwork() { super(); id = "alt.network"; addressHeader = 48; p2shHeader = 5; } } AltNetwork altNetwork = new AltNetwork(); Networks.register(altNetwork); NetworkParameters params = LegacyAddress.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); assertEquals(altNetwork.getId(), params.getId()); params = LegacyAddress.getParametersFromAddress("17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL"); assertEquals(MAINNET.getId(), params.getId()); Networks.unregister(altNetwork); try { LegacyAddress.getParametersFromAddress("LLxSnHLN2CYyzB5eWTR9K9rS9uWtbTQFb6"); fail(); } catch (AddressFormatException e) { } }
Source:
public SELF isEmpty() { isNotNull(); isFlipped(); if (actual.limit() != 0) throwAssertionError(shouldBeEmpty(actual)); return myself; }

Target:
public SELF isEmpty() { isNotNull(); if (actual.position() != actual.limit()) throwAssertionError(shouldBeEmpty(actual)); return myself; }
Source:
public void onPause() { scrollPosition = translationView.findFirstCompletelyVisibleItemPosition(); ayahTrackerPresenter.unbind(this); presenter.unbind(this); super.onPause(); }

Target:
public void onPause() { ayahTrackerPresenter.unbind(this); presenter.unbind(this); super.onPause(); }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("PlaceRequest(nameToken="); builder.append(nameToken); builder.append(", params="); builder.append(params); builder.append(")"); return builder.toString(); }

Target:
public String toString() { return "PlaceRequest(nameToken=" + nameToken + ", params=" + params + ")"; }
Source:
public void createAsynchronousServiceBusReceiverWithAad() { DefaultAzureCredential credential = new DefaultAzureCredentialBuilder() .build(); ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .credential("<<fully-qualified-namespace>>", credential) .buildReceiverClientBuilder() .queueName("<<queue-name>>") .buildAsyncClient(); }

Target:
public void createAsynchronousServiceBusReceiverWithAad() { ClientSecretCredential credential = new ClientSecretCredentialBuilder() .clientId("<< APPLICATION (CLIENT) ID >>") .clientSecret("<< APPLICATION SECRET >>") .tenantId("<< TENANT ID >>") .build(); ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .credential("<<fully-qualified-namespace>>", credential) .receiver() .queueName("<<queue-name>>") .buildAsyncClient(); }
Source:
private void writeFeed(Writer writer, Feed feed, String feedTemplate) throws IOException { String feedInfo = feedTemplate .replaceAll("\\{FEED_IMG\\}", feed.getImageUrl()) .replaceAll("\\{FEED_TITLE\\}", feed.getTitle()) .replaceAll("\\{FEED_LINK\\}", feed.getLink()) .replaceAll("\\{FEED_WEBSITE\\}", feed.getDownload_url()); writer.append(feedInfo); }

Target:
private void writeFeed(Writer writer, Feed feed, String feedTemplate) throws IOException { String feedInfo = feedTemplate .replace("{FEED_IMG}", feed.getImageUrl()) .replace("{FEED_TITLE}", feed.getTitle()) .replace("{FEED_LINK}", feed.getLink()) .replace("{FEED_WEBSITE}", feed.getDownload_url()); writer.append(feedInfo); }
Source:
public void testWrongChunkFormat1() throws IOException { Path foo = scratch.file("/root/foo.cc", "#include <stdio.h>", "", "void main(){", " printf(\"Hello foo\");", "}"); Path patchFile = scratch.file("/root/patchfile", "diff --git a/foo.cc b/foo.cc", "index f3008f9..ec4aaa0 100644", "--- a/foo.cc", "+++ b/foo.cc", "@@ -2,4 +2,5 @@", " ", " void main(){", " printf(\"Hello foo\");", "+ printf(\"Hello from patch\");", "+", " }"); PatchFailedException expected = assertThrows( PatchFailedException.class, () -> PatchUtil.apply(patchFile, 1, root)); assertThat(expected).hasMessageThat() .contains("Wrong chunk detected near line 11: }"); }

Target:
public void testWrongChunkFormat1() throws IOException { Path foo = scratch.file("/root/foo.cc", "#include <stdio.h>", "", "void main(){", " printf(\"Hello foo\");", "}"); Path patchFile = scratch.file("/root/patchfile", "diff --git a/foo.cc b/foo.cc", "index f3008f9..ec4aaa0 100644", "--- a/foo.cc", "+++ b/foo.cc", "@@ -2,4 +2,5 @@", " ", " void main(){", " printf(\"Hello foo\");", "+ printf(\"Hello from patch\");", "+", " }"); PatchFailedException expected = assertThrows( PatchFailedException.class, () -> PatchUtil.apply(patchFile, 1, root)); assertThat(expected).hasMessageThat() .contains("Wrong chunk detected near line 11: }, does not expect an equal line here."); }
Source:
private boolean setArtworkFromMetadata(Metadata metadata) { boolean isArtworkSet = false; int currentPicType = -1; for (int i = 0; i < metadata.length(); i++) { Metadata.Entry metadataEntry = metadata.get(i); int picType; byte[] bitmapData; if (metadataEntry instanceof ApicFrame) { bitmapData = ((ApicFrame) metadataEntry).pictureData; picType = ((ApicFrame) metadataEntry).pictureType; } else if (metadataEntry instanceof PictureFrame) { bitmapData = ((PictureFrame) metadataEntry).pictureData; picType = ((PictureFrame) metadataEntry).pictureType; } else { continue; } if (currentPicType != PICTURE_TYPE_FRONT_COVER) { Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length); isArtworkSet = setDrawableArtwork(new BitmapDrawable(getResources(), bitmap)); currentPicType = picType; } } return isArtworkSet; }

Target:
private boolean setArtworkFromMetadata(Metadata metadata) { boolean isArtworkSet = false; int currentPictureType = PICTURE_TYPE_NOT_SET; for (int i = 0; i < metadata.length(); i++) { Metadata.Entry metadataEntry = metadata.get(i); int pictureType; byte[] bitmapData; if (metadataEntry instanceof ApicFrame) { bitmapData = ((ApicFrame) metadataEntry).pictureData; pictureType = ((ApicFrame) metadataEntry).pictureType; } else if (metadataEntry instanceof PictureFrame) { bitmapData = ((PictureFrame) metadataEntry).pictureData; pictureType = ((PictureFrame) metadataEntry).pictureType; } else { continue; } if (currentPictureType == PICTURE_TYPE_NOT_SET || pictureType == PICTURE_TYPE_FRONT_COVER) { Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length); isArtworkSet = setDrawableArtwork(new BitmapDrawable(getResources(), bitmap)); currentPictureType = pictureType; if (currentPictureType == PICTURE_TYPE_FRONT_COVER) { break; } } } return isArtworkSet; }
Source:
public DataverseRequest(User aUser, HttpServletRequest aHttpServletRequest) { this.user = aUser; String saneDefault = undefined; String remoteAddressStr = saneDefault; IpAddress address = null; if (aHttpServletRequest != null) { if (headerToUse != null && ALLOWED_HEADERS.contains(headerToUse.toLowerCase())) { Enumeration<String> ipEnumeration = aHttpServletRequest.getHeaders(headerToUse); if (ipEnumeration.hasMoreElements()) { String ip = ipEnumeration.nextElement(); while (ipEnumeration.hasMoreElements()) { ip = ipEnumeration.nextElement(); } int index = ip.indexOf(','); if (index >= 0) { ip = ip.substring(index + 1); } if (ip != null) { try { address = IpAddress.valueOf(ip); } catch (IllegalArgumentException iae) { logger.warning("Ignoring invalid IP address received in header " + headerToUse + " : " + ip); address = null; } if (address!= null && address.isLocalhost()) { logger.warning("Ignoring localhost received as IP address in header " + headerToUse + " : " + ip); address = null; } } } if (address == null) { String remoteAddressFromRequest = aHttpServletRequest.getRemoteAddr(); if (remoteAddressFromRequest != null) { remoteAddressStr = remoteAddressFromRequest; try { address = IpAddress.valueOf(remoteAddressStr); } catch (IllegalArgumentException iae) { address = IpAddress.valueOf(saneDefault); } } } } } sourceAddress = address; }

Target:
public DataverseRequest(User aUser, HttpServletRequest aHttpServletRequest) { this.user = aUser; IpAddress address = null; if (aHttpServletRequest != null) { if (headerToUse != null) { Enumeration<String> ipEnumeration = aHttpServletRequest.getHeaders(headerToUse); if (ipEnumeration.hasMoreElements()) { String ip = ipEnumeration.nextElement(); while (ipEnumeration.hasMoreElements()) { ip = ipEnumeration.nextElement(); } int index = ip.lastIndexOf(','); if (index >= 0) { ip = ip.substring(index + 1); } if (ip != null) { try { address = IpAddress.valueOf(ip); } catch (IllegalArgumentException iae) { logger.warning("Ignoring invalid IP address received in header " + headerToUse + " : " + ip); address = null; } if (address!= null && address.isLocalhost()) { logger.warning("Ignoring localhost received as IP address in header " + headerToUse + " : " + ip); address = null; } } } } if (address == null) { String remoteAddressFromRequest = aHttpServletRequest.getRemoteAddr(); if (remoteAddressFromRequest != null) { String remoteAddressStr = remoteAddressFromRequest; try { address = IpAddress.valueOf(remoteAddressStr); } catch (IllegalArgumentException iae) { address = IpAddress.valueOf(undefined); } } } } sourceAddress = address; }
Source:
public EventDiskCache(Tracker tracker) { File baseDir = new File(tracker.getPiwik().getContext().getCacheDir(), CACHE_DIR_NAME); mCacheDir = new File(baseDir, tracker.getAPIUrl().getHost() + "_" + tracker.getAPIUrl().getPort()); File[] storedContainers = mCacheDir.listFiles(); if (storedContainers != null) { Arrays.sort(storedContainers); mEventContainer.addAll(Arrays.asList(storedContainers)); } else mCacheDir.mkdirs(); }

Target:
public EventDiskCache(Tracker tracker) { mMaxAge = tracker.getOfflineCacheAge(); mMaxSize = tracker.getOfflineCacheSize(); File baseDir = new File(tracker.getPiwik().getContext().getCacheDir(), CACHE_DIR_NAME); mCacheDir = new File(baseDir, tracker.getAPIUrl().getHost()); File[] storedContainers = mCacheDir.listFiles(); if (storedContainers != null) { Arrays.sort(storedContainers); for (File container : storedContainers) { mCurrentSize += container.length(); mEventContainer.add(container); } } else { if (!mCacheDir.mkdirs()) Timber.tag(TAG).e("Failed to make disk-cache dir %s", mCacheDir); } }
Source:
public void deleteModelWithResponse() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModelWithResponse(modelId).subscribe(val -> System.out.printf("Model ID = %s is deleted%n", modelId)); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.deleteModelWithResponse#string-string }

Target:
public void deleteModelWithResponse() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModelWithResponse(modelId).subscribe(response -> { System.out.printf("Response Status Code: %d.", response.getStatusCode()); System.out.printf("Model Id: %s is deleted%n", modelId); }); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.deleteModelWithResponse#string }
Source:
public TmfGraphBuildRequest(ITmfGraphProvider provider, IProgressMonitor monitor) { super(TmfEvent.class, TmfTimeRange.ETERNITY, 0, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND); fProvider = provider; long nbEvents = provider.getTrace().getNbEvents(); fEventFactor = Math.max(DEFAULT_FACTOR, nbEvents / DEFAULT_FACTOR); fMonitor = SubMonitor.convert(monitor, DEFAULT_FACTOR + 2); }

Target:
public TmfGraphBuildRequest(ITmfGraphProvider provider, IProgressMonitor monitor) { super(TmfEvent.class, TmfTimeRange.ETERNITY, 0, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND); fProvider = provider; long nbEvents = provider.getTrace().getNbEvents(); fEventFactor = Math.max(1, nbEvents / DEFAULT_FACTOR); fMonitor = SubMonitor.convert(monitor, DEFAULT_FACTOR); }
Source:
public <T> List<T> listServices(Class<T> clazz, String filterString) throws InvalidSyntaxException { Filter filter = makeFilter(clazz, filterString); ServiceTracker tracker = new ServiceTracker(bundleContext, filter, null); return getListFromTracker(tracker); }

Target:
public <T> List<T> listServices(Class<T> clazz, String filterString) throws IllegalArgumentException { Filter filter = makeFilter(clazz, filterString); ServiceTracker tracker = new ServiceTracker(bundleContext, filter, null); return getListFromTracker(tracker); }
Source:
private void processVmsWithDevicesChange() { if (!VmDeviceCommonUtils.isOldClusterVersion(vdsManager.getGroupCompatibilityVersion())) { if (!vmsWithChangedDevices.isEmpty()) { ArrayList<String> vmsToUpdate = new ArrayList<>(vmsWithChangedDevices.size()); for (Pair<VM, VmInternalData> pair : vmsWithChangedDevices) { Guid vmId = pair.getFirst().getId(); VmAnalyzer vmAnalyzer = vmAnalyzers.stream() .filter(analyzer -> vmId.equals(analyzer.getVdsmVm().getVmDynamic().getId())) .collect(Collectors.toList()) .get(0); if (vmAnalyzer.getVmDynamicToSave() != null) { vmAnalyzer.getVmDynamicToSave().setHash(pair.getSecond().getVmDynamic().getHash()); vmsToUpdate.add(vmId.toString()); } else { log.warn("VM '{}' not in changed list, skipping devices update.", vmId); } } updateVmDevices(vmsToUpdate); } } }

Target:
private void processVmsWithDevicesChange() { if (!VmDeviceCommonUtils.isOldClusterVersion(vdsManager.getGroupCompatibilityVersion())) { if (!vmsWithChangedDevices.isEmpty()) { ArrayList<String> vmsToUpdate = new ArrayList<>(vmsWithChangedDevices.size()); for (Pair<VM, VmInternalData> pair : vmsWithChangedDevices) { Guid vmId = pair.getFirst().getId(); VmAnalyzer vmAnalyzer = vmAnalyzers.stream() .filter(analyzer -> vmId.equals(analyzer.getVdsmVm().getVmDynamic().getId())) .findFirst().orElse(null); if (vmAnalyzer != null && vmAnalyzer.getVmDynamicToSave() != null) { vmAnalyzer.getVmDynamicToSave().setHash(pair.getSecond().getVmDynamic().getHash()); vmsToUpdate.add(vmId.toString()); } else { log.warn("VM '{}' not in changed list, skipping devices update.", vmId); } } updateVmDevices(vmsToUpdate); } } }
Source:
public void signal(String sessionId, String connectionId, SignalProperties props) throws OpenTokException , RequestException , InvalidArgumentException { if (sessionId == null || sessionId == "" || connectionId == null || connectionId == "") { throw new InvalidArgumentException("Session or Connection string null or empty"); } try { this.client.signal(sessionId, connectionId, props); } catch (Exception e) { throw e; } }

Target:
public void signal(String sessionId, String connectionId, SignalProperties props) throws OpenTokException , RequestException , InvalidArgumentException { if (sessionId == null || sessionId.isEmpty() || connectionId == null || connectionId.isEmpty()) { throw new InvalidArgumentException("Session or Connection string null or empty"); } try { this.client.signal(sessionId, connectionId, props); } catch (Exception e) { throw e; } }
Source:
public void validIsbnNumber() { Assert.assertEquals(true, isbnVerifier.isValid("3-598-21508-8")); }

Target:
public void validIsbnNumber() { assertTrue(isbnVerifier.isValid("3-598-21508-8")); }
Source:
private static void checkNotIndeterminate(Boolean equalsResult) { if (equalsResult == null) { throw new PrestoException(NOT_SUPPORTED, "array_position does not support indeterminate comparison results"); } }

Target:
private static void checkNotIndeterminate(Boolean equalsResult) { if (equalsResult == null) { throw new PrestoException(NOT_SUPPORTED, "array_position does not support arrays with elements that are null or contain null"); } }
Source:
public void checkWebhooks() { final long start = System.currentTimeMillis(); final List<SingularityWebhook> webhooks = webhookManager.getActiveWebhooks(); if (webhooks.isEmpty()) { return; } int taskUpdates = 0; int requestUpdates = 0; int deployUpdates = 0; List<CompletableFuture<Void>> webhookFutures = new ArrayList<>(); for (SingularityWebhook webhook : webhooks) { switch (webhook.getType()) { case TASK: taskUpdates += checkTaskUpdates(webhook, webhookFutures); break; case REQUEST: requestUpdates += checkRequestUpdates(webhook, webhookFutures); break; case DEPLOY: deployUpdates += checkDeployUpdates(webhook, webhookFutures); break; default: break; } } CompletableFutures.allOf(webhookFutures) .exceptionally((t) -> { LOG.error("Exception in webhook", t); return null; }); LOG.info("Sent task, request, and deploy updates for webhooks in {}", taskUpdates, requestUpdates, deployUpdates, webhooks.size(), JavaUtils.duration(start)); }

Target:
public void checkWebhooks() { final long start = System.currentTimeMillis(); final List<SingularityWebhook> webhooks = webhookManager.getActiveWebhooks(); if (webhooks.isEmpty()) { return; } int taskUpdates = 0; int requestUpdates = 0; int deployUpdates = 0; List<CompletableFuture<Response>> webhookFutures = new ArrayList<>(); for (SingularityWebhook webhook : webhooks) { switch (webhook.getType()) { case TASK: taskUpdates += checkTaskUpdates(webhook, webhookFutures); break; case REQUEST: requestUpdates += checkRequestUpdates(webhook, webhookFutures); break; case DEPLOY: deployUpdates += checkDeployUpdates(webhook, webhookFutures); break; default: break; } } CompletableFutures.allOf(webhookFutures) .exceptionally((t) -> { LOG.error("Exception in webhook", t); return null; }); LOG.info("Sent task, request, and deploy updates for webhooks in {}", taskUpdates, requestUpdates, deployUpdates, webhooks.size(), JavaUtils.duration(start)); }
Source:
private BlockingChannel getBlockingChannelBasedOnPortType(String host, int port) { BlockingChannel channel = null; if (portType == PortType.PLAINTEXT) { channel = new BlockingChannel(host, port, config.connectionPoolReadBufferSizeBytes, config.connectionPoolWriteBufferSizeBytes, config.connectionPoolReadTimeoutMs, config.connectionPoolConnectTimeoutMs); } else if (portType == PortType.SSL) { channel = new SSLBlockingChannel(host, port, config.connectionPoolReadBufferSizeBytes, config.connectionPoolWriteBufferSizeBytes, config.connectionPoolReadTimeoutMs, config.connectionPoolConnectTimeoutMs); } return channel; }

Target:
private BlockingChannel getBlockingChannelBasedOnPortType(String host, int port) { BlockingChannel channel = null; if (this.port.getPortType() == PortType.PLAINTEXT) { channel = new BlockingChannel(host, port, config.connectionPoolReadBufferSizeBytes, config.connectionPoolWriteBufferSizeBytes, config.connectionPoolReadTimeoutMs, config.connectionPoolConnectTimeoutMs); } else if (this.port.getPortType() == PortType.SSL) { channel = new SSLBlockingChannel(host, port, config.connectionPoolReadBufferSizeBytes, config.connectionPoolWriteBufferSizeBytes, config.connectionPoolReadTimeoutMs, config.connectionPoolConnectTimeoutMs); } return channel; }
Source:
public void endElement(String uri, String localName, String qName) throws SAXException { int l = isHeader(qName); int pl = l - 1; if (l > 0 && l < 7) { recording = false; NavPoint np = createNavPoint(buffer.toString()); if (l > 1) { NavPoint parent = headers[pl - 1]; while (parent == null && pl > 1) { pl = pl - 1; parent = headers[pl - 1]; } if (parent == null) { ncx.getNavMap().getNavPoints().add(np); headers[0] = np; } else { parent.getNavPoints().add(np); headers[pl] = np; } } else { ncx.getNavMap().getNavPoints().add(np); headers[0] = np; } buffer.setLength(0); } }

Target:
public void endElement(String uri, String localName, String qName) throws SAXException { int currentLevel = isHeader(qName); int parentLevel = currentLevel - 1; if (currentLevel > 0 && currentLevel < 7) { recording = false; NavPoint navPoint = createNavPoint(buffer.toString()); if (currentLevel > 1) { NavPoint parent = headers[parentLevel - 1]; while (parent == null && parentLevel > 1) { parentLevel = parentLevel - 1; parent = headers[parentLevel - 1]; } if (parent == null) { ncx.getNavMap().getNavPoints().add(navPoint); headers[0] = navPoint; } else { parent.getNavPoints().add(navPoint); headers[parentLevel] = navPoint; } } else { ncx.getNavMap().getNavPoints().add(navPoint); headers[0] = navPoint; } buffer.setLength(0); } }
Source:
public void detectsPullRequest() throws Exception { final Issue issue = Mockito.mock(Issue.class); Mockito.doReturn( Json.createObjectBuilder().add( "pull_request", Json.createObjectBuilder().add( "html_url", "<LINK_0>" ) ).build() ).when(issue).json(); final Pulls pulls = Mockito.mock(Pulls.class); final Repo repo = Mockito.mock(Repo.class); final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn(repo).when(issue).repo(); Mockito.doReturn(pulls).when(repo).pulls(); Mockito.when(pulls.get(Mockito.eq(1))).thenReturn(pull); MatcherAssert.assertThat( new Issue.Smart(issue).isPull(), Matchers.is(true) ); new Issue.Smart(issue).pull(); Mockito.verify(pulls).get(1); }

Target:
public void detectsPullRequest() throws Exception { final Issue issue = Mockito.mock(Issue.class); Mockito.doReturn( Json.createObjectBuilder().add( "pull_request", Json.createObjectBuilder().add( "html_url", "<LINK_1>" ) ).build() ).when(issue).json(); final Pulls pulls = Mockito.mock(Pulls.class); final Repo repo = Mockito.mock(Repo.class); final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn(repo).when(issue).repo(); Mockito.doReturn(pulls).when(repo).pulls(); Mockito.when(pulls.get(Mockito.eq(Tv.THREE))).thenReturn(pull); MatcherAssert.assertThat( new Issue.Smart(issue).isPull(), Matchers.is(true) ); new Issue.Smart(issue).pull(); Mockito.verify(pulls).get(Tv.THREE); }
Source:
public Port getPortToConnectTo() { if (sslEnabledDataCenters.contains(datacenter)) { if (ports.containsKey(PortType.SSL)) { return new Port(ports.get(PortType.SSL), PortType.SSL); } else { throw new IllegalArgumentException("No SSL Port exists for the data node " + hostname + ":" + port); } } return new Port(port, PortType.PLAINTEXT); }

Target:
public Port getPortToConnectTo() { if (sslEnabledDataCenters.contains(datacenter)) { if (ports.containsKey(PortType.SSL)) { return ports.get(PortType.SSL); } else { throw new IllegalArgumentException("No SSL Port exists for the data node " + hostname + ":" + portNum); } } return new Port(portNum, PortType.PLAINTEXT); }
Source:
protected void confirmLargeMessage(final LargeServerMessage largeServerMessage) { if (largeServerMessage.getPendingRecordID() >= 0) { try { confirmPendingLargeMessage(largeServerMessage.getPendingRecordID()); largeServerMessage.setPendingRecordID(LargeServerMessage.NO_PENDING_ID); } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToConfirmLargeMessage(e); } } }

Target:
protected void confirmLargeMessage(final LargeServerMessage largeServerMessage) { if (largeServerMessage.getPendingRecordID() >= 0) { try { confirmPendingLargeMessage(largeServerMessage.getPendingRecordID()); largeServerMessage.setPendingRecordID(LargeServerMessage.NO_PENDING_ID); } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } }
Source:
private void maintainAllCheckIntegrity() { Set<Object> parents = new HashSet<>(); ITreeContentProvider contentProvider = (ITreeContentProvider) getCheckboxTreeViewer().getContentProvider(); for (Object checkedElement : getCheckedElements()) { Object parentElem = contentProvider.getParent(checkedElement); if (parentElem != null) { parents.add(parentElem); } } HashSet<Object> parentsCopy = new HashSet<>(parents); for (Object element : parentsCopy) { Object parentElem = contentProvider.getParent(element); if (parentElem != null) { parents.add(parentElem); parents.removeAll(Arrays.asList(contentProvider.getChildren(parentElem))); } } for (Object element : parents) { getCheckboxTreeViewer().setChecked(parent, true); maintainCheckIntegrity(element); } }

Target:
private void maintainAllCheckIntegrity() { Set<Object> checked = new HashSet<>(); for (Object checkedElement : getCheckedElements()) { maintainCheckIntegrity(checkedElement, checked); } }