auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initPlayer(){ playerDb.setId("123"); playerDb.setName("Chunky"); playerDb.setFavoriteColor("Fuschia"); playerDb.setLocation("Home"); playerDb.setRev("high"); playerDb.setApiKey("FISH"); playerDb.setStory("fish"); playerDb.setPlayerMode("full"); playerArg.setId("123"); playerArg.setName("Chunky"); playerArg.setFavoriteColor("Fuschia"); playerArg.setRev("high"); }

Target:
public void initPlayer(){ playerDb.setId("123"); playerDb.setName("Chunky"); playerDb.setFavoriteColor("Fuschia"); playerDb.setLocation("Home"); playerDb.setRev("high"); playerDb.setApiKey("FISH"); playerDb.setStory("fish"); playerDb.setPlayerMode("default"); playerArg.setId("123"); playerArg.setName("Chunky"); playerArg.setFavoriteColor("Fuschia"); playerArg.setRev("high"); }
Source:
public static void sortFeedbackSessionsByCreationTimeDescending(List<FeedbackSessionAttributes> sessions) { sessions.sort((FeedbackSessionAttributes session1, FeedbackSessionAttributes session2) -> { int result = session2.createdTime.compareTo(session1.createdTime); if (result == 0) { if (session1.endTime == null || session2.endTime == null) { if (session1.endTime == null) { --result; } if (session2.endTime == null) { ++result; } } else { result = session2.endTime.compareTo(session1.endTime); } } if (result == 0) { result = session2.startTime.compareTo(session1.startTime); } if (result == 0) { result = session1.courseId.compareTo(session2.courseId); } if (result == 0) { result = session1.feedbackSessionName.compareTo(session2.feedbackSessionName); } return result; }); }

Target:
public static void sortFeedbackSessionsByCreationTimeDescending(List<FeedbackSessionAttributes> sessions) { sessions.sort(Comparator.comparing((FeedbackSessionAttributes session) -> session.createdTime, Comparator.reverseOrder()) .thenComparing(session -> session.endTime, Comparator.nullsFirst(Comparator.reverseOrder())) .thenComparing(session -> session.startTime, Comparator.reverseOrder()) .thenComparing(session -> session.courseId) .thenComparing(session -> session.feedbackSessionName)); }
Source:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } cdImagePath = getParameters().getCdImagePath(); if (!getVm().isRunningOrPaused()) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if (!canRunActionOnNonManagedVm()) { return false; } if ((IsoDomainListSyncronizer.getInstance().findActiveISODomain(getVm().getStoragePoolId()) == null) && !StringUtils.isEmpty(cdImagePath)) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (StringUtils.isNotEmpty(cdImagePath) && !cdImagePath.endsWith(ValidationUtils.ISO_SUFFIX)) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_CDROM_DISK_FORMAT); } cdImagePath = ImagesHandler.cdPathWindowsToLinux(getParameters().getCdImagePath(), getVm().getStoragePoolId(), getVm().getRunOnVds()); return true; }

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (!canRunActionOnNonManagedVm()) { return false; } cdImagePath = getParameters().getCdImagePath(); if (!getVm().isRunningOrPaused()) { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if ((IsoDomainListSyncronizer.getInstance().findActiveISODomain(getVm().getStoragePoolId()) == null) && !StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (StringUtils.isNotEmpty(cdImagePath) && !cdImagePath.endsWith(ValidationUtils.ISO_SUFFIX)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_CDROM_DISK_FORMAT); } return true; }
Source:
protected boolean validateScreenDescriptor() { if (screenBackgroundColor >= screenColors) { return false; } return true; }

Target:
protected boolean validateScreenDescriptor() { return screenBackgroundColor < screenColors; }
Source:
public void testGenotypePhenotypeSearchEnsureEvidence() throws InvalidProtocolBufferException, UnirestException, GAWrapperException { final String obfuscated = "WyJkYXRhc2V0MSIsImNnZCIsImh0dHA6Ly9vaHN1LmVkdS9jZ2QvMjdkMjE2OWMiXQ"; final String phenotypeAssociationSetId = Utils.getPhenotypeAssociationSetId(client); GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest request = GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest .newBuilder() .setPhenotypeAssociationSetId(phenotypeAssociationSetId) .addFeatureIds(obfuscated) .build(); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotypes(request); assertThat(response.getAssociationsList()).isNotNull(); assertThat(response.getAssociationsList()).isNotEmpty(); GenotypePhenotype.Evidence evidence = response.getAssociations(0).getEvidence(0); assertThat(evidence.getDescription()).isEqualTo(TestData.EVIDENCE_LEVEL); }

Target:
public void testGenotypePhenotypeSearchEnsureEvidence() throws InvalidProtocolBufferException, UnirestException, GAWrapperException { SearchFeaturesRequest featuresRequest = SearchFeaturesRequest .newBuilder() .setFeatureSetId(Utils.getFeatureG2PSetId(client)) .setName(TestData.FEATURE_NAME) .build(); SequenceAnnotationServiceOuterClass.SearchFeaturesResponse featuresResponse = client.sequenceAnnotations.searchFeatures(featuresRequest); assertThat(featuresResponse.getFeaturesList()).isNotNull() ; assertThat(featuresResponse.getFeaturesList()).isNotEmpty() ; assertThat(featuresResponse.getFeaturesList().size()).isEqualTo(3) ; final String obfuscated = featuresResponse.getFeaturesList().get(2).getId(); final String phenotypeAssociationSetId = Utils.getPhenotypeAssociationSetId(client); GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest request = GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest .newBuilder() .setPhenotypeAssociationSetId(phenotypeAssociationSetId) .addFeatureIds(obfuscated) .build(); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotypes(request); assertThat(response.getAssociationsList()).isNotNull(); assertThat(response.getAssociationsList()).isNotEmpty(); GenotypePhenotype.Evidence evidence = response.getAssociations(0).getEvidence(0); assertThat(evidence.getDescription()).isEqualTo(TestData.EVIDENCE_LEVEL); }
Source:
private void verifyResourceConflicts(AppleBundleResources resources, SourcePathResolver resolver) { Set<Path> filenames = new HashSet<>(); for (SourcePath path : Iterables.concat( resources.getResourceDirs(), resources.getDirsContainingResourceDirs(), resources.getResourceFiles())) { Path filename = resolver.getRelativePath(path).getFileName(); if (filenames.contains(filename)) { throw new HumanReadableException( "Bundle contains multiple resources with filename %s", filename); } else { filenames.add(filename); } } }

Target:
private void verifyResourceConflicts(AppleBundleResources resources, SourcePathResolver resolver) { Set<Path> resourcePaths = new HashSet<>(); for (SourcePath path : Iterables.concat( resources.getResourceDirs(), resources.getResourceFiles())) { Path pathInBundle = resolver.getRelativePath(path).getFileName(); if (resourcePaths.contains(pathInBundle)) { throw new HumanReadableException( "Bundle contains multiple resources with path %s", pathInBundle); } else { resourcePaths.add(pathInBundle); } } }
Source:
public HaplotypeProbabilitiesFromGenotype(final HaplotypeProbabilitiesFromGenotype other){ super(other.getHaplotype()); snp = other.snp; likelihoods = Arrays.copyOf(other.likelihoods,other.likelihoods.length); }

Target:
public HaplotypeProbabilitiesFromGenotype(final HaplotypeProbabilitiesFromGenotype other) { this(other.snp, other.getHaplotype(), other.likelihoods[0], other.likelihoods[1], other.likelihoods[2]); }
Source:
public RegisterDataPackValueEventImpl(final Cause cause, final Game game) { super(cause, game); this.serializables = new Object2ObjectOpenHashMap<>(); this.serializables.computeIfAbsent((SpongeDataPackType) DataPackTypes.RECIPE, k -> new ArrayList<>()); this.serializables.computeIfAbsent((SpongeDataPackType) DataPackTypes.ADVANCEMENT, k -> new ArrayList<>()); }

Target:
public RegisterDataPackValueEventImpl(final Cause cause, final Game game) { super(cause, game); this.serializables = new Object2ObjectOpenHashMap<>(); }
Source:
public synchronized void init(Server server) { ModClusterLogger.LOGGER.init(Version.INSTANCE.toString()); this.server = server; this.mcmpHandler.init(this.mcmpConfig.getProxies(), this); this.autoEnableContexts = this.mcmpConfig.isAutoEnableContexts(); this.excludedContexts.clear(); Map<String, Set<String>> excludedContextPaths = this.mcmpConfig.getExcludedContextsPerHost(); if (!excludedContextPaths.isEmpty()) { for (Engine engine : server.getEngines()) { String defaultHost = engine.getDefaultHost(); for (Host host : engine.getHosts()) { Set<String> excluded = new HashSet<String>(); Set<String> paths = excludedContextPaths.get(host.getName()); if (paths != null) { excluded.addAll(paths); } if (host.getName().equals(defaultHost)) { paths = excludedContextPaths.get(null); if (paths != null) { excluded.addAll(paths); } } if (!excluded.isEmpty()) { this.excludedContexts.put(host, Collections.unmodifiableSet(excluded)); } } } } this.resetRequestSource.init(server, this); this.loadBalanceFactorProvider = this.loadBalanceFactorProviderFactory.createLoadBalanceFactorProvider(); Boolean advertise = this.mcmpConfig.getAdvertise(); if (Boolean.TRUE.equals(advertise) || (advertise == null && this.mcmpConfig.getProxies().isEmpty())) { try { this.advertiseListener = this.listenerFactory.createListener(this.mcmpHandler, this.mcmpConfig); this.advertiseListener.start(); } catch (IOException e) { ModClusterLogger.LOGGER.advertiseStartFailed(e.getLocalizedMessage()); ModClusterLogger.LOGGER.catchingDebug(e); } } }

Target:
public synchronized void init(Server server) { ModClusterLogger.LOGGER.init(Version.INSTANCE.toString()); this.server = server; this.mcmpHandler.init(this.mcmpConfig.getProxies(), this); this.autoEnableContexts = this.mcmpConfig.isAutoEnableContexts(); this.excludedContexts.clear(); Map<String, Set<String>> excludedContextPaths = this.mcmpConfig.getExcludedContextsPerHost(); if (!excludedContextPaths.isEmpty()) { for (Engine engine : server.getEngines()) { String defaultHost = engine.getDefaultHost(); for (Host host : engine.getHosts()) { Set<String> excluded = new HashSet<String>(); Set<String> paths = excludedContextPaths.get(host.getName()); if (paths != null) { excluded.addAll(paths); } if (host.getName().equals(defaultHost)) { paths = excludedContextPaths.get(null); if (paths != null) { excluded.addAll(paths); } } if (!excluded.isEmpty()) { this.excludedContexts.put(host, Collections.unmodifiableSet(excluded)); } } } } this.resetRequestSource.init(server, this); this.loadBalanceFactorProvider = this.loadBalanceFactorProviderFactory.createLoadBalanceFactorProvider(); Boolean advertise = this.mcmpConfig.getAdvertise(); if (Boolean.TRUE.equals(advertise) || (advertise == null && this.mcmpConfig.getProxies().isEmpty())) { try { this.advertiseListener = this.listenerFactory.createListener(this.mcmpHandler, this.mcmpConfig); this.advertiseListener.start(); } catch (IOException e) { ModClusterLogger.LOGGER.advertiseStartFailed(e); } } }
Source:
public static VersionNotFoundException versionsNotFoundException(List<MissingVersion> missingVersions) { String details = missingVersions .stream() .map(i -> i.getCurrentURI()) .collect(Collectors.toSet()) .stream() .collect(Collectors.joining(",")); String message = format(VERSION_NOT_FOUND_FMT, details); return new VersionNotFoundException(message); }

Target:
public static VersionNotFoundException versionsNotFoundException(List<MissingVersion> missingVersions) { String details = missingVersions .stream() .map(i -> i.getCurrentURI()) .distinct() .collect(Collectors.joining(",")); String message = format(VERSION_NOT_FOUND_FMT, details); return new VersionNotFoundException(message); }
Source:
private static Set<Evidence> filterEvidence(Set<Evidence> evidences, EvidenceQueryRes evidenceQuery) { Set<Evidence> filtered = new HashSet<>(); if (evidenceQuery.getGene() != null) { for (Evidence evidence : evidences) { if (evidence.getGene().equals(evidenceQuery.getGene())) { if (evidence.getAlterations().isEmpty()) { filtered.add(evidence); } else { boolean hasjointed = Collections.disjoint(evidence.getAlterations(), evidenceQuery.getAlterations()); if (!hasjointed) { if (evidence.getOncoTreeType() == null) { if (evidence.getEvidenceType().equals(EvidenceType.ONCOGENIC)) { if (evidence.getDescription() == null) { List<Alteration> alterations = new ArrayList<>(); alterations.addAll(evidence.getAlterations()); } } filtered.add(evidence); } else { List<TumorType> tumorType = new ArrayList<>(); if (evidence.getOncoTreeType() != null) { tumorType.add(evidence.getOncoTreeType()); } hasjointed = Collections.disjoint(evidenceQuery.getOncoTreeTypes(), tumorType); if (!hasjointed) { filtered.add(evidence); } else { if (evidence.getLevelOfEvidence() != null && evidence.getPropagation() != null) { LevelOfEvidence propagationLevel = LevelOfEvidence.getByName(evidence.getPropagation()); if (propagationLevel != null) { if (evidenceQuery.getLevelOfEvidences() == null || evidenceQuery.getLevelOfEvidences().size() == 0 || evidenceQuery.getLevelOfEvidences().contains(propagationLevel)) { Evidence tempEvidence = new Evidence(evidence, evidence.getId()); tempEvidence.setLevelOfEvidence(propagationLevel); filtered.add(tempEvidence); } } } } } } } } } } return filtered; }

Target:
private static Set<Evidence> filterEvidence(Set<Evidence> evidences, EvidenceQueryRes evidenceQuery) { Set<Evidence> filtered = new HashSet<>(); if (evidenceQuery.getGene() != null) { for (Evidence evidence : evidences) { if (evidence.getGene().equals(evidenceQuery.getGene())) { if (evidence.getAlterations().isEmpty()) { filtered.add(evidence); } else { boolean hasjointed = !Collections.disjoint(evidence.getAlterations(), evidenceQuery.getAlterations()); if (hasjointed) { if (evidence.getOncoTreeType() == null) { if (evidence.getEvidenceType().equals(EvidenceType.ONCOGENIC)) { if (evidence.getDescription() == null) { List<Alteration> alterations = new ArrayList<>(); alterations.addAll(evidence.getAlterations()); } } filtered.add(evidence); } else { List<TumorType> tumorType = new ArrayList<>(); if (evidence.getOncoTreeType() != null) { tumorType.add(evidence.getOncoTreeType()); } hasjointed = !Collections.disjoint(evidenceQuery.getOncoTreeTypes(), tumorType); if (hasjointed) { filtered.add(evidence); } else { if (evidence.getLevelOfEvidence() != null && evidence.getPropagation() != null) { LevelOfEvidence propagationLevel = LevelOfEvidence.getByName(evidence.getPropagation()); if (propagationLevel != null) { if (evidenceQuery.getLevelOfEvidences() == null || evidenceQuery.getLevelOfEvidences().size() == 0 || evidenceQuery.getLevelOfEvidences().contains(propagationLevel)) { Evidence tempEvidence = new Evidence(evidence, evidence.getId()); tempEvidence.setLevelOfEvidence(propagationLevel); filtered.add(tempEvidence); } } } } } } } } } } return filtered; }
Source:
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT, FindByIndexOptions options) { assertNotEmpty(selectorJson, "selectorJson"); assertNotEmpty(options, "options"); URI uri = buildUri(getDBUri()).path("_find").build(); String body = getFindByIndexBody(selectorJson, options); InputStream stream = null; try { stream = getStream(client.executeRequest(createPost(uri, body, "application/json"))); Reader reader = new InputStreamReader(stream, "UTF-8"); JsonArray jsonArray = new JsonParser().parse(reader) .getAsJsonObject().getAsJsonArray("docs"); List<T> list = new ArrayList<T>(); for (JsonElement jsonElem : jsonArray) { JsonElement elem = jsonElem.getAsJsonObject(); T t = client.getGson().fromJson(elem, classOfT); list.add(t); } return list; } catch (UnsupportedEncodingException e) { return null; } finally { close(stream); } }

Target:
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT, FindByIndexOptions options) { assertNotEmpty(selectorJson, "selectorJson"); assertNotEmpty(options, "options"); URI uri = buildUri(getDBUri()).path("_find").build(); String body = getFindByIndexBody(selectorJson, options); InputStream stream = null; try { stream = getStream(client.executeRequest(createPost(uri, body, "application/json"))); Reader reader = new InputStreamReader(stream, "UTF-8"); JsonArray jsonArray = new JsonParser().parse(reader) .getAsJsonObject().getAsJsonArray("docs"); List<T> list = new ArrayList<T>(); for (JsonElement jsonElem : jsonArray) { JsonElement elem = jsonElem.getAsJsonObject(); T t = client.getGson().fromJson(elem, classOfT); list.add(t); } return list; } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } finally { close(stream); } }
Source:
Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); final List<TopicPartition> lostTaskChangelogs = new ArrayList<>(); final RuntimeException exception = active.closeZombieTasks(zombieTasks, lostTaskChangelogs); assignedActiveTasks.keySet().removeAll(zombieTasks); changelogReader.remove(lostTaskChangelogs); removeChangelogsFromRestoreConsumer(lostTaskChangelogs, false); if (exception != null) { throw exception; } else if (!(active.isEmpty())) { log.error("The set of active tasks was non-empty: {}", active); throw new IllegalStateException("TaskManager found leftover active task state after closing all zombies"); } else if (!(assignedActiveTasks.isEmpty())) { log.error("The set assignedActive tasks was non-empty: {}", assignedActiveTasks); throw new IllegalStateException("TaskManager found leftover active task state after closing all zombies"); } else if (!(changelogReader.isEmpty())) { log.error("The changelog-reader's internal state was non-empty: {}", changelogReader); throw new IllegalStateException("TaskManager found leftover active task state after closing all zombies"); } return zombieTasks; }

Target:
Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); final List<TopicPartition> lostTaskChangelogs = new ArrayList<>(); final RuntimeException exception = active.closeZombieTasks(zombieTasks, lostTaskChangelogs); assignedActiveTasks.keySet().removeAll(zombieTasks); changelogReader.remove(lostTaskChangelogs); removeChangelogsFromRestoreConsumer(lostTaskChangelogs, false); if (exception != null) { throw exception; } verifyActiveTaskStateIsEmpty(); return zombieTasks; }
Source:
protected int doWork() { IOUtil.assertFileIsWritable(OUTPUT); final Map<String, String> nameMap = new HashMap<>(INPUT.size()); for (final String variantPathString : INPUT) { final Path variantPath = getVariantPath(variantPathString); final VCFHeader header = getHeaderFromPath(variantPath); final int numberOfSamples = header.getNGenotypeSamples(); if (numberOfSamples != 1) { throw new PicardException("Input: " + variantPathString + " was expected to contain a single sample" + " but actually contained " + numberOfSamples + " samples."); } final String sampleName = header.getGenotypeSamples().get(0); final String previousPath = nameMap.put(sampleName, variantPathString); if (previousPath != null) { throw new PicardException("Duplicate sample: " + sampleName + ". Sample was found in both " + previousPath + " and in " + variantPath.toUri() + "."); } } final List<String> mapLines = new ArrayList<>(INPUT.size()); nameMap.forEach((name, path) -> mapLines.add(name + "\t" + path)); try { Files.write(OUTPUT.toPath(), mapLines); } catch (IOException e) { throw new PicardException("Error while writing output", e); } return 0; }

Target:
protected int doWork() { IOUtil.assertFileIsWritable(OUTPUT); final Map<String, String> pathToNameMap = new HashMap<>(INPUT.size()); final Map<String, String> nameToPathMap = new HashMap<>(INPUT.size()); for (final String variantPathString : INPUT) { final Path variantPath = getVariantPath(variantPathString); final VCFHeader header = getHeaderFromPath(variantPath); final int numberOfSamples = header.getNGenotypeSamples(); if (numberOfSamples != 1) { throw new PicardException("Input: " + variantPathString + " was expected to contain a single sample" + " but actually contained " + numberOfSamples + " samples."); } final String sampleName = header.getGenotypeSamples().get(0); pathToNameMap.put(variantPathString, sampleName); final String previousPath = nameToPathMap.put(sampleName, variantPathString); if (previousPath != null) { log.warn("Duplicate sample: " + sampleName + ". Sample was found in both " + previousPath + " and in " + variantPathString); } } final List<String> mapLines = new ArrayList<>(INPUT.size()); pathToNameMap.forEach((path, name) -> mapLines.add(path + "\t" + name)); try { Files.write(OUTPUT.toPath(), mapLines); } catch (IOException e) { throw new PicardException("Error while writing output", e); } return 0; }
Source:
public void run() { while (autoReconnect) { try { if (!enabled) { if (ready) { try { getInstance().ipcClient.close(); } catch (Exception ex) { } } Thread.sleep(1); continue; } if (dontTryAgain) { Thread.sleep(1); continue; } if (!connectedBefore && !ready) { lastPing = 0; try { ipcClient.connect(); } catch (Exception ex) { } Thread.sleep(15 * 1000); if (!ready) { reconnectTries += 1; if (reconnectTries >= 5) { dontTryAgain = true; } } continue; } if (ready) { Thread.sleep(1); lastPing += 1; if (lastPing >= 5 * 1000) { ipcClient.sendRichPresence(this.lastRichPresence); this.lastPing = 0; } } else { lastPing = 0; reconnecting = true; int timeout = (reconnectTries * 2) * 1000; getLogger().info("Discord RPC >> Reconnecting... (Timeout: " + timeout + "ms)"); try { ipcClient.connect(); } catch (Exception ex) { if (reconnectTries <= 5) { reconnectTries += 1; } if (reconnectTries >= 5) { dontTryAgain = true; } Thread.sleep(timeout); } } } catch (Exception ex) { } } }

Target:
public void run() { while (autoReconnect) { try { if (!enabled) { if (ready) { getInstance().ipcClient.close(); } Thread.sleep(1); continue; } if (dontTryAgain) { Thread.sleep(1); continue; } if (!connectedBefore && !ready) { lastPing = 0; try { ipcClient.connect(); } catch (Exception ex) { } Thread.sleep(15 * 1000); if (!ready) { reconnectTries += 1; if (reconnectTries >= RECONNECT_TRIES) { dontTryAgain = true; } } continue; } if (ready) { Thread.sleep(1); lastPing += 1; if (lastPing >= RECONNECT_TRIES * 1000) { ipcClient.sendRichPresence(this.lastRichPresence); this.lastPing = 0; } } else { lastPing = 0; reconnecting = true; int timeout = (reconnectTries * 2) * 1000; logger.info("Discord RPC >> Reconnecting... (Timeout: " + timeout + "ms)"); try { ipcClient.connect(); } catch (Exception ex) { if (reconnectTries <= RECONNECT_TRIES) { reconnectTries += 1; } if (reconnectTries >= RECONNECT_TRIES) { dontTryAgain = true; } Thread.sleep(timeout); } } } catch (InterruptedException ex) { } catch (Exception ex) { logger.trace(ex.getMessage(), ex.getCause()); } } }
Source:
public DefaultClasspathScanner(final List<String> rootPackages) { Assert.requireNonNull(rootPackages, "rootPackages"); LOG.info("Scanning class path for root packages {}", Arrays.toString(rootPackages.toArray())); ConfigurationBuilder configuration = ConfigurationBuilder.build(DefaultClasspathScanner.class.getClassLoader()); configuration = configuration.setExpandSuperTypes(false); if(rootPackages != null && rootPackages.size() > 0) { configuration = configuration.forPackages(rootPackages.toArray(new String[rootPackages.size()])); configuration = configuration.setUrls(rootPackages.stream().map(rootPackage -> ClasspathHelper.forPackage(rootPackage)).flatMap(list -> list.stream()).collect(Collectors.toList())); configuration = configuration.filterInputsBy(new FilterBuilder().includePackage(rootPackages.toArray(new String[rootPackages.size()]))); } try { Enumeration<URL> res = DefaultClasspathScanner.class.getClassLoader().getResources(""); configuration.getUrls().addAll(Collections.list(res)); } catch (IOException e) { throw new RuntimeException("Error in Dolphin Platform controller class scan", e); } Set<URL> urls = configuration.getUrls(); List<URL> toRemove = new ArrayList<>(); for (URL url : urls) { if (url.toString().endsWith(".jnilib")) { toRemove.add(url); } } for (URL url : toRemove) { LOG.info("Url removed {}", url.toString()); configuration.getUrls().remove(url); } reflections = new Reflections(configuration); }

Target:
public DefaultClasspathScanner(final List<String> rootPackages) { Assert.requireNonNull(rootPackages, "rootPackages"); LOG.trace("Scanning class path for root packages {}", Arrays.toString(rootPackages.toArray())); ConfigurationBuilder configuration = ConfigurationBuilder.build(DefaultClasspathScanner.class.getClassLoader()); configuration = configuration.setExpandSuperTypes(false); if(rootPackages.size() > 0) { configuration = configuration.forPackages(rootPackages.toArray(new String[rootPackages.size()])); configuration = configuration.setUrls(rootPackages.stream().map(rootPackage -> ClasspathHelper.forPackage(rootPackage)).flatMap(list -> list.stream()).collect(Collectors.toList())); configuration = configuration.filterInputsBy(new FilterBuilder().includePackage(rootPackages.toArray(new String[rootPackages.size()]))); } try { Enumeration<URL> res = DefaultClasspathScanner.class.getClassLoader().getResources(""); configuration.getUrls().addAll(Collections.list(res)); } catch (IOException e) { throw new RuntimeException("Error in Dolphin Platform controller class scan", e); } Set<URL> urls = configuration.getUrls(); List<URL> toRemove = new ArrayList<>(); for (URL url : urls) { if (url.toString().endsWith(".jnilib")) { toRemove.add(url); } } LOG.trace("Configuration Urls {}", Arrays.toString(configuration.getUrls().toArray())); for (URL url : toRemove) { LOG.trace("Url removed {}", url.toString()); configuration.getUrls().remove(url); } reflections = new Reflections(configuration); }
Source:
public void createControl(Composite parent) { Composite top; top = new Composite(parent, SWT.NONE); setControl(top); top.setLayout(new GridLayout()); this.top = top; }

Target:
public void createControl(Composite parent) { Composite top = new Composite(parent, SWT.NONE); setControl(top); top.setLayout(new GridLayout()); this.top = top; }
Source:
void validateQuery( IndexOrder indexOrder, IndexQuery[] predicates ) { if ( predicates.length != 1 ) { throw new UnsupportedOperationException(); } if ( indexOrder != IndexOrder.NONE ) { throw new UnsupportedOperationException( "unsupported order " + indexOrder ); } }

Target:
void validateQuery( IndexOrder indexOrder, IndexQuery[] predicates ) { if ( predicates.length != 1 ) { throw new UnsupportedOperationException(); } CapabilityValidator.validateQuery( StringSchemaIndexProvider.CAPABILITY, indexOrder, predicates ); }
Source:
public static final DisplayStyle getTableDisplayStyle(final Table table) { TableDisplayStyle displayStyle = (TableDisplayStyle) table.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); if (null == displayStyle && null != table.getTableConfiguration()) { displayStyle = (TableDisplayStyle) table.getTableConfiguration().getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); } if (displayStyle != null) { return displayStyle.getDisplayStyle(); } return DisplayStyle.NORMAL; }

Target:
public static final DisplayStyle getTableDisplayStyle(final Table table) { DisplayStyle result = DisplayStyle.NORMAL; if (null != table) { TableDisplayStyle displayStyle = (TableDisplayStyle) table.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); if (null == displayStyle && null != table.getTableConfiguration()) { displayStyle = (TableDisplayStyle) table.getTableConfiguration().getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); } if (displayStyle != null) { result = displayStyle.getDisplayStyle(); } } return result; }
Source:
public List<FirmwareCountInfo> getAllSeenFirmwares(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken) { final Jedis jedis = jedisPool.getResource(); final List<FirmwareCountInfo> firmwareCounts = new ArrayList<>(); try { final Set<Tuple> seenFirmwares = jedis.zrangeWithScores(REDIS_SEEN_FIRMWARE_KEY, 0, -1); for (final Tuple fwInfo:seenFirmwares) { final long lastSeen = (long) fwInfo.getScore(); final long fwCount = jedis.zcard(fwInfo.getElement()); if (fwCount > 0) { firmwareCounts.add(new FirmwareCountInfo(fwInfo.getElement(), fwCount, lastSeen)); } } } catch (Exception e) { LOGGER.error("Failed retrieving all seen firmwares.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return firmwareCounts; }

Target:
public List<FirmwareCountInfo> getAllSeenFirmwares(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken) { final Jedis jedis = jedisPool.getResource(); final List<FirmwareCountInfo> firmwareCounts = Lists.newArrayList(); try { final Set<Tuple> seenFirmwares = jedis.zrangeWithScores(REDIS_SEEN_FIRMWARE_KEY, 0, -1); final Pipeline pipe = jedis.pipelined(); final Map<String, redis.clients.jedis.Response<Long>> responseMap = Maps.newHashMap(); for (final Tuple fwInfo:seenFirmwares) { responseMap.put(fwInfo.getElement(), pipe.zcard(fwInfo.getElement())); } pipe.sync(); for (final Tuple fwInfo:seenFirmwares) { final String fwVersion = fwInfo.getElement(); final long fwCount = responseMap.get(fwVersion).get(); final long lastSeen = (long) fwInfo.getScore(); if (fwCount > 0) { firmwareCounts.add(new FirmwareCountInfo(fwInfo.getElement(), fwCount, lastSeen)); } } } catch (Exception e) { LOGGER.error("Failed retrieving all seen firmwares.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return firmwareCounts; }
Source:
public int rename(String oldPath, String newPath) { final AlluxioURI oldUri = mPathResolverCache.getUnchecked(oldPath); final AlluxioURI newUri = mPathResolverCache.getUnchecked(newPath); final String name = newUri.getName(); LOG.trace("rename({}, {}) [Alluxio: {}, {}]", oldPath, newPath, oldUri, newUri); if (name.length() > MAX_NAME_LENGTH) { LOG.error("Failed to rename to {}, name is longer than characters", oldPath, newPath, name, MAX_NAME_LENGTH); return -ErrorCodes.ENAMETOOLONG(); } try { mFileSystem.rename(oldUri, newUri); if (mOpenFiles.contains(PATH_INDEX, oldPath)) { OpenFileEntry oe = mOpenFiles.getFirstByField(PATH_INDEX, oldPath); oe.setPath(newPath); } } catch (FileDoesNotExistException e) { LOG.debug("Failed to rename to {}, file does not exist", oldPath, newPath, oldPath); return -ErrorCodes.ENOENT(); } catch (FileAlreadyExistsException e) { LOG.debug("Failed to rename to {}, file already exists", oldPath, newPath, newPath); return -ErrorCodes.EEXIST(); } catch (Throwable t) { LOG.error("Failed to rename to {}", oldPath, newPath, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }

Target:
public int rename(String oldPath, String newPath) { final AlluxioURI oldUri = mPathResolverCache.getUnchecked(oldPath); final AlluxioURI newUri = mPathResolverCache.getUnchecked(newPath); final String name = newUri.getName(); LOG.trace("rename({}, {}) [Alluxio: {}, {}]", oldPath, newPath, oldUri, newUri); if (name.length() > MAX_NAME_LENGTH) { LOG.error("Failed to rename to {}, name is longer than characters", oldPath, newPath, name, MAX_NAME_LENGTH); return -ErrorCodes.ENAMETOOLONG(); } try { mFileSystem.rename(oldUri, newUri); OpenFileEntry oe = mOpenFiles.getFirstByField(PATH_INDEX, oldPath); if (oe != null) { oe.setPath(newPath); } } catch (FileDoesNotExistException e) { LOG.debug("Failed to rename to {}, file does not exist", oldPath, newPath, oldPath); return -ErrorCodes.ENOENT(); } catch (FileAlreadyExistsException e) { LOG.debug("Failed to rename to {}, file already exists", oldPath, newPath, newPath); return -ErrorCodes.EEXIST(); } catch (Throwable t) { LOG.error("Failed to rename to {}", oldPath, newPath, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }
Source:
public void loadState(SonarLintGlobalSettings state) { XmlSerializerUtil.copyBean(state, this); includedRules.forEach(it -> { rules.put(it, new Rule(true)); }); excludedRules.forEach(it -> { rules.put(it, new Rule(false)); }); }

Target:
public void loadState(SonarLintGlobalSettings state) { XmlSerializerUtil.copyBean(state, this); if(includedRules != null) { includedRules.forEach(it -> { rules.put(it, new Rule(true)); }); } if(excludedRules != null) { excludedRules.forEach(it -> { rules.put(it, new Rule(false)); }); } includedRules = null; excludedRules = null; }
Source:
private void reloadWindowLayout() { assert window != null && windowMainLayout != null; Platform.runLater(() -> { windowMainLayout.getChildren().clear(); if (downloads.isEmpty()) { Label noDownloadLabel = new Label(); noDownloadLabel.setText(LABEL_NO_DOWNLOAD); noDownloadLabel.setPadding(new Insets(50)); windowMainLayout.getChildren().add(noDownloadLabel); } else { for (LabeledDownloadProgressBar progressTracker : downloads) { Label downloadLabel = new Label(); downloadLabel.setText(progressTracker.getDownloadLabel()); ProgressBar progressBar = progressTracker.getProgressBar(); VBox downloadProgressItem = new VBox(); downloadProgressItem.setSpacing(20); downloadProgressItem.setPadding(new Insets(20)); downloadProgressItem.setAlignment(Pos.CENTER_LEFT); downloadProgressItem.getChildren().addAll(downloadLabel, progressBar); windowMainLayout.getChildren().add(downloadProgressItem); } } }); }

Target:
private void reloadWindowLayout() { assert window != null && windowMainLayout != null; Platform.runLater(() -> { windowMainLayout.getChildren().clear(); if (downloads.isEmpty()) { Label noDownloadLabel = createNoDownloadLabel(); windowMainLayout.getChildren().add(noDownloadLabel); } else { for (LabeledDownloadProgressBar progressTracker : downloads) { VBox downloadProgressItem = createDownloadProgressItem(progressTracker); windowMainLayout.getChildren().add(downloadProgressItem); } } }); }
Source:
public void testGetStringDefault() { jsonObject.put("foo", "bar"); assertEquals("bar", jsonObject.getString("foo", "wibble")); assertEquals("bar", jsonObject.getString("foo", null)); jsonObject.put("bar", 123); try { assertEquals("123", jsonObject.getString("bar", "wibble")); } catch (ClassCastException e) { fail(); } jsonObject.putNull("foo"); assertNull(jsonObject.getString("foo", "wibble")); assertEquals("wibble", jsonObject.getString("absent", "wibble")); assertNull(jsonObject.getString("foo", null)); assertNull(jsonObject.getString("absent", null)); try { jsonObject.getString(null, null); fail(); } catch (NullPointerException e) { } }

Target:
public void testGetStringDefault() { jsonObject.put("foo", "bar"); assertEquals("bar", jsonObject.getString("foo", "wibble")); assertEquals("bar", jsonObject.getString("foo", null)); jsonObject.put("bar", 123); assertEquals("123", jsonObject.getString("bar", "wibble")); jsonObject.putNull("foo"); assertNull(jsonObject.getString("foo", "wibble")); assertEquals("wibble", jsonObject.getString("absent", "wibble")); assertNull(jsonObject.getString("foo", null)); assertNull(jsonObject.getString("absent", null)); try { jsonObject.getString(null, null); fail(); } catch (NullPointerException e) { } }
Source:
public void testPruneExpiredTombstonesSpecifiedPath() throws Exception { List<String> keepFilenames = new ArrayList<>( Arrays.asList("/dir1/fileK1", "/dir1/fileK2", "/dir1/fileK3")); List<String> removeFilenames = new ArrayList<>( Arrays.asList("/dir2/fileR1", "/dir2/fileR2", "/dir2/fileR3")); long cutoff = 9001; for(String fN : keepFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9002L); ms.put(pathMetadata); } for(String fN : removeFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9000L); pathMetadata.setIsDeleted(true); ms.put(pathMetadata); } final Map<String, String> diagnostics = ms.getDiagnostics(); if (ms instanceof LocalMetadataStore){ ms.prune(MetadataStore.PruneMode.TOMBSTONES_BY_LASTUPDATED, cutoff, "/dir2"); } else if (ms instanceof DynamoDBMetadataStore){ String bucket = getTestBucketName(getContract().getFileSystem().getConf()); ms.prune(MetadataStore.PruneMode.TOMBSTONES_BY_LASTUPDATED, cutoff, "/" + bucket + "/dir2"); } if(!allowMissing()) { for (String fN : keepFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNotNull(pathMetadata); } } for(String fN : removeFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNull(pathMetadata); } }

Target:
public void testPruneExpiredTombstonesSpecifiedPath() throws Exception { List<String> keepFilenames = new ArrayList<>( Arrays.asList("/dir1/fileK1", "/dir1/fileK2", "/dir1/fileK3")); List<String> removeFilenames = new ArrayList<>( Arrays.asList("/dir2/fileR1", "/dir2/fileR2", "/dir2/fileR3")); long cutoff = 9001; for(String fN : keepFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9002L); ms.put(pathMetadata); } for(String fN : removeFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9000L); pathMetadata.setIsDeleted(true); ms.put(pathMetadata); } final String prunePath = getPathStringForPrune("/dir2"); ms.prune(MetadataStore.PruneMode.TOMBSTONES_BY_LASTUPDATED, cutoff, prunePath); if(!allowMissing()) { for (String fN : keepFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNotNull("Kept files should be in the metastore after prune", pathMetadata); } } for(String fN : removeFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNull("Expired tombstones should be removed from metastore after " + "the prune.", pathMetadata); } }
Source:
public long size() { return isInTransaction() ? quadsIndex().listGraphNodes().count() : calculateRead(this, ()->quadsIndex().listGraphNodes().count()); }

Target:
public long size() { return access(() -> quadsIndex().listGraphNodes().count()); }
Source:
public CreateContainerCmd getBaseCommand() { String hostDir = MesosCluster.getHostDir().getAbsolutePath(); return dockerClient.createContainerCmd( getMesosImageName() + ":" + getMesosImageTag() ) .withName( getName() ) .withPrivileged(true) .withEnv(createMesosLocalEnvironment()) .withPid("host") .withLinks(new Link(getZooKeeperContainer().getContainerId(), "minimesos-zookeeper")) .withBinds( Bind.parse("/var/run/docker.sock:/var/run/docker.sock"), Bind.parse("/sys/fs/cgroup:/sys/fs/cgroup"), Bind.parse(String.format("%s:%s:rw", hostDir + "/.minimesos/sandbox-" + getClusterId() + "/" + MesosCluster.SLAVE_MAPPING_DIR + this.getUuid(), MESOS_AGENT_SANDBOX_DIR)), Bind.parse(hostDir + ":" + hostDir) ); }

Target:
public CreateContainerCmd getBaseCommand() { String hostDir = MesosCluster.getHostDir().getAbsolutePath(); List<Bind> binds = new ArrayList<>(); binds.add(Bind.parse("/var/run/docker.sock:/var/run/docker.sock")); binds.add(Bind.parse("/sys/fs/cgroup:/sys/fs/cgroup")); binds.add(Bind.parse(hostDir + ":" + hostDir)); if (getCluster().getMapAgentSandboxVolume()) { binds.add(Bind.parse(String.format("%s:%s:rw", hostDir + "/.minimesos/sandbox-" + getClusterId() + "/agent-" + getUuid(), MESOS_AGENT_SANDBOX_DIR))); } return dockerClient.createContainerCmd( getMesosImageName() + ":" + getMesosImageTag() ) .withName( getName() ) .withPrivileged(true) .withEnv(createMesosLocalEnvironment()) .withPid("host") .withLinks(new Link(getZooKeeperContainer().getContainerId(), "minimesos-zookeeper")) .withBinds(binds.stream().toArray(Bind[]::new)); }
Source:
public void get() { call = cachedService.service(site).get(); call.enqueue(new Callback<CardPageItem>() { @Override public void onResponse(Call<CardPageItem> call, Response<CardPageItem> response) { responseHeaderHandler.onHeaderCheck(response); PageTitle title = response.body().toPageTitle(site); cb.onSuccess(title); } @Override public void onFailure(Call<CardPageItem> call, Throwable t) { L.w("Failed to get random page title/summary", t); } }); }

Target:
public void get() { Call<CardPageItem> call = cachedService.service(site).get(); call.enqueue(new Callback<CardPageItem>() { @Override public void onResponse(Call<CardPageItem> call, Response<CardPageItem> response) { responseHeaderHandler.onHeaderCheck(response); PageTitle title = response.body().toPageTitle(site); cb.onSuccess(title); } @Override public void onFailure(Call<CardPageItem> call, Throwable t) { L.w("Failed to get random page title/summary", t); cb.onError(t); } }); }
Source:
public void handle(LegacyHandshake legacyHandshake) throws Exception { this.legacy = true; ch.close( bungee.getTranslation( "outdated_client", BungeeCord.getInstance().getGameVersion() ) ); }

Target:
public void handle(LegacyHandshake legacyHandshake) throws Exception { this.legacy = true; ch.close( bungee.getTranslation( "outdated_client", bungee.getGameVersion() ) ); }
Source:
protected void preHookCreateControlAndViewer() { fAdapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault() .getAdapterFactoryRegistry()); fAdapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec()); fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); getCompareConfiguration().setAdapterFactory(fAdapterFactory); updateColors(); inputChangedTask = new CompareInputChangedJob("Computing Model Differences"); }

Target:
protected void preHookCreateControlAndViewer() { fAdapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault() .getAdapterFactoryRegistry()); fAdapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec()); fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); getCompareConfiguration().setAdapterFactory(fAdapterFactory); inputChangedTask = new CompareInputChangedJob("Computing Model Differences"); }
Source:
public static Map<String, Object> encounterParameters(Encounter encounter) { Map<String, Object> encounterParameters = new HashMap<>(); encounterParameters.put(EventKeys.ENCOUNTER_ID, encounter.getUuid()); if (encounter.getEncounterProviders().get(0) != null) { encounterParameters.put(EventKeys.PROVIDER_ID, encounter.getEncounterProviders().get(0).getUuid()); } else { encounterParameters.put(EventKeys.PROVIDER_ID, null); } if (encounter.getLocation() != null) { encounterParameters.put(EventKeys.LOCATION_ID, encounter.getLocation().getUuid()); } else { encounterParameters.put(EventKeys.LOCATION_ID, null); } if (encounter.getVisit() != null) { encounterParameters.put(EventKeys.VISIT_ID, encounter.getVisit().getUuid()); } encounterParameters.put(EventKeys.ENCOUNTER_DATE, encounter.getEncounterDatetime()); encounterParameters.put(EventKeys.ENCOUNTER_TYPE, encounter.getEncounterType().getUuid()); encounterParameters.put(EventKeys.FORM_ID, encounter.getForm().getUuid()); return encounterParameters; }

Target:
public static Map<String, Object> encounterParameters(Encounter encounter) { Map<String, Object> encounterParameters = new HashMap<>(); encounterParameters.put(EventKeys.ENCOUNTER_ID, encounter.getUuid()); if (encounter.getEncounterProviders().get(0) != null) { encounterParameters.put(EventKeys.PROVIDER_ID, encounter.getEncounterProviders().get(0).getUuid()); } else { encounterParameters.put(EventKeys.PROVIDER_ID, null); } if (encounter.getLocation() != null) { encounterParameters.put(EventKeys.LOCATION_ID, encounter.getLocation().getUuid()); } else { encounterParameters.put(EventKeys.LOCATION_ID, null); } if (encounter.getVisit() != null) { encounterParameters.put(EventKeys.VISIT_ID, encounter.getVisit().getUuid()); } if (encounter.getForm() != null) { encounterParameters.put(EventKeys.FORM_ID, encounter.getForm().getUuid()); } encounterParameters.put(EventKeys.ENCOUNTER_DATE, encounter.getEncounterDatetime()); encounterParameters.put(EventKeys.ENCOUNTER_TYPE, encounter.getEncounterType().getUuid()); return encounterParameters; }
Source:
private boolean isHostHealthy(CassandraClientPoolingContainer container) { try { container.runWithPooledResource(CassandraUtils.getDescribeRing(config)); container.runWithPooledResource(CassandraUtils.getValidatePartitioner(config)); return true; } catch (Exception e) { log.debug("We tried to add blacklisted host '{}' back into the pool, but got an exception" + " that caused us to distrust this host further. Exception message was: : {}", SafeArg.of("host", CassandraLogHelper.host(container.getHost())), SafeArg.of("exceptionClass", e.getClass().getCanonicalName()), UnsafeArg.of("exceptionMessage", e.getMessage())); return false; } }

Target:
private boolean isHostHealthy(CassandraClientPoolingContainer container) { try { container.runWithPooledResource(CassandraUtils.getDescribeRing(config)); container.runWithPooledResource(CassandraUtils.getValidatePartitioner(config)); return true; } catch (Exception e) { log.info("We tried to add blacklisted host '{}' back into the pool, but got an exception" + " that caused us to distrust this host further. Exception message was: : {}", SafeArg.of("host", CassandraLogHelper.host(container.getHost())), SafeArg.of("exceptionClass", e.getClass().getCanonicalName()), UnsafeArg.of("exceptionMessage", e.getMessage())); return false; } }
Source:
protected void update(int position, Object object, int viewType) { if (viewType == ITEM_HEADER) { updater.view.setEnabled(false); updater.view.setOnClickListener(null); Repository repository = (Repository) object; setText(0, repository.fullName()); setText(1, "\uf03a"); if (!textView(1).hasOnClickListeners()) { textView(1).setOnClickListener(v -> notificationReadListener.readNotifications(repository)); } } else if (viewType == ITEM_NOTIFICATION) { NotificationThread notificationThread = (NotificationThread) object; String type = notificationThread.subject().type(); switch (type) { case "Issue": setText(0, OcticonTextView.ICON_ISSUE_OPEN); break; case "Release": setText(0, OcticonTextView.ICON_TAG); break; default: setText(0, OcticonTextView.ICON_PULL_REQUEST); break; } setText(1, notificationThread.subject().title()); setText(2, TimeUtils.getRelativeTime(notificationThread.updatedAt())); setText(3, "\uf03a"); setGone(3, !notificationThread.unread()); if (!textView(3).hasOnClickListeners()) { textView(3).setOnClickListener(v -> notificationReadListener.readNotification(notificationThread)); } } }

Target:
protected void update(int position, Object object, int viewType) { if (viewType == ITEM_HEADER) { updater.view.setEnabled(false); updater.view.setOnClickListener(null); Repository repository = (Repository) object; setText(0, repository.fullName()); setText(1, "\uf03a"); if (!textView(1).hasOnClickListeners()) { textView(1).setOnClickListener(v -> notificationReadListener.readNotifications(repository)); } } else if (viewType == ITEM_NOTIFICATION) { NotificationThread notificationThread = (NotificationThread) object; String type = notificationThread.subject().type(); switch (type) { case "Issue": setText(0, OcticonTextView.ICON_ISSUE_OPEN); break; case "Release": setText(0, OcticonTextView.ICON_TAG); break; default: setText(0, OcticonTextView.ICON_PULL_REQUEST); break; } setText(1, notificationThread.subject().title()); setText(2, TimeUtils.getRelativeTime(notificationThread.updatedAt())); setText(3, OcticonTextView.ICON_READ); setGone(3, !notificationThread.unread()); if (!textView(3).hasOnClickListeners()) { textView(3).setOnClickListener(v -> notificationReadListener.readNotification(notificationThread)); } } }