auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testJtaTransactionContextSwitch() throws Exception { for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { TransactionConfiguration configuration = grid(0).context().config().getTransactionConfiguration(); configuration.setDefaultTxConcurrency(concurrency); configuration.setDefaultTxIsolation(isolation); <START> jtaTransactionContextSwitch(TransactionConcurrency.OPTIMISTIC.equals(concurrency) <END> && (TransactionIsolation.REPEATABLE_READ.equals(isolation))); } } }</code><technical_language>rename "configuration" "cfg"</technical_language>

Target:
public void testJtaTransactionContextSwitch() throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { TransactionConfiguration cfg = grid(0).context().config().getTransactionConfiguration(); cfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC); cfg.setDefaultTxIsolation(isolation); jtaTransactionContextSwitch((TransactionIsolation.REPEATABLE_READ.equals(isolation))); } }
Source:
<code>public void parse(Map<String, Object> parameters) { Integer spotPercentage = getInt(parameters, AwsInstanceTemplate.EC2_SPOT_PERCENTAGE); doIfNotNull(spotPercentage, sp -> { spot = new AwsInstanceTemplateV4SpotParameters(); spot.setPercentage(sp); }); Double spotMaxPrice = getDouble(parameters, AwsInstanceTemplate.EC2_SPOT_MAX_PRICE); doIfNotNull(spotMaxPrice, maxPrice -> { if (Objects.isNull(spot)) { spot = new AwsInstanceTemplateV4SpotParameters(); } spot.setMaxPrice(maxPrice); }); encryption = new AwsEncryptionV4Parameters(); encryption.setKey(getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)); String type = getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE); if (type != null) { encryption.setType(EncryptionType.valueOf(type)); } String placementGroupStrategy = getParameterOrNull(parameters, AwsInstanceTemplate.PLACEMENT_GROUP_STRATEGY); if (placementGroupStrategy != null) { placementGroup = new AwsPlacementGroupV4Parameters(); placementGroup.setStrategy(AwsPlacementGroupStrategy.valueOf(placementGroupStrategy)); <START> } <END> }</code><technical_language>else branch great maps</technical_language>

Target:
public void parse(Map<String, Object> parameters) { Integer spotPercentage = getInt(parameters, AwsInstanceTemplate.EC2_SPOT_PERCENTAGE); doIfNotNull(spotPercentage, sp -> { spot = new AwsInstanceTemplateV4SpotParameters(); spot.setPercentage(sp); }); Double spotMaxPrice = getDouble(parameters, AwsInstanceTemplate.EC2_SPOT_MAX_PRICE); doIfNotNull(spotMaxPrice, maxPrice -> { if (Objects.isNull(spot)) { spot = new AwsInstanceTemplateV4SpotParameters(); } spot.setMaxPrice(maxPrice); }); encryption = new AwsEncryptionV4Parameters(); encryption.setKey(getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)); String type = getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE); if (type != null) { encryption.setType(EncryptionType.valueOf(type)); } String placementGroupStrategy = getParameterOrNull(parameters, AwsInstanceTemplate.PLACEMENT_GROUP_STRATEGY); placementGroup = new AwsPlacementGroupV4Parameters(); if (placementGroupStrategy != null) { placementGroup.setStrategy(AwsPlacementGroupStrategy.valueOf(placementGroupStrategy)); } else { placementGroup.setStrategy(AwsPlacementGroupStrategy.NONE); } }
Source:
<code>public void work() throws Exception { if (sslInfrastructureService.isRegistered()) { if (webSocketSessionHandler.isNotRunning()) { webSocketSessionHandler.clearCallBacks(); <START> synchronized (this) { <END> webSocketSessionHandler.setSession(webSocketClientHandler.connect(this)); } } updateServerAgentRuntimeInfo(); } }</code><technical_language>is sync required? If this is done synchronize session, calls webSocketSessionHandler in synchronized block, double checking webSocketSessionHandler.isNotRunning() well</technical_language>

Target:
public void work() throws Exception { if (sslInfrastructureService.isRegistered()) { if (webSocketSessionHandler.isNotRunning()) { webSocketSessionHandler.clearCallBacks(); webSocketSessionHandler.setSession(webSocketClientHandler.connect(this)); } updateServerAgentRuntimeInfo(); } }
Source:
<code>private Set<String> getEnabledCredentialTypes(List<CredentialProvider> credentialProviders) { Set<String> enabledCredentialTypes = new HashSet<>(); <START> for (AuthenticationFlowModel flow : realm.getAuthenticationFlows()) { <END> for (AuthenticationExecutionModel execution : realm.getAuthenticationExecutions(flow.getId())) { if (execution.getAuthenticator() != null) { AuthenticatorFactory authenticatorFactory = (AuthenticatorFactory) session.getKeycloakSessionFactory().getProviderFactory(Authenticator.class, execution.getAuthenticator()); if (authenticatorFactory != null && authenticatorFactory.getReferenceCategory() != null) { enabledCredentialTypes.add(authenticatorFactory.getReferenceCategory()); } } } } Set<String> credentialTypes = credentialProviders.stream() .map(CredentialProvider::getType) .collect(Collectors.toSet()); enabledCredentialTypes.retainAll(credentialTypes); return enabledCredentialTypes; }</code><technical_language>A credential is marked enabled authenticator is in flow. Steps reproduce: 1. Create a flow WebAuthn authenticator. 1. bind this flow anywhere, i.e. leave Browser Flow bound default flow. **Expected:** WebAuthn credential type is returned. **Actual:** is returned used</technical_language>

Target:
private Set<String> getEnabledCredentialTypes(List<CredentialProvider> credentialProviders) { Set<String> enabledCredentialTypes = new HashSet<>(); for (AuthenticationFlowModel flow : realm.getAuthenticationFlows()) { if (isFlowEffectivelyDisabled(flow)) continue; for (AuthenticationExecutionModel execution : realm.getAuthenticationExecutions(flow.getId())) { if (execution.getAuthenticator() != null && DISABLED != execution.getRequirement()) { AuthenticatorFactory authenticatorFactory = (AuthenticatorFactory) session.getKeycloakSessionFactory().getProviderFactory(Authenticator.class, execution.getAuthenticator()); if (authenticatorFactory != null && authenticatorFactory.getReferenceCategory() != null) { enabledCredentialTypes.add(authenticatorFactory.getReferenceCategory()); } } } } Set<String> credentialTypes = credentialProviders.stream() .map(CredentialProvider::getType) .collect(Collectors.toSet()); enabledCredentialTypes.retainAll(credentialTypes); return enabledCredentialTypes; }
Source:
<code>protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { DropboxConfiguration configuration = new DropboxConfiguration(); configuration.setAccessToken((String)parameters.get("accessToken")); configuration.setLocalPath((String)parameters.get("localPath")); <START> configuration.setRemotePath(((String)parameters.get("remotePath")).replaceAll("\\s","+")); <END> configuration.setNewRemotePath((String)parameters.get("newRemotePath")); configuration.setQuery((String)parameters.get("query")); configuration.setOperation(DropboxOperation.valueOf(remaining)); configuration.setClientIdentifier( parameters.get("clientIdentifier") == null ? DropboxPropertyManager.getInstance().getProperty("clientIdentifier") : (String) parameters.get("clientIdentifier")); if (parameters.get("uploadMode") != null) { configuration.setUploadMode(DropboxUploadMode.valueOf((String)parameters.get("uploadMode"))); } DropboxConfigurationValidator.validate(configuration); setProperties(configuration, parameters); Endpoint endpoint = new DropboxEndpoint(uri, this, configuration); return endpoint; }</code><technical_language>check for null, if removePath is null</technical_language>

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { DropboxConfiguration configuration = new DropboxConfiguration(); configuration.setAccessToken((String)parameters.get("accessToken")); configuration.setLocalPath((String)parameters.get("localPath")); configuration.setRemotePath( parameters.get("remotePath") != null ? ((String) parameters.get("remotePath")).replaceAll("\\s", "+") : null); configuration.setNewRemotePath((String)parameters.get("newRemotePath")); configuration.setQuery((String)parameters.get("query")); configuration.setOperation(DropboxOperation.valueOf(remaining)); configuration.setClientIdentifier( parameters.get("clientIdentifier") == null ? DropboxPropertyManager.getInstance().getProperty("clientIdentifier") : (String) parameters.get("clientIdentifier")); if (parameters.get("uploadMode") != null) { configuration.setUploadMode(DropboxUploadMode.valueOf((String)parameters.get("uploadMode"))); } DropboxConfigurationValidator.validate(configuration); setProperties(configuration, parameters); Endpoint endpoint = new DropboxEndpoint(uri, this, configuration); return endpoint; }
Source:
<code>private static IFile getFileForLocationURI(IWorkspaceRoot root, URI uri) { IFile[] files = root.findFilesForLocationURI(uri); int shortestPathSegmentCount = Integer.MAX_VALUE; IFile shortestPath = null; for (IFile file : files) { IPath fullPath = file.getFullPath(); if (!file.exists()) continue; if (fullPath.segmentCount() < shortestPathSegmentCount) { shortestPath = file; shortestPathSegmentCount = fullPath.segmentCount(); } } <START> return shortestPath; <END> }</code><technical_language>code extracted generic method? Logic good</technical_language>

Target:
private static IFile getFileForLocationURI(IWorkspaceRoot root, URI uri) { IFile[] files = root.findFilesForLocationURI(uri); return getExistingResourceWithShortestPath(files); }
Source:
<code>protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .csrf() <START> .disable() <END> .authorizeRequests() .anyRequest().permitAll(); }</code><technical_language>is csrf disabled in general</technical_language>

Target:
protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .csrf() .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) .ignoringRequestMatchers( new AntPathRequestMatcher( this.adminServerProperties.path("/instances"), HttpMethod.POST.toString()), new AntPathRequestMatcher( this.adminServerProperties.path("/instances/*"), HttpMethod.DELETE.toString()), new AntPathRequestMatcher( this.adminServerProperties.path("/actuator/**"))) .and() .authorizeRequests() .antMatchers(adminServerProperties.path("/assets/**")).permitAll() .antMatchers(adminServerProperties.path("/sw.js")).permitAll() .antMatchers(adminServerProperties.path("/instances")) .hasAnyAuthority("ROLE_client", "SCOPE_openid") .anyRequest().hasAuthority("SCOPE_openid") .and() .oauth2Login() .successHandler(authenticationSuccessHandler) .loginPage(adminServerProperties.path("/oauth2/authorization/" + getClientId())) .and() .logout() .logoutSuccessUrl(getLogoutSuccessUrl()) .and() .oauth2Client() .and() .httpBasic(); }
Source:
<code>public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); <START> long primarySsrc = getPrimarySsrc(ssrc); <END> if (primarySsrc == -1) { return pkts; } AbstractFECReceiver fpt; synchronized (fecReceivers) { fpt = fecReceivers.get(primarySsrc); if (fpt == null) { if (fecType == FecType.ULPFEC) { fpt = new ULPFECReceiver(primarySsrc, incomingPT); } else if (fecType == FecType.FLEXFEC_03) { fpt = new FlexFec03Receiver(primarySsrc, incomingPT); } else { logger.error("Unknown fec type set: " + fecType); return pkts; } fecReceivers.put(primarySsrc, fpt); } } return fpt.reverseTransform(pkts); }</code><technical_language>If ssrc is null, hit NPE unbox it</technical_language>

Target:
public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); long primarySsrc = getPrimarySsrc(ssrc); if (primarySsrc == -1) { return pkts; } AbstractFECReceiver fecReceiver; synchronized (fecReceivers) { fecReceiver = fecReceivers.get(primarySsrc); if (fecReceiver == null) { if (fecType == FecType.ULPFEC) { fecReceiver = new ULPFECReceiver(primarySsrc, incomingPT); } else if (fecType == FecType.FLEXFEC_03) { fecReceiver = new FlexFec03Receiver(primarySsrc, incomingPT); } else { logger.error("Unknown fec type set: " + fecType); return pkts; } fecReceivers.put(primarySsrc, fecReceiver); } } return fecReceiver.reverseTransform(pkts); }
Source:
<code>public static Shell getActiveShell() { Shell activeShell = Display.getDefault().getActiveShell(); <START> return (activeShell != null) ? activeShell : new Shell(); <END> }</code><technical_language>Alternately PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();</technical_language>

Target:
public static Shell getActiveShell() { return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); }
Source:
<code>private static long batchSize( long pagesToClean, int threads ) { <START> try { <END> int result = Math.multiplyExact(100 * threads); return min(MAX_BATCH_SIZE, max(MIN_BATCH_SIZE, pagesToClean / result)); } catch (ArithmeticException e) { return MIN_BATCH_SIZE; } }</code><technical_language>I a fix do (100L * threads) avoiding integer multiplication altogether</technical_language>

Target:
private static long batchSize( long pagesToClean, int threads ) { return min(MAX_BATCH_SIZE, max(MIN_BATCH_SIZE, pagesToClean / (100L * threads))); }
Source:
<code>public Object start(IApplicationContext context) throws Exception { File[] filesToFormat = processCommandLine((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); if (filesToFormat == null) { return IApplication.EXIT_OK; } if (!this.quiet) { if (this.configName != null) { System.out.println(Messages.bind(Messages.CommandLineConfigFile, this.configName)); } System.out.println(Messages.bind(Messages.CommandLineStart)); } @SuppressWarnings("unchecked") final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(this.options); for (int i = 0, max = filesToFormat.length; i < max; i++) { final File file = filesToFormat[i]; if (file.isDirectory()) { formatDirTree(file, codeFormatter); <START> } else if (hasSuitableFileExtension(file)) { <END> formatFile(file, codeFormatter); } } if (!this.quiet) { System.out.println(Messages.bind(Messages.CommandLineDone)); } return IApplication.EXIT_OK; }</code><technical_language>If provided file in command line, do need check extension</technical_language>

Target:
public Object start(IApplicationContext context) throws Exception { File[] filesToFormat = processCommandLine((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); if (filesToFormat == null) { return IApplication.EXIT_OK; } if (!this.quiet) { if (this.configName != null) { System.out.println(Messages.bind(Messages.CommandLineConfigFile, this.configName)); } System.out.println(Messages.CommandLineStart); } @SuppressWarnings("unchecked") final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(this.options); for (int i = 0, max = filesToFormat.length; i < max; i++) { final File file = filesToFormat[i]; if (file.isDirectory()) { formatDirTree(file, codeFormatter); } else { formatFile(file, codeFormatter); } } if (!this.quiet) { System.out.println(Messages.CommandLineDone); } return IApplication.EXIT_OK; }
Source:
<code>public QualityProfileDto getProfile(DbSession dbSession, QProfileReference ref) { QualityProfileDto profile; if (ref.hasKey()) { profile = dbClient.qualityProfileDao().selectByKey(dbSession, ref.getKey()); checkFound(profile, "Quality Profile with key '"+ref.getKey()+"' does not exist"); } else { OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null)); profile = dbClient.qualityProfileDao().selectByNameAndLanguage(org, ref.getName(), ref.getLanguage(), dbSession); <START> checkFound(profile, "Quality Profile for language '"+ref.getLanguage()+"' and name '"+ref.getName()+"' does not exist"+ref.getOrganizationKey().map(o ->" in organization '"+o+"'").orElse("")); <END> } return profile; }</code><technical_language>checkFound accepts patterns '%s' (String.format style), String concatenation (it a cost if check fail)</technical_language>

Target:
public QualityProfileDto getProfile(DbSession dbSession, QProfileReference ref) { QualityProfileDto profile; if (ref.hasKey()) { profile = dbClient.qualityProfileDao().selectByKey(dbSession, ref.getKey()); checkFound(profile, "Quality Profile with key '%s' does not exist", ref.getKey()); } else { OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null)); profile = dbClient.qualityProfileDao().selectByNameAndLanguage(org, ref.getName(), ref.getLanguage(), dbSession); checkFound(profile, "Quality Profile for language '%s' and name '%s' does not exist%s", ref.getLanguage(), ref.getName(), ref.getOrganizationKey().map(o -> " in organization '"+o+"'").orElse("")); } return profile; }
Source:
<code>public KeycloakTokenResponse getIdentityProviderToken(String oauthProvider) throws ForbiddenException, BadRequestException, IOException, ConflictException, NotFoundException, ServerException, UnauthorizedException { String url = UriBuilder.fromUri(keycloakSettings.get().get(AUTH_SERVER_URL_SETTING)) .path("/realms/{realm}/broker/{provider}/token") .build(keycloakSettings.get().get(REALM_SETTING), oauthProvider) .toString(); try { String response = doRequest(url, HttpMethod.GET, null); return DtoFactory.getInstance() .createDtoFromJson(toJson(response), KeycloakTokenResponse.class); } catch (BadRequestException e) { if (assotiateUserPattern.matcher(e.getMessage()).matches()) { throw new UnauthorizedException(e.getMessage()); <START> } else { <END> throw e; } } }</code><technical_language>remove else</technical_language>

Target:
public KeycloakTokenResponse getIdentityProviderToken(String oauthProvider) throws ForbiddenException, BadRequestException, IOException, NotFoundException, ServerException, UnauthorizedException { String url = UriBuilder.fromUri(keycloakSettings.get().get(AUTH_SERVER_URL_SETTING)) .path("/realms/{realm}/broker/{provider}/token") .build(keycloakSettings.get().get(REALM_SETTING), oauthProvider) .toString(); try { String response = doRequest(url, HttpMethod.GET, null); return DtoFactory.getInstance() .createDtoFromJson(toJson(response), KeycloakTokenResponse.class); } catch (BadRequestException e) { if (assotiateUserPattern.matcher(e.getMessage()).matches()) { throw new UnauthorizedException(e.getMessage()); } throw e; } }
Source:
<code>public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } if (authConfigs.get("docker.io") != null) { <START> AuthConfig authConfig = authConfigs.get("docker.io"); <END> authConfigs.remove("docker.io"); authConfigs.put(DEFAULT_REGISTRY, authConfig); } return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }</code><technical_language>AuthConfig abnormalDefaultRegistryAuthConfig = authConfigs.remove("docker.io"); if (abnormalDefaultRegistryAuthConfig != null) { authConfigs.put(DEFAULT_REGISTRY, abnormalDefaultRegistryAuthConfig); }</technical_language>

Target:
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } AuthConfig abnormalDefaultRegistryAuthConfig = authConfigs.remove("docker.io"); if (abnormalDefaultRegistryAuthConfig != null) { authConfigs.put(DEFAULT_REGISTRY, abnormalDefaultRegistryAuthConfig); } return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }
Source:
<code>public @NonNull Comparator<@NonNull LamiTableEntry> getComparator() { return (o1, o2) -> { Number d1 = resolveNumber(o1); Number d2 = resolveNumber(o2); if (d1 == null && d2 == null) { return 0; } if (d1 == null) { return 1; } if (d2 == null) { return -1; } <START> <END> BigDecimal bd1 = new BigDecimal(d1.toString()); BigDecimal bd2 = new BigDecimal(d2.toString()); return bd1.compareTo(bd2); }; }</code><technical_language>This class's implementation resolveNumber() return a Long, return Long.compare(d1.longValue(), d2.longValue())</technical_language>

Target:
public @NonNull Comparator<@NonNull LamiTableEntry> getComparator() { return (o1, o2) -> { Number d1 = resolveNumber(o1); Number d2 = resolveNumber(o2); if (d1 == null && d2 == null) { return 0; } if (d1 == null) { return 1; } if (d2 == null) { return -1; } return Long.compare(d1.longValue(), d2.longValue()); }; }
Source:
<code>private Subscription enqueue(Action0 action, long execTime) { if (innerSubscription.isUnsubscribed()) { return Subscriptions.empty(); } PriorityQueue<TimedAction> queue = QUEUE.get(); final TimedAction timedAction = new TimedAction(action, execTime, COUNTER_UPDATER.incrementAndGet(TrampolineScheduler.this)); queue.add(timedAction); if (wip.getAndIncrement() == 0) { while (!queue.isEmpty()) { queue.poll().action.call(); } <START> wip.decrementAndGet(); <END> return Subscriptions.empty(); } else { return Subscriptions.create(new Action0() { @Override public void call() { PriorityQueue<TimedAction> _q = QUEUE.get(); if (_q != null) { _q.remove(timedAction); } } }); } }</code><technical_language>This get wip zero. usual queue-drain pattern? java if (wip.getAndIncrement() == 0) { do { queue.poll().action.call(); } while (wip.decrementAndGet() > 0); }</technical_language>

Target:
private Subscription enqueue(Action0 action, long execTime) { if (innerSubscription.isUnsubscribed()) { return Subscriptions.empty(); } PriorityQueue<TimedAction> queue = QUEUE.get(); final TimedAction timedAction = new TimedAction(action, execTime, COUNTER_UPDATER.incrementAndGet(TrampolineScheduler.this)); queue.add(timedAction); if (wip.getAndIncrement() == 0) { do { queue.poll().action.call(); } while (wip.decrementAndGet() > 0); return Subscriptions.empty(); } else { return Subscriptions.create(new Action0() { @Override public void call() { PriorityQueue<TimedAction> _q = QUEUE.get(); if (_q != null) { _q.remove(timedAction); } } }); } }
Source:
<code>public void initialize(URL url, ResourceBundle resourceBundle) { queryState.getCurrentQuery().addListener((obs, odlVal, newVal) -> <START> queryState.setSelectedModel(runQuery())); <END> ListPane lp = new ListPane(queryState); VBox.setVgrow(lp, Priority.ALWAYS); ta = new TextArea(); ta.setEditable(false); ta.textProperty().bindBidirectional(queryState.getCurrentQuery()); vBox.getChildren().addAll(lp, ta); tableLikeView.setContent(new TablePane(queryState)); textLikeView.setContent(TextPane.getInstance(queryState)); }</code><technical_language>listener depend UI components applied in constructor if decouple text property of ta</technical_language>

Target:
public void initialize(URL url, ResourceBundle resourceBundle) { ListPane lp = new ListPane(queryState); VBox.setVgrow(lp, Priority.ALWAYS); ta = new TextArea(); ta.setEditable(false); ta.textProperty().bindBidirectional(queryState.getCurrentQuery()); vBox.getChildren().addAll(lp, ta); tableLikeView.setContent(new TablePane(queryState)); textLikeView.setContent(TextPane.getInstance(queryState)); }
Source:
<code>private static QueryDataSource subquery(final DataSource dataSource) { return new QueryDataSource( GroupByQuery.builder() .setDataSource(dataSource) <START> .setInterval(new MultipleIntervalSegmentSpec(Collections.singletonList(Intervals.of("2000/3000")))) <END> .setGranularity(Granularities.ALL) .build() ); }</code><technical_language>create a named constant for interval in asserts for of new tests</technical_language>

Target:
private static QueryDataSource subquery(final DataSource dataSource) { return new QueryDataSource( GroupByQuery.builder() .setDataSource(dataSource) .setInterval(new MultipleIntervalSegmentSpec(MILLENIUM_INTERVALS)) .setGranularity(Granularities.ALL) .build() ); }
Source:
<code>public void getRowsAccessibleThroughCopies() { Transaction t = startTransaction(); byte[] rowKey = row(0); byte[] value = value(0); t.put(TEST_TABLE, ImmutableMap.of( Cell.create(rowKey, column(0)), value)); t.commit(); t = startTransaction(); SortedMap<byte[], RowResult<byte[]>> result = t.getRows(TEST_TABLE, ImmutableList.of(rowKey), ColumnSelection.all()); assertThat(result.get(rowKey)) .as("it should be possible to get a row from getRows with a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); <START> byte[] rowKeyCopy = row(0); <END> assertThat(rowKeyCopy).isNotSameAs(rowKey); assertThat(result.get(rowKeyCopy)) .as("it should be possible to get a row from getRows with a copy of a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); }</code><technical_language>nit: i this is more clear rowKey.clone()</technical_language>

Target:
public void getRowsAccessibleThroughCopies() { Transaction t = startTransaction(); byte[] rowKey = row(0); byte[] value = value(0); t.put(TEST_TABLE, ImmutableMap.of( Cell.create(rowKey, column(0)), value)); t.commit(); t = startTransaction(); SortedMap<byte[], RowResult<byte[]>> result = t.getRows(TEST_TABLE, ImmutableList.of(rowKey), ColumnSelection.all()); assertThat(result.get(rowKey)) .as("it should be possible to get a row from getRows with a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); byte[] rowKeyCopy = rowKey.clone(); assertThat(rowKeyCopy).isNotSameAs(rowKey); assertThat(result.get(rowKeyCopy)) .as("it should be possible to get a row from getRows with a copy of a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); }
Source:
<code>private boolean isAllowedInCourseLevel(String privilegeName) { Assumption.assertTrue(isPrivilegeNameValid(privilegeName)); <START> return this.courseLevel.getOrDefault(privilegeName, Boolean.FALSE).booleanValue(); <END> }</code><technical_language>fine remove unboxing; return Boolean is. java return this.courseLevel.getOrDefault(privilegeName, false);</technical_language>

Target:
private boolean isAllowedInCourseLevel(String privilegeName) { Assumption.assertTrue(isPrivilegeNameValid(privilegeName)); return this.courseLevel.getOrDefault(privilegeName, false); }
Source:
<code>public void apply( WorkspaceConfigImpl workspaceConfig, Component k8sComponent, FileContentProvider contentProvider) throws DevfileException { checkArgument(workspaceConfig != null, "Workspace config must not be null"); checkArgument(k8sComponent != null, "Component must not be null"); checkArgument( kubernetesBasedComponentTypes.contains(k8sComponent.getType()), format("Plugin must have %s type", String.join(" or ", kubernetesBasedComponentTypes))); String componentContent = retrieveContent(k8sComponent, contentProvider); List<HasMetadata> componentObjects = new ArrayList<>(unmarshalComponentObjects(k8sComponent, componentContent)); if (!k8sComponent.getSelector().isEmpty()) { componentObjects = SelectorFilter.filter(componentObjects, k8sComponent.getSelector()); } List<PodData> podsData = getPodDatas(componentObjects); <START> Map<String, Map<String, String>> podToContainerAndMachineName = estimateMachineNames(podsData); <END> linkCommandsToMachineName(workspaceConfig, k8sComponent, podToContainerAndMachineName); if (Boolean.TRUE.equals(k8sComponent.getMountSources())) { applyProjectsVolumes(podsData, componentObjects); } applyEntrypoints(k8sComponent.getEntrypoints(), componentObjects); Map<String, MachineConfigImpl> machineConfigs = k8sComponent.getAlias() != null ? prepareMachineConfigs(k8sComponent.getAlias(), podToContainerAndMachineName) : emptyMap(); k8sEnvProvisioner.provision(workspaceConfig, environmentType, componentObjects, machineConfigs); }</code><technical_language>I this Map<String, Map<String, String>>, hard follow. map of maps ? I find usage of keys</technical_language>

Target:
public void apply( WorkspaceConfigImpl workspaceConfig, Component k8sComponent, FileContentProvider contentProvider) throws DevfileException { checkArgument(workspaceConfig != null, "Workspace config must not be null"); checkArgument(k8sComponent != null, "Component must not be null"); checkArgument( kubernetesBasedComponentTypes.contains(k8sComponent.getType()), format("Plugin must have %s type", String.join(" or ", kubernetesBasedComponentTypes))); String componentContent = retrieveContent(k8sComponent, contentProvider); List<HasMetadata> componentObjects = new ArrayList<>(unmarshalComponentObjects(k8sComponent, componentContent)); if (!k8sComponent.getSelector().isEmpty()) { componentObjects = SelectorFilter.filter(componentObjects, k8sComponent.getSelector()); } List<PodData> podsData = getPodDatas(componentObjects); if (Boolean.TRUE.equals(k8sComponent.getMountSources())) { applyProjectsVolumes(podsData, componentObjects); } applyEntrypoints(k8sComponent.getEntrypoints(), componentObjects); Map<String, MachineConfigImpl> machineConfigs = prepareMachineConfigs(podsData, k8sComponent.getAlias()); linkCommandsToMachineName(workspaceConfig, k8sComponent, machineConfigs.keySet()); k8sEnvProvisioner.provision(workspaceConfig, environmentType, componentObjects, machineConfigs); }
Source:
<code>private void doLogout() { boolean doUpdate = true; <START> if (app == null) { <END> doUpdate = false; app = WikipediaApp.getInstance(); } app.getEditTokenStorage().clearAllTokens(); app.getCookieManager().clearAllCookies(); app.getUserInfoStorage().clearUser(); Toast.makeText(app, R.string.toast_logout_complete, Toast.LENGTH_LONG).show(); if (doUpdate) { setupDynamicNavDrawerItems(); } }</code><technical_language>this case happen? initialize app in onCreate(). If so, initialize app in onAttach instead</technical_language>

Target:
private void doLogout() { app.getEditTokenStorage().clearAllTokens(); app.getCookieManager().clearAllCookies(); app.getUserInfoStorage().clearUser(); Toast.makeText(app, R.string.toast_logout_complete, Toast.LENGTH_LONG).show(); navDrawerHelper.setupDynamicNavDrawerItems(); }
Source:
<code>public void testDecompressionSkipForBinaryFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedBinaryFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV1, compressedPayload); assertTrue(decoderChannel.writeInbound(compressedBinaryFrame)); WebSocketFrame inboundFrame = decoderChannel.readInbound(); assertEquals(WebSocketExtension.RSV1, inboundFrame.rsv()); assertEquals(compressedPayload, inboundFrame.content()); assertTrue(inboundFrame.release()); <START> assertTrue(encoderChannel.finish()); <END> assertFalse(decoderChannel.finish()); }</code><technical_language>call encoderChannel.finishAndReleaseAll() fix LEAK</technical_language>

Target:
public void testDecompressionSkipForBinaryFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedBinaryFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV1, compressedPayload); assertTrue(decoderChannel.writeInbound(compressedBinaryFrame)); WebSocketFrame inboundFrame = decoderChannel.readInbound(); assertEquals(WebSocketExtension.RSV1, inboundFrame.rsv()); assertEquals(compressedPayload, inboundFrame.content()); assertTrue(inboundFrame.release()); assertTrue(encoderChannel.finishAndReleaseAll()); assertFalse(decoderChannel.finish()); }
Source:
<code><START> public void copy(boolean cut) { <END> Actor a = views.getKeyboardFocus(); if (a instanceof CopyListener) { Object content = cut ? ((CopyListener) a).cut() : ((CopyListener) a).copy(); if (content != null) { clipboard.setContents(assets.toJson(content)); contentClazz = content.getClass(); } } }</code><technical_language>Is reason for cut() copy() separated (e.g. in CopyListener) here? I lean of options, appreciate consistency</technical_language>

Target:
public void copy(boolean cut) { Actor a = views.getKeyboardFocus(); if (a instanceof CopyListener) { Object content = ((CopyListener) a).copy(cut); if (content != null) { for (ClipboardListener listener : clipboardListeners) { listener.copied(content); } clipboard.setContents(assets.toJson(content)); contentClazz = content.getClass(); } } }
Source:
<code>public void onPost(final GitLabMergeRequest req) { final ParameterizedJobMixIn scheduledJob = new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }; if (triggerOnMergeRequest && this.isBranchAllowed(req.getObjectAttribute().getTargetBranch())) { LOGGER.log(Level.INFO, "{0} triggered for merge request.", job.getFullName()); <START> String name = " #" + job.getNextBuildNumber(); <END> GitLabMergeCause cause = createGitLabMergeCause(req); Action[] actions = createActions(req, job); int projectbuildDelay = 0; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob)job; if (abstractProject.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = abstractProject.getQuietPeriod(); } } if(addCiMessage) { req.createCommitStatus(getDescriptor().getGitlab().instance(), "pending", Jenkins.getInstance().getRootUrl() + job.getUrl()); } scheduledJob.scheduleBuild2(projectbuildDelay, actions); } else { LOGGER.log(Level.INFO, "trigger on merge request not set"); } }</code><technical_language>variable name is removed</technical_language>

Target:
public void onPost(final GitLabMergeRequest req) { final ParameterizedJobMixIn scheduledJob = new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }; if (triggerOnMergeRequest && this.isBranchAllowed(req.getObjectAttribute().getTargetBranch())) { LOGGER.log(Level.INFO, "{0} triggered for merge request.", job.getFullName()); GitLabMergeCause cause = createGitLabMergeCause(req); Action action = createAction(req, job); int projectbuildDelay = 0; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob)job; if (abstractProject.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = abstractProject.getQuietPeriod(); } } if(addCiMessage) { req.createCommitStatus(getDescriptor().getGitlab().instance(), "pending", Jenkins.getInstance().getRootUrl() + job.getUrl()); } scheduledJob.scheduleBuild2(projectbuildDelay, action, new CauseAction(cause)); } else { LOGGER.log(Level.INFO, "trigger on merge request not set"); } }
Source:
<code>public void testMapTuple3WithoutSpecifiedColumn_shouldFail() throws SQLException { Handle handle = dbRule.getSharedHandle(); handle.registerRowMapper(new SomethingMapper()); Tuple3<Integer, Something, Integer> result = handle .createQuery("select * from something where id = 1") .mapTo(new GenericType<Tuple3<Integer, Something, Integer>>() {}) .findOnly(); assertThat(result._1).isEqualTo(1); assertThat(result._2).isEqualTo(new Something(1, "eric")); <START> <END> assertThat(result._3).isNotEqualTo(100); }</code><technical_language>Test name test fail, in test expects exception. I suspect if pull latest changes in master branch, this test start throwing exception expected</technical_language>

Target:
public void testMapTuple3WithoutSpecifiedColumn_shouldFail() throws SQLException { Handle handle = dbRule.getSharedHandle(); handle.registerRowMapper(new SomethingMapper()); assertThatThrownBy(() -> handle .createQuery("select * from something where id = 1") .mapTo(new GenericType<Tuple3<Integer, Something, Integer>>() {}) .findOnly()) .isInstanceOf(NoSuchMapperException.class) .hasMessageContaining("TupleMappers config class"); }
Source:
<code>private void loadMachineUUID() { String uuid = loadExistingUUID(); if (uuid == null) { uuid = UUID.randomUUID().toString(); saveUUID(uuid); } <START> environmentTracker.getService().setProperty(PROP_UUID, uuid); <END> }</code><technical_language>check environmentTracker is null</technical_language>

Target:
private void loadMachineUUID() { String uuid = loadExistingUUID(); if (uuid == null) { uuid = UUID.randomUUID().toString(); saveUUID(uuid); } EnvironmentInfo environment = environmentTracker.getService(); if (environment != null) { environment.setProperty(PROP_UUID, uuid); } else { System.setProperty(PROP_UUID, uuid); } }
Source:
<code>public void cleanCache() { resetInMemoryCache(); if (SalesforceSDKManagerWithSmartStore.getInstance().hasSmartStore()) { <START> smartStore.dropAllSoups(); <END> } }</code><technical_language>if smartstore in app? instead drop soups manage</technical_language>

Target:
public void cleanCache() { resetInMemoryCache(); if (SalesforceSDKManagerWithSmartStore.getInstance().hasSmartStore()) { clearAllSoups(); } }
Source:
<code>public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zcEvent = (ZoneChangeEvent) event; if (zcEvent.getFromZone() != Zone.BATTLEFIELD) { return false; } if (zcEvent.getToZone() != Zone.GRAVEYARD && zcEvent.getToZone() != Zone.COMMAND) { return false; } Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (!permanent.getControllerId().equals(this.getControllerId()) || !permanent.isCreature()) { return false; } <START> int countersOn = permanent.getCounters(game).getCount(CounterType.P1P1); <END> if (countersOn == 0) { return false; } this.getEffects().clear(); this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(countersOn))); return true; }</code><technical_language>Permanent null -- need check</technical_language>

Target:
public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zcEvent = (ZoneChangeEvent) event; if (zcEvent.getFromZone() != Zone.BATTLEFIELD) { return false; } if (zcEvent.getToZone() != Zone.GRAVEYARD && zcEvent.getToZone() != Zone.COMMAND) { return false; } Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent == null || !permanent.isCreature()) { return false; } Player player = game.getPlayer(this.getControllerId()); if (player == null || !player.getId().equals(this.getControllerId())) { return false; } int countersOn = permanent.getCounters(game).getCount(CounterType.P1P1); if (countersOn == 0) { return false; } this.getEffects().clear(); this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(countersOn))); return true; }
Source:
<code>public void generateData(Path outFile, Configuration configuration, ParquetProperties.WriterVersion version, int blockSize, int pageSize, int fixedLenByteArraySize, CompressionCodecName codec, int nRows) throws IOException { if (exists(configuration, outFile)) { System.out.println("File already exists " + outFile); return; } System.out.println("Generating data @ " + outFile); MessageType schema = parseMessageType( "message test { " + "required binary binary_field; " + "required int32 int32_field; " + "required int64 int64_field; " + "required boolean boolean_field; " + "required float float_field; " + "required double double_field; " + "required fixed_len_byte_array(" + fixedLenByteArraySize +") flba_field; " + "required int96 int96_field; " + "} "); GroupWriteSupport.setSchema(schema, configuration); SimpleGroupFactory f = new SimpleGroupFactory(schema); ParquetWriter<Group> writer = new ParquetWriter<Group>(outFile, new GroupWriteSupport(), codec, blockSize, pageSize, DICT_PAGE_SIZE, true, false, version, configuration); char[] chars = new char[fixedLenByteArraySize]; Arrays.fill(chars, '*'); for (int i = 0; i < nRows; i++) { writer.write( f.newGroup() .append("binary_field", randomUUID().toString()) .append("int32_field", i) .append("int64_field", 64l) .append("boolean_field", true) .append("float_field", 1.0f) .append("double_field", 2.0d) .append("flba_field", new String(chars)) <START> .append("int96_field", Binary.fromUnmodifiedByteArray(new byte[12])) <END> ); } writer.close(); }</code><technical_language>This is correct is reference byte array</technical_language>

Target:
public void generateData(Path outFile, Configuration configuration, ParquetProperties.WriterVersion version, int blockSize, int pageSize, int fixedLenByteArraySize, CompressionCodecName codec, int nRows) throws IOException { if (exists(configuration, outFile)) { System.out.println("File already exists " + outFile); return; } System.out.println("Generating data @ " + outFile); MessageType schema = parseMessageType( "message test { " + "required binary binary_field; " + "required int32 int32_field; " + "required int64 int64_field; " + "required boolean boolean_field; " + "required float float_field; " + "required double double_field; " + "required fixed_len_byte_array(" + fixedLenByteArraySize +") flba_field; " + "required int96 int96_field; " + "} "); GroupWriteSupport.setSchema(schema, configuration); SimpleGroupFactory f = new SimpleGroupFactory(schema); ParquetWriter<Group> writer = new ParquetWriter<Group>(outFile, new GroupWriteSupport(), codec, blockSize, pageSize, DICT_PAGE_SIZE, true, false, version, configuration); char[] chars = new char[fixedLenByteArraySize]; Arrays.fill(chars, '*'); for (int i = 0; i < nRows; i++) { writer.write( f.newGroup() .append("binary_field", randomUUID().toString()) .append("int32_field", i) .append("int64_field", 64l) .append("boolean_field", true) .append("float_field", 1.0f) .append("double_field", 2.0d) .append("flba_field", new String(chars)) .append("int96_field", Binary.fromConstantByteArray(new byte[12])) ); } writer.close(); }
Source:
<code>public void service(HttpRequest request, HttpResponse response) throws IOException { <START> Integer lazyGlobal = getLazyGlobal(); <END> BufferedWriter writer = response.getWriter(); writer.write(String.format("Lazy global: %s; non-lazy global: %s", lazyGlobal, NON_LAZY_GLOBAL)); }</code><technical_language>this LazyGlobalHolder.getInstance()</technical_language>

Target:
public void service(HttpRequest request, HttpResponse response) throws IOException { Integer lazyGlobal = LazyGlobalHolder.getInstance(); BufferedWriter writer = response.getWriter(); writer.write(String.format("Lazy global: %s; non-lazy global: %s", lazyGlobal, NON_LAZY_GLOBAL)); }
Source:
<code>private ObjectId insertMultiProposal(Repository git, ObjectInserter inserter) throws IOException, NoOp { ObjectId <START> last = <END> acceptedOld; ObjectId oldTree; RefTree tree; if (ObjectId.zeroId().equals(last)) { oldTree = ObjectId.zeroId(); tree = RefTree.newEmptyTree(); } else { try (RevWalk rw = new RevWalk(git)) { RevCommit c = rw.parseCommit(last); oldTree = c.getTree(); tree = RefTree.read(rw.getObjectReader(), c.getTree()); } } PersonIdent committer = leader.getSystem().newCommitter(); for (Proposal p : todo) { if (!tree.apply(p.getCommands())) { throw new IOException( KetchText.get().queuedProposalFailedToApply); } ObjectId treeId = tree.writeTree(inserter); if (treeId.equals(oldTree)) { continue; } CommitBuilder b = new CommitBuilder(); b.setTreeId(treeId); if (!ObjectId.zeroId().equals(last)) { b.setParentId(last); } b.setAuthor(p.getAuthor() != null ? p.getAuthor() : committer); b.setCommitter(committer); b.setMessage(message(p)); last = inserter.insert(b); } if (last.equals(acceptedOld)) { throw new NoOp(); } return last; }</code><technical_language>s/last/lastIndex/</technical_language>

Target:
private ObjectId insertMultiProposal(Repository git, ObjectInserter inserter) throws IOException, NoOp { ObjectId lastIndex = acceptedOldIndex; ObjectId oldTreeId; RefTree tree; if (ObjectId.zeroId().equals(lastIndex)) { oldTreeId = ObjectId.zeroId(); tree = RefTree.newEmptyTree(); } else { try (RevWalk rw = new RevWalk(git)) { RevCommit c = rw.parseCommit(lastIndex); oldTreeId = c.getTree(); tree = RefTree.read(rw.getObjectReader(), c.getTree()); } } PersonIdent committer = leader.getSystem().newCommitter(); for (Proposal p : todo) { if (!tree.apply(p.getCommands())) { throw new IOException( KetchText.get().queuedProposalFailedToApply); } ObjectId treeId = tree.writeTree(inserter); if (treeId.equals(oldTreeId)) { continue; } CommitBuilder b = new CommitBuilder(); b.setTreeId(treeId); if (!ObjectId.zeroId().equals(lastIndex)) { b.setParentId(lastIndex); } b.setAuthor(p.getAuthor() != null ? p.getAuthor() : committer); b.setCommitter(committer); b.setMessage(message(p)); lastIndex = inserter.insert(b); } if (lastIndex.equals(acceptedOldIndex)) { throw new NoOp(); } return lastIndex; }
Source:
<code>public Pacer(TimeSource timeSource, long delay) { this.timeSource = timeSource; <START> this.delay = delay; <END> }</code><technical_language>310-ing in here</technical_language>

Target:
public Pacer(TimeSource timeSource, long delay) { this.timeSource = timeSource; this.delay = delay; this.nextLogTime = new AtomicLong(timeSource.getTimeMillis()); }
Source:
<code><START> public void draw(Batch batch, float parentAlpha) { <END> batch.setShader(shader); if (alpha == 0.0f) { super.setVisible(false); } else { super.setVisible(true); } if (lookData instanceof DroneVideoLookData) { lookData.draw(batch, alpha); } if (isLookVisible() && this.getDrawable() != null) { super.draw(batch, this.alpha); } batch.setShader(null); }</code><technical_language>Please synchronize it</technical_language>

Target:
public synchronized void draw(Batch batch, float parentAlpha) { batch.setShader(shader); if (alpha == 0.0f) { super.setVisible(false); } else { super.setVisible(true); } if (lookData instanceof DroneVideoLookData) { lookData.draw(batch, alpha); } if (isLookVisible() && this.getDrawable() != null) { super.draw(batch, this.alpha); } batch.setShader(null); }
Source:
<code>public PluginInterface findPluginWithId( Class<? extends PluginTypeInterface> pluginType, String pluginId, boolean waitForPluginToBeAvailable ) { <START> return waitForPluginToBeAvailable && findPluginWithId( pluginType, pluginId ) == null <END> ? waitForPluginToBeAvailable( pluginType, pluginId, waitForPluginToBeAvailableLimit ) : findPluginWithId( pluginType, pluginId ); }</code><technical_language>pull findPluginWithId call out of conditional need invoke twice</technical_language>

Target:
public PluginInterface findPluginWithId( Class<? extends PluginTypeInterface> pluginType, String pluginId, boolean waitForPluginToBeAvailable ) { PluginInterface pluginInterface = findPluginWithId( pluginType, pluginId ); return waitForPluginToBeAvailable && pluginInterface == null ? waitForPluginToBeAvailable( pluginType, pluginId, WAIT_FOR_PLUGIN_TO_BE_AVAILABLE_LIMIT ) : pluginInterface; }
Source:
<code>private NotificationCompat.Builder getBuilder() { String title = getString(R.string.app_name); <START> NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext) <END> .setSmallIcon(R.drawable.notification_icon) .setColor(getResources().getColor(R.color.blue_wordpress)) .setContentTitle(title) .setAutoCancel(true); return builder; }</code><technical_language>Local variable 'builder' is redundant</technical_language>

Target:
private NotificationCompat.Builder getBuilder() { return new NotificationCompat.Builder(mContext) .setSmallIcon(R.drawable.notification_icon) .setColor(getResources().getColor(R.color.blue_wordpress)) .setContentTitle(getString(R.string.app_name)) .setAutoCancel(true); }