auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void openContextMenuByPathSelectedItem(String path) { for (int i = 1; ; i++) { waitAndSelectItem(path); actionsFactory.createAction(seleniumWebDriver).contextClick().perform(); waitContextMenu(); try { waitItemIsSelected(path, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); return; } catch (WebDriverException e) { seleniumWebDriverHelper.hideContextMenu(); waitContextMenuPopUpClosed(); if (i == 2) { throw e; } } } }

Target:
public void openContextMenuByPathSelectedItem(String path) { for (int i = 1; ; i++) { waitAndSelectItem(path); actionsFactory.createAction(seleniumWebDriver).contextClick().perform(); waitContextMenu(); try { waitItemIsSelected(path, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); return; } catch (TimeoutException e) { seleniumWebDriverHelper.hideContextMenu(); waitContextMenuPopUpClosed(); if (i == 2) { throw e; } } } }
Source:
@Test public void testCastInStringOperandOfComparison() { final String query = "select \"employee_id\" " + "from \"foodmart\".\"employee\" " + "where 10 = cast('10' as int) and \"birth_date\" = cast('1914-02-02' as date) or " + "\"hire_date\" = cast('1996-01-01 '||'00:00:00' as timestamp)"; final String expected = "SELECT \"employee_id\"\n" + "FROM \"foodmart\".\"employee\"\n" + "WHERE 10 = '10' AND \"birth_date\" = '1914-02-02' OR \"hire_date\" = '1996-01-01 ' || " + "'00:00:00'"; final String expectedBiqquery = "SELECT employee_id\n" + "FROM foodmart.employee\n" + "WHERE 10 = CAST('10' AS INTEGER) AND birth_date = '1914-02-02' OR hire_date = " + "CAST('1996-01-01 ' || '00:00:00' AS TIMESTAMP(0))"; sql(query) .ok(expected) .withBigQuery() .ok(expectedBiqquery); }

Target:
@Test public void testCastInStringOperandOfComparison() { final String query = "select \"employee_id\" " + "from \"foodmart\".\"employee\" " + "where 10 = cast('10' as int) and \"birth_date\" = cast('1914-02-02' as date) or " + "\"hire_date\" = cast('1996-01-01 '||'00:00:00' as timestamp)"; final String expected = "SELECT \"employee_id\"\n" + "FROM \"foodmart\".\"employee\"\n" + "WHERE 10 = '10' AND \"birth_date\" = '1914-02-02' OR \"hire_date\" = '1996-01-01 ' || " + "'00:00:00'"; final String expectedBiqquery = "SELECT employee_id\n" + "FROM foodmart.employee\n" + "WHERE 10 = CAST('10' AS INTEGER) AND birth_date = '1914-02-02' OR hire_date = " + "CAST('1996-01-01 ' || '00:00:00' AS TIMESTAMP)"; sql(query) .ok(expected) .withBigQuery() .ok(expectedBiqquery); }
Source:
public void testEarliestAggregators() throws Exception { skipVectorize(); testQuery( "SELECT " + "EARLIEST(cnt), EARLIEST(m1), EARLIEST(dim1, 10), " + "EARLIEST(cnt + 1), EARLIEST(m1 + 1), EARLIEST(dim1 || CAST(cnt AS VARCHAR), 10) " + "FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( expressionVirtualColumn("v0", "(\"cnt\" + 1)", ValueType.LONG), expressionVirtualColumn("v1", "(\"m1\" + 1)", ValueType.FLOAT), expressionVirtualColumn("v2", "concat(\"dim1\",CAST(\"cnt\", 'STRING'))", ValueType.STRING) ) .aggregators( aggregators( new LongFirstAggregatorFactory("a0", "cnt"), new FloatFirstAggregatorFactory("a1", "m1"), new StringFirstAggregatorFactory("a2", "dim1", 10), new LongFirstAggregatorFactory("a3", "v0"), new FloatFirstAggregatorFactory("a4", "v1"), new StringFirstAggregatorFactory("a5", "v2", 10) ) ) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L, 1.0f, "", 2L, 2.0f, "1"} ) ); }

Target:
public void testEarliestAggregators() throws Exception { skipVectorize(); testQuery( "SELECT " + "EARLIEST(cnt), EARLIEST(m1), EARLIEST(dim1, 10), " + "EARLIEST(cnt + 1), EARLIEST(m1 + 1), EARLIEST(dim1 || CAST(cnt AS VARCHAR), 10) " + "FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns( expressionVirtualColumn("v0", "(\"cnt\" + 1)", ValueType.LONG), expressionVirtualColumn("v1", "(\"m1\" + 1)", ValueType.FLOAT), expressionVirtualColumn("v2", "concat(\"dim1\",CAST(\"cnt\", 'STRING'))", ValueType.STRING) ) .aggregators( aggregators( new LongFirstAggregatorFactory("a0", "cnt"), new FloatFirstAggregatorFactory("a1", "m1"), new StringFirstAggregatorFactory("a2", "dim1", 10), new LongFirstAggregatorFactory("a3", "v0"), new FloatFirstAggregatorFactory("a4", "v1"), new StringFirstAggregatorFactory("a5", "v2", 10) ) ) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L, 1.0f, NullHandling.sqlCompatible() ? "" : "10.1", 2L, 2.0f, "1"} ) ); }
Source:
public final String extendedGuideUrl() { return formatString(DynamicMessageKey.EXTENDED_GUIDE_URL, LocaleInfo.getCurrentLocale().getLocaleName()); }

Target:
public final String extendedGuideUrl() { return formatString(DynamicMessageKey.EXTENDED_GUIDE_URL, getCurrentLocaleAsString()); }
Source:
public RegexProvider getRegexpProvider() { return new RegexProvider() { @Override public Map<String, String> getLanguageRegexes() { return ImmutableMap.of("maven", ".*pom\\.xml"); } @Override public Set<String> getFileWatchPatterns() { return ImmutableSet.of(); } }; }

Target:
public RegexProvider getRegexpProvider() { return new RegexProvider() { @Override public Map<String, String> getLanguageRegexes() { return ImmutableMap.of("maven", ".*[/\\\\]?pom\\.xml$"); } @Override public Set<String> getFileWatchPatterns() { return ImmutableSet.of(); } }; }
Source:
public Multimap<CallStackDepth, ISegment> queryCallStacks(Collection<CallStackDepth> callstacks, Collection<Long> times) { Map<Integer, CallStackDepth> quarks = new HashMap<>(); for (CallStackDepth csDepth : callstacks) { quarks.put(csDepth.getQuark(), csDepth); } Multimap<CallStackDepth, ISegment> map = Objects.requireNonNull(ArrayListMultimap.create()); Collection<Long> queryTimes = getTimes(fStateSystem, times); try { Iterable<ITmfStateInterval> query2d = fStateSystem.query2D(quarks.keySet(), queryTimes); for (ITmfStateInterval callInterval : query2d) { CallStackDepth callStackDepth = Objects.requireNonNull(quarks.get(callInterval.getAttribute())); if (!callInterval.getStateValue().isNull()) { map.put(callStackDepth, callStackDepth.getCallStack().getFunctionFromInterval(callInterval)); } else { map.put(callStackDepth, new NullFunction(callInterval)); } } } catch (IndexOutOfBoundsException | TimeRangeException | StateSystemDisposedException e) { e.printStackTrace(); } return map; }

Target:
public Multimap<CallStackDepth, ISegment> queryCallStacks(Collection<CallStackDepth> callstacks, Collection<Long> times) { Map<Integer, CallStackDepth> quarks = Maps.uniqueIndex(callstacks, cs -> cs.getQuark()); Multimap<CallStackDepth, ISegment> map = Objects.requireNonNull(ArrayListMultimap.create()); Collection<Long> queryTimes = getTimes(fStateSystem, times); try { Iterable<ITmfStateInterval> query2d = fStateSystem.query2D(quarks.keySet(), queryTimes); for (ITmfStateInterval callInterval : query2d) { CallStackDepth callStackDepth = Objects.requireNonNull(quarks.get(callInterval.getAttribute())); if (callInterval.getValue() != null) { map.put(callStackDepth, callStackDepth.getCallStack().getFunctionFromInterval(callInterval)); } else { map.put(callStackDepth, new BasicSegment(callInterval.getStartTime(), callInterval.getEndTime() + 1)); } } } catch (IndexOutOfBoundsException | TimeRangeException | StateSystemDisposedException e) { e.printStackTrace(); } return map; }
Source:
private ImpersonatedCredentials(Builder builder) { this.sourceCredentials = builder.getSourceCredentials(); this.targetPrincipal = builder.getTargetPrincipal(); this.delegates = builder.getDelegates(); this.scopes = builder.getScopes(); this.lifetime = builder.getLifetime(); this.transportFactory = firstNonNull( builder.getHttpTransportFactory(), getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); if (this.delegates == null) { this.delegates = new ArrayList<String>(); } if (this.scopes == null) { throw new IllegalStateException(SCOPE_EMPTY_ERROR); } if (this.lifetime > TWELVE_HOURS_IN_SECONDS) { throw new IllegalStateException(LIFETIME_EXCEEDED_ERROR); } if (this.lifetime == 0) { this.lifetime = DEFAULT_LIFETIME_IN_SECONDS; } }

Target:
private ImpersonatedCredentials(Builder builder) { this.sourceCredentials = builder.getSourceCredentials(); this.targetPrincipal = builder.getTargetPrincipal(); this.delegates = builder.getDelegates(); this.scopes = builder.getScopes(); this.lifetime = builder.getLifetime(); this.transportFactory = firstNonNull( builder.getHttpTransportFactory(), getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); if (this.delegates == null) { this.delegates = new ArrayList<String>(); } if (this.scopes == null) { throw new IllegalStateException("Scopes cannot be null"); } if (this.lifetime > TWELVE_HOURS_IN_SECONDS) { throw new IllegalStateException("lifetime must be less than or equal to 43200"); } }
Source:
public void createPayment_success() throws JsonProcessingException { final Account account = new Account(GATEWAY_ACCOUNT_ID, TokenPaymentType.DIRECT_DEBIT); final String status = "created"; final boolean finished = false; DirectDebitConnectorCreatePaymentResponse connectorResponse = aDirectDebitConnectorCreatePaymentResponse() .withPaymentExternalId(PAYMENT_ID) .withAmount(500L) .withPaymentProvider(PAYMENT_PROVIDER) .withCreatedDate(CREATED_DATE) .withDescription(DESCRIPTION) .withState(new PaymentState(status, finished)) .withReference(REFERENCE) .build(); connectorDDMockClient.respondWithPaymentCreated(connectorResponse, account.getAccountId()); String request = new GsonBuilder().create().toJson(Map.of( "amount", 500, "description", DESCRIPTION, "reference", REFERENCE, "mandate_id", MANDATE_ID)); postPaymentResponse(request) .statusCode(201) .body("payment_id", is(PAYMENT_ID)) .body("amount", is(500)) .body("payment_provider", is(PAYMENT_PROVIDER)) .body("created_date", is(CREATED_DATE)) .body("description", is(DESCRIPTION)) .body("reference", is(REFERENCE)) .body("state.status", is(status)) .body("state.finished", is(finished)) .body("_links.events.href", is(paymentEventsLocationFor(PAYMENT_ID))) .body("_links.events.method", is("GET")) .body("_links.self.href", is(paymentLocationFor(PAYMENT_ID))) .body("_links.self.method", is("GET")); }

Target:
public void createPayment_success() throws JsonProcessingException { final Account account = new Account(GATEWAY_ACCOUNT_ID, TokenPaymentType.DIRECT_DEBIT); final String status = "created"; final boolean finished = false; DirectDebitConnectorCreatePaymentResponse connectorResponse = aDirectDebitConnectorCreatePaymentResponse() .withPaymentExternalId(PAYMENT_ID) .withAmount(500L) .withPaymentProvider(PAYMENT_PROVIDER) .withCreatedDate(CREATED_DATE) .withDescription(DESCRIPTION) .withState(new PaymentState(status, finished)) .withReference(REFERENCE) .build(); connectorDDMockClient.respondWithPaymentCreated(connectorResponse, account.getAccountId()); String request = new Gson().toJson(Map.of( "amount", 500, "description", DESCRIPTION, "reference", REFERENCE, "mandate_id", MANDATE_ID)); postPaymentResponse(request) .statusCode(201) .body("payment_id", is(PAYMENT_ID)) .body("amount", is(500)) .body("payment_provider", is(PAYMENT_PROVIDER)) .body("created_date", is(CREATED_DATE)) .body("description", is(DESCRIPTION)) .body("reference", is(REFERENCE)) .body("state.status", is(status)) .body("state.finished", is(finished)) .body("_links.events.href", is(paymentEventsLocationFor(PAYMENT_ID))) .body("_links.events.method", is("GET")) .body("_links.self.href", is(paymentLocationFor(PAYMENT_ID))) .body("_links.self.method", is("GET")); }
Source:
private Map<String, byte[]> getPropagatedVariables(SchedulerDBManager dbManager, EligibleTaskDescriptor eligibleTaskDescriptor, InternalJob job, InternalTask task) throws UnknownTaskException { Map<String, byte[]> variables = new HashMap<>(); if (job.getType() == JobType.TASKSFLOW && eligibleTaskDescriptor != null) { TaskResultImpl taskResult = (TaskResultImpl) dbManager.loadLastTaskResult(task.getId()); if (taskResult != null){ variables.putAll(taskResult.getPropagatedVariables()); }else{ int numberOfParentTasks = eligibleTaskDescriptor.getParents().size(); if ((numberOfParentTasks > 0) && task.handleResultsArguments()) { variables = extractTaskResultsAndMergeIntoMap(dbManager, eligibleTaskDescriptor, job); } else { variables = extractJobVariables(job); } } } return variables; }

Target:
private Map<String, byte[]> getPropagatedVariables(SchedulerDBManager dbManager, EligibleTaskDescriptor eligibleTaskDescriptor, InternalJob job, InternalTask task) throws UnknownTaskException { Map<String, byte[]> variables = new HashMap<>(); if (job.getType() == JobType.TASKSFLOW && eligibleTaskDescriptor != null) { TaskResultImpl taskResult = null; try{ taskResult = (TaskResultImpl) dbManager.loadLastTaskResult(task.getId()); }catch(DatabaseManagerException exception){ tlogger.error(task.getId(), exception.getMessage(), exception); } if (taskResult != null){ variables.putAll(taskResult.getPropagatedVariables()); }else{ int numberOfParentTasks = eligibleTaskDescriptor.getParents().size(); if ((numberOfParentTasks > 0) && task.handleResultsArguments()) { variables = extractTaskResultsAndMergeIntoMap(dbManager, eligibleTaskDescriptor, job); } else { variables = extractJobVariables(job); } } } return variables; }
Source:
public static JavaArchive deployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "pdp-service-bean.jar"); jar.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); XACMLTestUtils.addCommonClassesToArchive(jar); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); XACMLTestUtils.addXACMLPoliciesToArchive(jar); for (int i = 1; i <= 7; i++) { jar.addAsResources(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/scenario2-testcase" + i + "-request.xml"); } jar.addAsResource(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/med-example-request.xml"); final String tempDir = System.getProperty("java.io.tmpdir"); final String testObjectsPolicies = AssetUtil.getClassLoaderResourceName(JBossPDPInteroperabilityTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES); jar.addAsResource(createPermissionsXmlAsset( new FilePermission(testObjectsPolicies + "/-", "read"), new FilePermission(tempDir + "/-", "read,write,delete"), new PropertyPermission("java.io.tmpdir", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("getClassLoader"), new RuntimePermission("accessDeclaredMembers") ),"META-INF/permissions.xml"); return jar; }

Target:
public static JavaArchive deployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "pdp-service-bean.jar"); jar.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); XACMLTestUtils.addCommonClassesToArchive(jar); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); XACMLTestUtils.addXACMLPoliciesToArchive(jar); for (int i = 1; i <= 7; i++) { jar.addAsResources(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/scenario2-testcase" + i + "-request.xml"); } jar.addAsResource(JBossPDPServletInitializationTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_REQUESTS + "/med-example-request.xml"); final String tempDir = System.getProperty("java.io.tmpdir"); final String testObjectsPolicies = AssetUtil.getClassLoaderResourceName(JBossPDPInteroperabilityTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES); jar.addAsResource(createPermissionsXmlAsset( new FilePermission(testObjectsPolicies + "/-", "read"), new FilePermission(tempDir + "/-", "read,write,delete") ),"META-INF/permissions.xml"); return jar; }
Source:
protected void fetchClusterWideStatsIfNeeded() { if (launchNewDistTask()) { List<Future<Map<String, Number>>> responseList = Collections.emptyList(); try { responseList = des.submitEverywhere(new DistributedCacheStatsCallable()); updateFieldsFromResponseMap(responseList); } catch (Exception e) { log.warn("Could not execute cluster wide cache stats operation ", e); } finally { statsUpdateTimestamp = ts.time(); } } }

Target:
protected synchronized void fetchClusterWideStatsIfNeeded() { if (launchNewDistTask()) { List<Future<Map<String, Number>>> responseList = Collections.emptyList(); try { responseList = des.submitEverywhere(new DistributedCacheStatsCallable()); updateFieldsFromResponseMap(responseList); } catch (Exception e) { log.warn("Could not execute cluster wide cache stats operation ", e); } finally { statsUpdateTimestamp = ts.time(); } } }
Source:
private void logTrace(String string) { System.out.println("SaveableCompareEditorInput " + hashCode() + ": " + string); }

Target:
private void logTrace(String string) { System.out.println("SaveableCompareEditorInput " + System.identityHashCode(this) + ": " + string); }
Source:
private File[] retrieveSortedBenchmarkReportDirectories(File benchmarkDirectory) { File[] benchmarkReportDirectories = benchmarkDirectory.listFiles((FileFilter) DirectoryFileFilter.INSTANCE); if (benchmarkReportDirectories == null) { return new File[] {}; } else { Arrays.sort(benchmarkReportDirectories); return benchmarkReportDirectories; } }

Target:
private File[] retrieveSortedBenchmarkReportDirectories(File benchmarkDirectory) { File[] benchmarkReportDirectories = benchmarkDirectory.listFiles((FileFilter) DirectoryFileFilter.INSTANCE); if (benchmarkReportDirectories == null) { throw new IllegalStateException("Unable to list subdirectories in a directory (" + benchmarkDirectory.getAbsolutePath() + ")."); } else { Arrays.sort(benchmarkReportDirectories); return benchmarkReportDirectories; } }
Source:
private Department getDepartment(HttpServletRequest request, List<Department> departments) { Department department = getDomainObject(request, "departmentID"); return department != null ? department : departments.stream().findAny().orElse(null); }

Target:
private Department getDepartment(HttpServletRequest request, List<Department> departments) { Department department = getDomainObject(request, "departmentID"); return department != null ? department : departments.isEmpty() ? null : departments.get(0); }
Source:
protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { if (partition == null) { metrics.badRequestError.inc(); return ServerErrorCode.Bad_Request; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } ServerErrorCode errorCode = storeManager.isPartitionAvailable(partition, localReplica); switch (errorCode) { case Disk_Unavailable: metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return errorCode; case Replica_Unavailable: metrics.replicaUnavailableError.inc(); return errorCode; case Partition_Unknown: metrics.partitionUnknownError.inc(); return errorCode; } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }

Target:
protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { if (partition == null) { metrics.badRequestError.inc(); return ServerErrorCode.Bad_Request; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } ServerErrorCode errorCode = storeManager.checkLocalPartitionStatus(partition, localReplica); switch (errorCode) { case Disk_Unavailable: metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return errorCode; case Replica_Unavailable: metrics.replicaUnavailableError.inc(); return errorCode; case Partition_Unknown: metrics.partitionUnknownError.inc(); return errorCode; } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { View view = super.onCreateView(inflater, viewGroup, bundle); mCallback.onMapReady(); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { View view = super.onCreateView(inflater, viewGroup, bundle); if (mOnMapReadyListener != null){ mOnMapReadyListener.onMapReady(); } return view; }
Source:
protected DocumentModelList searchUsers() { if (StringUtils.isBlank(prefix)) { return new DocumentModelListImpl(); } String trimmedPrefix = prefix.trim(); if (Framework.getService(ConfigurationService.class).isBooleanPropertyFalse(FULLNAME_SEARCH_PROPERTY)) { return userManager.searchUsers(trimmedPrefix); } String[] searchTerms = trimmedPrefix.split("\\s", 2); DocumentModelList firstTermResults = userManager.searchUsers(searchTerms[0]); if (firstTermResults.isEmpty()) { return new DocumentModelListImpl(); } if (searchTerms.length <= 1) { return firstTermResults; } DocumentModelList secondTermResults = userManager.searchUsers(searchTerms[1].trim()); DocumentModelList results = firstTermResults.stream().filter(secondTermResults::contains).collect( Collectors.toCollection(DocumentModelListImpl::new)); if (results.isEmpty()) { return userManager.searchUsers(trimmedPrefix); } else { return results; } }

Target:
protected DocumentModelList searchUsers() { if (StringUtils.isBlank(prefix)) { return new DocumentModelListImpl(); } String trimmedPrefix = prefix.trim(); if (Framework.getService(ConfigurationService.class).isBooleanPropertyFalse(FULLNAME_SEARCH_PROPERTY)) { return userManager.searchUsers(trimmedPrefix); } String[] searchTerms = trimmedPrefix.split("\\s", 2); return Stream.of(searchTerms) .map(userManager::searchUsers) .reduce((a, b) -> { a.retainAll(b); return a; }) .filter(result -> !result.isEmpty()) .orElseGet(() -> userManager.searchUsers(trimmedPrefix)); }
Source:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { if (extractionFn == null) { return factory.makeValueMatcher(dimension, value); } else { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { return value.equals(Strings.nullToEmpty(extractionFn.apply(Strings.emptyToNull(input)))); } } ); } }

Target:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { if (extractionFn == null) { return factory.makeValueMatcher(dimension, value); } else { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { return value.equals(Strings.nullToEmpty(extractionFn.apply(input))); } } ); } }
Source:
public Chronology getChronology() { return chronology; }

Target:
public AccountingChronology getChronology() { return chronology; }
Source:
public final LogEventRequestType transformRequestToAuditMsg(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, boolean isRequesting, Properties webContextProperties, String serviceName) { setRequest(request); setTarget(target); setAssertion(assertion); AuditMessageType auditMsg = createBaseAuditMessage(assertion, target, isRequesting, webContextProperties, serviceName); auditMsg = getParticipantObjectIdentificationForRequest(request, assertion, auditMsg); return buildLogEventRequestType(auditMsg, direction, getMessageCommunityId(assertion, target, isRequesting), serviceName, assertion, auditMsg.getEventIdentification().getEventID().getDisplayName(), auditMsg.getEventIdentification().getEventOutcomeIndicator(), auditMsg.getEventIdentification().getEventDateTime(), getRequestorUserId(auditMsg,assertion)); }

Target:
public final LogEventRequestType transformRequestToAuditMsg(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, boolean isRequesting, Properties webContextProperties, String serviceName) { setRequest(request); setTarget(target); setAssertion(assertion); AuditMessageType auditMsg = createBaseAuditMessage(assertion, target, isRequesting, webContextProperties, serviceName); auditMsg = getParticipantObjectIdentificationForRequest(request, assertion, auditMsg); return buildLogEventRequestType(auditMsg, direction, getMessageCommunityId(assertion, target, isRequesting), serviceName, assertion, auditMsg.getEventIdentification().getEventID().getDisplayName(), auditMsg .getEventIdentification().getEventOutcomeIndicator(), auditMsg.getEventIdentification() .getEventDateTime(), getRequestorUserId(auditMsg.getActiveParticipant(), assertion)); }
Source:
public static @Nullable KernelMemoryUsageDataProvider create(ITmfTrace trace) { TmfStateSystemAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStateSystemAnalysisModule.class, KernelMemoryAnalysisModule.ID); if (module != null) { module.schedule(); return new KernelMemoryUsageDataProvider(trace, module); } return null; }

Target:
public static @Nullable KernelMemoryUsageDataProvider create(ITmfTrace trace) { KernelMemoryAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelMemoryAnalysisModule.class, KernelMemoryAnalysisModule.ID); if (module != null) { module.schedule(); return new KernelMemoryUsageDataProvider(trace, module); } return null; }
Source:
public void shouldSearchAndReturnAListOfLogEntriesGeneratedByUser() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("generatedBy", "1010d442-e134-11de-babe-001e378eb67e"); SimpleObject result = deserialize(handle(req)); Assert.assertEquals(5, Util.getResultsSize(result)); }

Target:
public void shouldSearchAndReturnAListOfLogEntriesGeneratedByUser() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("generatedBy", USER_UUID); SimpleObject result = deserialize(handle(req)); Assert.assertEquals(2, Util.getResultsSize(result)); }
Source:
public void handleVolumeCommand(Command command, ChannelUID channelUID) throws IOException { if (command instanceof RefreshType) { updateState(channelUID, new DecimalType(connection.getVolume() / 100.0)); } if (command instanceof DecimalType) { connection.setVolume(((DecimalType) command).intValue()); } }

Target:
public void handleVolumeCommand(Command command, ChannelUID channelUID) throws IOException { handleVolumeCommand(command, channelUID, 0); }
Source:
public TexBibEntriesResolverResult resolve(TexParserResult texParserResult) { TexBibEntriesResolverResult resolverResult = new TexBibEntriesResolverResult(texParserResult); Map<Path, BibDatabase> bibDatabases = resolverResult.getBibFiles().values().stream().distinct().collect(Collectors.toMap( Function.identity(), path -> OpenDatabase.loadDatabase(path.toString(), importFormatPreferences, fileMonitor).getDatabase())); texParserResult.getCitations().entries().forEach(mapEntry -> texParserResult.getBibFiles().get(mapEntry.getValue().getPath()).forEach(bibFile -> bibDatabases.get(bibFile).getEntriesByKey(mapEntry.getKey()).forEach(entry -> { Optional<BibEntry> databaseEntry = masterDatabase.getEntryByKey(entry.getCiteKeyOptional().orElse("")); if (!databaseEntry.isPresent() || !databaseEntry.get().equals(entry)) { bibDatabases.get(bibFile).getReferencedEntry(entry).ifPresent(refEntry -> refEntry.getFields().forEach(field -> entry.getFieldMap().putIfAbsent(field, refEntry.getFieldOrAlias(field).orElse("")))); resolverResult.addEntry(entry); } }))); return resolverResult; }

Target:
public TexBibEntriesResolverResult resolve(TexParserResult texParserResult) { TexBibEntriesResolverResult resolverResult = new TexBibEntriesResolverResult(texParserResult); Map<Path, BibDatabase> bibDatabases = resolverResult.getBibFiles().values().stream().distinct().collect(Collectors.toMap( Function.identity(), path -> OpenDatabase.loadDatabase(path.toString(), importFormatPreferences, fileMonitor).getDatabase())); Stream<Map.Entry<String, Citation>> citationsStream = texParserResult.getCitations().entries().stream().distinct(); Set<BibEntry> newEntries = citationsStream.flatMap(mapEntry -> apply(mapEntry, texParserResult, bibDatabases)).collect(Collectors.toSet()); resolverResult.getNewEntries().addAll(newEntries); return resolverResult; }
Source:
public String toString() { return "ControllerBasedStartupStrategy - deploays kie containers given by controller ignoring locally defined"; }

Target:
public String toString() { return "ControllerBasedStartupStrategy - deploys kie containers given by controller ignoring locally defined"; }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { self = this; NotificationManagerCompat.from(this).cancelAll(); final String machine = (String) intent.getExtras().get("machine"); int timeLeft = (int) intent.getExtras().get("time"); notifcationIds.put(machine, id); CountDownTimer timer = new CountDownTimer(timeLeft, 1000) { public void onTick(long millisUntilFinished) { updateTimeNotification(machine, NotificationCreator.this, millisUntilFinished); } public void onFinish() { updateTimeNotification(machine, NotificationCreator.this, 0); stopTimer(id, machine); } }.start(); timers.put(id, timer); id++; return START_REDELIVER_INTENT; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { self = new WeakReference<>(this); NotificationManagerCompat.from(this).cancelAll(); final String machine = (String) intent.getExtras().get("machine"); int timeLeft = (int) intent.getExtras().get("time"); notifcationIds.put(machine, id); CountDownTimer timer = new CountDownTimer(timeLeft, 1000) { public void onTick(long millisUntilFinished) { updateTimeNotification(machine, NotificationCreator.this, millisUntilFinished); } public void onFinish() { updateTimeNotification(machine, NotificationCreator.this, 0); stopTimer(id, machine); } }.start(); timers.put(id, timer); id++; return START_REDELIVER_INTENT; }
Source:
public static int ascii(String s) { return s.length() == 0 ? 0 : s.substring(0, 1).getBytes(StandardCharsets.UTF_8)[0]; }

Target:
public static int ascii(String s) { return s.isEmpty() ? 0 : s.codePointAt(0); }
Source:
default Collection<Container> addContainers(String accountName, Collection<Container> containers) { throw new UnsupportedOperationException("This method is not supported"); }

Target:
default Collection<Container> addContainers(String accountName, Collection<Container> containers) throws AccountServiceException { throw new UnsupportedOperationException("This method is not supported"); }
Source:
public boolean isSupported(AbstractFile file) { if (file == null) { return false; } if (file.getSize() == 0) { return false; } if (file.getNameExtension().toLowerCase().startsWith(LOG_FILE_EXTENSION)) { return false; } byte[] header = new byte[0x4000]; try { file.read(header, 0x0, Math.min(0x4000, file.getSize())); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to read file content", ex); } ByteBuffer buf = ByteBuffer.wrap(header); RegistryHive hive = new RegistryHiveBuffer(buf); try { hive.getHeader(); return true; } catch (RegistryParseException ex) { logger.log(Level.WARNING, "Failed to get hive header", ex); return false; } }

Target:
public boolean isSupported(AbstractFile file) { if (file == null) { return false; } if (file.getSize() == 0) { return false; } if (file.getNameExtension().toLowerCase().startsWith(LOG_FILE_EXTENSION)) { return false; } byte[] header = new byte[0x4000]; try { file.read(header, 0x0, Math.min(0x4000, file.getSize())); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to read file content", ex); return false; } ByteBuffer buf = ByteBuffer.wrap(header); RegistryHive hive = new RegistryHiveBuffer(buf); try { hive.getHeader(); return true; } catch (RegistryParseException ex) { logger.log(Level.WARNING, "Failed to get hive header", ex); return false; } }
Source:
private BigInteger byteArrayToBigInteger(final byte[] bitStringValue) { BigInteger value = null; for (final byte element : bitStringValue) { if (value != null) { value = value.shiftLeft(8); } else if (value == null) { value = BigInteger.valueOf(0); } value = value.add(BigInteger.valueOf(element & 0xFF)); } return value; }

Target:
private BigInteger byteArrayToBigInteger(final byte[] bitStringValue) { if (bitStringValue == null || bitStringValue.length == 0) { return null; } BigInteger value = BigInteger.valueOf(0); for (final byte element : bitStringValue) { value = value.shiftLeft(8); value = value.add(BigInteger.valueOf(element & 0xFF)); } return value; }
Source:
public void executionSkipped(TestIdentifier testIdentifier, String reason) { String source = getClassName(testIdentifier).orElse(parentDisplayName(testIdentifier)); runListener.testSkipped(ignored(source, testIdentifier.getDisplayName(), reason)); }

Target:
public void executionSkipped(TestIdentifier testIdentifier, String reason) { String source = getClassName(testIdentifier).orElseGet(() -> parentDisplayName(testIdentifier)); runListener.testSkipped(ignored(source, testIdentifier.getDisplayName(), reason)); }
Source:
public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( AppConfig.class); PersonRepository repository = context.getBean(PersonRepository.class); Person peter = new Person("Peter", "Sagan", 17); Person nasta = new Person("Nasta", "Kuzminova", 25); Person john = new Person("John", "lawrence", 35); Person terry = new Person("Terry", "Law", 36); repository.save(peter); repository.save(nasta); repository.save(john); repository.save(terry); LOGGER.info("Count Person records: {}", repository.count()); List<Person> persons = (List<Person>) repository.findAll(); for (Person person : persons) { LOGGER.info(person.toString()); } nasta.setName("Barbora"); nasta.setSurname("Spotakova"); repository.save(nasta); LOGGER.info("Find by id 2: {}", repository.findById(2L)); repository.deleteById(2L); LOGGER.info("Count Person records: {}", repository.count()); Optional<Person> p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); LOGGER.info("Find by John is {}", p.get()); persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40)); LOGGER.info("Find Person with age between 20,40: "); for (Person person : persons) { LOGGER.info(person.toString()); } context.close(); }

Target:
public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( AppConfig.class); PersonRepository repository = context.getBean(PersonRepository.class); Person peter = new Person("Peter", "Sagan", 17); Person nasta = new Person("Nasta", "Kuzminova", 25); Person john = new Person("John", "lawrence", 35); Person terry = new Person("Terry", "Law", 36); repository.save(peter); repository.save(nasta); repository.save(john); repository.save(terry); LOGGER.info("Count Person records: {}", repository.count()); List<Person> persons = (List<Person>) repository.findAll(); for (Person person : persons) { LOGGER.info(person.toString()); } nasta.setName("Barbora"); nasta.setSurname("Spotakova"); repository.save(nasta); LOGGER.info("Find by id 2: {}", repository.findById(2L).get()); repository.deleteById(2L); LOGGER.info("Count Person records: {}", repository.count()); Optional<Person> p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); LOGGER.info("Find by John is {}", p.get()); persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40)); LOGGER.info("Find Person with age between 20,40: "); for (Person person : persons) { LOGGER.info(person.toString()); } context.close(); }
Source:
public String generateLoadBalancerEndpoint(Stack stack, LoadBalancerType type) { List<String> s = Arrays.asList(stack.getName(), ENDPOINT_SUFFIX); if (LoadBalancerType.PUBLIC.equals(type)) { s.add(PUBLIC_SUFFIX); } return String.join("-", s); }

Target:
public String generateLoadBalancerEndpoint(Stack stack, LoadBalancerType type) { StringBuilder name = new StringBuilder() .append(stack.getName()) .append('-') .append(ENDPOINT_SUFFIX); if (LoadBalancerType.PUBLIC.equals(type)) { name.append('-').append(PUBLIC_SUFFIX); } return name.toString(); }
Source:
private boolean requirejsManagerInitIsCalled( String response, String useFullyQualifiedUrlParameter ) { final boolean containsScript = response.contains( "requirejs-manager/js/require-init.js?requirejs=false" ); final boolean containsFullyQualifiedUrlParameter = response.contains( "&useFullyQualifiedUrl=" + ( useFullyQualifiedUrlParameter != null ? useFullyQualifiedUrlParameter : "" ) ); return containsScript && containsFullyQualifiedUrlParameter == ( useFullyQualifiedUrlParameter != null ); }

Target:
private boolean requirejsManagerInitIsCalled( String response, String useFullyQualifiedUrlParameter ) { final boolean containsScript = response.contains( "requirejs-manager/js/require-init.js?requirejs=false" ); final String parameterValue = useFullyQualifiedUrlParameter != null ? useFullyQualifiedUrlParameter : ""; final boolean containsFullyQualifiedUrlParameter = response.contains( "&" + PentahoWebContextFilter.USE_FULL_URL_PARAM + "=" + parameterValue ); return containsScript && containsFullyQualifiedUrlParameter == ( useFullyQualifiedUrlParameter != null ); }
Source:
public static Duration adjustServerTimeout(Duration clientTimeout) { return clientTimeout.minusMillis(200); }

Target:
static Duration adjustServerTimeout(Duration clientTimeout) { return clientTimeout.minusMillis(200); }
Source:
public boolean transientHasPriority() { return transientHasPriority; }

Target:
public boolean transientHasPriority() { return this.transientHasPriority; }
Source:
public void testFiresOnNestedCountAggregate() { tester.assertThat(new PruneCountAggregationOverScalar()) .on(p -> p.aggregation((a) -> a.addAggregation( p.symbol("count_1", BigintType.BIGINT), new AggregationNode.Aggregation( new FunctionCall(QualifiedName.of("count"), ImmutableList.of()), new Signature("count", AGGREGATE, parseTypeSignature(StandardTypes.BIGINT)), Optional.empty())) .source(p.aggregation((aggregationBuilder) -> aggregationBuilder .source(p.tableScan(ImmutableList.of(), ImmutableMap.of())) .groupingSets(ImmutableList.of(ImmutableList.of())))) .step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of())) .step(AggregationNode.Step.SINGLE) )).matches(PlanMatchPattern.values(ImmutableMap.of("count_1", 0))); }

Target:
public void testFiresOnNestedCountAggregate() { tester.assertThat(new PruneCountAggregationOverScalar()) .on(p -> p.aggregation((a) -> a .addAggregation( p.symbol("count_1", BigintType.BIGINT), new FunctionCall(QualifiedName.of("count"), ImmutableList.of()), ImmutableList.of(BigintType.BIGINT)) .globalGrouping() .step(AggregationNode.Step.SINGLE) .source( p.aggregation((aggregationBuilder) -> aggregationBuilder .source(p.tableScan(ImmutableList.of(), ImmutableMap.of())) .globalGrouping() .step(AggregationNode.Step.SINGLE))))) .matches(values(ImmutableMap.of("count_1", 0))); }
Source:
public boolean provides(IAdaptable adaptable) { if (adaptable != null) { View view = (View) adaptable.getAdapter(View.class); if (view != null) { Diagram diagram = view.getDiagram(); return diagram != null && diagram.getElement() instanceof DDiagram; } } return false; }

Target:
public boolean provides(IAdaptable adaptable) { if (adaptable != null) { View view = (View) adaptable.getAdapter(View.class); if (view != null) { Diagram diagram = view.getDiagram(); return diagram != null && DiagramPackage.Literals.DDIAGRAM.isInstance(diagram.getElement()); } } return false; }
Source:
void cacheConfig(boolean doCache) { Map<File, CachedConfig> cache = CACHED_CONFIG.get(); CachedConfig cfg = cache.get(getDirectory()); if (cfg == null) { if (!doCache) { return; } cfg = new CachedConfig(); cache.put(getDirectory(), cfg); } if (!doCache && cfg.level > 0) { if (--cfg.level == 0) { cache.remove(getDirectory()); } } else if (doCache) { cfg.level++; } }

Target:
void cacheConfig(boolean doCache) { Map<File, CachedConfig> cache = CACHED_CONFIG.get(); CachedConfig cfg = cache.get(getDirectory()); if (cfg == null) { if (!doCache) { return; } cfg = new CachedConfig(); cache.put(getDirectory(), cfg); } if (!doCache) { if (cfg.level > 0) { if (--cfg.level == 0) { cache.remove(getDirectory()); } } else { Activator.logWarning(MessageFormat.format( CoreText.CachingRepository_cacheLevelZero, getDirectory()), null); } } else if (doCache) { cfg.level++; } }
Source:
void shouldReturnDelegateWhenFullyQualifiedNamePresent() { final Optional<IDelegate> result = xmlGameElementMapper.newDelegate("games.strategy.triplea.delegate.battle.BattleDelegate"); assertThat(result, isPresent()); assertThat(result.get(), is(instanceOf(BattleDelegate.class))); }

Target:
void shouldReturnDelegateWhenFullyQualifiedNamePresent() { final Optional<IDelegate> result = xmlGameElementMapper.newDelegate("games.strategy.triplea.delegate.BattleDelegate"); assertThat(result, isPresent()); assertThat(result.get(), is(instanceOf(BattleDelegate.class))); }
Source:
public void testNot() { assertOptimizedEquals("not true", "false"); assertOptimizedEquals("not false", "true"); assertOptimizedEquals("not null", "null"); assertOptimizedEquals("not 1=1", "false"); assertOptimizedEquals("not 1=BIGINT '1'", "false"); assertOptimizedEquals("not 1!=1", "true"); assertOptimizedEquals("not unbound_long=1", "not unbound_long=1"); assertOptimizedEquals("not unbound_long=(1+1)", "not unbound_long=2"); assertOptimizedEquals("cast(json_parse(unbound_string) as map(varchar, varchar))", "cast(json_parse(unbound_string) as map(varchar, varchar))"); assertOptimizedEquals("cast(json_parse(unbound_string) as array(varchar))", "cast(json_parse(unbound_string) as array(varchar))"); assertOptimizedEquals("cast(json_parse(unbound_string) as row(bigint, varchar))", "cast(json_parse(unbound_string) as row(bigint, varchar))"); }

Target:
public void testNot() { assertOptimizedEquals("not true", "false"); assertOptimizedEquals("not false", "true"); assertOptimizedEquals("not null", "null"); assertOptimizedEquals("not 1=1", "false"); assertOptimizedEquals("not 1=BIGINT '1'", "false"); assertOptimizedEquals("not 1!=1", "true"); assertOptimizedEquals("not unbound_long=1", "not unbound_long=1"); assertOptimizedEquals("not unbound_long=(1+1)", "not unbound_long=2"); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof TupleValue)) return false; DefaultTupleValue that = (DefaultTupleValue) o; if (this.protocolVersion() != that.protocolVersion()) return false; for (int i = 0; i < values.length; i++) { DataType innerThisType = type.getComponentTypes().get(i); DataType innerThatType = type.getComponentTypes().get(i); if (!innerThisType.equals(innerThatType)) { return false; } Object thisValue = this.codecRegistry() .codecFor(innerThatType) .decode(this.values[i], this.protocolVersion()); Object thatValue = that.codecRegistry() .codecFor(innerThatType) .decode(that.values[i], that.protocolVersion()); if (!((thisValue == thatValue) || (thisValue != null && thisValue.equals(thatValue)))) { return false; } } return true; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TupleValue)) { return false; } TupleValue that = (TupleValue) o; if (!this.protocolVersion().equals(that.protocolVersion())) { return false; } for (int i = 0; i < values.length; i++) { DataType innerThisType = type.getComponentTypes().get(i); DataType innerThatType = that.getType().getComponentTypes().get(i); if (!innerThisType.equals(innerThatType)) { return false; } Object thisValue = this.codecRegistry() .codecFor(innerThisType) .decode(this.getBytesUnsafe(i), this.protocolVersion()); Object thatValue = that.codecRegistry() .codecFor(innerThatType) .decode(that.getBytesUnsafe(i), that.protocolVersion()); if (!Objects.equals(thisValue, thatValue)) { return false; } } return true; }
Source:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { ViewGroup answerView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.base_geo_widget_layout, null); answerDisplay = answerView.findViewById(R.id.geo_answer_text); answerDisplay.setTextColor(new ThemeUtils(context).getColorOnSurface()); answerDisplay.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); startGeoButton = answerView.findViewById(R.id.simple_button); readOnly = getFormEntryPrompt().isReadOnly(); if (readOnly) { startGeoButton.setVisibility(GONE); } else { startGeoButton.setText(getDefaultButtonLabel()); startGeoButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); startGeoButton.setOnClickListener(v -> onButtonClick()); } return answerView; }

Target:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = GeoWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); View answerView = binding.getRoot(); binding.geoAnswerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); readOnly = prompt.isReadOnly(); if (readOnly) { binding.simpleButton.setVisibility(GONE); } else { binding.simpleButton.setText(getDefaultButtonLabel()); binding.simpleButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.simpleButton.setOnClickListener(v -> onButtonClick()); } return answerView; }
Source:
public void setFocus(final IDMContext[] focus, RequestMonitor rm) { assert focus != null; IDMContext elem = focus[0]; IFrameDMContext frameCtx = null; IMIExecutionDMContext threadCtx = null; if (elem instanceof IFrameDMContext) { frameCtx = (IFrameDMContext)elem; threadCtx = getThreadFromFrame(frameCtx); } else if (elem instanceof IMIExecutionDMContext) { threadCtx = (IMIExecutionDMContext)elem; frameCtx = createFrameContext((IExecutionDMContext)elem, STACKFRAME_ID_DEFAULT); } else { assert false; return; } final IFrameDMContext finalFrameCtx = frameCtx; final IMIExecutionDMContext finalThreadCtx = threadCtx; setThreadFocus(threadCtx, new ImmediateRequestMonitor(rm) { @Override protected void handleCompleted() { setFrameFocus(finalFrameCtx, new ImmediateRequestMonitor(rm) { @Override public void handleCompleted() { fCurrentStackFrameCtx = finalFrameCtx; fCurrentThreadCtx = finalThreadCtx; rm.done(); } }); } } ); }

Target:
public void setFocus(final IDMContext[] focus, RequestMonitor rm) { assert focus != null; IDMContext elem = focus[0]; if (elem instanceof IFrameDMContext) { final IFrameDMContext finalFrameCtx = (IFrameDMContext)elem; setFrameFocus(finalFrameCtx, new ImmediateRequestMonitor(rm) { @Override public void handleCompleted() { fCurrentGDBFocus = finalFrameCtx; rm.done(); } }); } else if (elem instanceof IMIExecutionDMContext) { final IMIExecutionDMContext finalThreadCtx = (IMIExecutionDMContext)elem; setThreadFocus(finalThreadCtx, new ImmediateRequestMonitor(rm) { @Override protected void handleCompleted() { fCurrentGDBFocus = finalThreadCtx; rm.done(); } }); } else { assert false; rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context to set focus to", null)); return; } }