auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LanguageServerRegistryImpl(Set<LanguageServerLauncher> languageServerLaunchers, Set<LanguageDescription> languages, Provider<ProjectManager> projectManagerProvider, ServerInitializer initializer) { this.languages.addAll(languages); this.launchers.putAll(languageServerLaunchers.stream() .collect(Collectors.toMap(LanguageServerLauncher::getLanguageId, launcher -> launcher))); this.projectManagerProvider = projectManagerProvider; this.initializer = initializer; this.projectToServer = new ConcurrentHashMap<>(); this.initializer.addObserver(this); }

Target:
public LanguageServerRegistryImpl(Set<LanguageServerLauncher> languageServerLaunchers, Set<LanguageDescription> languages, Provider<ProjectManager> projectManagerProvider, ServerInitializer initializer) { this.languages= new ArrayList<>(languages); this.launchers.putAll(languageServerLaunchers.stream() .collect(Collectors.toMap(LanguageServerLauncher::getLanguageId, launcher -> launcher))); this.projectManagerProvider = projectManagerProvider; this.initializer = initializer; this.initializer.addObserver(this); }
Source:
public String toString() { int blockSizeLimit = 100; return MoreObjects.toStringHelper(this).add("id", mId).add("workerAddress", mWorkerAddress) .add("capacityBytes", mCapacityBytes).add("usedBytes", mUsedBytes) .add("lastUpdatedTimeMs", mLastUpdatedTimeMs) .add("blocks", (mBlocks.size() < blockSizeLimit) ? mBlocks : mBlocks.stream().limit(blockSizeLimit).collect(Collectors.toList())) .add("lostStorage", mLostStorage).toString(); }

Target:
public String toString() { int blockSizeLimit = 100; Collection<Long> blocks = mBlocks; if (!LOG.isDebugEnabled()) { blocks = (mBlocks.size() < blockSizeLimit) ? mBlocks : mBlocks.stream().limit(blockSizeLimit).collect(Collectors.toList()); } return MoreObjects.toStringHelper(this).add("id", mId).add("workerAddress", mWorkerAddress) .add("capacityBytes", mCapacityBytes).add("usedBytes", mUsedBytes) .add("lastUpdatedTimeMs", mLastUpdatedTimeMs) .add("blockCount", mBlocks.size()) .add("blocks", blocks) .add("lostStorage", mLostStorage).toString(); }
Source:
private DTCellValue52 value() { if (editingCol() instanceof LimitedEntryActionSetFieldCol52) { return factory().makeNewValue(editingPattern(), (LimitedEntryActionSetFieldCol52) editingCol()); } else if (editingCol() instanceof LimitedEntryConditionCol52) { return factory().makeNewValue(editingPattern(), (LimitedEntryConditionCol52) editingCol()); } else if (editingCol() instanceof LimitedEntryActionInsertFactCol52) { return factory().makeNewValue(editingCol()); } return null; }

Target:
private DTCellValue52 value() { if (editingCol() instanceof LimitedEntryActionSetFieldCol52) { return factory().makeNewValue(editingPattern(), (LimitedEntryActionSetFieldCol52) editingCol()); } else if (editingCol() instanceof LimitedEntryConditionCol52) { return factory().makeNewValue(editingPattern(), (LimitedEntryConditionCol52) editingCol()); } else if (editingCol() instanceof LimitedEntryActionInsertFactCol52) { return factory().makeNewValue(editingCol()); } throw new UnsupportedOperationException("The column type is not supported by the 'LimitedWidget'"); }
Source:
public void pass_the_null_tolerance_check() { final NullToleranceTest nullToleranceTest = NullToleranceTest.newBuilder() .setClass(Stringifiers.class) .addDefaultValue(CommandId.newBuilder()) .build(); final boolean passed = nullToleranceTest.check(); assertTrue(passed); }

Target:
public void pass_the_null_tolerance_check() { final NullToleranceTest nullToleranceTest = NullToleranceTest.newBuilder() .setClass(Stringifiers.class) .build(); final boolean passed = nullToleranceTest.check(); assertTrue(passed); }
Source:
private boolean isExpired(String candidateId, long now) { SessionData sessionData = sessionDataMap.get(candidateId); return sessionData != null && sessionData.getExpiry() < now; }

Target:
private boolean isExpired(String candidateId, long now) { SessionData sessionData; synchronized (sessionDataMap) { sessionData = sessionDataMap.get(candidateId); } return sessionData != null && sessionData.getExpiry() < now; }
Source:
public void connect(MessageContext messageContext) throws ConnectException { Registry registry = messageContext.getConfiguration().getRegistry(); String accessTokenRegistryPath = (String) messageContext.getProperty(PROPERTY_PREFIX + "accessTokenRegistryPath"); handleRefresh(messageContext, registry, accessTokenRegistryPath); }

Target:
public void connect(MessageContext messageContext) throws ConnectException { Registry registry = messageContext.getConfiguration().getRegistry(); String accessTokenRegistryPath = (String) messageContext.getProperty(PROPERTY_PREFIX + "accessTokenRegistryPath"); if (StringUtils.isEmpty(accessTokenRegistryPath)) { throw new ConnectException("Access token registry path not provided for access token storage and reuse."); } handleRefresh(messageContext, registry, accessTokenRegistryPath); }
Source:
public ValidationResult defaultPoolFlagIsNotSet() { if (newMacPool.isDefaultPool()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_CHANGING_DEFAULT_MAC_POOL_IS_NOT_SUPPORTED); } else { return ValidationResult.VALID; } }

Target:
public ValidationResult defaultPoolFlagIsNotSet() { return ValidationResult.failWith(VdcBllMessages.ACTION_TYPE_FAILED_SETTING_DEFAULT_MAC_POOL_IS_NOT_SUPPORTED). when(macPool.isDefaultPool()); }
Source:
public ConcurrentHashMap<Class<?>, ModelUsageData> getSubModels() { return subModels; }

Target:
public ConcurrentMap<Class<?>, ModelUsageData> getSubModels() { return subModels; }
Source:
private boolean areQuestionNumbersConsistent() { Set<Integer> questionNumbersInSession = new HashSet<>(); for (FeedbackQuestionAttributes question : this.questions.values()) { if (questionNumbersInSession.contains(question.questionNumber)) { return false; } questionNumbersInSession.add(question.questionNumber); } for (int i = 1; i <= this.questions.values().size(); i++) { if (!questionNumbersInSession.contains(i)) { return false; } } return true; }

Target:
private boolean areQuestionNumbersConsistent() { Set<Integer> questionNumbersInSession = new HashSet<>(); for (FeedbackQuestionAttributes question : this.questions.values()) { if (!questionNumbersInSession.add(question.questionNumber)) { return false; } } for (int i = 1; i <= this.questions.values().size(); i++) { if (!questionNumbersInSession.contains(i)) { return false; } } return true; }
Source:
long getLastHealthReportTime() { long diskCheckTime = dirsHandler.getLastDisksCheckTime(); long lastReportTime = (nodeHealthScriptRunner == null) ? diskCheckTime : Math.max(nodeHealthScriptRunner.getLastReportedTime(), diskCheckTime); lastReportTime = Math.max(lastReportTime, nodeHealthExceptionReportTime); return lastReportTime; }

Target:
long getLastHealthReportTime() { return Collections.max(Arrays.asList( dirsHandler.getLastDisksCheckTime(), nodeHealthScriptRunner == null ? 0 : nodeHealthScriptRunner.getLastReportedTime(), nodeHealthExceptionReportTime)); }
Source:
protected void executeQueryCommand() { Guid domainId = getParameters().getStorageDomainId(); List<DiskImage> disksOfDomain = new ArrayList(); List<VM> vms = getAllVMsForStorageDomain(domainId); VdcQueryReturnValue queryReturnValue = getAllDisksByStorageDomain(domainId); if (queryReturnValue.getSucceeded()) { disksOfDomain = (List<DiskImage>) queryReturnValue.getReturnValue(); } Map<String, VM> vmNameToVMMap = new HashMap(); for (VM vm : vms) { vmNameToVMMap.put(vm.getName(), vm); } for (DiskImage disk : disksOfDomain) { List<String> vmNames = disk.getVmNames(); if (vmNames == null) { continue; } for (String vmName : vmNames) { VM vm = vmNameToVMMap.get(vmName); if (vm != null) { vm.getDiskMap().put(disk.getId(), disk); vm.getDiskList().add(disk); } } } Collections.sort(vms, Collections.reverseOrder(new VmsComparerByDiskSize())); getQueryReturnValue().setReturnValue(vms); }

Target:
protected void executeQueryCommand() { Guid domainId = getParameters().getStorageDomainId(); List<DiskImage> disksOfDomain = null; List<VM> vms = getAllVMsForStorageDomain(domainId); VdcQueryReturnValue queryReturnValue = getAllDisksByStorageDomain(domainId); if (queryReturnValue.getSucceeded()) { disksOfDomain = (List<DiskImage>) queryReturnValue.getReturnValue(); Map<String, VM> vmNameToVMMap = new HashMap(); for (VM vm : vms) { vmNameToVMMap.put(vm.getName(), vm); } for (DiskImage disk : disksOfDomain) { List<String> vmNames = disk.getVmNames(); if (vmNames == null) { continue; } for (String vmName : vmNames) { VM vm = vmNameToVMMap.get(vmName); if (vm != null) { vm.getDiskMap().put(disk.getId(), disk); vm.getDiskList().add(disk); } } } Collections.sort(vms, Collections.reverseOrder(new VmsComparerByDiskSize())); getQueryReturnValue().setReturnValue(vms); } else { log.error("Failed to retrieve disks by storage domain id " + domainId + " due to exception " + queryReturnValue.getExceptionString()); getQueryReturnValue().setSucceeded(false); getQueryReturnValue().setExceptionString(queryReturnValue.getExceptionString()); } }
Source:
public void copy_to_ClipBoard(Context context,String address){ com.fsck.k9.helper.ClipboardManager clipboardManager = com.fsck.k9.helper.ClipboardManager.getInstance(context); clipboardManager.setText(address,address); }

Target:
public void copy_to_ClipBoard(Context context,String address){ ClipboardManager clipboardManager = ClipboardManager.getInstance(context); clipboardManager.setText(address,address); }
Source:
public InitialSetupTask(@NotNull final Registry registry) { super(registry); this.timerId = registry.createId("genie.jobs.tasks.initialSetupTask.timer"); }

Target:
public InitialSetupTask(@NotNull final Registry registry) { super(registry); this.timerId = getRegistry().createId("genie.jobs.tasks.initialSetupTask.timer"); }
Source:
private RuleUpdate createRuleUpdate(DbSession dbSession, RuleKey key, OrganizationDto organization) { RuleDto rule = dbClient.ruleDao().selectByKey(dbSession, organization, key) .transform(Optional::of).or(Optional::empty) .orElseThrow(() -> new NotFoundException(format("This rule does not exists: %s", key))); RuleUpdate ruleUpdate = ofNullable(rule.getTemplateId()) .map(x -> RuleUpdate.createForCustomRule(key)) .orElseGet(() -> RuleUpdate.createForPluginRule(key)); ruleUpdate.setOrganization(organization); return ruleUpdate; }

Target:
private RuleUpdate createRuleUpdate(DbSession dbSession, RuleKey key, OrganizationDto organization) { RuleDto rule = dbClient.ruleDao().selectByKey(dbSession, organization, key) .orElseThrow(() -> new NotFoundException(format("This rule does not exist: %s", key))); RuleUpdate ruleUpdate = ofNullable(rule.getTemplateId()) .map(x -> RuleUpdate.createForCustomRule(key)) .orElseGet(() -> RuleUpdate.createForPluginRule(key)); ruleUpdate.setOrganization(organization); return ruleUpdate; }
Source:
public List<ChplJob> getAllJobs() throws SchedulerException { List<ChplJob> jobs = new ArrayList<ChplJob>(); Scheduler scheduler = getScheduler(); for (String group : scheduler.getJobGroupNames()) { for (JobKey jobKey : scheduler.getJobKeys(groupEquals(group))) { JobDetail jobDetail = scheduler.getJobDetail(jobKey); jobs.add(new ChplJob(jobDetail)); } } Iterator<ChplJob> iterator = jobs.iterator(); while (iterator.hasNext()) { if (!permissions.hasAccess( Permissions.SCHEDULER, SchedulerDomainPermissions.GET_ALL, iterator.next())) { iterator.remove(); } } return jobs; }

Target:
public List<ChplJob> getAllJobs() throws SchedulerException { List<ChplJob> jobs = new ArrayList<ChplJob>(); Scheduler scheduler = getScheduler(); for (String group : scheduler.getJobGroupNames()) { for (JobKey jobKey : scheduler.getJobKeys(groupEquals(group))) { JobDetail jobDetail = scheduler.getJobDetail(jobKey); jobs.add(new ChplJob(jobDetail)); } } return jobs; }
Source:
public void steps_are_not_executed_on_dry_run() throws Throwable { { StepDefinition stepDefinition = mock(StepDefinition.class); Runtime runtime = createRuntime(backend); runtime.getRunner().runPickle(createPickleEventMatchingStepDefinitions(asList(stepDefinition), runtime)); verify(stepDefinition).execute(Matchers.anyString(), Matchers.<Object[]>any()); } { StepDefinition stepDefinition = mock(StepDefinition.class); Runtime dryRuntime = createRuntime(backend, "--dry-run"); dryRuntime.getRunner().runPickle(createPickleEventMatchingStepDefinitions(asList(stepDefinition), dryRuntime)); verify(stepDefinition, never()).execute(Matchers.anyString(), Matchers.<Object[]>any()); } }

Target:
public void steps_are_not_executed_on_dry_run() throws Throwable { final StepDefinition stepDefinition = mock(StepDefinition.class); final Runtime dryRuntime = createRuntime(backend, "--dry-run"); dryRuntime.getRunner().runPickle(createPickleEventMatchingStepDefinitions(asList(stepDefinition), dryRuntime)); verify(stepDefinition, never()).execute(Matchers.anyString(), Matchers.<Object[]>any()); }
Source:
protected boolean nextInner() throws IOException { if (range == null) { return false; } boolean next = range.hasNext(); if (next) { String nextkey = range.next(); key = (K) nextkey; persistent = ((RedisStore<K, T>) getDataStore()).get(key, query.getFields()); } return next; }

Target:
protected boolean nextInner() throws IOException { if (range == null) { return false; } boolean next = range.hasNext(); if (next) { key = (K) range.next(); persistent = ((RedisStore<K, T>) getDataStore()).get(key, query.getFields()); } return next; }
Source:
public void init() { post( "/list/import", (request, response) -> { MultipartConfigElement multipartConfigElement = new MultipartConfigElement(""); request.raw().setAttribute("org.eclipse.jetty.multipartConfig", multipartConfigElement); String listType = request.headers(LIST_TYPE_HEADER); if (StringUtils.isBlank(listType)) { String exceptionMessage = String.format("The header %s must be set.", LIST_TYPE_HEADER); LOGGER.info(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } List<Part> parts = new ArrayList<>(request.raw().getParts()); Pair<AttachmentInfo, Metacard> attachmentInfo = catalogService.parseAttachments(partsToInfo(parts), null); if (attachmentInfo == null) { String exceptionMessage = "Unable to parse the attachments."; LOGGER.debug(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } try (TemporaryFileBackedOutputStream temporaryFileBackedOutputStream = new TemporaryFileBackedOutputStream()) { IOUtils.copy(attachmentInfo.getLeft().getStream(), temporaryFileBackedOutputStream); for (Splitter splitter : lookupSplitters(attachmentInfo.getLeft().getContentType())) { if (attemptToSplitAndStore( response, listType, attachmentInfo, temporaryFileBackedOutputStream, splitter)) break; } } IOUtils.closeQuietly(attachmentInfo.getLeft().getStream()); return ""; }); }

Target:
public void init() { post( "/list/import", (request, response) -> { MultipartConfigElement multipartConfigElement = new MultipartConfigElement(""); request.raw().setAttribute("org.eclipse.jetty.multipartConfig", multipartConfigElement); String listType = request.headers(LIST_TYPE_HEADER); if (StringUtils.isBlank(listType)) { String exceptionMessage = String.format("The header %s must be set.", LIST_TYPE_HEADER); LOGGER.info(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } List<Part> parts = new ArrayList<>(request.raw().getParts()); Map.Entry<AttachmentInfo, Metacard> attachmentInfo = catalogService.parseParts(parts, null); if (attachmentInfo == null) { String exceptionMessage = "Unable to parse the attachments."; LOGGER.debug(exceptionMessage); createBadRequestResponse(exceptionMessage, response); return null; } try (TemporaryFileBackedOutputStream temporaryFileBackedOutputStream = new TemporaryFileBackedOutputStream()) { IOUtils.copy(attachmentInfo.getKey().getStream(), temporaryFileBackedOutputStream); for (Splitter splitter : lookupSplitters(attachmentInfo.getKey().getContentType())) { if (attemptToSplitAndStore( response, listType, attachmentInfo, temporaryFileBackedOutputStream, splitter)) break; } } IOUtils.closeQuietly(attachmentInfo.getKey().getStream()); return ""; }); }
Source:
public final void testSelect0() throws Exception { List<String> tables = executeDDL("sample1_ddl.sql", "sample1", "sample1"); List inputList = new ArrayList<>(); inputList.addAll(Arrays.asList("sample1")); assertEquals(inputList, tables); ResultSet res = executeQuery(); assertResultSet(res); cleanupQuery(res); }

Target:
public final void testSelect0() throws Exception { List<String> tables = executeDDL("sample1_ddl.sql", "sample1", "sample1"); assertEquals(Arrays.asList("sample1"), tables); ResultSet res = executeQuery(); assertResultSet(res); cleanupQuery(res); }
Source:
public static String readContent(URL url) throws Exception { if (url == null) throw new Exception("unable to verify a null URL"); return IOUtils.toString(url.openStream(), StandardCharsets.UTF_8); }

Target:
public static String readContent(URL url) throws Exception { return readContent(url, StandardCharsets.UTF_8); }
Source:
private Field[] getFields(Class<?> currentClass) { final List<Field> fields = new ArrayList<>(); if (currentClass != null) { do { fields.addAll(Arrays.asList(currentClass.getDeclaredFields())); currentClass = currentClass.getSuperclass(); } while (currentClass.getSuperclass() != null); } return fields.toArray(new Field[0]); }

Target:
private Field[] getFields(Class<?> currentClass) { final List<Field> fields = new ArrayList<>(); while (currentClass != null) { fields.addAll(Arrays.asList(currentClass.getDeclaredFields())); currentClass = currentClass.getSuperclass(); } return fields.toArray(new Field[0]); }
Source:
public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) { try { Set<TeamWorkFlowArtifact> awas = new HashSet<>(); List<Artifact> arts = new ArrayList<>(); for (TreeItem item : treeItems) { Artifact art = AtsClientService.get().getQueryServiceClient().getArtifact(item); if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) { awas.add((TeamWorkFlowArtifact) art); arts.add(art); } } for (AbstractWorkflowArtifact teamArt : awas) { promptChangeVersion(teamArt, AtsClientService.get().getUserService().isAtsAdmin() ? VersionReleaseType.Both : VersionReleaseType.UnReleased, AtsClientService.get().getUserService().isAtsAdmin() ? VersionLockedType.Both : VersionLockedType.UnLocked); ((XViewer) getXViewer()).update(awas.toArray(), null); } return; } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }

Target:
public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) { try { Set<TeamWorkFlowArtifact> awas = new HashSet<>(); List<Artifact> arts = new ArrayList<>(); for (TreeItem item : treeItems) { Artifact art = AtsClientService.get().getQueryServiceClient().getArtifact(item); if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) { awas.add((TeamWorkFlowArtifact) art); arts.add(art); } } promptChangeVersionMultiSelect(new ArrayList<TeamWorkFlowArtifact>(awas), AtsClientService.get().getUserService().isAtsAdmin() ? VersionReleaseType.Both : VersionReleaseType.UnReleased, AtsClientService.get().getUserService().isAtsAdmin() ? VersionLockedType.Both : VersionLockedType.UnLocked); ((XViewer) getXViewer()).update(awas.toArray(), null); return; } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
Source:
public void startParsing() { BackgroundTask.wrap(() -> currentCitationfetcher.performSearch(inputTextProperty.getValue())) .onRunning(() -> dialogService.notify(Localization.lang("Your text is being parsed..."))) .onSuccess(parsedEntries -> { dialogService.notify(Localization.lang("GROBID could parse %0 Entries from your query.", String.valueOf(parsedEntries.size()))); importHandler.importEntries(parsedEntries); for (BibEntry bibEntry : parsedEntries) { trackNewEntry(bibEntry); } }).executeWith(taskExecutor); }

Target:
public void startParsing() { BackgroundTask.wrap(() -> currentCitationfetcher.performSearch(inputTextProperty.getValue())) .onRunning(() -> dialogService.notify(Localization.lang("Your text is being parsed..."))) .onSuccess(parsedEntries -> { dialogService.notify(Localization.lang("%0 entries were parsed from your query.", String.valueOf(parsedEntries.size()))); importHandler.importEntries(parsedEntries); for (BibEntry bibEntry : parsedEntries) { trackNewEntry(bibEntry); } }).executeWith(taskExecutor); }
Source:
public Builder() { this.settings = new ESSettings(); this.settings.setClusterName("elasticsearch"); this.settings.setShards(1); this.settings.setReplicas(1); this.settings.setHostToPortMapping(new HashMap<>()); this.settings.setIndexName("test"); }

Target:
public Builder() { this.settings = new ESSettings(); this.settings.setClusterName("elasticsearch"); this.settings.setShards(1); this.settings.setReplicas(1); this.settings.setHostToPortMapping(new HashMap<>()); this.settings.setIndexName("jena-text"); }
Source:
public LocalCluster(String jarFileName, int siteCount, int hostCount, int kfactor, int clusterId, BackendTarget target, FailureState failureState, boolean debug, boolean isRejoinTest, Map<String, String> env) { this(null, null, jarFileName, siteCount, hostCount, kfactor, clusterId, target, failureState, debug, env); }

Target:
public LocalCluster(String jarFileName, int siteCount, int hostCount, int kfactor, int clusterId, BackendTarget target, FailureState failureState, boolean debug, boolean isRejoinTest, Map<String, String> env) { this(null, null, jarFileName, siteCount, hostCount, kfactor, clusterId, target, failureState, debug, isRejoinTest, env); }
Source:
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value) { checkValidPropertyDescriptor(propertyDescriptor); propertyValuesByDescriptor.put(propertyDescriptor, value); }

Target:
public <T> void setProperty(PropertyDescriptor<T> propertyDescriptor, T value) { checkValidPropertyDescriptor(propertyDescriptor); if (value instanceof List) { propertyValuesByDescriptor.put(propertyDescriptor, Collections.unmodifiableList((List) value)); } else { propertyValuesByDescriptor.put(propertyDescriptor, value); } }
Source:
public AmmitEternal(UUID ownerId, CardSetInfo cardSetInfo) { super(ownerId, cardSetInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); subtype.add("Zombie"); subtype.add("Crocodile"); subtype.add("Demon"); power = new MageInt(5); toughness = new MageInt(5); this.addAbility(new AfflictAbility(3)); this.addAbility(new SpellCastOpponentTriggeredAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance()), false)); this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new RemoveAllCountersSourceEffect(CounterType.M1M1), false)); }

Target:
public AmmitEternal(UUID ownerId, CardSetInfo cardSetInfo) { super(ownerId, cardSetInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); subtype.add("Zombie"); subtype.add("Crocodile"); subtype.add("Demon"); power = new MageInt(5); toughness = new MageInt(5); this.addAbility(new AfflictAbility(3)); this.addAbility(new SpellCastOpponentTriggeredAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance()), false)); this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new RemoveAllCountersSourceEffect(CounterType.M1M1), false)); }
Source:
public List<InstallationProfile> getInstallationProfiles() { logger.debug("Looking for installation profile features"); List<InstallationProfile> profiles = new ArrayList<InstallationProfile>(); try{ for (Feature feature : featuresService.listFeatures()) { if (feature.getName().contains(InstallationProfile.INSTALLATION_PROFILE_FEATURE_PREFIX)) { InstallationProfile profile = new InstallationProfileImpl(feature); profiles.add(profile); } } } catch(Exception e){ logger.error("Encountered an error whil trying to obtain the installation profile features.", e); } return profiles; }

Target:
public List<Feature> getInstallationProfiles() { logger.debug("Looking for installation profile features"); List<Feature> profiles = new ArrayList<Feature>(); try{ for (Feature feature : featuresService.listFeatures()) { if (feature.getName().contains(INSTALLATION_PROFILE_PREFIX)) { profiles.add(feature); } } } catch(Exception e){ logger.error( "Encountered an error while trying to obtain the installation profile features.", e); } return profiles; }
Source:
protected void serviceInit(Configuration conf) throws Exception { super.serviceInit(conf); threshold = HiveConf.getFloatVar(conf, HiveConf.ConfVars.HIVE_TEST_LOAD_UTILIZATION); victimsHostName = HiveConf.getTrimmedStringsVar(conf, HiveConf.ConfVars.HIVE_TEST_LOAD_HOSTNAMES); interval = HiveConf.getTimeVar(conf, HiveConf.ConfVars.HIVE_TEST_LOAD_INTERVAL, TimeUnit.MILLISECONDS); LOG.info("LlapLoadGeneratorService init with {}", interval, threshold, victimsHostName); }

Target:
protected void serviceInit(Configuration conf) throws Exception { super.serviceInit(conf); threshold = HiveConf.getFloatVar(conf, HiveConf.ConfVars.HIVE_TEST_LOAD_UTILIZATION); if (threshold < 0 || threshold > 1.0) { throw new IllegalArgumentException(HiveConf.ConfVars.HIVE_TEST_LOAD_UTILIZATION.varname + " should " + "be between 0.0 and 1.0. The configuration specified [" + threshold + "]"); } victimsHostName = HiveConf.getTrimmedStringsVar(conf, HiveConf.ConfVars.HIVE_TEST_LOAD_HOSTNAMES); interval = HiveConf.getTimeVar(conf, HiveConf.ConfVars.HIVE_TEST_LOAD_INTERVAL, TimeUnit.MILLISECONDS); LOG.info("LlapLoadGeneratorService init with {}", interval, threshold, victimsHostName); }
Source:
private Comparator<Offer> getComparatorWithSecondarySortOrder(boolean reversePrimarySortOrder) { Comparator<Offer> primary = Comparator.comparing(Offer::getPrice, (o1, o2) -> { long a = o1 != null ? o1.getValue() : 0; long b = o2 != null ? o2.getValue() : 0; if (a != b) { if (o1 != null && CurrencyUtil.isCryptoCurrency(o1.getCurrencyCode())) return a > b ? 1 : -1; else return a < b ? 1 : -1; } else { return 0; } }); if (reversePrimarySortOrder) primary = primary.reversed(); return primary.thenComparing(Offer::getAmount); }

Target:
private Comparator<Offer> getComparatorWithSecondarySortOrder(boolean reversePrimarySortOrder) { Comparator<Offer> primary = Comparator.comparing(Offer::getPrice, (o1, o2) -> { long a = o1 != null ? o1.getValue() : 0; long b = o2 != null ? o2.getValue() : 0; if (a != b) { if (o1 != null && CurrencyUtil.isCryptoCurrency(o1.getCurrencyCode())) return a > b ? 1 : -1; else return a < b ? 1 : -1; } else { return 0; } }); if (reversePrimarySortOrder) primary = primary.reversed(); Comparator<Offer> secondary = Comparator.comparing(Offer::getAmount, Comparator.reverseOrder()); return primary.thenComparing(secondary); }
Source:
public static List<CPListElement> getExistingEntries(IJavaProject project) throws JavaModelException { ArrayList<CPListElement> newClassPath= new ArrayList<>(); for (IClasspathEntry curr : project.getRawClasspath()) { newClassPath.add(CPListElement.createFromExisting(curr, project)); } return newClassPath; }

Target:
public static List<CPListElement> getExistingEntries(IJavaProject project) throws JavaModelException { ArrayList<CPListElement> newClassPath= new ArrayList<>(); for (IClasspathEntry entry : project.getRawClasspath()) { newClassPath.add(CPListElement.createFromExisting(entry, project)); } return newClassPath; }
Source:
public void putDownloadRemoteMavenIndexCronJob() throws Exception { Assert.assertTrue(context.containsBean("repositoryIndexManager")); List<CronTaskConfigurationDto> configurationList = getDownloadRemoteMavenIndexOfCarlspringCronJobs(); assertThat(configurationList.size(), CoreMatchers.equalTo(1)); CronTaskConfigurationDto configuration = configurationList.get(0); assertThat(configuration.getProperties().keySet().size(), CoreMatchers.equalTo(4)); assertThat(configuration.getProperties().get("cronExpression"), CoreMatchers.equalTo("0 0 5 * * ?")); configuration.addProperty("cronExpression", "0 0 0 * * ?"); client.put2(getContextBaseUrl() + "/cron", configuration, MediaType.APPLICATION_JSON_VALUE); configurationList = getDownloadRemoteMavenIndexOfCarlspringCronJobs(); assertThat(configurationList.size(), CoreMatchers.equalTo(1)); configuration = configurationList.get(0); assertThat(configuration.getProperties().keySet().size(), CoreMatchers.equalTo(4)); assertThat(configuration.getProperties().get("cronExpression"), CoreMatchers.equalTo("0 0 0 * * ?")); }

Target:
public void putDownloadRemoteMavenIndexCronJob() throws Exception { assertTrue(context.containsBean("repositoryIndexManager")); List<CronTaskConfigurationDto> configurationList = getDownloadRemoteMavenIndexOfCarlspringCronJobs(); assertThat(configurationList.size(), CoreMatchers.equalTo(1)); CronTaskConfigurationDto configuration = configurationList.get(0); assertThat(configuration.getProperties().keySet().size(), CoreMatchers.equalTo(4)); assertThat(configuration.getProperties().get("cronExpression"), CoreMatchers.equalTo("0 0 5 * * ?")); configuration.addProperty("cronExpression", "0 0 0 * * ?"); client.put2(getContextBaseUrl() + "/cron", configuration, MediaType.APPLICATION_JSON_VALUE); configurationList = getDownloadRemoteMavenIndexOfCarlspringCronJobs(); assertThat(configurationList.size(), CoreMatchers.equalTo(1)); configuration = configurationList.get(0); assertThat(configuration.getProperties().keySet().size(), CoreMatchers.equalTo(4)); assertThat(configuration.getProperties().get("cronExpression"), CoreMatchers.equalTo("0 0 0 * * ?")); }
Source:
public long getSerializedSize() { if (valueBuffers.size() != 1) { throw new UnsupportedOperationException("Method not supported for version 2 GenericIndexed."); } return theBuffer.remaining() + 2 + 4 + 4; }

Target:
public long getSerializedSize() { if (valueBuffers.size() != 1) { throw new UnsupportedOperationException("Method not supported for version 2 GenericIndexed."); } return theBuffer.remaining() + 2 + Ints.BYTES + Ints.BYTES; }
Source:
public boolean add(E object) { switch (additionMode) { case ALL: { int modified = 0; for (Collection<E> parent : parents) { if (parent.add(object)) { modified++; } } return resultBoolean(modified); } case LAST: { return parents.get(parents.size() - 1).add(object); } } throw new IllegalStateException("This SuperCollection has an invalid addition mode!"); }

Target:
public boolean add(E object) { switch (additionMode) { case ALL: int modified = 0; for (Collection<E> parent : parents) { if (parent.add(object)) { modified++; } } return resultBoolean(modified); case LAST: return parents.get(parents.size() - 1).add(object); } throw new IllegalStateException("This SuperCollection has an invalid addition mode!"); }
Source:
public void releaseSerializer(final Serializer<?> serializer) throws IOException { AtomicInteger currentCount = providedVsCount.get(serializer); if(currentCount != null) { if(currentCount.decrementAndGet() < 0) { currentCount.incrementAndGet(); throw new IllegalArgumentException("Given serializer:" + serializer.getClass().getName() + " is not managed by this provider"); } } else { throw new IllegalArgumentException("Given serializer:" + serializer.getClass().getName() + " is not managed by this provider"); } if(instantiated.contains(serializer) && serializer instanceof Closeable) { ((Closeable)serializer).close(); } }

Target:
public void releaseSerializer(final Serializer<?> serializer) throws IOException { AtomicInteger currentCount = providedVsCount.get(serializer); if(currentCount != null) { if(currentCount.decrementAndGet() < 0) { currentCount.incrementAndGet(); throw new IllegalArgumentException("Given serializer:" + serializer.getClass().getName() + " is not managed by this provider"); } } else { throw new IllegalArgumentException("Given serializer:" + serializer.getClass().getName() + " is not managed by this provider"); } if(instantiated.remove(serializer) && serializer instanceof Closeable) { ((Closeable)serializer).close(); } }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!Utils.isMonkeyRunning()) { updatePreferences(); } }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); updatePreferences(); }
Source:
public InvitationSentEvent(User user, String mail, String language, Group group, Vo vo) { this.sender = user; this.email = mail; this.language = language; this.group = group; this.vo = vo; this.message = formatMessage("Invitation to VO: %s, group: %s, sent by user: %s, to email: %s, in language: %s", vo, group == null ? "None" : group, sender, email, language); }

Target:
public InvitationSentEvent(User user, String mail, String language, Group group, Vo vo) { this.sender = user; this.email = mail; this.language = language; this.group = group; this.vo = vo; this.message = formatMessage("Invitation to %s, sent by %s, to email: %s, in language: %s.", (group != null) ? group : vo, sender, email, language); }
Source:
private void verifyMessageSplitCorrectlyForDataCoding(String payload, DataCoding dataCoding, Integer maxMessageSize) throws UnsupportedEncodingException { SmesMessageSpecification smesMessageSpecification = getSmesMessageSpecification(payload, dataCoding, maxMessageSize); if (dataCoding == null) { dataCoding = (DataCoding) ReflectionTestUtils.getField(smesMessageSpecification, "dataCoding"); } int maxCharacters; if (maxMessageSize == null) { maxCharacters = DataCodingSpecification.getMaxCharacters(dataCoding.toByte()); } else { maxCharacters = maxMessageSize; } int maxCharactersWithRoomForPrefix = maxCharacters - MULTISEGMENT_PREFIX_BYTES; String charsetName = DataCodingSpecification.getCharsetName(dataCoding.toByte()); List<byte[]> messageParts = (List<byte[]>) ReflectionTestUtils.getField(smesMessageSpecification, "shortMessageParts"); int expectedPartsCountAfterSplit = (payload.length() + maxCharactersWithRoomForPrefix - 1) / maxCharactersWithRoomForPrefix; if (Boolean.getBoolean("show_test_output")) { System.out.println("Datacoding[" + dataCoding.getClass().getSimpleName() + " " + dataCoding.toByte() + "] maxCharacters: " + maxCharacters + ", maxCharactersWithRoomForPrefix: " + maxCharactersWithRoomForPrefix + ", payload length: " + payload.length() + ", expectedPartsCountForDataCoding: " + expectedPartsCountAfterSplit); } assertEquals("Message parts count after split does not match expected size", expectedPartsCountAfterSplit, messageParts.size()); for (byte[] messagePart : messageParts) { String string = new String(messagePart, charsetName); assertTrue("MessagePart is longer than allowed max message size for data coding - Actual part length: " + string.length() + " vs. max size: " + maxCharacters, string.length() <= maxCharacters); } }

Target:
private void verifyMessageSplitCorrectlyForDataCoding(String payload, DataCoding dataCoding, Integer maxMessageSize) throws UnsupportedEncodingException { SmesMessageSpecification smesMessageSpecification = getSmesMessageSpecification(payload, dataCoding, maxMessageSize); if (dataCoding == null) { dataCoding = (DataCoding) ReflectionTestUtils.getField(smesMessageSpecification, "dataCoding"); } int maxCharacters; if (maxMessageSize == null) { maxCharacters = DataCodingSpecification.getMaxCharacters(dataCoding.toByte()); } else { maxCharacters = maxMessageSize; } int maxCharactersWithRoomForPrefix = maxCharacters - PREFIX_BYTES; String charsetName = DataCodingSpecification.getCharsetName(dataCoding.toByte()); List<byte[]> messageParts = (List<byte[]>) ReflectionTestUtils.getField(smesMessageSpecification, "shortMessageParts"); int expectedPartsCountAfterSplit = (payload.length() + maxCharactersWithRoomForPrefix - 1) / maxCharactersWithRoomForPrefix; assertEquals("Message parts count after split does not match expected size", expectedPartsCountAfterSplit, messageParts.size()); for (byte[] messagePart : messageParts) { String string = new String(messagePart, charsetName); assertTrue("MessagePart is longer than allowed max message size for data coding - Actual part length: " + string.length() + " vs. max size: " + maxCharacters , string.length() <= maxCharacters); } }
Source:
public String getDosingInstructionsAsString(Locale locale) { StringBuilder dosingInstructions = new StringBuilder(); if (this.dosageAdjustmentPercentage != null) { dosingInstructions.append("Dosage Adjustment Percentage : "); dosingInstructions.append(this.dosageAdjustmentPercentage); dosingInstructions.append("\n"); } if (this.dosageDeliveredTiming != null) { dosingInstructions.append("Dosage Delivered Timing : "); dosingInstructions.append(this.dosageDeliveredTiming); dosingInstructions.append("\n"); } if (this.dosageDilutionInstructions != null) { dosingInstructions.append("Dosage Dilution Instructions : "); dosingInstructions.append(this.dosageDilutionInstructions); dosingInstructions.append("\n"); } return dosingInstructions.toString(); }

Target:
public String getDosingInstructionsAsString(Locale locale) { StringBuilder dosingInstructions = new StringBuilder(); if (this.dosageAdjustmentPercentage != null) { dosingInstructions.append(this.formatDosingInformation(ADJUSTMENT_PERCENTAGE, this.dosageAdjustmentPercentage.toString())); } if (this.dosageDeliveredTiming != null) { dosingInstructions.append(this.formatDosingInformation(DELIVERED_TIMING, this.dosageDeliveredTiming)); } if (this.dosageDilutionInstructions != null) { dosingInstructions.append(this.formatDosingInformation(DILUTION_INSTRUCTIONS, this.dosageDilutionInstructions)); } return dosingInstructions.toString(); }
Source:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.beginTask(MessageFormat.format(Messages.UI_SessionEditor_session_loading_task_title, new Object[0]), 1); session = SessionManager.INSTANCE.getSession(sessionResourceURI, subMonitor); if (!session.isOpen()) { session.open(monitor); } subMonitor.worked(1); subMonitor.worked(1); subMonitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } }

Target:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.beginTask(MessageFormat.format(Messages.UI_SessionEditor_session_loading_task_title, new Object[0]), 1); session = SessionManager.INSTANCE.getSession(sessionResourceURI, subMonitor); if (!session.isOpen()) { session.open(monitor); } subMonitor.worked(1); subMonitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("type: ").append(type); if (incarnationId != null) { sb.append(" incarnationId ").append(incarnationId); } if (!type.equals(Type.Uninitialized)) { if (sessionId != null) { sb.append(" sessionId ").append(sessionId); } if (storeKey != null) { sb.append(" storeKey ").append(storeKey); } sb.append(" offset ").append(offset); sb.append(" bytesRead ").append(bytesRead); } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("type: ").append(type); if (incarnationId != null) { sb.append(" incarnationId ").append(incarnationId); } sb.append(" inclusiveness ").append(inclusive == 1 ? true : false); if (!type.equals(Type.Uninitialized)) { if (sessionId != null) { sb.append(" sessionId ").append(sessionId); } if (storeKey != null) { sb.append(" storeKey ").append(storeKey); } sb.append(" offset ").append(offset); sb.append(" bytesRead ").append(bytesRead); } return sb.toString(); }
Source:
public void createX509Credential() throws IOException, CertificateException { val request = new MockHttpServletRequest(); try (val inStream = new FileInputStream(new ClassPathResource("ldap-crl.crt").getFile())) { X509Certificate[] certs = {CertUtils.readCertificate(inStream)}; request.setAttribute(REQUEST_ATTRIBUTE_X509_CERTIFICATE, certs); val cred = factory.fromRequest(request, null).iterator().next(); assertTrue(cred instanceof X509CertificateCredential); } }

Target:
public void createX509Credential() throws IOException, CertificateException { val request = new MockHttpServletRequest(); try (val inStream = new FileInputStream(new ClassPathResource("ldap-crl.crt").getFile())) { val certs = new X509Certificate[]{CertUtils.readCertificate(inStream)}; request.setAttribute(REQUEST_ATTRIBUTE_X509_CERTIFICATE, certs); val cred = factory.fromRequest(request, null).iterator().next(); assertTrue(cred instanceof X509CertificateCredential); } }
Source:
public AsyncPrettyPrinter getInstance(final String headerName, final String headerValue) { final MatchResult result = matchAndParseHeader(headerName, headerValue); if (result == null) { return null; } String uri = result.getSchemaUri(); URL schemaURL = parseURL(uri); if (schemaURL == null) { return getErrorAsyncPrettyPrinter(headerName, headerValue); } else { ExecutorService sExecutorService = AsyncPrettyPrinterExecutorHolder.getExecutorService(); final Future<String> response = sExecutorService.submit(new Request(schemaURL)); return new AsyncPrettyPrinter() { public void printTo(PrintWriter output, InputStream payload) throws IOException { try { String schema; try { schema = response.get(); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (IOException.class.isInstance(cause)) { doErrorPrint( output, payload, "Cannot successfully download schema: " + e.getMessage()); return; } else { throw e; } } doPrint(output, payload, schema); } catch (InterruptedException e) { doErrorPrint( output, payload, "Encountered spurious interrupt while downloading schema for pretty printing: " + e.getMessage()); } catch (ExecutionException e) { Throwable cause = e.getCause(); throw ExceptionUtil.propagate(cause); } } public PrettyPrinterDisplayType getPrettifiedType() { return result.getDisplayType(); } }; } }

Target:
public AsyncPrettyPrinter getInstance(final String headerName, final String headerValue) { final MatchResult result = matchAndParseHeader(headerName, headerValue); if (result == null) { return null; } String uri = result.getSchemaUri(); URL schemaURL = parseURL(uri); if (schemaURL == null) { return getErrorAsyncPrettyPrinter(headerName, headerValue); } else { ExecutorService executorService = AsyncPrettyPrinterExecutorHolder.getExecutorService(); if (executorService == null) { return null; } final Future<String> response = executorService.submit(new Request(schemaURL)); return new AsyncPrettyPrinter() { public void printTo(PrintWriter output, InputStream payload) throws IOException { try { String schema; try { schema = response.get(); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (IOException.class.isInstance(cause)) { doErrorPrint( output, payload, "Cannot successfully download schema: " + e.getMessage()); return; } else { throw e; } } doPrint(output, payload, schema); } catch (InterruptedException e) { doErrorPrint( output, payload, "Encountered spurious interrupt while downloading schema for pretty printing: " + e.getMessage()); } catch (ExecutionException e) { Throwable cause = e.getCause(); throw ExceptionUtil.propagate(cause); } } public PrettyPrinterDisplayType getPrettifiedType() { return result.getDisplayType(); } }; } }
Source:
static void setTccl(final ClassLoader cl) { if (System.getSecurityManager() == null) { Thread.currentThread().setContextClassLoader(cl); } else { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { Thread.currentThread().setContextClassLoader(cl); return null; } }); } }

Target:
static void setTccl(final ClassLoader cl) { Thread.currentThread().setContextClassLoader(cl); }
Source:
protected void writeCommandParameters(ObjectOutput output, ReplicableCommand command) throws IOException { command.writeTo(output); if (command instanceof TopologyAffectedCommand) { output.writeInt(((TopologyAffectedCommand) command).getTopologyId()); } if (command instanceof SegmentSpecificCommand) { UnsignedNumeric.writeUnsignedInt(output, ((SegmentSpecificCommand) command).getSegment()); } }

Target:
protected void writeCommandParameters(ObjectOutput output, ReplicableCommand command) throws IOException { command.writeTo(output); if (command instanceof TopologyAffectedCommand) { output.writeInt(((TopologyAffectedCommand) command).getTopologyId()); } }
Source:
public void refreshTimeEstimation() throws NoScriptDefinitionSelectedException { ScriptDefinitionWrapper scriptDefinition = getScriptDefinition() .orElseThrow(() -> new NoScriptDefinitionSelectedException( "Tried to refresh time estimation with no script definition selected")); try { generator.refreshTimeEstimation(scriptGeneratorTable, scriptDefinition); languageSupported = true; threadError = false; } catch (UnsupportedLanguageException e) { firePropertyChange(LANGUAGE_SUPPORT_PROPERTY, languageSupported, false); LOG.error(e); languageSupported = false; } catch (InterruptedException | ExecutionException e) { firePropertyChange(THREAD_ERROR_PROPERTY, threadError, true); LOG.error(e); threadError = true; } }

Target:
public void refreshTimeEstimation() throws NoScriptDefinitionSelectedException { ScriptDefinitionWrapper scriptDefinition = getScriptDefinition() .orElseThrow(() -> new NoScriptDefinitionSelectedException( "Tried to refresh time estimation with no script definition selected")); try { generator.refreshTimeEstimation(scriptGeneratorTable, scriptDefinition); languageSupported = true; threadError = false; } catch (UnsupportedLanguageException e) { firePropertyChange(LANGUAGE_SUPPORT_PROPERTY, languageSupported, languageSupported = false); LOG.error(e); } catch (InterruptedException | ExecutionException e) { registerThreadError(e); } }
Source:
private void setProperties() { configProperties.setProperty("store.default-rocksdb.opts.gwNamespace", "default"); configProperties.setProperty("store.default-rocksdb.type", "rocksdb"); }

Target:
private void setProperties() { configProperties.setProperty("store.default-filesystem.opts.gwNamespace", ""); configProperties.setProperty("store.default-filesystem.type", "filesystem"); }
Source:
public void testReusedArrayWithString() throws Exception { List<String> input = Arrays.asList("second"); h.registerArrayType(String.class, "text"); h.inTransaction(t -> { t.createUpdate("create table test_reused_array(id int, a text[], unique (id))").execute(); t.createUpdate("insert into test_reused_array(id, a) values(1, '{\"first\"}')").execute(); t.createUpdate("insert into test_reused_array(id, a) values(1, :array) " + "on conflict(id) do update set a=:array") .bindArray("array", String.class, input) .execute(); Array result = t.createQuery("select a from test_reused_array where id=1") .map((rs, ctx) -> rs.getArray("a")).first(); t.createUpdate("drop table test_reused_array"); assertThat((String[]) result.getArray()).hasSameElementsAs(input); return 1; }); }

Target:
public void testReusedArrayWithString() throws Exception { h.registerArrayType(String.class, "text"); assertThat(h.createQuery("select :array = :array") .bindArray("array", String.class, Collections.singletonList("element")) .mapTo(boolean.class) .one()).isTrue(); }