auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addDisk(DiskImage disk) { if (disk != null) { saveImage(disk); saveBaseDisk(disk); saveDiskImageDynamic(disk); } else { log.error("Memory/Metadata disk could not be added"); } }

Target:
private void addDisk(DiskImage disk) { if (disk != null) { saveImage(disk); saveBaseDisk(disk); saveDiskImageDynamic(disk); } else { log.error("Memory metadata/dump disk could not be added"); } }
Source:
String dumpState() { return new StringBuilder(256).append("TLSEncryptionAdapter[") .append("isEmpty()=").append(isEmpty()) .append(", exceptions.isEmpty()=").append(m_exceptions.isEmpty()) .append(", gateway=").append(m_ecryptgw.dumpState()) .append(", inFligth=").append(m_inFlight.availablePermits()) .append("]").toString(); }

Target:
String dumpState() { return new StringBuilder(256).append("TLSEncryptionAdapter[") .append("isEmpty()=").append(isEmpty()) .append(", exceptions.isEmpty()=").append(m_exceptions.isEmpty()) .append(", gateway=").append(m_ecryptgw.dumpState()) .append(", inFlight=").append(m_inFlight.availablePermits()) .append("]").toString(); }
Source:
public List<String> getImageUrls() { final List<String> imageUrls = new ArrayList<>(3); final String mainImageUrl = getMainImageUrl(); if (mainImageUrl != null) { imageUrls.add(mainImageUrl); Log.d(LOG_TAG, "Flurry Native Ad main image found."); } final String iconUrl = getIconImageUrl(); if (iconUrl != null) { imageUrls.add(iconUrl); Log.d(LOG_TAG, "Flurry Native Ad icon image found."); } final String privacyUrl = getPrivacyInformationIconImageUrl(); if (iconUrl != null) { imageUrls.add(privacyUrl); Log.d(LOG_TAG, "Flurry Native Ad privacy information icon image found."); } return imageUrls; }

Target:
public List<String> getImageUrls() { final List<String> imageUrls = new ArrayList<>(3); final String mainImageUrl = getMainImageUrl(); if (mainImageUrl != null) { imageUrls.add(mainImageUrl); Log.d(LOG_TAG, "Flurry Native Ad main image found."); } final String iconUrl = getIconImageUrl(); if (iconUrl != null) { imageUrls.add(iconUrl); Log.d(LOG_TAG, "Flurry Native Ad icon image found."); } final String privacyUrl = getPrivacyInformationIconImageUrl(); if (privacyUrl != null) { imageUrls.add(privacyUrl); Log.d(LOG_TAG, "Flurry Native Ad privacy information icon image found."); } return imageUrls; }
Source:
public static OfferResult accept() { return new OfferResult(Arrays.asList()); }

Target:
public static OfferResult accept() { return new OfferResult(Collections.emptyList()); }
Source:
public List<UserModel> searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm) { try (LDAPQuery ldapQuery = LDAPUtils.createQueryForUserSearch(this, realm)) { LDAPQueryConditionsBuilder conditionsBuilder = new LDAPQueryConditionsBuilder(); Condition attrCondition = conditionsBuilder.equal(attrName, attrValue, EscapeStrategy.DEFAULT); ldapQuery.addWhereCondition(attrCondition); List<LDAPObject> ldapObjects = ldapQuery.getResultList(); if (ldapObjects == null || ldapObjects.isEmpty()) { return Collections.emptyList(); } List<UserModel> searchResults = new LinkedList<UserModel>(); for (LDAPObject ldapUser : ldapObjects) { String ldapUsername = LDAPUtils.getUsername(ldapUser, this.ldapIdentityStore.getConfig()); UserModel localUser = session.userLocalStorage().getUserByUsername(ldapUsername, realm); if (localUser == null) { UserModel imported = importUserFromLDAP(session, realm, ldapUser); searchResults.add(imported); } else if (shouldUserAttributeBeAlwaysReadFromLdap(realm, attrName)) { searchResults.add(proxy(realm, localUser, ldapUser)); } } return searchResults; } }

Target:
public List<UserModel> searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm) { try (LDAPQuery ldapQuery = LDAPUtils.createQueryForUserSearch(this, realm)) { LDAPQueryConditionsBuilder conditionsBuilder = new LDAPQueryConditionsBuilder(); Condition attrCondition = conditionsBuilder.equal(attrName, attrValue, EscapeStrategy.DEFAULT); ldapQuery.addWhereCondition(attrCondition); List<LDAPObject> ldapObjects = ldapQuery.getResultList(); if (ldapObjects == null || ldapObjects.isEmpty()) { return Collections.emptyList(); } List<UserModel> searchResults = new LinkedList<UserModel>(); for (LDAPObject ldapUser : ldapObjects) { String ldapUsername = LDAPUtils.getUsername(ldapUser, this.ldapIdentityStore.getConfig()); UserModel localUser = session.userLocalStorage().getUserByUsername(ldapUsername, realm); if (localUser == null) { UserModel imported = importUserFromLDAP(session, realm, ldapUser); searchResults.add(imported); } else { searchResults.add(proxy(realm, localUser, ldapUser)); } } return searchResults; } }
Source:
public List<String> validateQuestionDetails() { List<String> errors = new ArrayList<String>(); if (!distributeToRecipients && numOfConstSumOptions < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_OPTIONS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS + "."); } if (points < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_POINTS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS + "."); } Set<String> constSumOptionsSet = new HashSet<>(constSumOptions); if (constSumOptionsSet.size() < numOfConstSumOptions) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_DUPLICATE_OPTIONS); } return errors; }

Target:
public List<String> validateQuestionDetails() { List<String> errors = new ArrayList<String>(); if (!distributeToRecipients && numOfConstSumOptions < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_OPTIONS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS + "."); } if (points < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_POINTS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS + "."); } if (!FieldValidator.areElementsUnique(constSumOptions)) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_DUPLICATE_OPTIONS); } return errors; }
Source:
public SwiftAccessIO getSwiftObject() { try { DataFileIO dataFileIO = getInitialDataFile().getDataFileIO(); try { SwiftAccessIO swiftIO = (SwiftAccessIO)dataFileIO; return swiftIO; } catch (Exception e) { e.printStackTrace(); } } catch (Exception e){ e.printStackTrace(); } return null; }

Target:
public SwiftAccessIO getSwiftObject() { try { StorageIO<DataFile> storageIO = getInitialDataFile() == null ? null : getInitialDataFile().getStorageIO(); if (storageIO != null && storageIO instanceof SwiftAccessIO) { return (SwiftAccessIO)storageIO; } else { logger.fine("DatasetPage: Failed to cast storageIO as SwiftAccessIO (most likely because storageIO is a FileAccessIO)"); } } catch (IOException e) { logger.fine("DatasetPage: Failed to get storageIO"); } return null; }
Source:
protected void preparePrerequisites(String repo, ArtifactoryBaseClient client) throws VersionException, IOException { validateArtifactoryVersion(client); validateRepoExists(repo, client,"Target repo must be specified"); }

Target:
protected void preparePrerequisites(String repo, ArtifactoryBaseClient client) throws VersionException, IOException { validateArtifactoryVersion(client); validateRepoExists(repo, client, "The provided repo must be specified"); }
Source:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { if (_autoPausedSourcePartitions.containsKey(topicPartition)) { _logger.warn("Abort sending as is auto-paused", topicPartition); } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition); int numBytes = record.serializedKeySize() + record.serializedValueSize(); _consumerMetrics.updateBytesProcessedRate(numBytes); } } catch (Exception e) { _logger.warn("Got exception while sending record {}", record); pauseTopicPartitionWhenException(topicPartition, e); break; } } } _kafkaPositionTracker.ifPresent(tracker -> tracker.updatePositions(readTime, records, _consumer.metrics(), records.partitions().stream().collect(Collectors.toMap(Function.identity(), tp -> _consumer.position(tp))))); }

Target:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { if (_autoPausedSourcePartitions.containsKey(topicPartition)) { _logger.warn("Abort sending as is auto-paused", topicPartition); } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); int numBytes = record.serializedKeySize() + record.serializedValueSize(); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition, numBytes); } } catch (Exception e) { _logger.warn("Got exception while sending record {}", record); rewindAndPausePartitionOnException(topicPartition, e); break; } } } }
Source:
private void readNextContainer() { nextContainer = containerFromStream(cramHeader.getVersion(), countingInputStream); if (nextContainer.isEOF()) { eof = true; nextContainer = null; } }

Target:
private void readNextContainer() { nextContainer = containerFromStream(countingInputStream); if (nextContainer.isEOF()) { eof = true; nextContainer = null; } }
Source:
private void addCustomActionPlugins() { if ( actionPlugins != null ) { for ( RuleModellerActionPlugin actionPlugin : actionPlugins ) { final IAction iAction = actionPlugin.createIAction( oracle.getResourcePath() ); actionPlugin.addPluginToActionList( oracle.getResourcePath(), () -> { choices.addItem( actionPlugin.getActionAddDescription(), actionPlugin.getId() ); cmds.put( actionPlugin.getId(), () -> { model.addRhsItem( iAction, Integer.parseInt( positionCbo.getValue( positionCbo.getSelectedIndex() ) ) ); hide(); } ); } ); } } }

Target:
private void addCustomActionPlugins() { if (actionPlugins != null) { for (RuleModellerActionPlugin actionPlugin : actionPlugins) { final IAction iAction = actionPlugin.createIAction(ruleModeller); actionPlugin.addPluginToActionList(ruleModeller, () -> { choices.addItem(actionPlugin.getActionAddDescription(), actionPlugin.getId()); cmds.put(actionPlugin.getId(), () -> { model.addRhsItem(iAction, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex()))); hide(); }); }); } } }
Source:
static void checkConfigGroupsHasServiceName() { Map<Long, ConfigGroup> configGroupMap = collectConfigGroupsWithoutServiceName(); if (MapUtils.isEmpty(configGroupMap)) return; StringBuilder output = new StringBuilder("[(ConfigGroup) => "); for (ConfigGroup configGroup : configGroupMap.values()) { configGroupMap.put(configGroup.getId(), configGroup); output.append("( "); output.append(configGroup.getName()); output.append(" ), "); } output.replace(output.lastIndexOf(","), output.length(), "]"); warning("You have config groups present in the database with no " + " service name, {}. Run --auto-fix-database to fix " + "this automatically.", output.toString()); }

Target:
static void checkConfigGroupsHasServiceName() { Map<Long, ConfigGroup> configGroupMap = collectConfigGroupsWithoutServiceName(); if (MapUtils.isEmpty(configGroupMap)) return; StringBuilder output = new StringBuilder("[(ConfigGroup) => "); for (ConfigGroup configGroup : configGroupMap.values()) { output.append("( "); output.append(configGroup.getName()); output.append(" ), "); } output.replace(output.lastIndexOf(","), output.length(), "]"); warning("You have config groups present in the database with no " + "service name, {}. Run --auto-fix-database to fix " + "this automatically. Please backup Ambari Server database before running --auto-fix-database.", output.toString()); }
Source:
public ColumnCapabilities getColumnCapabilities(String column) { if (index.getColumn(column) == null) { return null; } return index.getColumn(column).getCapabilities(); }

Target:
public ColumnCapabilities getColumnCapabilities(String column) { Column columnObj = index.getColumn(column); if (columnObj == null) { return null; } return columnObj.getCapabilities(); }
Source:
private Set<String> generateIds(final String namespace, final ComponentCategory category, final int quantity) { final Set<String> generatedComponentIds = newLinkedHashSet(); final int maxAttempts = getConfig().getMaxIdGenerationAttempts(); int remainingQuantity = quantity; for (int attempt = 1; attempt <= maxAttempts && generatedComponentIds.size() != quantity; attempt++) { final int currentAttempt = attempt; final Set<String> newGeneratedComponentIds = IntStream.range(0, remainingQuantity) .mapToObj(i -> generateId(namespace, category, currentAttempt)) .collect(Collectors.toSet()); Set<String> reservedIds = isReserved(newGeneratedComponentIds, generatedComponentIds); newGeneratedComponentIds.removeAll(reservedIds); generatedComponentIds.addAll(newGeneratedComponentIds); } if (generatedComponentIds.size() != quantity) { throw new BadRequestException("Couldn't generate %s identifiers [%s, %s] in maximum (%s) number of attempts", quantity, category, namespace, maxAttempts); } else { return ImmutableSet.<String>copyOf(generatedComponentIds); } }

Target:
private Set<String> generateIds(final String namespace, final ComponentCategory category, final int quantity) { final Set<String> generatedComponentIds = newLinkedHashSet(); final int maxAttempts = getConfig().getMaxIdGenerationAttempts(); for (int attempt = 1; attempt <= maxAttempts && generatedComponentIds.size() != quantity; attempt++) { final int remainingQuantity = quantity - generatedComponentIds.size(); Set<String> newGeneratedComponentIds = doGenerateIds(namespace, category, remainingQuantity, attempt); Set<String> reservedIds = isReserved(newGeneratedComponentIds, generatedComponentIds); newGeneratedComponentIds.removeAll(reservedIds); generatedComponentIds.addAll(newGeneratedComponentIds); } if (generatedComponentIds.size() != quantity) { final String namespaceValue = Strings.isNullOrEmpty(namespace) ? SnomedIdentifiers.INT_NAMESPACE : namespace; throw new BadRequestException("Couldn't generate %s identifiers [%s, %s] in maximum (%s) number of attempts", quantity, category, namespaceValue, maxAttempts); } else { return ImmutableSet.<String>copyOf(generatedComponentIds); } }
Source:
public StreamingOutput create(RegisterDetail registerDetail, List<Record> records) { return output -> { try (ZipEntryWriter zipEntryWriter = new ZipEntryWriter(output)) { zipEntryWriter.writeEntry("register.json", registerDetail); records.stream() .collect(Collectors.toMap(e -> e.entry.getSha256hex(), e -> e)) .forEach((hash, d) -> { zipEntryWriter.writeEntry(String.format("item/%s.json", hash), d.item.content); zipEntryWriter.writeEntry(String.format("entry/%s.json", d.entry.entryNumber), new ArchiveEntryData(d.entry.entryNumber, d.entry.getSha256hex(), d.entry.getTimestamp())); } ); } }; }

Target:
public StreamingOutput create(RegisterDetail registerDetail, List<Record> records) { return output -> { try (ZipEntryWriter zipEntryWriter = new ZipEntryWriter(output)) { zipEntryWriter.writeEntry("register.json", registerDetail); records.stream().map(r -> r.item).distinct().forEach(item -> zipEntryWriter.writeEntry(String.format("item/%s.json", item.sha256hex), item.content) ); records.stream().map(r -> r.entry).forEach(entry -> zipEntryWriter.writeEntry(String.format("entry/%s.json", entry.entryNumber), new ArchiveEntryData(entry.entryNumber, entry.getSha256hex(), entry.getTimestamp())) ); } }; }
Source:
public VersionInfo getVersionInfo() { String versionString = BuildConfig.VERSION_NAME; String splits[] = versionString.split("\\."); int major = Integer.parseInt(splits[0]); int minor = Integer.parseInt(splits[1]); int micro = Integer.parseInt(splits[2]) * 100 + Integer.parseInt(splits[3]); return new VersionInfo(major, minor, micro); }

Target:
public VersionInfo getVersionInfo() { String versionString = BuildConfig.VERSION_NAME; String splits[] = versionString.split("\\."); int major = 0; int minor = 0; int micro = 0; if (splits.length > 2) { major = Integer.parseInt(splits[0]); minor = Integer.parseInt(splits[1]); micro = Integer.parseInt(splits[2]) * 100; if (splits.length > 3) { micro += Integer.parseInt(splits[3]); } } else if (splits.length == 2) { major = Integer.parseInt(splits[0]); minor = Integer.parseInt(splits[1]); } else if (splits.length == 1) { major = Integer.parseInt(splits[0]); } return new VersionInfo(major, minor, micro); }
Source:
private Set<String> collectMapValues(Map<String, Set<String>> map) { return map.values() .stream() .flatMap(set -> set.stream()) .collect(Collectors.toCollection(HashSet::new)); }

Target:
private Set<String> collectMapValues(Map<String, Set<String>> map) { Set<String> set = new HashSet<>(); map.values().forEach((s) -> set.addAll(s)); return set; }
Source:
private boolean isCommonCacheUsed(){ AuthenticationContext authenticationContext = createAuthenticationContext(); if(authenticationContext.getCache() instanceof DefaultTokenCacheStore){ return true; } return false; }

Target:
private boolean isCommonCacheUsed() { boolean isCommonAvailable = false; try { Class.forName("com.microsoft.identity.common.internal.cache.ADALOAuth2TokenCache"); isCommonAvailable = true; } catch (ClassNotFoundException e) { e.printStackTrace(); } if(isCommonAvailable) { AuthenticationContext authenticationContext = createAuthenticationContext(); return authenticationContext.getCache() instanceof DefaultTokenCacheStore; } return false; }
Source:
public void testNonBlockingRouterFactory() throws Exception { MockClusterMap mockClusterMap = new MockClusterMap(); try { Properties props = getNonBlockingRouterProperties("NotInClusterMap"); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); router = (NonBlockingRouter) new NonBlockingRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem()).getRouter(); Assert.fail("NonBlockingRouterFactory instantiation should have failed because the router datacenter is not in " + "the cluster map"); } catch (IllegalStateException e) { } Properties props = getNonBlockingRouterProperties("DC1"); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); router = (NonBlockingRouter) new NonBlockingRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem()).getRouter(); assertExpectedThreadCounts(1); router.close(); assertExpectedThreadCounts(0); }

Target:
public void testNonBlockingRouterFactory() throws Exception { MockClusterMap mockClusterMap = new MockClusterMap(); Properties props = getNonBlockingRouterProperties("NotInClusterMap"); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); try { router = (NonBlockingRouter) new NonBlockingRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem()).getRouter(); Assert.fail("NonBlockingRouterFactory instantiation should have failed because the router datacenter is not in " + "the cluster map"); } catch (IllegalStateException e) { } props = getNonBlockingRouterProperties("DC1"); verifiableProperties = new VerifiableProperties((props)); router = (NonBlockingRouter) new NonBlockingRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem()).getRouter(); assertExpectedThreadCounts(1); router.close(); assertExpectedThreadCounts(0); }
Source:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (firstMessage == null) { firstMessage = msg; if (VmSettings.MESSAGE_TIMESTAMPS) { firstMessageTimeStamp = System.currentTimeMillis(); } } else { appendToMailbox(msg); } logMessageAddedToMailbox(msg); if ((!isExecuting) && replayCanProcess(msg)) { isExecuting = true; executeOnPool(); } }

Target:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (firstMessage == null) { firstMessage = msg; if (VmSettings.MESSAGE_TIMESTAMPS) { firstMessageTimeStamp = System.currentTimeMillis(); } } else { appendToMailbox(msg); } if (!isExecuting) { isExecuting = true; executeOnPool(); } }
Source:
private static void dumpMetadata(Checker checker, String path) throws CheckstyleException, IOException { final List<File> validFiles = new ArrayList<>(); if (path.endsWith(".java")) { validFiles.add(new File(path)); } else { final List<String> moduleFolders = Arrays.asList("checks", "filters", "filefilters"); for (String folder : moduleFolders) { try (Stream<Path> files = Files.walk(Paths.get(path + "/" + folder))) { validFiles.addAll(files.map(Path::toString) .filter(fileName -> { return fileName.endsWith("SuppressWarningsHolder.java") || fileName.endsWith("Check.java") || fileName.endsWith("Filter.java"); }) .map(File::new) .collect(Collectors.toList())); } } } checker.process(validFiles); }

Target:
private static void dumpMetadata(Checker checker, String path) throws CheckstyleException, IOException { final List<File> validFiles = new ArrayList<>(); if (path.endsWith(".java")) { validFiles.add(new File(path)); } else { final List<String> moduleFolders = Arrays.asList("checks", "filters", "filefilters"); for (String folder : moduleFolders) { try (Stream<Path> files = Files.walk(Paths.get(path + "/" + folder))) { validFiles.addAll( files.map(Path::toFile) .filter(file -> { return file.getName().endsWith("SuppressWarningsHolder.java") || file.getName().endsWith("Check.java") || file.getName().endsWith("Filter.java"); }) .collect(Collectors.toList())); } } } checker.process(validFiles); }
Source:
private void onNext() { String phoneNumber = getPseudoValidPhoneNumber(); if (phoneNumber == null) { mPhoneInputLayout.setError(getString(R.string.fui_invalid_phone_number)); } else { mHandler.verifyPhoneNumber(phoneNumber, false); } }

Target:
private void onNext() { String phoneNumber = getPseudoValidPhoneNumber(); if (phoneNumber == null) { mPhoneInputLayout.setError(getString(R.string.fui_invalid_phone_number)); } else { mVerificationHandler.verifyPhoneNumber(phoneNumber, false); } }
Source:
private void toBoolean(Value value) { ValueType type = value.getType(); if (type == ValueType.STRING) { String s = value.getString(); if (Boolean.TRUE.toString().equalsIgnoreCase(s)) { value.set(Boolean.TRUE); } else if (Boolean.FALSE.toString().equalsIgnoreCase(s)) { value.set(Boolean.FALSE); } else if ("true".equalsIgnoreCase(s)) { value.set(Boolean.TRUE); } else if ("false".equalsIgnoreCase(s)) { value.set(Boolean.TRUE); } else if ("0".equals(s)) { value.set(Boolean.FALSE); } else if ("1".equals(s)) { value.set(Boolean.TRUE); } else { try { double d = Double.parseDouble(s); value.set(d != 0d); } catch (Exception ignore) { } } } else if (type == ValueType.NUMBER) { Number num = value.getNumber(); if (num instanceof Double) { value.set(num.doubleValue() != 0d); } else if (num instanceof Float) { value.set(num.floatValue() != 0f); } else { value.set(num.longValue() != 0l); } } }

Target:
private void toBoolean(Value value) { ValueType type = value.getType(); if (type == ValueType.STRING) { String s = value.getString(); if ("true".equalsIgnoreCase(s)) { value.set(Boolean.TRUE); } else if ("false".equalsIgnoreCase(s)) { value.set(Boolean.FALSE); } else if ("0".equals(s)) { value.set(Boolean.FALSE); } else if ("1".equals(s)) { value.set(Boolean.TRUE); } else { try { double d = Double.parseDouble(s); value.set(d != 0d); } catch (Exception ignore) { } } } else if (type == ValueType.NUMBER) { Number num = value.getNumber(); if (num instanceof Double) { value.set(num.doubleValue() != 0d); } else if (num instanceof Float) { value.set(num.floatValue() != 0f); } else { value.set(num.longValue() != 0l); } } }
Source:
private void finishPage() { IStatus status= fPage.getModuleStatus(); if (status.isOK()) { moduleName= fPage.getModuleText(); if (project != null) { try { IPackageFragmentRoot[] packageFragmentRoots= project.getPackageFragmentRoots(); List<IPackageFragmentRoot> packageFragmentRootsAsList= new ArrayList<>(Arrays.asList(packageFragmentRoots)); for (IPackageFragmentRoot packageFragmentRoot : packageFragmentRoots) { IResource res= packageFragmentRoot.getCorrespondingResource(); if (res == null || res.getType() != IResource.FOLDER || packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) { packageFragmentRootsAsList.remove(packageFragmentRoot); } } packageFragmentRoots= packageFragmentRootsAsList.toArray(new IPackageFragmentRoot[packageFragmentRootsAsList.size()]); if (packageFragmentRoots.length == 0) { return; } IPackageFragmentRoot targetPkgFragmentRoot= null; for (IPackageFragmentRoot packageFragmentRoot : packageFragmentRoots) { if (packageFragmentRoot.getPackageFragment("").getCompilationUnit(MODULE_INFO_JAVA_FILENAME).exists()) { targetPkgFragmentRoot= packageFragmentRoot; break; } } if (targetPkgFragmentRoot == null) { targetPkgFragmentRoot= packageFragmentRoots[0]; } createAndOpenFile(targetPkgFragmentRoot, packageFragmentRoots); } catch (CoreException e) { JavaPlugin.log(e); } } } return; }

Target:
private void finishPage() { IStatus status= fPage.getModuleNameStatus(); if (status.isOK()) { if (fProject != null && fTargetPkgFragmentRoot != null && fPackageFragmentRoots != null && fPackageFragmentRoots.length > 0) { try { createAndOpenFile(fTargetPkgFragmentRoot, fPackageFragmentRoots); } catch (CoreException e) { JavaPlugin.log(e); } } } return; }
Source:
private byte[] convertToByteArray(Object value) { if (value instanceof IndexedRecord) { IndexedRecord payloadRecord = (IndexedRecord) value; try { return AvroUtils.encodeAvroRecord(payloadRecord.getSchema(), payloadRecord); } catch (IOException e) { ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, "Failed to encode event in Avro, event=" + payloadRecord, e); } } else if (value instanceof String) { return ((String) value).getBytes(); } throw new DatastreamRuntimeException("Transport provider supports payloads of type String or AvroRecords"); }

Target:
private byte[] convertToByteArray(Object value) { if (value instanceof IndexedRecord) { IndexedRecord payloadRecord = (IndexedRecord) value; try { return AvroUtils.encodeAvroIndexedRecord(payloadRecord.getSchema(), payloadRecord); } catch (IOException e) { ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, "Failed to encode event in Avro, event=" + payloadRecord, e); } } else if (value instanceof String) { return ((String) value).getBytes(); } throw new DatastreamRuntimeException("Transport provider supports payloads of type String or AvroRecords"); }
Source:
public synchronized void dispose() { fDisposed = true; ModelNode[] childrenNodes = getChildrenNodes(); if (childrenNodes != null) { for (ModelNode childrenNode : childrenNodes) { childrenNode.dispose(); } } }

Target:
public synchronized void dispose() { fDisposed = true; ModelNode[] childrenNodes = getChildrenNodes(); if (childrenNodes != null) { for (ModelNode node : childrenNodes) { node.dispose(); } } }
Source:
static RuleSet getVoltPhysicalConversionRules() { final List<RelOptRule> ruleList = new ArrayList<>(); ruleList.add(VoltDBPCalcRule.INSTANCE); ruleList.add(VoltDBPSeqScanRule.INSTANCE); ruleList.add(VoltDBPSortConvertRule.INSTANCE_VOLTDB); ruleList.add(VoltDBPLimitRule.INSTANCE); ruleList.add(VoltDBPAggregateRule.INSTANCE); ruleList.add(VoltDBPJoinRule.INSTANCE); return RuleSets.ofList(ruleList); }

Target:
static RuleSet getVoltPhysicalConversionRules() { return s_VoltPhysicalConversionRules; }
Source:
public void visitIfStatement(IfStatementTree tree) { Tree parentTree = tree.parent(); if (parentTree.is(Tree.Kind.IF_STATEMENT) && ((IfStatementTree) parentTree).elseKeyword() != null) { checkForReport(tree.thenStatement(), ((IfStatementTree) parentTree).elseKeyword(), tree.closeParenToken(), tree.ifKeyword().firstToken().text()); } else { checkForReport(tree.thenStatement(), tree.ifKeyword(), tree.closeParenToken(), tree.ifKeyword().text()); } SyntaxToken elseKeyword = tree.elseKeyword(); if (elseKeyword != null && !tree.elseStatement().is(Tree.Kind.IF_STATEMENT)) { checkForReport(tree.elseStatement(), elseKeyword, elseKeyword, elseKeyword.firstToken().text()); } super.visitIfStatement(tree); }

Target:
public void visitIfStatement(IfStatementTree tree) { Tree parentTree = tree.parent(); if (parentTree.is(Tree.Kind.IF_STATEMENT) && tree.equals(((IfStatementTree) parentTree).elseStatement())) { checkForReport(tree.thenStatement(), ((IfStatementTree) parentTree).elseKeyword(), tree.closeParenToken(), tree.ifKeyword().firstToken().text()); } else { checkForReport(tree.thenStatement(), tree.ifKeyword(), tree.closeParenToken(), tree.ifKeyword().text()); } SyntaxToken elseKeyword = tree.elseKeyword(); if (elseKeyword != null && !tree.elseStatement().is(Tree.Kind.IF_STATEMENT)) { checkForReport(tree.elseStatement(), elseKeyword, elseKeyword, elseKeyword.firstToken().text()); } super.visitIfStatement(tree); }
Source:
void okbuck() { boolean hasGroovyLib = okBuckExtension.buckProjects.parallelStream().anyMatch(project -> ProjectUtil.getType(project) == ProjectType.GROOVY_LIB); if (hasGroovyLib) { GroovyUtil.setupGroovyHome(getProject()); } boolean hasKotlinLib = ProjectUtil.hasArtifactInClasspath(getProject(), KotlinUtil.KOTLIN_GROUP, KotlinUtil.KOTLIN_GRADLE_MODULE); if (hasKotlinLib) { KotlinUtil.setupKotlinHome(getProject()); } generate(okBuckExtension, hasGroovyLib ? GroovyUtil.GROOVY_HOME_LOCATION : null, hasKotlinLib ? KotlinUtil.KOTLIN_HOME_LOCATION : null); }

Target:
void okbuck() { boolean hasGroovyLib = okBuckExtension.buckProjects.parallelStream().anyMatch(project -> ProjectUtil.getType(project) == ProjectType.GROOVY_LIB); if (hasGroovyLib) { GroovyUtil.setupGroovyHome(getProject()); } boolean hasKotlinLib = KotlinUtil.hasKotlinPluginInClasspath(getProject()); if (hasKotlinLib) { KotlinUtil.setupKotlinHome(getProject()); } generate(okBuckExtension, hasGroovyLib ? GroovyUtil.GROOVY_HOME_LOCATION : null, hasKotlinLib ? KotlinUtil.KOTLIN_HOME_LOCATION : null); }
Source:
private Stream<ConfigurationSetting> listSettings(SettingSelector options, Context context) { List<ConfigurationSetting> listConfigurationSettings = client.listSettings(options, context).collectList().block(); return listConfigurationSettings != null ? listConfigurationSettings.stream() : Stream.empty(); }

Target:
public PagedIterable<ConfigurationSetting> listSettings(SettingSelector options, Context context) { return new PagedIterable<>(client.listSettings(options, context)); }
Source:
protected Boolean visitDereferenceExpression(DereferenceExpression expected, RowExpression actual) { if (!(actual instanceof SpecialFormExpression) || !(((SpecialFormExpression) actual).getForm().equals(DEREFERENCE))) { return false; } SpecialFormExpression actualDereference = (SpecialFormExpression) actual; if (actualDereference.getArguments().size() == 2 && actualDereference.getArguments().get(0).getType() instanceof RowType && actualDereference.getArguments().get(1) instanceof ConstantExpression) { RowType rowType = (RowType) actualDereference.getArguments().get(0).getType(); Object value = LiteralInterpreter.evaluate(TEST_SESSION.toConnectorSession(), (ConstantExpression) actualDereference.getArguments().get(1)); Preconditions.checkState(value instanceof Long); long index = (Long) value; Preconditions.checkState(index >= 0 && index < rowType.getFields().size()); RowType.Field field = rowType.getFields().get((int) index); Preconditions.checkState(field.getName().isPresent()); return expected.getField().getValue().equals(field.getName().get()) && process(expected.getBase(), actualDereference.getArguments().get(0)); } return false; }

Target:
protected Boolean visitDereferenceExpression(DereferenceExpression expected, RowExpression actual) { if (!(actual instanceof SpecialFormExpression) || !(((SpecialFormExpression) actual).getForm().equals(DEREFERENCE))) { return false; } SpecialFormExpression actualDereference = (SpecialFormExpression) actual; if (actualDereference.getArguments().size() == 2 && actualDereference.getArguments().get(0).getType() instanceof RowType && actualDereference.getArguments().get(1) instanceof ConstantExpression) { RowType rowType = (RowType) actualDereference.getArguments().get(0).getType(); Object value = LiteralInterpreter.evaluate(TEST_SESSION.toConnectorSession(), (ConstantExpression) actualDereference.getArguments().get(1)); checkState(value instanceof Long); long index = (Long) value; checkState(index >= 0 && index < rowType.getFields().size()); RowType.Field field = rowType.getFields().get(toIntExact(index)); checkState(field.getName().isPresent()); return expected.getField().getValue().equals(field.getName().get()) && process(expected.getBase(), actualDereference.getArguments().get(0)); } return false; }
Source:
public WindowedStream<T> window(final WindowInformation windowInfo) { final WindowedStream<T> downStream = windowInfo.getWindowedStream(dag); dag.addVertex(downStream); dag.addEdge(this, downStream, StreamType.Direction.LEFT); return downStream; }

Target:
public WindowOperatorStream<T> window(final WindowInformation windowInfo) { final WindowOperatorStream<T> downStream = new WindowOperatorStream<>(windowInfo, dag); dag.addVertex(downStream); dag.addEdge(this, downStream, StreamType.Direction.LEFT); return downStream; }
Source:
public void visitFileInput(FileInput fileInput) { scopesByRootTree = new HashMap<>(); fileInput.accept(new FirstPhaseVisitor()); fileInput.accept(new SecondPhaseVisitor()); addSymbolsToTree((FileInputImpl) fileInput); handleClassMemberAccess(fileInput); if (!SymbolUtils.isTypeShedFile(pythonFile)) { TypeInference.inferTypes(fileInput); } }

Target:
public void visitFileInput(FileInput fileInput) { scopesByRootTree = new HashMap<>(); fileInput.accept(new FirstPhaseVisitor()); fileInput.accept(new SecondPhaseVisitor()); addSymbolsToTree((FileInputImpl) fileInput); fileInput.accept(new ThirdPhaseVisitor()); if (!SymbolUtils.isTypeShedFile(pythonFile)) { TypeInference.inferTypes(fileInput); } }
Source:
public void deleteGroupRole(String group, String role) { throw new RuntimeException("Deleting a group role is not supporting in LDAP"); }

Target:
public void deleteGroupRole(String group, String role) { throw new UnsupportedOperationException("Deleting a group role is not supporting in LDAP"); }
Source:
public void testTemplateMemberAccessibilities() throws Exception { BindingAssertionHelper bh = getAssertionHelper(); ICPPClassTemplate aTemplate = bh.assertNonProblem("ATemplate"); ICPPField defaultMemberVariable = bh.assertNonProblem("defaultMemberVariable"); VisibilityHelper.assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(defaultMemberVariable)); ICPPField publicMemberVariable = bh.assertNonProblem("publicMemberVariable"); VisibilityHelper.assertVisibility(ICPPClassType.v_public, aTemplate.getVisibility(publicMemberVariable)); ICPPField protectedMemberVariable = bh.assertNonProblem("protectedMemberVariable"); VisibilityHelper.assertVisibility(ICPPClassType.v_protected, aTemplate.getVisibility(protectedMemberVariable)); ICPPField privateMemberVariable = bh.assertNonProblem("privateMemberVariable"); VisibilityHelper.assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(privateMemberVariable)); }

Target:
public void testTemplateMemberAccessibilities() throws Exception { BindingAssertionHelper bh = getAssertionHelper(); ICPPClassTemplate aTemplate = bh.assertNonProblem("ATemplate"); ICPPField defaultMemberVariable = bh.assertNonProblem("defaultMemberVariable"); assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(defaultMemberVariable)); ICPPField publicMemberVariable = bh.assertNonProblem("publicMemberVariable"); assertVisibility(ICPPClassType.v_public, aTemplate.getVisibility(publicMemberVariable)); ICPPField protectedMemberVariable = bh.assertNonProblem("protectedMemberVariable"); assertVisibility(ICPPClassType.v_protected, aTemplate.getVisibility(protectedMemberVariable)); ICPPField privateMemberVariable = bh.assertNonProblem("privateMemberVariable"); assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(privateMemberVariable)); }
Source:
private static void assertAggregationInternal(InternalAggregationFunction function, BiFunction<Object, Object, Boolean> isEqual, String testDescription, Object expectedValue, Page... pages) { assertFunctionEquals(isEqual, testDescription, aggregation(function, pages), expectedValue); assertFunctionEquals(isEqual, testDescription, partialAggregation(function, pages), expectedValue); if (pages.length > 0) { assertFunctionEquals(isEqual, testDescription, groupedAggregation(function, pages), expectedValue); assertFunctionEquals(isEqual, testDescription, groupedPartialAggregation(function, pages), expectedValue); assertFunctionEquals(isEqual, testDescription, distinctAggregation(function, pages), expectedValue); } }

Target:
private static void assertAggregationInternal(InternalAggregationFunction function, BiFunction<Object, Object, Boolean> isEqual, String testDescription, Object expectedValue, Page... pages) { assertFunctionEquals(isEqual, testDescription, aggregation(function, pages), expectedValue); assertFunctionEquals(isEqual, testDescription, partialAggregation(function, pages), expectedValue); if (pages.length > 0) { assertFunctionEquals(isEqual, testDescription, groupedAggregation(isEqual, function, pages), expectedValue); assertFunctionEquals(isEqual, testDescription, groupedPartialAggregation(isEqual, function, pages), expectedValue); assertFunctionEquals(isEqual, testDescription, distinctAggregation(function, pages), expectedValue); } }
Source:
private static void putSwtVersion(VersionMap values, Version swtVersion) { if (!(swtVersion instanceof OSGiVersion)) return; int major = ((OSGiVersion) swtVersion).getMajor(); if (major != 3) return; int minor = ((OSGiVersion) swtVersion).getMinor(); if (minor == 100) { values.put(VERSION, "4.2"); } else if (minor < 200) { values.put(VERSION, "4." + (minor - 99)); } }

Target:
private static void putSwtVersion(VersionMap values, Version swtVersion) { if (!(swtVersion instanceof OSGiVersion)) return; int major = ((OSGiVersion) swtVersion).getMajor(); if (major != 3) return; int minor = ((OSGiVersion) swtVersion).getMinor(); if (minor < 100) { values.put(VERSION, "3." + minor); } else if (minor == 100) { values.put(VERSION, "4.2"); } else if (minor < 200) { values.put(VERSION, "4." + (minor - 99)); } }
Source:
public List<NodeHistory> getNodesHistory(long windowStart, long windowEnd) { return executeReadTransaction(session -> { Query query = session.createQuery("FROM NodeHistory " + "WHERE (:windowStart <= startTime AND startTime <= :windowEnd) " + "OR (:windowStart <= endTime AND endTime <= :windowEnd)"); query.setParameter("windowStart", windowStart); query.setParameter("windowEnd", windowEnd); return query.list(); }); }

Target:
public List<NodeHistory> getNodesHistory(long windowStart, long windowEnd) { return executeReadTransaction(session -> { Query query = session.createQuery("FROM NodeHistory " + "WHERE (endTime = 0 OR :windowStart <= endTime) " + "AND ( startTime <= :windowEnd )"); query.setParameter("windowStart", windowStart); query.setParameter("windowEnd", windowEnd); return (List<NodeHistory>) query.list(); }); }
Source:
protected void recursivelyPrint(AbstractPlanNode node, StringBuilder sb) { for (int i = 0; i < indent; i++) { sb.append("\t"); } sb.append(node.toJSONString() + "\n"); indent++; if (node.getChildCount() > 0) { recursivelyPrint(node.getChild(0), sb); } }

Target:
protected void recursivelyPrint(AbstractPlanNode node, StringBuilder sb) { recursivelyPrint(node, sb, 0); }
Source:
public Collection[] getCollections() throws SQLException { List<Collection> collections = new ArrayList<Collection>(); TableRowIterator tri = null; try { String query = "SELECT c.* FROM community2collection c2c, collection c " + "LEFT JOIN metadatavalue m on (m.resource_id = c.collection_id and m.resource_type_id = ? and m.metadata_field_id = ?) " + "WHERE c2c.collection_id=c.collection_id AND c2c.community_id=? "; if("oracle".equals(ConfigurationManager.getProperty("db.name"))){ query += " ORDER BY cast(m.text_value as varchar2(128))"; }else{ query += " ORDER BY m.text_value"; } tri = DatabaseManager.query( ourContext, query, Constants.COLLECTION, MetadataField.findByElement(ourContext, MetadataSchema.find(ourContext, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(), getID() ); } catch (SQLException e) { log.error("Find all Collections for this community - ",e); throw e; } try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) ourContext.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(ourContext, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; }

Target:
public Collection[] getCollections() throws SQLException { List<Collection> collections = new ArrayList<Collection>(); TableRowIterator tri = null; try { String query = "SELECT c.* FROM community2collection c2c, collection c " + "LEFT JOIN metadatavalue m on (m.resource_id = c.collection_id and m.resource_type_id = ? and m.metadata_field_id = ?) " + "WHERE c2c.collection_id=c.collection_id AND c2c.community_id=? "; if(DatabaseManager.isOracle()){ query += " ORDER BY cast(m.text_value as varchar2(128))"; }else{ query += " ORDER BY m.text_value"; } tri = DatabaseManager.query( ourContext, query, Constants.COLLECTION, MetadataField.findByElement(ourContext, MetadataSchema.find(ourContext, MetadataSchema.DC_SCHEMA).getSchemaID(), "title", null).getFieldID(), getID() ); } catch (SQLException e) { log.error("Find all Collections for this community - ",e); throw e; } try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) ourContext.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(ourContext, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; }
Source:
private void runLoop() { subscribeConsumer(); boolean needRebalance = false; while (isRunning()) { try { if (needRebalance) { enforceRebalance(); needRebalance = false; } runOnce(); if (assignmentErrorCode.get() == AssignorError.VERSION_PROBING.code()) { log.info("Version probing detected. Rejoining the consumer group to trigger a new rebalance."); assignmentErrorCode.set(AssignorError.NONE.code()); enforceRebalance(); } } catch (final TaskCorruptedException e) { log.warn("Detected the states of tasks are corrupted. " + "Will close the task as dirty and re-create and bootstrap from scratch.", e.corruptedTaskWithChangelogs()); taskManager.handleCorruption(e.corruptedTaskWithChangelogs()); } catch (final TaskMigratedException e) { log.warn("Detected that the thread is being fenced. " + "This implies that this thread missed a rebalance and dropped out of the consumer group. " + "Will close out all assigned tasks and rejoin the consumer group."); taskManager.handleLostAll(); needRebalance = true; } } }

Target:
private void runLoop() { subscribeConsumer(); while (isRunning()) { try { runOnce(); if (assignmentErrorCode.get() == AssignorError.VERSION_PROBING.code()) { log.info("Version probing detected. Rejoining the consumer group to trigger a new rebalance."); assignmentErrorCode.set(AssignorError.NONE.code()); enforceRebalance(); } } catch (final TaskCorruptedException e) { log.warn("Detected the states of tasks are corrupted. " + "Will close the task as dirty and re-create and bootstrap from scratch.", e.corruptedTaskWithChangelogs()); taskManager.handleCorruption(e.corruptedTaskWithChangelogs()); } catch (final TaskMigratedException e) { log.warn("Detected that the thread is being fenced. " + "This implies that this thread missed a rebalance and dropped out of the consumer group. " + "Will close out all assigned tasks and rejoin the consumer group."); taskManager.handleLostAll(); enforceRebalance(); } } }
Source:
public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); initStreamLogDirectory(); String logSizeQuotaParam = serverContext.getServerConfig().get("--log-size-quota").toString(); logSizeLimit = Long.parseLong(logSizeQuotaParam); long initialLogSize = estimateSize(logDir); logSizeQuota = new ResourceQuota("LogSizeQuota", logSizeLimit); logSizeQuota.consume(initialLogSize); verifyLogs(); logMetadata = new LogMetadata(); initializeLogMetadata(); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }

Target:
public StreamLogFiles(ServerContext serverContext, boolean noVerify) { logDir = Paths.get(serverContext.getServerConfig().get("--log-path").toString(), "log"); writeChannels = new ConcurrentHashMap<>(); channelsToSync = new HashSet<>(); this.verify = !noVerify; this.dataStore = StreamLogDataStore.builder().dataStore(serverContext.getDataStore()).build(); String logSizeQuotaParam = (String) serverContext.getServerConfig().get("--log-size-quota-bytes"); logSizeLimit = Long.parseLong(logSizeQuotaParam); initStreamLogDirectory(); long initialLogSize = estimateSize(logDir); log.info("StreamLogFiles: size is bytes, limit {}", logDir, initialLogSize, logSizeLimit); logSizeQuota = new ResourceQuota("LogSizeQuota", logSizeLimit == -1 ? Long.MAX_VALUE : logSizeLimit); logSizeQuota.consume(initialLogSize); verifyLogs(); logMetadata = new LogMetadata(); initializeLogMetadata(); if (Math.max(logMetadata.getGlobalTail(), 0L) < getTrimMark()) { syncTailSegment(getTrimMark() - 1); } }
Source:
private void broadcastSuccess(final Migration migration) { final Set<String> activeEvaluatorIds = partitionManager.getActiveEvaluators(); final String senderId = migration.getSenderId(); final String receiverId = migration.getReceiverId(); activeEvaluatorIds.remove(senderId); activeEvaluatorIds.remove(receiverId); final List<Integer> blockIds = migration.getBlockIds(); LOG.log(Level.INFO, "Broadcast the result of migration to other active evaluators: {0}", activeEvaluatorIds); try (final TraceScope traceScope = Trace.startSpan("ROUTING_UPDATE")) { final TraceInfo traceInfo = TraceInfo.fromSpan(traceScope.getSpan()); for (final String evalId : activeEvaluatorIds) { sender.get().sendRoutingUpdateMsg(evalId, blockIds, senderId, receiverId, traceInfo); } } }

Target:
private void broadcastSuccess(final Migration migration) { final Set<String> activeEvaluatorIds = partitionManager.getActiveEvaluators(); final String senderId = migration.getSenderId(); final String receiverId = migration.getReceiverId(); activeEvaluatorIds.remove(senderId); activeEvaluatorIds.remove(receiverId); final List<Integer> blockIds = migration.getBlockIds(); LOG.log(Level.INFO, "Broadcast the result of migration to other active evaluators: {0}", activeEvaluatorIds); try (final TraceScope traceScope = Trace.startSpan("ROUTING_UPDATE")) { final TraceInfo traceInfo = TraceInfo.fromSpan(traceScope.getSpan()); for (final String evalId : activeEvaluatorIds) { sender.get().sendRoutingTableUpdateMsg(evalId, blockIds, senderId, receiverId, traceInfo); } } }
Source:
public @Nullable Long getTimeForPoint(int x) { return UIThreadRunnable.syncExec((Result<@Nullable Long>) () -> { Rectangle bounds = widget.getBounds(); Point p = new Point(x, bounds.y + bounds.height / 2); if (!bounds.contains(p)) { return null; } return widget.getTimeAtX(x); }); }

Target:
public Long getTimeForPoint(int x) { return UIThreadRunnable.syncExec((Result<@Nullable Long>) () -> { Rectangle bounds = widget.getBounds(); Point p = new Point(x, bounds.y + bounds.height / 2); if (!bounds.contains(p)) { return null; } return widget.getTimeAtX(x); }); }