auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public TransportChannel(final TransportConnection connection, final CloseableHttpResponse response) throws IOException { super(); this.connection = connection; this.response = response; this.responseHttpEntity = response.getEntity(); this.streamParser = new TransportEventStreamParser( this.responseHttpEntity.getContent()); this.iterator = this.streamParser; if (log.isDebugEnabled()) { log.debug( <START> "constructed " + this.toString() + " of type " + this.getClass().getName()); <END> } }</code><technical_language>do string formatting yourself. java log.debug("constructed of type {}", this, this.getClass().getName());</technical_language>

Target:
public TransportChannel(final TransportConnection connection, final CloseableHttpResponse response) throws IOException { super(); this.connection = connection; this.response = response; this.responseHttpEntity = response.getEntity(); this.streamParser = new TransportEventStreamParser( this.responseHttpEntity.getContent()); this.iterator = this.streamParser; log.debug("constructed of type {}", this, this.getClass().getName()); }
Source:
<code>public ArrayList<String> getPeriod(String hostname, String service){ if (service.equals("SRMv2")) { service = "SRM"; <START> } <END> ArrayList<String> period = new ArrayList<String>(); for (DowntimeItem item : this.list) { if (item.hostname.equals(hostname)) { if (item.service.equals(service)) { period.add(item.startTime); period.add(item.endTime); return period; } } } return null; }</code><technical_language>I thought need this mapping in compute engine</technical_language>

Target:
public ArrayList<String> getPeriod(String hostname, String service){ ArrayList<String> period = new ArrayList<String>(); for (DowntimeItem item : this.list) { if (item.hostname.equals(hostname)) { if (item.service.equals(service)) { period.add(item.startTime); period.add(item.endTime); return period; } } } return null; }
Source:
<code>void assignResourceRequests() { while (hasReadyPendingRequest()) { SamzaResourceRequest request = peekReadyPendingRequest().get(); String processorId = request.getProcessorId(); String preferredHost = hostAffinityEnabled ? request.getPreferredHost() : ResourceRequestState.ANY_HOST; Instant requestCreationTime = request.getRequestTimestamp(); LOG.info("Handling assignment request for Processor ID: on host: {}.", processorId, preferredHost); if (hasAllocatedResource(preferredHost)) { LOG.info("Found an available container for Processor ID: on the host: {}", processorId, preferredHost); if (hostAffinityEnabled) { state.matchedResourceRequests.incrementAndGet(); } containerManager.handleContainerLaunch(request, preferredHost, peekAllocatedResource(preferredHost), resourceRequestState, this); } else { LOG.info("Did not find any allocated containers for running Processor ID: on the host: {}.", processorId, preferredHost); if (isRequestExpired(request)) { updateExpiryMetrics(request); <START> containerManager.handleExpiredRequestForControlActionOrHostAffinityEnabled(processorId, preferredHost, request, this, resourceRequestState); <END> } else { LOG.info("Request for Processor ID: on preferred host has not expired yet." + "Request creation time: {}. Current Time: {}. Request timeout: ms", processorId, preferredHost, requestCreationTime, System.currentTimeMillis(), getRequestTimeout(request)); break; } } } }</code><technical_language>prefer renaming method handleExpiredRequest is longer distinction this method expired request handled</technical_language>

Target:
void assignResourceRequests() { while (hasReadyPendingRequest()) { SamzaResourceRequest request = peekReadyPendingRequest().get(); String processorId = request.getProcessorId(); String preferredHost = hostAffinityEnabled ? request.getPreferredHost() : ResourceRequestState.ANY_HOST; Instant requestCreationTime = request.getRequestTimestamp(); LOG.info("Handling assignment for Processor ID: with request {}", processorId, request); if (hasAllocatedResource(preferredHost)) { LOG.info("Found an available container for Processor ID: on the host: {}", processorId, preferredHost); if (hostAffinityEnabled) { state.matchedResourceRequests.incrementAndGet(); } boolean containerLaunchComplete = containerManager.handleContainerLaunch(request, preferredHost, peekAllocatedResource(preferredHost), resourceRequestState, this); if (!containerLaunchComplete) { break; } } else { LOG.info("Did not find any allocated containers for running Processor ID: on the host: {}.", processorId, preferredHost); if (isRequestExpired(request)) { updateExpiryMetrics(request); containerManager.handleExpiredRequest(processorId, preferredHost, request, this, resourceRequestState); } else { LOG.info("Request for Processor ID: on preferred host has not expired yet." + "Request creation time: {}. Current Time: {}. Request timeout: ms", processorId, preferredHost, requestCreationTime, System.currentTimeMillis(), getRequestTimeout(request).toMillis()); break; } } } }
Source:
<code>public int compareOrder(NodeInfo other) { int result = 0; if (other instanceof ElementNode) { result = Integer.compare(depth, ((ElementNode) other).depth); <START> if (result == 0) { <END> result = compareCommonAncestorChildrenOrder(this, other); } } return result; }</code><technical_language>is this update required fix stackoverflow ? if this is related move separate commit of PR</technical_language>

Target:
public int compareOrder(NodeInfo other) { int result = 0; if (other instanceof AbstractNode) { result = Integer.compare(depth, ((AbstractNode) other).getDepth()); if (result == 0) { result = compareCommonAncestorChildrenOrder(this, other); } } return result; }
Source:
<code>public SecureStore get() { String secureStore = getCurrentSecureStoreName(); if (DefaultSecureStore.NAME.equals(secureStore)) { return defaultSecureStore; } int separatorPosition = secureStore.lastIndexOf("/"); String storeName = secureStore.substring(separatorPosition + 1); String pluginName = secureStore.substring(0, separatorPosition); <START> Set<SecureStoreData> stores = getSecureStores(pluginName); for (SecureStoreData store : stores) { if (store.getStoreName().equals(secureStore)) { Class<? extends SecureStore> secureStoreImpl = store.load(); return new SecureStoreWrapper(injector.getInstance(secureStoreImpl)); } } <END> throw new SecureStoreException(String.format( "Cannot find secure store with name %s in plugin %s", storeName, pluginName)); }</code><technical_language>DynamicItem is safe in master (I merged WebSession work Martin Jonathan) this model item contributed a plugin automatically overrides default supplied Gerrit</technical_language>

Target:
public DynamicItem<SecureStore> get() { String secureStore = getCurrentSecureStoreName(); if (DefaultSecureStore.NAME.equals(secureStore)) { return DynamicItem.<SecureStore> of(defaultSecureStore); } int separatorPosition = secureStore.lastIndexOf("/"); if (separatorPosition < 0) { throw new SecureStoreException(String.format( "Unsupported secure store format %s." + "Proper format is: $plugin_name/$secure_store_name", secureStore)); } String storeName = secureStore.substring(separatorPosition + 1); String pluginName = secureStore.substring(0, separatorPosition); Set<SecureStoreData> stores = getSecureStores(pluginName); for (SecureStoreData store : stores) { if (store.getStoreName().equals(secureStore)) { Class<? extends SecureStore> secureStoreImpl = store.load(); return DynamicItem.<SecureStore> of(new SecureStoreWrapper(injector .getInstance(secureStoreImpl))); } } throw new SecureStoreException(String.format( "Cannot find secure store with name %s in plugin %s", storeName, pluginName)); }
Source:
<code><START> public void testQuotedIdentifiers() throws Throwable { <END> Schema schema = new Schema(); schema.addColumn("컬럼1", TEXT); schema.addColumn("컬럼2", TEXT); testEval(schema, "테이블1", "123,234", "select \"컬럼1\"::float, cast (\"컬럼2\" as float4) as a from \"테이블1\"", new String[]{"123.0", "234.0"}); testEval(schema, "테이블1", "123,234", "select char_length(\"컬럼1\"), \"컬럼2\"::float4 as \"별명1\" from \"테이블1\"", new String[]{"3", "234.0"}); }</code><technical_language>enough TajoException Throwable</technical_language>

Target:
public void testQuotedIdentifiers() throws TajoException { Schema schema = new Schema(); schema.addColumn("컬럼1", TEXT); schema.addColumn("컬럼2", TEXT); testEval(schema, "테이블1", "123,234", "select \"컬럼1\"::float, cast (\"컬럼2\" as float4) as a from \"테이블1\"", new String[]{"123.0", "234.0"}); testEval(schema, "테이블1", "123,234", "select char_length(\"컬럼1\"), \"컬럼2\"::float4 as \"별명1\" from \"테이블1\"", new String[]{"3", "234.0"}); }
Source:
<code>public long getEstimatedSize() { <START> return strategy.getEstimatedSize(); <END> }</code><technical_language>is longer for strategy null</technical_language>

Target:
public long getEstimatedSize() { return strategy == null ? 0 : strategy.getEstimatedSize(); }
Source:
<code>public void afterNavigateTo(String url, WebDriver driver) { StringBuilder builder = new StringBuilder(); if (!AlertHandler.isAlertPresent(driver)) { if (url.equals(driver.getCurrentUrl())) { builder.append("<tr class=\"success\"><td>Url after navigation</td><td>" + "<a href='" + driver.getCurrentUrl() + "'>" + driver.getCurrentUrl() + "</a></td><td> <br/> &nbsp;</td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); } else { if (driver.getCurrentUrl().contains("data:text/html,chromewebdata ")) { driver.get(url); } logWarning("Url after navigation", driver.getCurrentUrl()); } } else { logWarning("Url after navigation", "Unable to check URL after navigation - alert present"); } Method method = TestContext.getCurrentTestMethod(); if (method.isAnnotationPresent(Execute.class) && TestContext.isIsFirstLoad()) { TestContext.setFirstLoad(false); User user = method.getAnnotation(Execute.class).asUser(); <START> if (user == User.ANONYMOUS) { <END> } else { new WikiBasePageObject(driver).loginAs(user); driver.get(url); } } logJSError(driver); }</code><technical_language>for is this empty if statement</technical_language>

Target:
public void afterNavigateTo(String url, WebDriver driver) { StringBuilder builder = new StringBuilder(); if (!AlertHandler.isAlertPresent(driver)) { if (url.equals(driver.getCurrentUrl())) { builder.append("<tr class=\"success\"><td>Url after navigation</td><td>" + "<a href='" + driver.getCurrentUrl() + "'>" + driver.getCurrentUrl() + "</a></td><td> <br/> &nbsp;</td></tr>"); CommonUtils.appendTextToFile(logPath, builder.toString()); } else { if (driver.getCurrentUrl().contains("data:text/html,chromewebdata ")) { driver.get(url); } logWarning("Url after navigation", driver.getCurrentUrl()); } } else { logWarning("Url after navigation", "Unable to check URL after navigation - alert present"); } Method method = TestContext.getCurrentTestMethod(); if (method.isAnnotationPresent(Execute.class) && TestContext.isIsFirstLoad()) { TestContext.setFirstLoad(false); User user = method.getAnnotation(Execute.class).asUser(); if (user == User.ANONYMOUS) { } else { new WikiBasePageObject(driver).loginAs(user.getUserName(), user.getPassword(), url); } } logJSError(driver); }
Source:
<code>private void outputLine(String line, ProblemMarkerInfo marker) { String l = line + "\n"; <START> if ( outputStream == null ) return; <END> try { if ( marker != null && outputStream instanceof IErrorMarkeredOutputStream ) { IErrorMarkeredOutputStream s = (IErrorMarkeredOutputStream) outputStream; s.write(l, marker); } else { byte[] b = l.getBytes(); outputStream.write(b, 0, b.length); } } catch (IOException e) { CCorePlugin.log(e); } }</code><technical_language>Restore formatting</technical_language>

Target:
private void outputLine(String line, ProblemMarkerInfo marker) { String l = line + "\n"; if ( outputStream == null ) { return; } try { if ( marker != null && outputStream instanceof IErrorMarkeredOutputStream ) { IErrorMarkeredOutputStream s = (IErrorMarkeredOutputStream) outputStream; s.write(l, marker); } else { byte[] b = l.getBytes(); outputStream.write(b, 0, b.length); } } catch (IOException e) { CCorePlugin.log(e); } }
Source:
<code>public RegisteredServiceMultifactorPolicy.FailureModes determineFailureMode(final RegisteredService service) { RegisteredServiceMultifactorPolicy.FailureModes failureMode = CLOSED; if (StringUtils.isNotBlank(this.globalFailureMode)) { failureMode = RegisteredServiceMultifactorPolicy.FailureModes.valueOf(this.globalFailureMode); LOGGER.debug("Using global multi-factor failure mode for defined as [{}]", service, failureMode); } if (service != null) { <START> LOGGER.debug("Evaluating multifactor authentication policy for service [{}}", service); <END> final RegisteredServiceMultifactorPolicy policy = service.getMultifactorPolicy(); if (policy != null && policy.getFailureMode() != NOT_SET) { failureMode = policy.getFailureMode(); LOGGER.debug("Multi-factor failure mode for is defined as [{}]", service.getServiceId(), failureMode); } } return failureMode; }</code><technical_language>Small typo for param placeholder</technical_language>

Target:
public RegisteredServiceMultifactorPolicy.FailureModes determineFailureMode(final RegisteredService service) { RegisteredServiceMultifactorPolicy.FailureModes failureMode = CLOSED; if (StringUtils.isNotBlank(this.globalFailureMode)) { failureMode = RegisteredServiceMultifactorPolicy.FailureModes.valueOf(this.globalFailureMode); LOGGER.debug("Using global multi-factor failure mode for defined as [{}]", service, failureMode); } if (service != null) { LOGGER.debug("Evaluating multifactor authentication policy for service [{}]", service); final RegisteredServiceMultifactorPolicy policy = service.getMultifactorPolicy(); if (policy != null && policy.getFailureMode() != NOT_SET) { failureMode = policy.getFailureMode(); LOGGER.debug("Multi-factor failure mode for is defined as [{}]", service.getServiceId(), failureMode); } } LOGGER.debug("Final failure mode has been determined to be [{}]", failureMode); return failureMode; }
Source:
<code>public Asset updateAssetInventory(String capitalAssetNumber, String conditionCode, String buildingCode, String roomNumber, String netid) { Asset asset = businessObjectService.findBySinglePrimaryKey(Asset.class, capitalAssetNumber); if (ObjectUtils.isNull(asset)) { return null; } asset.setConditionCode(conditionCode); asset.setBuildingCode(buildingCode); asset.setBuildingRoomNumber(roomNumber); Timestamp currentTimestamp = dateTimeService.getCurrentTimestamp(); asset.setLastInventoryDate(currentTimestamp); asset.setLastUpdatedTimestamp(currentTimestamp); asset = businessObjectService.save(asset); <START> AssetExtension assetExtension = businessObjectService.findBySinglePrimaryKey(AssetExtension.class, capitalAssetNumber); <END> if (ObjectUtils.isNull(asset)) { LOG.error("updateAssetInventory: Asset Extension #[" + capitalAssetNumber + "] not found "); return null; } assetExtension.setLastScannedNetid(netid); assetExtension.setLastScannedDate(currentTimestamp); businessObjectService.save(assetExtension); return asset; }</code><technical_language>able do AssetExtension assetExtension = (AssetExtension) asset.getExtension() want check for null, create a new instance of AssetExtension needed. If need create a new AssetExtension object, want call asset.setExtension(). a business object save of asset save asset asset extension</technical_language>

Target:
public Asset updateAssetInventory(String capitalAssetNumber, String conditionCode, String buildingCode, String roomNumber, String netid) { Asset asset = businessObjectService.findBySinglePrimaryKey(Asset.class, capitalAssetNumber); if (ObjectUtils.isNull(asset)) { return null; } asset.setConditionCode(conditionCode); asset.setBuildingCode(buildingCode); asset.setBuildingRoomNumber(roomNumber); Timestamp currentTimestamp = dateTimeService.getCurrentTimestamp(); asset.setLastInventoryDate(currentTimestamp); asset.setLastUpdatedTimestamp(currentTimestamp); AssetExtension assetExtension = (AssetExtension) asset.getExtension(); if (ObjectUtils.isNull(assetExtension)) { assetExtension = new AssetExtension(); asset.setExtension(assetExtension); } Person person = personService.getPersonByPrincipalName(netid); String lastScannedBy = person.getFirstName() + " " + person.getLastName() + " (" + netid + ")"; assetExtension.setLastScannedBy(lastScannedBy); assetExtension.setLastScannedDate(currentTimestamp); asset = businessObjectService.save(asset); return asset; }
Source:
<code>public boolean check(VM vm) { if (vm.getStatus() == VMStatus.Suspended || vm.getStatus() == VMStatus.SavingState <START> || vm.getStatus() == VMStatus.RestoringState) { <END> return vm.getCustomCompatibilityVersion() != null; } return true; }</code><technical_language>simplify a bit with: EnumSet.of(VMStatus.Suspended, VMStatus.SavingState, VMStatus.RestoringState).contains(vm.getStatus())</technical_language>

Target:
public boolean check(VM vm) { if (EnumSet.of(VMStatus.Suspended, VMStatus.SavingState, VMStatus.RestoringState).contains(vm.getStatus())) { return vm.getCustomCompatibilityVersion() != null; } return true; }
Source:
<code>public void setUp() throws Exception { super.setUp(); mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); PackageManager packageManager = mContext.getPackageManager(); mHasWifi = packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI); mHasTelephony = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); mBuilder = new JobInfo.Builder(CONNECTIVITY_JOB_ID, kJobServiceComponent); mInitialRestrictBackground = SystemUtil .runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_GET_CMD) .contains("enabled"); <START> if(!mHasWifi) { return; } mInitialWiFiState = mWifiManager.isWifiEnabled(); } <END></code><technical_language>Express this more directly: if (mHasWifi) { mInitialWifiState = mWifiManager.isWifiEnabled(); } Note a space "if" parentheses</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); PackageManager packageManager = mContext.getPackageManager(); mHasWifi = packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI); mHasTelephony = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); mBuilder = new JobInfo.Builder(CONNECTIVITY_JOB_ID, kJobServiceComponent); mInitialRestrictBackground = SystemUtil .runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_GET_CMD) .contains("enabled"); if (mHasWifi) { mInitialWiFiState = mWifiManager.isWifiEnabled(); } }
Source:
<code>public void prepareRun(BatchJoinerContext context) { if (conf.getNumPartitions() != null) { context.setNumPartitions(conf.getNumPartitions()); if (conf.getDistributionFactor() != null && conf.getDistributionFactor() < conf.getNumPartitions()) { LOG.warn(String.format( <START> "Number of partitions (currently %d) should be greater than or equal to distribution factor (currently %d) " <END> + "for optimal results.", conf.getNumPartitions(), conf.getDistributionFactor())); } } FailureCollector collector = context.getFailureCollector(); context.record(createFieldOperations(conf.getSelectedFields(collector), conf.getJoinKeys(collector))); }</code><technical_language>nit: remove 'currently' in parentheses shorten message a little</technical_language>

Target:
public void prepareRun(BatchJoinerContext context) { if (conf.getNumPartitions() != null) { context.setNumPartitions(conf.getNumPartitions()); if (conf.getDistributionFactor() != null && conf.getDistributionFactor() < conf.getNumPartitions()) { LOG.warn("Number of partitions ({}) should be greater than or equal to distribution factor ({}) for optimal " + "results.", conf.getNumPartitions(), conf.getDistributionFactor()); } } FailureCollector collector = context.getFailureCollector(); context.record(createFieldOperations(conf.getSelectedFields(collector), conf.getJoinKeys(collector))); }
Source:
<code>public final TaskResult run() { boolean isThisNextJob = getUserContent(WORKFLOW_STARTED, Scope.WORKFLOW) == null || this.callbackContext.getJobConfig().getJobId() .equals(this.callbackContext.getJobConfig().getWorkflow() + "_" + getUserContent(NEXT_JOB, Scope.WORKFLOW)); TaskResult result = isThisNextJob ? onRun(this.taskHelper) : new TaskResult(TaskResult.Status.COMPLETED, "Not a target job"); if (participant != null) { <START> participant.unregisterRunningTask(this); <END> } return result; }</code><technical_language>Do this in a finally block</technical_language>

Target:
public final TaskResult run() { try { boolean isThisNextJob = getUserContent(WORKFLOW_STARTED, Scope.WORKFLOW) == null || this.callbackContext.getJobConfig().getJobId() .equals(this.callbackContext.getJobConfig().getWorkflow() + "_" + getUserContent(NEXT_JOB, Scope.WORKFLOW)); return isThisNextJob ? onRun(this.taskHelper) : new TaskResult(TaskResult.Status.COMPLETED, "Not a target job"); } finally { if (participant != null) { participant.unregisterRunningTask(this); } else { logger.warn("Task with id: " + taskId + " is not unregistered since the participant is not set"); } } }
Source:
<code>public void setUp() { <START> repository = mock(Repository.class); <END> entityType = mock(EntityType.class); repositoryCollection = mock(RepositoryCollection.class); dataService = mock(DataService.class); decoratorConfiguration = mock(DecoratorConfiguration.class); dynamicRepositoryDecoratorFactory = mock(DynamicRepositoryDecoratorFactory.class); when(entityType.getId()).thenReturn("entityTypeId"); when(repositoryCollection.hasRepository(decoratorConfigurationMetadata)).thenReturn(true); when(repository.getEntityType()).thenReturn(entityType); }</code><technical_language>@Mock, e.g. MolgenisLocaleResolverTest</technical_language>

Target:
public void setUp() { when(entityType.getId()).thenReturn("entityTypeId"); when(repositoryCollection.hasRepository(decoratorConfigurationMetadata)).thenReturn(true); when(repository.getEntityType()).thenReturn(entityType); }
Source:
<code>public void onActivityResumed(Activity activity) { installConnectionSensor(activity); mEditState.add(activity); mCurrentActivity = activity; <START> ConnectivityIndicator.show(activity); <END> }</code><technical_language>check for mMixpanelInEditMode here. show show a view responsibility check is a socket open not, etc.</technical_language>

Target:
public void onActivityResumed(Activity activity) { installConnectionSensor(activity); mEditState.add(activity); mCurrentActivity = new WeakReference<>(activity); if (ViewCrawler.mMixpanelInEditMode) { ConnectivityIndicator.show(activity, mContext); } }
Source:
<code>public MediaBrowserServiceCompat.BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, @Nullable Bundle rootHints) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(radioDroidApp.getApplicationContext().getApplicationContext()); showIconsInBrowser = sharedPref.getBoolean("show_station_icons_in_hud_browser", false); Bundle extras = new Bundle(); extras.putInt(CONTENT_STYLE_BROWSABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); if (showIconsInBrowser) { <START> Log.d(TAG, "Settimg grid style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_GRID_ITEM_HINT_VALUE); } else { Log.d(TAG, "Settimg list style for playables"); <END> extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); } extras.putBoolean(CONTENT_STYLE_SUPPORTED, true); return new MediaBrowserServiceCompat.BrowserRoot(MEDIA_ID_ROOT, extras); }</code><technical_language>"setting"</technical_language>

Target:
public MediaBrowserServiceCompat.BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, @Nullable Bundle rootHints) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(radioDroidApp.getApplicationContext().getApplicationContext()); showIconsInBrowser = sharedPref.getBoolean("show_station_icons_in_hud_browser", false); Bundle extras = new Bundle(); extras.putInt(CONTENT_STYLE_BROWSABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); if (showIconsInBrowser && sharedPref.getBoolean("settings_grid_style_hud_icon_display", false)) { Log.d(TAG, "Setting grid style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_GRID_ITEM_HINT_VALUE); } else { Log.d(TAG, "Setting list style for playables"); extras.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE); } extras.putBoolean(CONTENT_STYLE_SUPPORTED, true); return new MediaBrowserServiceCompat.BrowserRoot(MEDIA_ID_ROOT, extras); }
Source:
<code><START> private Vanilla(){} <END></code><technical_language>This protected modders subclass small changes</technical_language>

Target:
protected Vanilla(){}
Source:
<code>public void pruneParentDirectoryOne() throws IOException { final String parentDir = createRandomDirectory(testPathPrefix, 1); final String childDir = createRandomDirectory(parentDir, 3); LOG.info("CHILD DIR : " + childDir); LOG.info("Parent DIR : " + parentDir); mantaClient.delete(childDir, null, 1); <START> MantaAssert.assertResponseFailureStatusCode(404, RESOURCE_NOT_FOUND_ERROR, <END> (MantaFunction<Object>) () -> mantaClient.get(childDir)); Assert.assertTrue(mantaClient.existsAndIsAccessible(parentDir)); }</code><technical_language>a necessary change simplified Assert.assertFalse(mantaClient.existsAndIsAccessible(childDir). if want this change</technical_language>

Target:
public void pruneParentDirectoryOne() throws IOException { final String parentDir = createRandomDirectory(testPathPrefix, 1); final String childDir = createRandomDirectory(parentDir, 3); LOG.info("CHILD DIR : " + childDir); LOG.info("Parent DIR : " + parentDir); mantaClient.delete(childDir, null, 1); Assert.assertFalse(mantaClient.existsAndIsAccessible(childDir)); Assert.assertTrue(mantaClient.existsAndIsAccessible(parentDir)); }
Source:
<code>public void testLhsOrder() { final SpreadsheetCompiler converter = new SpreadsheetCompiler(); String drl = converter.compile( "/data/LhsOrder.xls", InputType.XLS); System.out.println(drl); assertNotNull( drl ); int firstLine = drl.indexOf( "accumulate(Person(name == \"John\", $a : age); $max:max($a))" ); int secondLine = drl.indexOf( "$p:Person(name == \"John\", age == $max)" ); <START> <END> assertTrue( firstLine > -1 ); assertTrue( secondLine > -1 ); assertTrue( "Lhs order is wrong. firstLineIndex = " + firstLine + ", secondLineIndex = " + secondLine , firstLine < secondLine ); }</code><technical_language>shorten test slightly if assertj library code below, mind incorporate? java @Test public void testLhsOrder() { // DROOLS-3080 final SpreadsheetCompiler converter = new SpreadsheetCompiler(); String drl = converter.compile("/data/LhsOrder.xls", InputType.XLS); Assertions.assertThat(drl.split("\n")) .as("Lhs order is wrong") .containsSequence("accumulate(Person(name == \"John\", $a : age); $max:max($a))", "$p:Person(name == \"John\", age == $max)"); }</technical_language>

Target:
public void testLhsOrder() { final SpreadsheetCompiler converter = new SpreadsheetCompiler(); String drl = converter.compile("/data/LhsOrder.xls", InputType.XLS); Assertions.assertThat(drl.split("\n")) .as("Lhs order is wrong") .containsSequence("accumulate(Person(name == \"John\", $a : age); $max:max($a))", "$p:Person(name == \"John\", age == $max)"); }
Source:
<code>public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) { if (isSimple) { <START> try { <END> emitter.emit(StructuredRecordStringConverter.fromJsonString((String) input.get(config.field), outSchema)); } catch (IOException e) { emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), input)); } return; } Object document = Configuration.defaultConfiguration().jsonProvider().parse((String) input.get(config.field)); StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); for (Schema.Field field : fields) { String name = field.getName(); if (mapping.containsKey(name)) { String path = mapping.get(name); try { Object value = JsonPath.read(document, path); builder.set(field.getName(), value); } catch (PathNotFoundException e) { LOG.error("Json path '" + path + "' specified for the field '" + name + "' doesn't exist. " + "Fix the issue before proceeding further with processing."); emitter.emitError(new InvalidEntry<>(31, e.getStackTrace()[0].toString() + " : " + e.getMessage(), input)); throw e; } } else { Object value = input.get(name); if (value != null) { builder.set(name, value); } } } emitter.emit(builder.build()); }</code><technical_language>remove</technical_language>

Target:
public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) throws Exception { if (isSimple) { emitter.emit(StructuredRecordStringConverter.fromJsonString((String) input.get(config.field), outSchema)); return; } Object document = Configuration.defaultConfiguration().jsonProvider().parse((String) input.get(config.field)); StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); for (Schema.Field field : fields) { String name = field.getName(); if (mapping.containsKey(name)) { String path = mapping.get(name); try { Object value = JsonPath.read(document, path); builder.set(field.getName(), value); } catch (PathNotFoundException e) { if (field.getSchema().isNullable()) { builder.set(field.getName(), null); } else { LOG.error("Json path '" + path + "' specified for the field '" + name + "' doesn't exist. " + "Dropping the error record: " + StructuredRecordStringConverter.toJsonString(input)); return; } } } else { Object value = input.get(name); if (value != null) { builder.set(name, value); } } } emitter.emit(builder.build()); }
Source:
<code>private void addListeners() { final UIManager uiManager = getMapperManager().getUiManager(); addOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().addOutput(); } }); removeOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().removeSelectedOutput(); } }); guessItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { List<DataMapTableView> outputsTablesView = getMapperManager().getUiManager().getOutputsTablesView(); for (DataMapTableView dataMapTableView : outputsTablesView) { dataMapTableView.notifyFocusLost(); } IPreferenceStore weightStore = CoreUIPlugin.getDefault().getPreferenceStore(); <START> getMapperManager().mapAutomaticallly(weightStore.getInt(ITalendCorePrefConstants.LEVENSHTEIN_WEIGHT), <END> weightStore.getInt(ITalendCorePrefConstants.JACCARD_WEIGHT)); } }); }</code><technical_language>read "weight" parameters here? need, read in AutoMapper also</technical_language>

Target:
private void addListeners() { final UIManager uiManager = getMapperManager().getUiManager(); addOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().addOutput(); } }); removeOutputItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { getMapperManager().removeSelectedOutput(); } }); guessItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { List<DataMapTableView> outputsTablesView = getMapperManager().getUiManager().getOutputsTablesView(); for (DataMapTableView dataMapTableView : outputsTablesView) { dataMapTableView.notifyFocusLost(); } getMapperManager().mapAutomaticallly(); } }); }
Source:
<code><START> public static Map<String, Class<?>> findMostSpecificTypesFromData(CsvReader csvReader, <END> String[] headers) throws IOException { Map<String, Class<?>> result = new HashMap<String, Class<?>>(); for (String header : headers) { result.put(header, Integer.class); } while (csvReader.readRecord()) { String[] record = csvReader.getValues(); List<String> values = Arrays.asList(record); if (record.length >= headers.length) { values = values.subList(0, headers.length); } int i = 0; for (String value : values) { String header = headers[i]; Class<?> type = result.get(header); if (type == Integer.class) { try { Integer.parseInt(value); } catch (NumberFormatException e) { try { Double.parseDouble(value); type = Double.class; } catch (NumberFormatException ex) { type = String.class; } } } else if (type == Double.class) { try { Double.parseDouble(value); } catch (NumberFormatException e) { type = String.class; } } else { type = String.class; } result.put(header, type); i++; } } return result; }</code><technical_language>Knock this protected (no need define public api here) - this provide a chance for subclasses smarter (for example WKTStratagy start recogning geometry column). this method is ugly/confusing :)</technical_language>

Target:
protected static Map<String, Class<?>> findMostSpecificTypesFromData(CsvReader csvReader, String[] headers) throws IOException { Map<String, Class<?>> result = new HashMap<String, Class<?>>(); for (String header : headers) { result.put(header, Integer.class); } while (csvReader.readRecord()) { String[] record = csvReader.getValues(); List<String> values = Arrays.asList(record); if (record.length >= headers.length) { values = values.subList(0, headers.length); } int i = 0; for (String value : values) { String header = headers[i]; Class<?> type = result.get(header); if (type == Integer.class) { try { Integer.parseInt(value); } catch (NumberFormatException e) { try { Double.parseDouble(value); type = Double.class; } catch (NumberFormatException ex) { type = String.class; } } } else if (type == Double.class) { try { Double.parseDouble(value); } catch (NumberFormatException e) { type = String.class; } } else { type = String.class; } result.put(header, type); i++; } } return result; }
Source:
<code>private Object[][] containerStateTestCases() { final ReferenceContext mappedReferenceContext = new ReferenceContext(5); final int slice1AlignmentStart = 10; final int slice1AlignmentSpan = 15; final Slice slice1 = new Slice(mappedReferenceContext); slice1.alignmentStart = slice1AlignmentStart; slice1.alignmentSpan = slice1AlignmentSpan; final int slice2AlignmentStart = 20; final int slice2AlignmentSpan = 20; <START> final Slice slice2 = new Slice(mappedReferenceContext); <END> slice2.alignmentStart = slice2AlignmentStart; slice2.alignmentSpan = slice2AlignmentSpan; final int expectedSpan = slice2AlignmentStart + slice2AlignmentSpan - slice1AlignmentStart; return new Object[][] { { Arrays.asList(slice1), mappedReferenceContext, slice1AlignmentStart, slice1AlignmentSpan }, { Arrays.asList(slice1, slice2), mappedReferenceContext, slice1AlignmentStart, expectedSpan }, { Arrays.asList(new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT), new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT)), ReferenceContext.MULTIPLE_REFERENCE_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, { Arrays.asList(new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT), new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT)), ReferenceContext.UNMAPPED_UNPLACED_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, }; }</code><technical_language>Minor suggestion improve readability of code below: mappedSlice a prefix for variables</technical_language>

Target:
private Object[][] containerStateTestCases() { final ReferenceContext mappedReferenceContext = new ReferenceContext(5); final int slice1AlignmentStart = 10; final int slice1AlignmentSpan = 15; final Slice mappedSlice1 = new Slice(mappedReferenceContext); mappedSlice1.alignmentStart = slice1AlignmentStart; mappedSlice1.alignmentSpan = slice1AlignmentSpan; final int slice2AlignmentStart = 20; final int slice2AlignmentSpan = 20; final Slice mappedSlice2 = new Slice(mappedReferenceContext); mappedSlice2.alignmentStart = slice2AlignmentStart; mappedSlice2.alignmentSpan = slice2AlignmentSpan; final int expectedSpan = slice2AlignmentStart + slice2AlignmentSpan - slice1AlignmentStart; return new Object[][] { { Arrays.asList(mappedSlice1), mappedReferenceContext, slice1AlignmentStart, slice1AlignmentSpan }, { Arrays.asList(mappedSlice1, mappedSlice2), mappedReferenceContext, slice1AlignmentStart, expectedSpan }, { Arrays.asList(new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT), new Slice(ReferenceContext.MULTIPLE_REFERENCE_CONTEXT)), ReferenceContext.MULTIPLE_REFERENCE_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, { Arrays.asList(new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT), new Slice(ReferenceContext.UNMAPPED_UNPLACED_CONTEXT)), ReferenceContext.UNMAPPED_UNPLACED_CONTEXT, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN }, }; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); YieldsApplication.setApplicationContext(getApplicationContext()); YieldsApplication.setResources(getResources()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUser = YieldsApplication.getUser(); mGroup = YieldsApplication.getGroup(); mMessages = new ArrayList<>(); mImage = null; mSendImage = false; mAdapter = new ListAdapterMessages(YieldsApplication.getApplicationContext(), R.layout.messagelayout, mMessages); mMessageScrollLayout = (ListView) findViewById(R.id.messageScrollLayout); mMessageScrollLayout.setAdapter(mAdapter); mInputField = (EditText) findViewById(R.id.inputMessageField); if(mUser == null || mGroup == null) { showErrorToast("Couldn't get group information."); mActionBar.setTitle("Unknown group"); } else { setHeaderBar(); try { retrieveGroupMessages(); } catch (IOException e) { <START> showErrorToast("Couldn't load messages"); <END> } } }</code><technical_language>is a need for a centralized toast generator</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); YieldsApplication.setApplicationContext(getApplicationContext()); YieldsApplication.setResources(getResources()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUser = YieldsApplication.getUser(); mGroup = YieldsApplication.getGroup(); mMessages = new ArrayList<>(); mImage = null; mSendImage = false; mAdapter = new ListAdapterMessages(YieldsApplication.getApplicationContext(), R.layout.messagelayout, mMessages); mMessageScrollLayout = (ListView) findViewById(R.id.messageScrollLayout); mMessageScrollLayout.setAdapter(mAdapter); mInputField = (EditText) findViewById(R.id.inputMessageField); if(mUser == null || mGroup == null) { String message = "Couldn't get group information."; YieldsApplication.showToast(getApplicationContext(), message); mActionBar.setTitle("Unknown group"); } else { setHeaderBar(); try { retrieveGroupMessages(); } catch (IOException e) { String message = "Couldn't load messages"; YieldsApplication.showToast(getApplicationContext(), message); } } }
Source:
<code>private void updateMenuItem() { MenuItem item = (MenuItem) widget; String text = model.getLocalizedLabel(); ParameterizedCommand parmCmd = model.getWbCommand(); String keyBindingText = null; if (parmCmd != null) { if (text == null || text.isEmpty()) { text = model.getCommand().getLocalizedCommandName(); } if (bindingService != null) { TriggerSequence binding = bindingService .getBestSequenceFor(parmCmd); if (binding != null) keyBindingText = binding.format(); } } if (text != null) { if (model instanceof MMenuElement) { String mnemonics = ((MMenuElement) model).getMnemonics(); if (mnemonics != null && !mnemonics.isEmpty()) { int idx = text.indexOf(mnemonics); if (idx != -1) { text = text.substring(0, idx) + '&' + text.substring(idx); } } } if (keyBindingText == null) item.setText(text); else item.setText(text + '\t' + keyBindingText); } else { item.setText(""); } <START> final String tooltip = getToolTipText(); <END> item.setToolTipText(tooltip); item.setSelection(model.isSelected()); item.setEnabled(model.isEnabled()); }</code><technical_language>model.getLocalizedTooltip()</technical_language>

Target:
protected void updateMenuItem() { MenuItem item = (MenuItem) widget; String text = getModel().getLocalizedLabel(); ParameterizedCommand parmCmd = getModel().getWbCommand(); String keyBindingText = null; if (parmCmd != null) { if (text == null || text.isEmpty()) { text = getModel().getCommand().getLocalizedCommandName(); } if (bindingService != null) { TriggerSequence binding = bindingService.getBestSequenceFor(parmCmd); if (binding != null) keyBindingText = binding.format(); } } if (text != null) { if (getModel() instanceof MMenuElement) { String mnemonics = ((MMenuElement) getModel()).getMnemonics(); if (mnemonics != null && !mnemonics.isEmpty()) { int idx = text.indexOf(mnemonics); if (idx != -1) { text = text.substring(0, idx) + '&' + text.substring(idx); } } } if (keyBindingText == null) item.setText(text); else item.setText(text + '\t' + keyBindingText); } else { item.setText(""); } final String tooltip = getToolTipText(false); item.setToolTipText(tooltip); item.setSelection(getModel().isSelected()); item.setEnabled(getModel().isEnabled()); }
Source:
<code>public void testSetupChildInvalidProperty() throws Exception { final Checker checker = new Checker(); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); <START> checker.setModuleFactory(factory); <END> final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); checkConfig.addAttribute("$$No such property", null); checker.finishLocalSetup(); try { checker.setupChild(checkConfig); fail("Exception is expected"); } catch (CheckstyleException ex) { assertEquals("Error message is not expected", "cannot initialize module " + checkConfig.getName() + " - Property '$$No such property' in module " + checkConfig.getName() + " does not exist, please check the documentation", ex.getMessage()); } }</code><technical_language>calling createChecker</technical_language>

Target:
public void testSetupChildInvalidProperty() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); checkConfig.addAttribute("$$No such property", null); try { createChecker(checkConfig); fail("Exception is expected"); } catch (CheckstyleException ex) { assertEquals("Error message is not expected", "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker" + " - Property '$$No such property' in module " + checkConfig.getName() + " does not exist, please check the documentation", ex.getMessage()); } }
Source:
<code>public void onStart() { super.onStart(); if (isSignedIn()) { attachRecyclerViewAdapter(); <START> } else { <END> signInAnonymously(); } }</code><technical_language>before: this change unrelated topic of this PR expresses a personal preference. While preference existing code, pollute this PR</technical_language>

Target:
public void onStart() { super.onStart(); if (!isSignedIn()) { signInAnonymously(); } else { attachRecyclerViewAdapter(); } }
Source:
<code><START> ValidationResult validateBondOptionsForNewAttachement(NetworkAttachment attachment) { <END> Bond newOrEditedBondInterfaceForAttachement = bondsMap.get(attachment.getNicName()); if(newOrEditedBondInterfaceForAttachement != null){ return validateNewOrModifiedBondOptionsForNewAttachement(attachment.getNetworkName(), newOrEditedBondInterfaceForAttachement); } return validateExistingBondOptionsForNewAttachement(attachment); }</code><technical_language>If follow suggestion in line 444, this method removed</technical_language>

Target:
ValidationResult validateBondOptionsForNewAttachement(NetworkAttachment attachment) { VdsNetworkInterface existingNetworkInterfaceForAttachement = existingInterfacesMap.get(attachment.getNicName()); if(existingNetworkInterfaceForAttachement != null && existingNetworkInterfaceForAttachement.isBond()){ String bondMode = BondMode.getBondMode((Bond) existingNetworkInterfaceForAttachement); if ( !BondMode.isBondModeValidForVmNetwork(bondMode) && networkBusinessEntityMap.get(attachment.getNetworkId(), attachment.getNetworkName()).isVmNetwork()){ return new ValidationResult(EngineMessage.INVALID_BOND_MODE_FOR_BOND_WITH_VM_NETWORK, ReplacementUtils.createSetVariableString(VAR_BOND_NAME, attachment.getNicName()), ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, attachment.getNetworkName())); } } return ValidationResult.VALID; }
Source:
<code>private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescriptor, NodeExecutionAdvisor advisor) { Set<ExclusiveResource> exclusiveResources = getExclusiveResources(testDescriptor); if (exclusiveResources.isEmpty()) { <START> advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(singleton(GLOBAL_READ))); <END> testDescriptor.getChildren().forEach(child -> walk(globalLockDescriptor, child, advisor)); } else { Set<ExclusiveResource> allResources = new HashSet<>(exclusiveResources); advisor.forceDescendantExecutionMode(testDescriptor, SAME_THREAD); doForChildrenRecursively(testDescriptor, child -> { allResources.addAll(getExclusiveResources(child)); advisor.forceDescendantExecutionMode(child, SAME_THREAD); }); if (!globalLockDescriptor.equals(testDescriptor) && allResources.contains(GLOBAL_READ_WRITE)) { advisor.forceDescendantExecutionMode(globalLockDescriptor, SAME_THREAD); doForChildrenRecursively(globalLockDescriptor, child -> advisor.forceDescendantExecutionMode(child, SAME_THREAD)); advisor.useResourceLock(globalLockDescriptor, lockManager.getLockForResources(singleton(GLOBAL_READ_WRITE))); } advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(allResources)); } }</code><technical_language>create a constant for singleton locks, real need create new instances, for read_write</technical_language>

Target:
private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescriptor, NodeExecutionAdvisor advisor) { Set<ExclusiveResource> exclusiveResources = getExclusiveResources(testDescriptor); if (exclusiveResources.isEmpty()) { advisor.useResourceLock(testDescriptor, globalReadLock); testDescriptor.getChildren().forEach(child -> walk(globalLockDescriptor, child, advisor)); } else { Set<ExclusiveResource> allResources = new HashSet<>(exclusiveResources); advisor.forceDescendantExecutionMode(testDescriptor, SAME_THREAD); doForChildrenRecursively(testDescriptor, child -> { allResources.addAll(getExclusiveResources(child)); advisor.forceDescendantExecutionMode(child, SAME_THREAD); }); if (!globalLockDescriptor.equals(testDescriptor) && allResources.contains(GLOBAL_READ_WRITE)) { advisor.forceDescendantExecutionMode(globalLockDescriptor, SAME_THREAD); doForChildrenRecursively(globalLockDescriptor, child -> advisor.forceDescendantExecutionMode(child, SAME_THREAD)); advisor.useResourceLock(globalLockDescriptor, globalReadWriteLock); } advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(allResources)); } }
Source:
<code><START> public void cleanUpArtifacts() throws Exception { <END> restAPIStore.removeApplicationById(applicationID); restAPIPublisher.deleteAPIByID(apiID); }</code><technical_language>clenUp() remove</technical_language>

Target:
public void cleanUpArtifacts() throws Exception { restAPIStore.removeApplicationById(applicationID); restAPIPublisher.deleteAPIByID(apiID); super.cleanUp(); }