auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private int loadAndRunTests(Object operations, String testDir) throws Exception { int failedTestCnt = 0; try { Class classToRun = operations.getClass(); Method[] tests = classToRun.getDeclaredMethods(); for (Method test : tests) { String testName = test.getName(); if (testName.endsWith("Test")) { System.out.printf("Running test: %s...", testName); boolean passed = false; try { test.invoke(operations); passed = true; cleanupUfs(testDir); } catch (Exception e) { if (mUfs.getUnderFSType().equals(S3_IDENTIFIER)) { logRelatedS3Operations(test); } System.err.format("Test %s.%s aborted%n%s", test.getClass(), test.getName(), e); } finally { RunTestUtils.printPassInfo(passed); if (!passed) { failedTestCnt++; } } } } } finally { mUfs.deleteDirectory(testDir, DeleteOptions.defaults().setRecursive(true)); mUfs.close(); return failedTestCnt; } }

Target:
private int loadAndRunTests(Object operations, String testDir) throws Exception { int failedTestCnt = 0; try { Class classToRun = operations.getClass(); Field[] fields = classToRun.getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); } Method[] tests = classToRun.getDeclaredMethods(); for (Method test : tests) { String testName = test.getName(); if (testName.endsWith("Test")) { System.out.printf("Running test: %s...", testName); boolean passed = false; try { test.invoke(operations); passed = true; } catch (Exception e) { if (mUfs.getUnderFSType().equals(S3_IDENTIFIER)) { logRelatedS3Operations(test); } System.err.format("Test %s.%s aborted%n%s", test.getClass(), test.getName(), e); } finally { cleanupUfs(testDir); RunTestUtils.printPassInfo(passed); if (!passed) { failedTestCnt++; } } } } } finally { mUfs.deleteDirectory(testDir, DeleteOptions.defaults().setRecursive(true)); mUfs.close(); return failedTestCnt; } }
Source:
private boolean hasJackson25() { try { ObjectMapper.class.getMethod("writerFor", Class.class); return true; } catch (NoSuchMethodException e) { return false; } }

Target:
private boolean hasJackson25() { try { ObjectMapper.class.getMethod("writerFor", JavaType.class); return true; } catch (NoSuchMethodException e) { return false; } }
Source:
private int doDeliver(ShardProcessingSession session) { ShardIndex index = session.shardIndex(); Timestamp now = Time.currentTime(); Timestamp idempotenceWndStart = Timestamps.subtract(now, idempotenceWindow); Page<InboxMessage> startingPage = inboxStorage.contentsBackwards(index); Optional<Page<InboxMessage>> maybePage = Optional.of(startingPage); int totalMessagesDelivered = 0; while (maybePage.isPresent()) { Page<InboxMessage> currentPage = maybePage.get(); ImmutableList<InboxMessage> messages = currentPage.contents(); if (messages.isEmpty()) { maybePage = currentPage.next(); continue; } MessageClassifier classifier = MessageClassifier.of(messages, idempotenceWndStart); ImmutableList<InboxMessage> toDeliver = classifier.toDeliver(); if (!toDeliver.isEmpty()) { ImmutableList<InboxMessage> idempotenceSource = classifier.idempotenceSource(); ImmutableList<RuntimeException> observedExceptions = deliverByType(toDeliver, idempotenceSource); int deliveredInBatch = toDeliver.size(); totalMessagesDelivered += deliveredInBatch; if (!observedExceptions.isEmpty()) { throw observedExceptions.iterator() .next(); } } ImmutableList<InboxMessage> toRemove = classifier.removals(); inboxStorage.removeAll(toRemove); maybePage = currentPage.next(); } return totalMessagesDelivered; }

Target:
private int doDeliver(ShardProcessingSession session) { ShardIndex index = session.shardIndex(); Timestamp now = Time.currentTime(); Timestamp idempotenceWndStart = Timestamps.subtract(now, idempotenceWindow); Page<InboxMessage> startingPage = inboxStorage.readAll(index); Optional<Page<InboxMessage>> maybePage = Optional.of(startingPage); int totalMessagesDelivered = 0; while (maybePage.isPresent()) { Page<InboxMessage> currentPage = maybePage.get(); ImmutableList<InboxMessage> messages = currentPage.contents(); if (!messages.isEmpty()) { MessageClassifier classifier = MessageClassifier.of(messages, idempotenceWndStart); int deliveredInBatch = deliverClassified(classifier); totalMessagesDelivered += deliveredInBatch; ImmutableList<InboxMessage> toRemove = classifier.removals(); inboxStorage.removeAll(toRemove); } maybePage = currentPage.next(); } return totalMessagesDelivered; }
Source:
private int getMateAlignmentStartImpl() { try { if (isAligned && getReadPairedFlag() && !getMateUnmappedFlag()) { Alignment mate = getCurrentAlignment().getMateAlignment(); return (int) mate.getAlignmentPosition() + 1; } } catch (ErrorMsg e) { throw new RuntimeException(e); } return 0; }

Target:
private int getMateAlignmentStartImpl() { try { if (isAligned && getReadPairedFlag() && !getMateUnmappedFlag()) { Alignment mate = getCurrentAlignment().getMateAlignment(); return (int) mate.getAlignmentPosition() + 1; } } catch (ErrorMsg e) { throw new RuntimeException(e); } return SAMRecord.NO_ALIGNMENT_START; }
Source:
public ItemsWrapper<SubscriptionEventTypeStats> getSubscriptionStat(final String subscriptionId, final StatsMode statsMode, final Span span) throws InconsistentStateException, NoSuchEventTypeException, NoSuchSubscriptionException, ServiceTemporarilyUnavailableException { final Subscription subscription; try { subscription = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionView(subscription); } catch (final ServiceTemporarilyUnavailableException ex) { TracingService.logErrorInSpan(span, ex.getMessage()); throw new InconsistentStateException(ex.getMessage()); } final List<SubscriptionEventTypeStats> subscriptionStat = createSubscriptionStat(subscription, statsMode); return new ItemsWrapper<>(subscriptionStat); }

Target:
public ItemsWrapper<SubscriptionEventTypeStats> getSubscriptionStat(final String subscriptionId, final StatsMode statsMode, final Span span) throws InconsistentStateException, NoSuchEventTypeException, NoSuchSubscriptionException, ServiceTemporarilyUnavailableException { final Subscription subscription; try { subscription = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionView(subscription); } catch (final ServiceTemporarilyUnavailableException ex) { TracingService.logErrorInSpan(span, ex); throw new InconsistentStateException(ex.getMessage()); } final List<SubscriptionEventTypeStats> subscriptionStat = createSubscriptionStat(subscription, statsMode); return new ItemsWrapper<>(subscriptionStat); }
Source:
protected static void hashRow(List<DimensionSelector> selectorList, HyperLogLogCollector collector) { final Hasher hasher = hashFn.newHasher(); for (int k = 0; k < selectorList.size(); ++k) { if(k != 0) { hasher.putByte((byte)0); } final DimensionSelector selector = selectorList.get(k); final IndexedInts row = selector.getRow(); final int size = row.size(); if (size == 1) { final String value = selector.lookupName(row.get(0)); hasher.putString(value != null ? value : NULL_STRING); } else if (size == 0) { } else { final String[] values = new String[size]; for (int i = 0; i < size; ++i) { final String value = selector.lookupName(row.get(i)); values[i] = value != null ? value : NULL_STRING; } Arrays.sort(values); for (int i = 0; i < size; ++i) { if(i != 0) { hasher.putChar(SEPARATOR); } final String value = values[i]; hasher.putString(value); } } } collector.add(hasher.hash().asBytes()); }

Target:
protected static void hashRow(List<DimensionSelector> selectorList, HyperLogLogCollector collector) { final Hasher hasher = hashFn.newHasher(); for (int k = 0; k < selectorList.size(); ++k) { if (k != 0) { hasher.putByte((byte) 0); } final DimensionSelector selector = selectorList.get(k); final IndexedInts row = selector.getRow(); final int size = row.size(); if (size == 1) { final String value = selector.lookupName(row.get(0)); hasher.putString(value != null ? value : NULL_STRING); } else if (size != 0) { final String[] values = new String[size]; for (int i = 0; i < size; ++i) { final String value = selector.lookupName(row.get(i)); values[i] = value != null ? value : NULL_STRING; } Arrays.sort(values); for (int i = 0; i < size; ++i) { if (i != 0) { hasher.putChar(SEPARATOR); } hasher.putString(values[i]); } } } collector.add(hasher.hash().asBytes()); }
Source:
private Map<String, ExternalMergeTool> setupPredefinedTools() { Map<String, ExternalMergeTool> tools = new TreeMap<>(); for (PreDefinedMergeTools tool : PreDefinedMergeTools.values()) { tools.put(tool.name(), new PreDefinedMergeTool(tool.name(), tool.getPath(), tool.getParameters(true), tool.getParameters(false), BooleanOption.toConfigured(tool.isExitCodeTrustable()))); } return tools; }

Target:
private Map<String, ExternalMergeTool> setupPredefinedTools() { Map<String, ExternalMergeTool> tools = new TreeMap<>(); for (CommandLineMergeTool tool : CommandLineMergeTool.values()) { tools.put(tool.name(), new PreDefinedMergeTool(tool)); } return tools; }
Source:
private static Publication documentEntity() { Publication result = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_ARTICLE, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addTitle(result, TITLE); addDescription(result, ABSTRACT); setLanguage(result, LANGUAGE); result.setSubject(Lists.newArrayList()); for (String keyword : KEYWORDS) { StructuredProperty subject = new StructuredProperty(); subject.setValue(keyword); result.getSubject().add(subject); } result.setPid(Lists.newArrayList()); for (Entry<String, String> entry : EXT_IDENTIFIERS.entrySet()) { StructuredProperty pid = new StructuredProperty(); pid.setValue(entry.getValue()); Qualifier pidType = new Qualifier(); pidType.setClassid(entry.getKey()); pid.setQualifier(pidType); result.getPid().add(pid); } Journal journal = new Journal(); journal.setName(JOURNAL); result.setJournal(journal); Field<String> dateofacceptance = new Field<>(); dateofacceptance.setValue(String.format("%s-02-29", YEAR)); result.setDateofacceptance(dateofacceptance); Field<String> publisher = new Field<>(); publisher.setValue(PUBLISHER); result.setPublisher(publisher); result.setCollectedfrom(Lists.newArrayList()); for (String id : DATASOURCE_IDS) { KeyValue collFrom = new KeyValue(); collFrom.setKey(id); result.getCollectedfrom().add(collFrom); } Author author = new Author(); author.setName(FIRST_NAME); author.setSurname(SECOND_NAME + ' ' + SECOND_SECOND_NAME); author.setFullname(FULL_NAME); author.setRank(0); result.setAuthor(Lists.newArrayList(author)); return result; }

Target:
private static Publication documentEntity() { Publication result = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_ARTICLE, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addTitle(result, TITLE); addDescription(result, ABSTRACT); setLanguage(result, LANGUAGE); result.setSubject(Lists.newArrayList()); KEYWORDS.stream().map(keyword -> { StructuredProperty subject = new StructuredProperty(); subject.setValue(keyword); return subject; }).forEach(result.getSubject()::add); result.setPid(Lists.newArrayList()); EXT_IDENTIFIERS.entrySet().stream().map(entry -> { StructuredProperty pid = new StructuredProperty(); pid.setValue(entry.getValue()); Qualifier pidType = new Qualifier(); pidType.setClassid(entry.getKey()); pid.setQualifier(pidType); return pid; }).forEach(result.getPid()::add); Journal journal = new Journal(); journal.setName(JOURNAL); result.setJournal(journal); Field<String> dateofacceptance = new Field<>(); dateofacceptance.setValue(String.format("%s-02-29", YEAR)); result.setDateofacceptance(dateofacceptance); Field<String> publisher = new Field<>(); publisher.setValue(PUBLISHER); result.setPublisher(publisher); result.setCollectedfrom(Lists.newArrayList()); DATASOURCE_IDS.stream().map(id -> { KeyValue collFrom = new KeyValue(); collFrom.setKey(id); return collFrom; }).forEach(result.getCollectedfrom()::add); Author author = new Author(); author.setName(FIRST_NAME); author.setSurname(SECOND_NAME + ' ' + SECOND_SECOND_NAME); author.setFullname(FULL_NAME); author.setRank(0); result.setAuthor(Lists.newArrayList(author)); return result; }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; AvailabilityZone that = AvailabilityZone.class.cast(obj); return Objects.equal(this.name, that.name) && this.state.equals(that.state); }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; AvailabilityZone that = AvailabilityZone.class.cast(obj); return Objects.equal(this.name, that.name) && Objects.equal(this.state, that.state); }
Source:
public void testIfEOModelIsRecognizedAsEngineeringObject_shouldWork() throws Exception { Class<?> eo = registry.loadModel(getEOModelDescription()); assertThat(ModelUtils.isEngineeringObjectClass(eo), is(true)); }

Target:
public void testIfEOModelIsRecognizedAsEngineeringObject_shouldWork() throws Exception { Class<?> eo = registry.loadModel(getEOModelDescription()); assertThat(SimpleModelWrapper.isEngineeringObjectClass(eo), is(true)); }
Source:
public void testDeleteMavenPathInRepository(@MavenRepository(repositoryId = MAVEN_REPOSITORY_RELEASES, setup = MavenIndexedRepositorySetup.class) Repository repository, @MavenTestArtifact(repositoryId = MAVEN_REPOSITORY_RELEASES, id = "com.artifacts.to.delete.releases:delete-foo", versions = "1.2.1") Path path) throws Exception { deleteRepositoryPath(repository, path); }

Target:
public void testDeleteMavenPathInRepository(@MavenRepository(repositoryId = MAVEN_REPOSITORY_RELEASES, setup = MavenIndexedRepositorySetup.class) Repository repository, @MavenTestArtifact(repositoryId = MAVEN_REPOSITORY_RELEASES, id = "com.artifacts.to.delete.releases:delete-foo", versions = "1.2.1") Path path) throws Exception { deleteRepositoryPath(repository, path, false); }
Source:
private List<String> internalListTables(String prefix) { try { List<String> tables; if (prefix.isEmpty()) { tables = client.getTablesList().getTablesList(); } else { tables = client.getTablesList(prefix).getTablesList().stream() .filter(name -> name.startsWith(prefix)).collect(toImmutableList()); } return tables; } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }

Target:
private List<String> internalListTables(String prefix) { try { if (prefix.isEmpty()) { return client.getTablesList().getTablesList(); } else { return client.getTablesList(prefix).getTablesList(); } } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
Source:
public boolean matches(final RelOptRuleCall call) { Preconditions.checkArgument(call.rels.length > 2); VoltPhysicalTableSequentialScan scan = call.rel(call.rels.length - 2); Preconditions.checkArgument(scan.getVoltTable() != null && scan.getVoltTable().getCatalogTable() != null); CatalogMap<Index> indexMap = scan.getVoltTable().getCatalogTable().getIndexes(); return (indexMap != null && !indexMap.isEmpty()) ? true : false; }

Target:
public boolean matches(final RelOptRuleCall call) { Preconditions.checkArgument(call.rels.length > 2); VoltPhysicalTableSequentialScan scan = call.rel(call.rels.length - 2); Preconditions.checkArgument(scan.getVoltTable() != null && scan.getVoltTable().getCatalogTable() != null); CatalogMap<Index> indexMap = scan.getVoltTable().getCatalogTable().getIndexes(); return indexMap != null && !indexMap.isEmpty(); }
Source:
public BaseTask(final String name, final String taskType) { super(Promises.settable()); _name = truncate(name); final State state = State.INIT; _shallowTraceBuilder = new ShallowTraceBuilder(_id); _shallowTraceBuilder.setName(getName()); _shallowTraceBuilder.setResultType(ResultType.UNFINISHED); if (taskType != null) { _shallowTraceBuilder.setTaskType(taskType); } _stateRef = new AtomicReference<>(state); if (ParSeqGlobalConfiguration.getInstance().isCrossThreadStackTracesEnabled()) { _taskStackTrace = Thread.currentThread().getStackTrace(); } else { _taskStackTrace = null; } }

Target:
public BaseTask(final String name, final String taskType) { super(Promises.settable()); _name = truncate(name); final State state = State.INIT; _shallowTraceBuilder = new ShallowTraceBuilder(_id); _shallowTraceBuilder.setName(getName()); _shallowTraceBuilder.setResultType(ResultType.UNFINISHED); if (taskType != null) { _shallowTraceBuilder.setTaskType(taskType); } _stateRef = new AtomicReference<>(state); if (ParSeqGlobalConfiguration.isCrossThreadStackTracesEnabled()) { _taskStackTrace = Thread.currentThread().getStackTrace(); } else { _taskStackTrace = null; } }
Source:
private Mono<HttpClientRequest> addAuthorization(Mono<HttpClientRequest> request) { return Mono .zip(request, token) .map(tuple -> tuple.getT1().addHeader(HttpHeaderNames.AUTHORIZATION, tuple.getT2())); }

Target:
private Mono<HttpClientRequest> addAuthorization(Mono<HttpClientRequest> request) { return Mono .zip(request, this.token) .map(tuple -> tuple.getT1().header(HttpHeaderNames.AUTHORIZATION, tuple.getT2())); }
Source:
private void mapNodes() { if (fNodesList == null) { fNodesMap = new HashMap<>(1); return; } fNodesMap = new HashMap<>(fNodesList.size() * 4 / 3); for (ModelDelta element : fNodesList) { mapNode( element ); } }

Target:
private void mapNodes() { if (fNodesList == null) { fNodesMap = new HashMap<>(1); return; } fNodesMap = new HashMap<>(fNodesList.size() * 4 / 3); for (ModelDelta node : fNodesList) { mapNode( node ); } }
Source:
public void sendPutResponse(RequestResponseChannel requestResponseChannel, PutResponse response, Request request, MetricsHistogram responseQueueTime, MetricsHistogram responseSendTime, MetricsHistogram requestTotalTime, long totalTimeSpent, long blobSize, ServerMetrics metrics) throws InterruptedException { if(response.getError() == ServerErrorCode.No_Error){ metrics.markPutBlobRequestRate(blobSize); if (blobSize <= ServerMetrics.smallBlob) { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, new HistogramMeasurement(metrics.putSmallBlobProcessingTimeInMs), new HistogramMeasurement(metrics.putSmallBlobTotalTimeInMs), totalTimeSpent)); } else if (blobSize <= ServerMetrics.mediumBlob) { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, new HistogramMeasurement(metrics.putMediumBlobProcessingTimeInMs), new HistogramMeasurement(metrics.putMediumBlobTotalTimeInMs), totalTimeSpent)); } else { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, new HistogramMeasurement(metrics.putLargeBlobProcessingTimeInMs), new HistogramMeasurement(metrics.putLargeBlobTotalTimeInMs), totalTimeSpent)); } } else{ requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, null, null, totalTimeSpent)); } }

Target:
public void sendPutResponse(RequestResponseChannel requestResponseChannel, PutResponse response, Request request, MetricsHistogram responseQueueTime, MetricsHistogram responseSendTime, MetricsHistogram requestTotalTime, long totalTimeSpent, long blobSize, ServerMetrics metrics) throws InterruptedException { if (response.getError() == ServerErrorCode.No_Error) { metrics.markPutBlobRequestRateBySize(blobSize); if (blobSize <= ServerMetrics.smallBlob) { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, new HistogramMeasurement(metrics.putSmallBlobProcessingTimeInMs), new HistogramMeasurement(metrics.putSmallBlobTotalTimeInMs), totalTimeSpent)); } else if (blobSize <= ServerMetrics.mediumBlob) { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, new HistogramMeasurement(metrics.putMediumBlobProcessingTimeInMs), new HistogramMeasurement(metrics.putMediumBlobTotalTimeInMs), totalTimeSpent)); } else { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, new HistogramMeasurement(metrics.putLargeBlobProcessingTimeInMs), new HistogramMeasurement(metrics.putLargeBlobTotalTimeInMs), totalTimeSpent)); } } else { requestResponseChannel.sendResponse(response, request, new NetworkRequestMetrics(responseQueueTime, responseSendTime, requestTotalTime, null, null, totalTimeSpent)); } }
Source:
public static void setupStore() throws Exception { defaultStoreDir = BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class).getObjectStoreDir(); new MetaObjectStoreEnvironmentBean().setObjectStoreType(storeClassName); Util.emptyObjectStore(); }

Target:
public static void setupStore() throws Exception { defaultStoreDir = BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class).getObjectStoreDir(); BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class).setObjectStoreType(storeClassName); BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, "default").setObjectStoreType(storeClassName); BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, "communicationStore").setObjectStoreType(storeClassName); Util.emptyObjectStore(); }
Source:
protected void doStart() throws Exception { if( mongoConnection == null ) { mongoConnection = CamelContextHelper.mandatoryLookup(getCamelContext(), connectionBean, MongoClient.class); } log.debug("Resolved the connection with the name as {}", connectionBean, mongoConnection); super.doStart(); }

Target:
protected void doStart() throws Exception { if (mongoConnection == null) { mongoConnection = CamelContextHelper.mandatoryLookup(getCamelContext(), connectionBean, MongoClient.class); log.debug("Resolved the connection provided by context reference as {}", connectionBean, mongoConnection); } else { log.debug("Resolved the connection provided by mongoConnection property parameter as {}", mongoConnection); } super.doStart(); }
Source:
private void doMutation(final Mutation mutation) { handleExceptions(); Long sequenceId = sizeManager.registerOperationWithHeapSize(mutation.heapSize()); AccountingFutureCallback callback = new AccountingFutureCallback(mutation, sequenceId); Futures.addCallback(batchExecutor.issueRequest(mutation), callback); }

Target:
private void doMutation(final Mutation mutation) throws RetriesExhaustedWithDetailsException { Long sequenceId = null; try { sequenceId = sizeManager.registerOperationWithHeapSize(mutation.heapSize()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } AccountingFutureCallback callback = new AccountingFutureCallback(mutation, sequenceId); Futures.addCallback(batchExecutor.issueRequest(mutation), callback); }
Source:
public void visitClassDeclaration(ClassDeclarationTree tree) { privateProperties = new LinkedList<>(); privateMethods = new LinkedList<>(); isFinalClassStack.addLast(isFinalClass(tree)); finalMethodsStack.addLast(getFinalMethods(tree)); super.visitClassDeclaration(tree); isFinalClassStack.removeLast(); finalMethodsStack.removeLast(); }

Target:
public void visitClassDeclaration(ClassDeclarationTree tree) { isFinalClassStack.addLast(isFinalClass(tree)); finalOrPrivateMethodsStack.addLast(getFinalOrPrivateMethods(tree)); privatePropertiesStack.addLast(getPrivateProperties(tree)); super.visitClassDeclaration(tree); isFinalClassStack.removeLast(); finalOrPrivateMethodsStack.removeLast(); privatePropertiesStack.removeLast(); }
Source:
private void setUpWebView(View view) { mProgressBar = (ProgressBar) view.findViewById(R.id.progress); mWebView.setBackgroundColor(Color.TRANSPARENT); mWebView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(getActivity())) { @Override public void onPageStarted(android.webkit.WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); if (getActivity() != null) { getActivity().invalidateOptionsMenu(); } } @Override public void onPageFinished(android.webkit.WebView view, String url) { super.onPageFinished(view, url); if (getActivity() != null) { getActivity().invalidateOptionsMenu(); } } }); mWebView.setWebChromeClient(new CacheableWebView.ArchiveClient() { @Override public void onProgressChanged(android.webkit.WebView view, int newProgress) { super.onProgressChanged(view, newProgress); mProgressBar.setProgress(newProgress); mProgressBar.setVisibility(newProgress == 100 ? GONE : VISIBLE); mButtonRefresh.setImageResource(newProgress == 100 ? R.drawable.ic_refresh_white_24dp : R.drawable.ic_clear_white_24dp); } }); mWebView.setDownloadListener((url, userAgent, contentDisposition, mimetype, contentLength) -> { if (isPdfRenderingSupported() && mimetype.equals(PDF_MIME_TYPE)) { downloadFileAndRenderPdf(); } else { if (getActivity() == null) { return; } final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); if (intent.resolveActivity(getActivity().getPackageManager()) == null) { return; } mExternalRequired = true; mWebView.setVisibility(GONE); view.findViewById(R.id.empty).setVisibility(VISIBLE); view.findViewById(R.id.download_button).setOnClickListener(v -> startActivity(intent)); } }); AppUtils.toggleWebViewZoom(mWebView.getSettings(), false); }

Target:
private void setUpWebView(View view) { mProgressBar = (ProgressBar) view.findViewById(R.id.progress); mWebView.setBackgroundColor(Color.TRANSPARENT); mWebView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(getActivity())) { @Override public void onPageStarted(android.webkit.WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); if (getActivity() != null) { getActivity().invalidateOptionsMenu(); } } @Override public void onPageFinished(android.webkit.WebView view, String url) { super.onPageFinished(view, url); if (getActivity() != null) { getActivity().invalidateOptionsMenu(); } } }); mWebView.setWebChromeClient(new CacheableWebView.ArchiveClient() { @Override public void onProgressChanged(android.webkit.WebView view, int newProgress) { super.onProgressChanged(view, newProgress); mProgressBar.setProgress(newProgress); mProgressBar.setVisibility(newProgress == 100 ? GONE : VISIBLE); mButtonRefresh.setImageResource(newProgress == 100 ? R.drawable.ic_refresh_white_24dp : R.drawable.ic_clear_white_24dp); } }); mWebView.setDownloadListener((url, userAgent, contentDisposition, mimetype, contentLength) -> { if (getActivity() == null) { return; } if (isPdfRenderingSupported() && mimetype.equals(PDF_MIME_TYPE)) { downloadFileAndRenderPdf(); } else { offerExternalApp(); } }); AppUtils.toggleWebViewZoom(mWebView.getSettings(), false); }
Source:
private File getSourceFile() throws IOException { try (OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient()) { String path = new Operations(client).invoke("take-snapshot", Address.root()).value().asString(); File copyFrom = new File(path); if (!copyFrom.exists()) { throw new IOException("Source config file does not exits: '" + copyFrom.toString() + "'!"); } return copyFrom; } }

Target:
private File getSourceFile() throws IOException { try (OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient()) { ModelNodeResult result = new Operations(client).invoke("take-snapshot", Address.root()); String path = result.stringValue(); File copyFrom = new File(path); if (!copyFrom.exists()) { throw new IOException("Source config file does not exits: '" + copyFrom.toString() + "'!"); } return copyFrom; } }
Source:
void setBlkioDeviceOptionss(Instance instance, Map<String, Object> fromInspect) { List<String> fields = Arrays.asList(READ_IOPS, WRITE_IOPS, READ_BPS, WRITE_BPS, WEIGHT); Map<String, BlkioDeviceOption> target = new HashMap<>(); for (String field : fields) { List<Map> deviceOptions = null; try { deviceOptions = (List<Map>)CollectionUtils.toList(CollectionUtils.getNestedValue(fromInspect, "HostConfig", field)); } catch (Exception e) { continue; } if (deviceOptions == null || deviceOptions.isEmpty()) { continue; } for (Map deviceOption : deviceOptions) { String path = null; Integer value = null; try { path = (String)deviceOption.get("Path"); value = (Integer)(field == WEIGHT ? deviceOption.get("Weight") : deviceOption.get("Rate")); } catch (Exception e) { } if (path != null && value != null) { BlkioDeviceOption targetDevOpt = target.get(path); if (targetDevOpt == null) { targetDevOpt = new BlkioDeviceOption(); target.put(path, targetDevOpt); } switch (field) { case READ_IOPS: targetDevOpt.setReadIops(value); break; case WRITE_IOPS: targetDevOpt.setWriteIops(value); break; case READ_BPS: targetDevOpt.setReadBps(value); break; case WRITE_BPS: targetDevOpt.setWriteBps(value); break; case WEIGHT: targetDevOpt.setWeight(value); break; } } } } if (!target.isEmpty()) { setField(instance, FIELD_BLKIO_DEVICE_OPTIONS, target); } }

Target:
void setBlkioDeviceOptionss(Instance instance, Map<String, Object> fromInspect) { List<String> fields = Arrays.asList(READ_IOPS, WRITE_IOPS, READ_BPS, WRITE_BPS, WEIGHT); Map<String, BlkioDeviceOption> target = new HashMap<>(); for (String field : fields) { List<Map> deviceOptions = null; try { deviceOptions = (List<Map>)CollectionUtils.toList(CollectionUtils.getNestedValue(fromInspect, HOST_CONFIG, field)); } catch (Exception e) { continue; } if (deviceOptions == null || deviceOptions.isEmpty()) { continue; } for (Map deviceOption : deviceOptions) { String path = null; Integer value = null; try { path = (String)deviceOption.get("Path"); value = (Integer)(field == WEIGHT ? deviceOption.get("Weight") : deviceOption.get("Rate")); } catch (Exception e) { } if (path != null && value != null) { BlkioDeviceOption targetDevOpt = target.get(path); if (targetDevOpt == null) { targetDevOpt = new BlkioDeviceOption(); target.put(path, targetDevOpt); } switch (field) { case READ_IOPS: targetDevOpt.setReadIops(value); break; case WRITE_IOPS: targetDevOpt.setWriteIops(value); break; case READ_BPS: targetDevOpt.setReadBps(value); break; case WRITE_BPS: targetDevOpt.setWriteBps(value); break; case WEIGHT: targetDevOpt.setWeight(value); break; } } } } if (!target.isEmpty()) { setField(instance, FIELD_BLKIO_DEVICE_OPTIONS, target); } }
Source:
private void addResearchTask(List<Block> blockList, Block result, EntityRef player, EntityRef laboratory) { List<String> blockNameList = new ArrayList<>(); for (Block block : blockList) { blockNameList.add(block.getURI().toString()); } Task researchTask = new ResearchTask(blockNameList, result.getURI().toString()); researchTask.requiredBuildingEntityID = laboratory.getId(); TaskComponent taskComponent = new TaskComponent(); taskComponent.assignedTaskType = AssignedTaskType.Research; taskComponent.task = researchTask; ConstructedBuildingComponent buildingComponent = laboratory.getComponent(ConstructedBuildingComponent.class); taskComponent.taskRegion = buildingComponent.boundingRegions.get(16); taskManagementSystem.addTask(player, entityManager.create(taskComponent)); }

Target:
private void addResearchTask(List<Block> blockList, Block result, EntityRef player, EntityRef laboratory) { List<String> blockNameList = new ArrayList<>(); for (Block block : blockList) { blockNameList.add(block.getURI().toString()); } Task researchTask = new ResearchTask(blockNameList, result.getURI().toString()); researchTask.requiredBuildingEntityID = laboratory.getId(); TaskComponent taskComponent = new TaskComponent(); taskComponent.assignedTaskType = AssignedTaskType.Research; taskComponent.task = researchTask; ConstructedBuildingComponent buildingComponent = laboratory.getComponent(ConstructedBuildingComponent.class); taskComponent.taskRegion = buildingComponent.boundingRegions.get(Constants.LABORATORY_SLAB_REGION); taskManagementSystem.addTask(player, entityManager.create(taskComponent)); }
Source:
public void clientTest() { client.addFlow(flow); List<FloodlightOFFlow> flows = client.getFlows(SWITCH_ID); Assert.assertEquals("Flows size must be 1", 1, flows.size()); Assert.assertEquals("getFlows() must contain the created flow", flows.get(0).getName(), flow.getName()); Assert.assertEquals("getFlows() must contain the created flow action", flow.getActions().get(0).getValue(), flows.get(0).getActions().get(0).getValue()); }

Target:
public void clientTest() throws InterruptedException { client.addFlow(flow); List<FloodlightOFFlow> flows = client.getFlows(SWITCH_ID); Assert.assertEquals("Flows size must be 1", 1, flows.size()); Assert.assertEquals("getFlows() must contain the created flow", flows.get(0).getName(), flow.getName()); Assert.assertEquals("getFlows() must contain the created flow action", flow.getActions().get(0).getValue(), flows.get(0).getActions().get(0).getValue()); }
Source:
public static void prepareUser() { try { workflowControllerService = new ServiceManager().getWorkflowControllerService(); } catch (Exception e) { User user = new User(); workflowControllerService.setUser(user); } }

Target:
public static void prepareUser() { Helper.setCurrentUser(new User()); workflowControllerService = new ServiceManager().getWorkflowControllerService(); }
Source:
private BibEntry jsonItemToBibEntry(JSONObject item) throws ParseException { try { BibEntry entry = new BibEntry(); entry.setType(convertType(item.getString("type"))); entry.setField(StandardField.TITLE, item.getString("title")); entry.setField(StandardField.AUTHOR, toAuthors(item.optJSONArray("author"))); entry.setField(StandardField.YEAR, Optional.ofNullable(item.optJSONObject("issued")) .map(array -> array.optJSONArray("date-parts")) .map(array -> array.optJSONArray(0)) .map(array -> array.optInt(0)) .map(year -> Integer.toString(year)).orElse("")); entry.setField(StandardField.DOI, item.getString("DOI")); entry.setField(StandardField.PAGES, item.optString("page")); entry.setField(StandardField.ISSN, item.optString("ISSN")); entry.setField(StandardField.JOURNAL, item.optString("container-title")); entry.setField(StandardField.PUBLISHER, item.optString("publisher")); entry.setField(StandardField.URL, item.optString("URL")); entry.setField(StandardField.VOLUME, item.optString("volume")); return entry; } catch (JSONException exception) { throw new ParseException("mEdRA API JSON format has changed", exception); } }

Target:
private BibEntry jsonItemToBibEntry(JSONObject item) throws ParseException { try { return new BibEntry(convertType(item.getString("type"))) .withField(StandardField.TITLE, item.getString("title")) .withField(StandardField.AUTHOR, toAuthors(item.optJSONArray("author"))) .withField(StandardField.YEAR, Optional.ofNullable(item.optJSONObject("issued")) .map(array -> array.optJSONArray("date-parts")) .map(array -> array.optJSONArray(0)) .map(array -> array.optInt(0)) .map(year -> Integer.toString(year)).orElse("")) .withField(StandardField.DOI, item.getString("DOI")) .withField(StandardField.PAGES, item.optString("page")) .withField(StandardField.ISSN, item.optString("ISSN")) .withField(StandardField.JOURNAL, item.optString("container-title")) .withField(StandardField.PUBLISHER, item.optString("publisher")) .withField(StandardField.URL, item.optString("URL")) .withField(StandardField.VOLUME, item.optString("volume")); } catch (JSONException exception) { throw new ParseException("mEdRA API JSON format has changed", exception); } }
Source:
public <T> T readValue(@Nonnull final IMAPResponse[] content, @Nonnull final Class<T> valueType) throws ImapAsyncClientException, ProtocolException, IOException { if (valueType == Capability.class) { return (T) parser.parseToCapabilities(content); } if (valueType == AppendUID.class) { return (T) parser.parseToAppendUid(content); } if (valueType == CopyUID.class) { return (T) parser.parseToCopyUid(content); } if (valueType == ExtensionMailboxInfo.class) { return (T) parser.parseToExtensionMailboxInfo(content); } if (valueType == MailboxInfo.class) { return (T) parser.parseToMailboxInfo(content); } if (valueType == ListInfoList.class) { return (T) parser.parseToListInfoList(content); } if (valueType == Status.class) { return (T) parser.parseToStatus(content); } if (valueType == IdResult.class) { return (T) parser.parseToIdResult(content); } if (valueType == SearchResult.class) { return (T) parser.parseToSearchResult(content); } return readValue(content, valueType, EMPTY_FETCH_ITEMS); }

Target:
public <T> T readValue(@Nonnull final IMAPResponse[] content, @Nonnull final Class<T> valueType) throws ImapAsyncClientException, ProtocolException { if (valueType == Capability.class) { return (T) parser.parseToCapabilities(content); } if (valueType == AppendUID.class) { return (T) parser.parseToAppendUid(content); } if (valueType == CopyUID.class) { return (T) parser.parseToCopyUid(content); } if (valueType == ExtensionMailboxInfo.class) { return (T) parser.parseToExtensionMailboxInfo(content); } if (valueType == MailboxInfo.class) { return (T) parser.parseToMailboxInfo(content); } if (valueType == ListInfoList.class) { return (T) parser.parseToListInfoList(content); } if (valueType == Status.class) { return (T) parser.parseToStatus(content); } if (valueType == IdResult.class) { return (T) parser.parseToIdResult(content); } if (valueType == SearchResult.class) { return (T) parser.parseToSearchResult(content); } return readValue(content, valueType, EMPTY_FETCH_ITEMS); }
Source:
PdlBuilder writeJson(Object value) throws IOException { DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter(); prettyPrinter.indentObjectsWith(new DefaultIndenter(" ", DefaultIndenter.SYS_LF + getIndentSpaces())); _jsonCodec.setPrettyPrinter(prettyPrinter); return super.writeJson(value); }

Target:
PdlBuilder writeJson(Object value) throws IOException { JacksonDataCodec jsonCodec = new JacksonDataCodec(); DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter(); prettyPrinter.indentObjectsWith( new DefaultIndenter(getIndentSpaces(1), DefaultIndenter.SYS_LF + getIndentSpaces(_indentDepth))); jsonCodec.setPrettyPrinter(prettyPrinter); write(toJson(value, jsonCodec)); return this; }
Source:
protected boolean handleFailureImpl(StateExecution execution) { logger.warn("Cron workflow " + getType() + " / " + execution.getWorkflowInstanceId() + "work failed"); return true; }

Target:
protected boolean handleFailureImpl(StateExecution execution) { logger.error("Cron workflow / work failed", getType(), execution.getWorkflowInstanceId()); return true; }
Source:
public ResultValidator expectExceptionMessage(String exceptionMessage) { StringDescription description = new StringDescription( new StringBuilder("Given exception message is null!")); if (exceptionMessage == null) { reporter.reportWrongExceptionMessage(actualException, description); return this; } description = new StringDescription(new StringBuilder(exceptionMessage)); if (actualException != null && !exceptionMessage.equals(actualException.getMessage())) { reporter.reportWrongExceptionMessage(actualException, description); } return this; }

Target:
public ResultValidator expectExceptionMessage(String exceptionMessage) { return expectExceptionMessage(equalTo(exceptionMessage)); }
Source:
private Builder(CuratorFramework client, String path) { this.client = client; this.path = path; }

Target:
private Builder(CuratorFramework client, String path) { this.client = checkNotNull(client); this.path = validatePath(path); }
Source:
@Override public Date read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } String stringDate = in.nextString(); try { return df.parse(stringDate); } catch (ParseException e) { throw new DateTypeParseException(stringDate); } }

Target:
@Override public Date read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return null; } String stringDate = in.nextString(); try { return df.parse(stringDate); } catch (ParseException e) { return new Date(); } }
Source:
public void handleVolumeCommand(Command command, ChannelUID channelUID, int zone) throws IOException { if (command instanceof RefreshType) { updateState(channelUID, new DecimalType(connection.getVolume(zone) / 100.0)); } if (command instanceof DecimalType) { connection.setVolume(((DecimalType) command).intValue(), zone); } }

Target:
public void handleVolumeCommand(Command command, ChannelUID channelUID, int zone) throws IOException { if (command instanceof RefreshType) { try { logger.debug("handleVolumeCommand RefreshType {}", zone); SonyAudioConnection.SonyAudioVolume result = volumeCache[zone].getValue(); if (result != null) { updateState(channelUID, new PercentType(result.volume)); } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof PercentType) { logger.debug("handleVolumeCommand PercentType set {}", zone, command); connection.setVolume(((PercentType) command).intValue(), zone); } if (command instanceof IncreaseDecreaseType) { logger.debug("handleVolumeCommand IncreaseDecreaseType set {}", zone, command); String change = command == IncreaseDecreaseType.INCREASE ? "+1" : "-1"; connection.setVolume(change, zone); } if (command instanceof OnOffType) { logger.debug("handleVolumeCommand OnOffType set {}", zone, command); connection.setMute(((OnOffType) command) == OnOffType.ON, zone); } }
Source:
private SSLContext createSSLContext(final KeyStore keyStore, final KeyStore trustStore) throws NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException { KeyManager[] keyManagers; KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); char[] pass = keyStoreProperties.getPassword().toCharArray(); keyManagerFactory.init(keyStore, pass); keyManagers = keyManagerFactory.getKeyManagers(); TrustManager[] trustManagers; TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustStore); trustManagers = trustManagerFactory.getTrustManagers(); SSLContext sslContext; sslContext = SSLContext.getInstance(protocol); sslContext.init(keyManagers, trustManagers, SecureRandom.getInstanceStrong()); return sslContext; }

Target:
private SSLContext createSSLContext(final KeyStore keyStore, final KeyStore trustStore) throws NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException { KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); char[] pass = keyStoreProperties.getPassword().toCharArray(); keyManagerFactory.init(keyStore, pass); KeyManager[] keyManagers = keyManagerFactory.getKeyManagers(); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); SSLContext sslContext = SSLContext.getInstance(protocol); sslContext.init(keyManagers, trustManagers, SecureRandom.getInstanceStrong()); return sslContext; }
Source:
protected void doInvokeListener(MessageListener listener, Object data) { Message message = null; try { if (listener instanceof BatchMessageListener) { listener.onMessageBatch((List<Message>) data); } else { message = (Message) data; listener.onMessage(message); } } catch (Exception e) { throw wrapToListenerExecutionFailedExceptionIfNeeded(e, message); } }

Target:
protected void doInvokeListener(MessageListener listener, Object data) { Message message = null; try { if (data instanceof List) { listener.onMessageBatch((List<Message>) data); } else { message = (Message) data; listener.onMessage(message); } } catch (Exception e) { throw wrapToListenerExecutionFailedExceptionIfNeeded(e, message); } }
Source:
static Try<Void> runRunnable(Runnable runnable) { return run(runnable::run); }

Target:
static Try<Void> runRunnable(Runnable runnable) { Objects.requireNonNull(runnable, "runnable is null"); return run(runnable::run); }
Source:
public void testRelation(){ String templateUrl = getClasspathUrlForResource("templates/relationship.yaml"); EntitySpec<? extends Application> app = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(app); assertEquals(app.getChildren().size(), 2); EntitySpec<TomcatServer> tomcatServer = (EntitySpec<TomcatServer>) app.getChildren().get(0); assertNotNull(tomcatServer.getConfig().get(TomcatServer.JAVA_SYSPROPS)); assertEquals(((Map) tomcatServer.getConfig().get(TomcatServer.JAVA_SYSPROPS)).size(), 1); assertEquals(((Map)tomcatServer.getConfig().get(TomcatServer.JAVA_SYSPROPS)) .get("brooklyn.example.db.url").toString(), DATABASE_DEPENDENCY_INJECTION); }

Target:
public void testRelation(){ String templateUrl = getClasspathUrlForResource("templates/relationship.yaml"); EntitySpec<? extends Application> app = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(app); assertEquals(app.getChildren().size(), 2); EntitySpec<TomcatServer> tomcatServer = (EntitySpec<TomcatServer>) findChildEntitySpecByPlanId(app, "tomcat_server"); assertNotNull(tomcatServer.getConfig().get(TomcatServer.JAVA_SYSPROPS)); assertEquals(((Map) tomcatServer.getConfig().get(TomcatServer.JAVA_SYSPROPS)).size(), 1); assertEquals(((Map)tomcatServer.getConfig().get(TomcatServer.JAVA_SYSPROPS)) .get("brooklyn.example.db.url").toString(), DATABASE_DEPENDENCY_INJECTION); }
Source:
public InfinispanRepository( BaseInfinispanSource source, BasicCacheContainer cacheContainer ) { super(source); this.cacheContainer = source.createCacheContainer(); assert this.cacheContainer != null; Set<String> workspaceNames = new HashSet<String>(); for (String workspaceName : source.getPredefinedWorkspaceNames()) { workspaceNames.add(workspaceName); } this.predefinedWorkspaceNames = Collections.unmodifiableSet(workspaceNames); initialize(); }

Target:
public InfinispanRepository( BaseInfinispanSource source, BasicCacheContainer cacheContainer ) { super(source); this.cacheContainer = cacheContainer; assert this.cacheContainer != null; Set<String> workspaceNames = new HashSet<String>(); for (String workspaceName : source.getPredefinedWorkspaceNames()) { workspaceNames.add(workspaceName); } this.predefinedWorkspaceNames = Collections.unmodifiableSet(workspaceNames); initialize(); }
Source:
private static synchronized void filter(final Collection<Geocache> caches) { final boolean excludeMine = Settings.isExcludeMyCaches(); final boolean excludeDisabled = Settings.isExcludeDisabledCaches(); final List<Geocache> removeList = new ArrayList<>(); for (final Geocache cache : caches) { if ((excludeMine && (cache.isFound() || cache.isOwner())) || (excludeDisabled && (cache.isDisabled() && cache.isArchived()))) { removeList.add(cache); } } caches.removeAll(removeList); }

Target:
private static synchronized void filter(final Collection<Geocache> caches) { final boolean excludeMine = Settings.isExcludeMyCaches(); final boolean excludeDisabled = Settings.isExcludeDisabledCaches(); final List<Geocache> removeList = new ArrayList<>(); for (final Geocache cache : caches) { if ((excludeMine && (cache.isFound() || cache.isOwner())) || (excludeDisabled && (cache.isDisabled() || cache.isArchived()))) { removeList.add(cache); } } caches.removeAll(removeList); }
Source:
public String getBootstrapServers() { if (port == -1) { throw new IllegalStateException("You should start Kafka container first"); } return String.format("PLAINTEXT://%s:%s", getContainerIpAddress(), port); }

Target:
public String getBootstrapServers() { if (port == PORT_NOT_ASSIGNED) { throw new IllegalStateException("You should start Kafka container first"); } return String.format("PLAINTEXT://%s:%s", getContainerIpAddress(), port); }