auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); <START> String topicId = ((DiscussionBlockModel)getArguments().getSerializable( <END> Router.EXTRA_COURSE_UNIT)).getData().topicId; Bundle args = new Bundle(); args.putString(Router.EXTRA_DISCUSSION_TOPIC_ID, topicId); args.putSerializable(Router.EXTRA_ENROLLMENT_COURSE_DATA, getArguments().getSerializable(Router.EXTRA_ENROLLMENT_COURSE_DATA)); Fragment fragment = new CourseDiscussionPostsThreadFragment(); fragment.setArguments(args); FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.content, fragment, FRAG_TAG); fragmentTransaction.disallowAddToBackStack(); fragmentTransaction.commit(); }</code><technical_language>a space (DiscussionBlockModel) cast</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (savedInstanceState == null) { String topicId = ((DiscussionBlockModel) unit).getData().topicId; Fragment fragment = CourseDiscussionPostsThreadFragment.newInstance(topicId, getArguments().getSerializable(Router.EXTRA_COURSE_DATA), !TextUtils.isEmpty(unit.getDisplayName())); FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.content, fragment); fragmentTransaction.commit(); } }
Source:
<code>public void canRemoveHook() throws Exception { final Repos repos = RtHooksITCase.github().repos(); <START> final Repo repo = repos.create( <END> Json.createObjectBuilder().add( "name", RandomStringUtils.randomNumeric(5) ).build() ); try { final Hooks hooks = repo.hooks(); final Hook hook = hooks.create( "geocommit", Collections.<String, String>emptyMap() ); hooks.remove(hook.number()); MatcherAssert.assertThat( hooks.iterate(), Matchers.not(Matchers.hasItem(hook)) ); } finally { repos.remove(repo.coordinates()); } }</code><technical_language>if move this repeated code final Repos repos = RtHooksITCase.github().repos(); final Repo repo = repos.create( .... ) static method reused tests</technical_language>

Target:
public void canRemoveHook() throws Exception { final Repos repos = RtHooksITCase.repos(); final Repo repo = RtHooksITCase.repo(repos); try { final Hooks hooks = repo.hooks(); final Hook hook = hooks.create( "geocommit", Collections.<String, String>emptyMap() ); hooks.remove(hook.number()); MatcherAssert.assertThat( hooks.iterate(), Matchers.not(Matchers.hasItem(hook)) ); } finally { repos.remove(repo.coordinates()); } }
Source:
<code>private void changeNameListener() { final EditText editTextUsername = new EditText(UserSettingsActivity.this); editTextUsername.setId(R.id.editText); editTextUsername.setText(mUser.getName()); editTextUsername.setSelection(editTextUsername.length()); final int minimumSize = getResources().getInteger(R.integer.minimumNameSize); final AlertDialog dialog = new AlertDialog.Builder(UserSettingsActivity.this) .setTitle("Change your username") .setMessage("Your new username must be at least " + minimumSize + " characters long.") .setView(editTextUsername) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override <START> public void onClick(DialogInterface dialog, int which) { <END> } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String newName = editTextUsername.getText().toString(); if (newName.length() < minimumSize) { YieldsApplication.showToast(getApplicationContext(), "The username is too short"); } else { YieldsApplication.showToast(getApplicationContext(), "Username changed to \"" + newName + "\" !"); mUser.setName(newName); ServiceRequest request = new UserUpdateRequest(mUser); YieldsApplication.getBinder().sendRequest(request); dialog.dismiss(); } } }); }</code><technical_language>Empty method</technical_language>

Target:
private void changeNameListener() { final EditText editTextUsername = new EditText(UserSettingsActivity.this); editTextUsername.setId(R.id.editText); editTextUsername.setText(mUser.getName()); editTextUsername.setSelection(editTextUsername.length()); final int minimumSize = getResources().getInteger(R.integer.minimumNameSize); DialogInterface.OnClickListener emptyListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }; final AlertDialog dialog = new AlertDialog.Builder(UserSettingsActivity.this) .setTitle("Change your username") .setMessage("Your new username must be at least " + minimumSize + " characters long.") .setView(editTextUsername) .setPositiveButton("Ok", emptyListener) .setNegativeButton("Cancel", emptyListener) .create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String newName = editTextUsername.getText().toString(); if (newName.length() < minimumSize) { YieldsApplication.showToast(getApplicationContext(), "The username is too short"); } else { YieldsApplication.showToast(getApplicationContext(), "Username changed to \"" + newName + "\" !"); mUser.setName(newName); ServiceRequest request = new UserUpdateRequest(mUser); YieldsApplication.getBinder().sendRequest(request); dialog.dismiss(); } } }); }
Source:
<code>boolean hasRestoringTasks() { <START> if (restoring.isEmpty()) { <END> restoredPartitions.clear(); restoringByPartition.clear(); } return !restoring.isEmpty(); }</code><technical_language>a bit awkward a hasXXX call side effects. I do understand motivation here, I guess this is revisit a subsequent refactoring/follow-on PR</technical_language>

Target:
boolean hasRestoringTasks() { return !restoring.isEmpty(); }
Source:
<code>public List<MappingFileData> build(BeanContainer beanContainer, DestBeanCreator destBeanCreator, PropertyDescriptorFactory propertyDescriptorFactory) { <START> List<MappingFileData> answer = new ArrayList<MappingFileData>(); <END> for (MappingsDefinition mappingsDefinition : mappingsDefinitions) { Configuration configuration = null; if (mappingsDefinition.getConfiguration() != null) { configuration = mappingsDefinition.getConfiguration().build(beanContainer); } MappingFileData data = new MappingFileData(); data.setConfiguration(configuration); data.getClassMaps().addAll(mappingsDefinition.build(configuration, beanContainer, destBeanCreator, propertyDescriptorFactory)); answer.add(data); } return answer; }</code><technical_language>cleanup a bit diamond operator</technical_language>

Target:
public List<MappingFileData> build(BeanContainer beanContainer, DestBeanCreator destBeanCreator, PropertyDescriptorFactory propertyDescriptorFactory) { List<MappingFileData> answer = new ArrayList<>(); for (MappingsDefinition mappingsDefinition : mappingsDefinitions) { Configuration configuration = null; if (mappingsDefinition.getConfiguration() != null) { configuration = mappingsDefinition.getConfiguration().build(beanContainer); } MappingFileData data = new MappingFileData(); data.setConfiguration(configuration); data.getClassMaps().addAll(mappingsDefinition.build(configuration, beanContainer, destBeanCreator, propertyDescriptorFactory)); answer.add(data); } return answer; }
Source:
<code>public void verifyInputExpand(String comment) { showCommentsSection(); String inputHeight = commentInputArea.getCssValue("height"); commentInputArea.sendKeys(comment); String inputExpandedHeight = commentInputArea.getCssValue("height"); <START> Assertion.assertTrue(Integer.parseInt(inputExpandedHeight.substring(0, 1)) <END> > Integer.parseInt(inputHeight.substring(0, 1)), "input is not bigger" ); }</code><technical_language>wrong formatting, hard read</technical_language>

Target:
public void verifyInputExpand(String comment) { showCommentsSection(); int inputHeight = Integer.parseInt(commentInputArea.getCssValue("height").substring(0, 1)); commentInputArea.sendKeys(comment); int inputExpandedHeight = Integer.parseInt(commentInputArea.getCssValue("height").substring(0, 1)); Assertion.assertTrue(inputExpandedHeight > inputHeight, "input is not bigger"); }
Source:
<code>public void canCreateAllPopularImageVM() { if (skipInPlayback()) { return; } rgName = generateRandomResourceName("rg", 10); List<Mono<VirtualMachine>> vmFluxes = new ArrayList<>(); for (KnownWindowsVirtualMachineImage image : KnownWindowsVirtualMachineImage.values()) { Mono<VirtualMachine> flux = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularWindowsImage(image) .withAdminUsername("testUser") .withAdminPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmFluxes.add(flux); } for (KnownLinuxVirtualMachineImage image : KnownLinuxVirtualMachineImage.values()) { <START> Mono<VirtualMachine> flux = computeManager.virtualMachines() <END> .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularLinuxImage(image) .withRootUsername("testUser") .withRootPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmFluxes.add(flux); } Flux.merge(vmFluxes).blockLast(); }</code><technical_language>If is Mono, do name flux</technical_language>

Target:
public void canCreateAllPopularImageVM() { if (skipInPlayback()) { return; } rgName = generateRandomResourceName("rg", 10); List<Mono<VirtualMachine>> vmMonos = new ArrayList<>(); for (KnownWindowsVirtualMachineImage image : KnownWindowsVirtualMachineImage.values()) { Mono<VirtualMachine> mono = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularWindowsImage(image) .withAdminUsername("testUser") .withAdminPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmMonos.add(mono); } for (KnownLinuxVirtualMachineImage image : KnownLinuxVirtualMachineImage.values()) { Mono<VirtualMachine> mono = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularLinuxImage(image) .withRootUsername("testUser") .withRootPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmMonos.add(mono); } Flux.merge(vmMonos).blockLast(); }
Source:
<code>public void testRemoveWithHostName() throws Exception { setUpGetEntityExpectations(); <START> VDS host = BackendHostsResourceTest.setUpEntityExpectations(control.createMock(VDS.class), control.createMock(RpmVersion.class), 1); <END> setUpGetEntityExpectations("Hosts: name=" + NAMES[1], SearchType.VDS, host); setUriInfo(setUpActionExpectations(VdcActionType.RemoveStorageDomain, RemoveStorageDomainParameters.class, new String[] { "StorageDomainId", "VdsId", "DoFormat" }, new Object[] { GUIDS[0], GUIDS[1], Boolean.FALSE }, true, true)); StorageDomain storageDomain = new StorageDomain(); storageDomain.setHost(new Host()); storageDomain.getHost().setName(NAMES[1]); verifyRemove(collection.remove(GUIDS[0].toString(), storageDomain)); }</code><technical_language>(no need define version)</technical_language>

Target:
public void testRemoveWithHostName() throws Exception { setUpGetEntityExpectations(); VDS host = BackendHostsResourceTest.setUpEntityExpectations(control.createMock(VDS.class), 1); setUpGetEntityExpectations("Hosts: name=" + NAMES[1], SearchType.VDS, host); setUriInfo(setUpActionExpectations(VdcActionType.RemoveStorageDomain, RemoveStorageDomainParameters.class, new String[] { "StorageDomainId", "VdsId", "DoFormat" }, new Object[] { GUIDS[0], GUIDS[1], Boolean.FALSE }, true, true)); StorageDomain storageDomain = new StorageDomain(); storageDomain.setHost(new Host()); storageDomain.getHost().setName(NAMES[1]); verifyRemove(collection.remove(GUIDS[0].toString(), storageDomain)); }
Source:
<code><START> private Set<LoadBalancer> createLoadBalancers(StackV4Request source, Stack stack, DetailedEnvironmentResponse environment) { <END> LOGGER.info("Setting up load balancers for stack {}", source.getName()); Set<LoadBalancer> loadBalancers = new HashSet<>(); Optional<TargetGroup> knoxTargetGroup = setupKnoxTargetGroup(stack); if (knoxTargetGroup.isPresent()) { if (shouldCreateInternalKnoxLoadBalancer(source.getType())) { setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.DEFAULT_GATEWAY, stack), knoxTargetGroup.get()); } if (shouldCreateExternalKnoxLoadBalancer(source.getType(), environment.getNetwork())) { setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.ENDPOINT_ACCESS_GATEWAY, stack), knoxTargetGroup.get()); } } return loadBalancers; }</code><technical_language>I useful add some extra log lines, a if investigate</technical_language>

Target:
private Set<LoadBalancer> createLoadBalancers(StackV4Request source, Stack stack, DetailedEnvironmentResponse environment) { LOGGER.info("Setting up load balancers for stack {}", source.getName()); Set<LoadBalancer> loadBalancers = new HashSet<>(); Optional<TargetGroup> knoxTargetGroup = setupKnoxTargetGroup(stack); if (knoxTargetGroup.isPresent()) { if (shouldCreateInternalKnoxLoadBalancer(source.getType())) { LOGGER.debug("Found Knox enabled instance groups in stack. Setting up internal Knox load balancer"); setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.DEFAULT_GATEWAY, stack), knoxTargetGroup.get()); } if (shouldCreateExternalKnoxLoadBalancer(source.getType(), environment.getNetwork())) { LOGGER.debug("Public endpoint access gateway is enabled. Setting up public Knox load balancer"); setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.ENDPOINT_ACCESS_GATEWAY, stack), knoxTargetGroup.get()); } } else { LOGGER.debug("No Knox instance groups found. If load balancer creation is enabled, Knox routing in the load balancer will be skipped."); } return loadBalancers; }
Source:
<code>private void postReload(Request req, Response resp) throws IOException { ClassLoader webLoader = req.getContext().getLoader().getClassLoader(); if (webLoader instanceof NuxeoDevWebappClassLoader) { NuxeoDevWebappClassLoader loader = (NuxeoDevWebappClassLoader) webLoader; DevFrameworkBootstrap bootstrap = loader.getBootstrap(); String devBundlesLocation = bootstrap.getDevBundlesLocation(); try { Files.copy(req.getStream(), Paths.get(devBundlesLocation), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { resp.sendError(500, "Unable to write to dev.bundles"); <START> } <END> bootstrap.loadDevBundles(); } resp.setStatus(200); }</code><technical_language>Log stack trace somewhere</technical_language>

Target:
private void postReload(Request req, Response resp) throws IOException { ClassLoader webLoader = req.getContext().getLoader().getClassLoader(); if (webLoader instanceof NuxeoDevWebappClassLoader) { NuxeoDevWebappClassLoader loader = (NuxeoDevWebappClassLoader) webLoader; DevFrameworkBootstrap bootstrap = loader.getBootstrap(); String devBundlesLocation = bootstrap.getDevBundlesLocation(); try { Files.copy(req.getStream(), Paths.get(devBundlesLocation), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { log.error("Unable to write to dev.bundles", e); resp.sendError(500, "Unable to write to dev.bundles"); } bootstrap.loadDevBundles(); } resp.setStatus(200); }
Source:
<code>public void seek(final long pos) throws IOException { if (mFile == null) { <START> throw new IOException("Cannot seek on stream based file " + mFile.getSource()); <END> } final long compressedOffset = BlockCompressedFilePointerUtil.getBlockAddress(pos); final int uncompressedOffset = BlockCompressedFilePointerUtil.getBlockOffset(pos); final int available; if (mBlockAddress == compressedOffset && mCurrentBlock != null) { available = mCurrentBlock.length; } else { mFile.seek(compressedOffset); mBlockAddress = compressedOffset; mLastBlockLength = 0; readBlock(); available = available(); } if (uncompressedOffset > available || (uncompressedOffset == available && !eof())) { throw new IOException("Invalid file pointer: " + pos + " for " + mFile.getSource()); } mCurrentOffset = uncompressedOffset; }</code><technical_language>test this too</technical_language>

Target:
public void seek(final long pos) throws IOException { if (mFile == null) { throw new IOException(CANNOT_SEEK_STREAM_MSG); } final long compressedOffset = BlockCompressedFilePointerUtil.getBlockAddress(pos); final int uncompressedOffset = BlockCompressedFilePointerUtil.getBlockOffset(pos); final int available; if (mBlockAddress == compressedOffset && mCurrentBlock != null) { available = mCurrentBlock.length; } else { mFile.seek(compressedOffset); mBlockAddress = compressedOffset; mLastBlockLength = 0; readBlock(); available = available(); } if (uncompressedOffset > available || (uncompressedOffset == available && !eof())) { throw new IOException(INVALID_FILE_PTR_MSG + pos + " for " + mFile.getSource()); } mCurrentOffset = uncompressedOffset; }
Source:
<code>public Map<Class<? extends Annotation>, List<FrameworkMethod>> getAnnotationToMethods() { <START> return Collections.unmodifiableMap(fMethodsForAnnotations); <END> }</code><technical_language>returned Map is unmodifiable, values modifiable lists. Please change to: public List<FrameworkMethod> getAnnotatedMethods(Class<? extends Annotation> annotation) { return Collections.unmodifiableList(fMethodsForAnnotations.get(annotation)); } (though I prefer values for fMethodsForAnnotations unmodifiable lists)</technical_language>

Target:
public Map<Class<? extends Annotation>, List<FrameworkMethod>> getAnnotationToMethods() { return fMethodsForAnnotations; }
Source:
<code>public String view() { try { String frontEndCaseDataIn = extractWidgetConfig("frontEndCaseData"); this.setFrontEndCaseData(frontEndCaseDataIn); String channelIn = extractWidgetConfig("channel"); this.setChannel(channelIn); KieBpmConfig config = formManager.getKieServerConfigurations().get(this.getKnowledgeSourceId()); <START> if (null == config) { <END> logger.warn("Null configuration"); this.setErrorCode(ERROR_NULL_CONFIG); return SUCCESS; } this.setComments(this.getCaseManager().getCaseComments(config, this.getContainerid(), this.getCasePath()).toString()); } catch (ApsSystemException t) { logger.error("Error getting the configuration parameter", t); return FAILURE; } return SUCCESS; }</code><technical_language>this in base action? repeated of widgets. a call super class for config manage this error condition block in widget</technical_language>

Target:
public String view() { try { if (!isKieServerConfigurationValid()) { return SUCCESS; } String frontEndCaseDataIn = extractWidgetConfig("frontEndCaseData"); this.setFrontEndCaseData(frontEndCaseDataIn); String channelIn = extractWidgetConfig("channel"); this.setChannel(channelIn); KieBpmConfig config = formManager.getKieServerConfigurations().get(this.getKnowledgeSourceId()); this.setComments(this.getCaseManager().getCaseComments(config, this.getContainerid(), this.getCasePath()).toString()); } catch (ApsSystemException t) { logger.error("Error getting the configuration parameter", t); return FAILURE; } return SUCCESS; }
Source:
<code>public ResponseEntity undelete(@RepositoryMapping Repository repository, @RequestHeader(HttpHeaders.ACCEPT) String accept) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); try { repositoryManagementService.undeleteTrash(storageId, repositoryId); logger.debug("Undeleted trash for repository {}.", repositoryId); } catch (ArtifactStorageException e) { <START> if (repositoryManagementService.getStorage(storageId) == null) <END> { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(getResponseEntityBody("The specified storageId does not exist!", accept)); } else if (repositoryManagementService.getStorage(storageId) .getRepository(repositoryId) == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(getResponseEntityBody("The specified repositoryId does not exist!", accept)); } return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(getResponseEntityBody("Could not restore the trash for a specified repository.", accept)); } return ResponseEntity.ok(getResponseEntityBody("The trash in '" + storageId + ":" + repositoryId + "' " + "has been restored successfully.", accept)); }</code><technical_language>longer happen</technical_language>

Target:
public ResponseEntity undelete(@RepositoryMapping Repository repository, @RequestHeader(HttpHeaders.ACCEPT) String accept) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); try { repositoryManagementService.undeleteTrash(storageId, repositoryId); logger.debug("Undeleted trash for repository {}.", repositoryId); } catch (ArtifactStorageException e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(getResponseEntityBody("Could not restore the trash for a specified repository.", accept)); } return ResponseEntity.ok(getResponseEntityBody("The trash in '" + storageId + ":" + repositoryId + "' " + "has been restored successfully.", accept)); }
Source:
<code><START> public Parcelable onSaveInstanceState() { <END> if (true) { return super.onSaveInstanceState(); } Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.selectedId = this.checkedId; return ss; }</code><technical_language>corrected this, left a lot of code in place, please clean</technical_language>

Target:
public Parcelable onSaveInstanceState() { if (!doesNavigationViewSavedStateExist()) { return super.onSaveInstanceState(); } Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.selectedId = this.checkedId; return ss; }
Source:
<code>public void uploadFile(String containerName, String fileName, InputStream inputStream) throws BlobStorageException, IOException { try { BlobContainerClient containerClient = getContainer(containerName, true); <START> BlockBlobClient blobClient = containerClient.getBlobClient(fileName).getBlockBlobClient(); <END> blobClient.uploadWithResponse(inputStream, inputStream.available(), null, null, null, null, null, null, Context.NONE); } catch (UncheckedIOException e) { throw e.getCause(); } }</code><technical_language>method getBlockBlobClient(String containerName, String blobName, boolean autoCreateContainer) here</technical_language>

Target:
public void uploadFile(String containerName, String fileName, InputStream inputStream) throws BlobStorageException, IOException { try { BlockBlobClient blobClient = getBlockBlobClient(containerName, fileName, true); blobClient.uploadWithResponse(inputStream, inputStream.available(), null, null, null, null, null, null, Context.NONE); } catch (UncheckedIOException e) { throw e.getCause(); } }
Source:
<code>public Object execute() throws Exception { if(this.agents != null) { boolean single = (agents.size() == 1); for(AgentMessagingInterface agent : this.agents) { out.println("Found agent with appname=" + agent.getApplicationName()); if(single) { <START> if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { <END> out.println("Single agent eligible to cancel recipe"); cancelRecipe(agent.getApplicationName(), agent.getScopedInstancePath()); } } else if(agent.getApplicationName().equals(this.applicationName)) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Agent is eligible to cancel recipe"); cancelRecipe(this.applicationName, this.scopedInstancePath); } } } } else { out.println("No agent found, command not applicable"); } return null; }</code><technical_language>Objects.equals( ... )</technical_language>

Target:
public Object execute() throws Exception { if(this.agents != null) { boolean single = (agents.size() == 1); for(AgentMessagingInterface agent : this.agents) { out.println("Found agent with appname=" + agent.getApplicationName()); if(single) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Single agent eligible to cancel recipe"); cancelRecipe(agent.getApplicationName(), agent.getScopedInstancePath()); } } else if(Objects.equals(agent.getApplicationName(), this.applicationName)) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Agent is eligible to cancel recipe"); cancelRecipe(this.applicationName, this.scopedInstancePath); } } } } else { out.println("No agent found, command not applicable"); } return null; }
Source:
<code>public static void main(String[] args) { String rowKey = String.format("rowKey0"); Put put = new Put(Bytes.toBytes(rowKey)); byte[] value = RandomStringUtils.randomAlphanumeric(10000).getBytes(); put.addColumn(Bytes.toBytes("Family1"), Bytes.toBytes("Qaulifier"), value); BigtableOptions options = BigtableOptions.builder() .setInstanceId("instanceId") .setProjectId("projectId") .build(); HBaseRequestAdapter adapter = new HBaseRequestAdapter(options, TableName.valueOf("tableName"), new Configuration()); <START> requestContext = RequestContext.create(adapter.getBigtableTableName().toGcbInstanceName(), ""); <END> for (int i = 0; i < 10; i++) { putAdapterPerf(adapter, put); } }</code><technical_language>adapter.getBigtableTableName().toGcbInstanceName() right here. options.getGcbInstanceName()</technical_language>

Target:
public static void main(String[] args) { String rowKey = String.format("rowKey0"); Put put = new Put(Bytes.toBytes(rowKey)); byte[] value = RandomStringUtils.randomAlphanumeric(10000).getBytes(); put.addColumn(Bytes.toBytes("Family1"), Bytes.toBytes("Qaulifier"), value); BigtableOptions options = BigtableOptions.builder() .setInstanceId("instanceId") .setProjectId("projectId") .build(); HBaseRequestAdapter adapter = new HBaseRequestAdapter(options, TableName.valueOf("tableName"), new Configuration()); requestContext = RequestContext.create(options.getInstanceName().toGcbInstanceName(), ""); for (int i = 0; i < 10; i++) { putAdapterPerf(adapter, put); } }
Source:
<code>public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); try { response = urlopen.open("<LINK_0>"); Matcher matcher; matcher = reBalance.matcher(response); int i = 0; while (matcher.find()) { BigDecimal amount = Helpers.parseBalance(matcher.group(3).replace(",", "")).negate(); Account account = new Account( Html.fromHtml(matcher.group(2)).toString().trim(), amount, matcher.group(1).trim(), Account.LOANS); if (i > 0) { account.setAliasfor("0"); } accounts.add(account); balance = balance.add(amount); i++; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } <START> finally { <END> super.updateComplete(); } }</code><technical_language>remove finally {</technical_language>

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); response = urlopen.open("<LINK_0>"); Matcher matcher; matcher = reBalance.matcher(response); int i = 0; while (matcher.find()) { BigDecimal amount = Helpers.parseBalance(matcher.group(3).replace(",", "")).negate(); Account account = new Account( Html.fromHtml(matcher.group(2)).toString().trim(), amount, matcher.group(1).trim(), Account.LOANS); if (i > 0) { account.setAliasfor("0"); } accounts.add(account); balance = balance.add(amount); i++; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
<code>public int read(byte b[], int off, int len) { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (pos >= count) { return -1; } if (pos + len > count) { len = count - pos; } if (len <= 0) { return 0; } <START> System.arraycopy(buf, pos, b, off, len); <END> pos += len; return len; }</code><technical_language>org.mozilla.internal.Sys class here</technical_language>

Target:
public int read(byte b[], int off, int len) { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (pos >= count) { return -1; } if (pos + len > count) { len = count - pos; } if (len <= 0) { return 0; } Sys.copyArray(buf, pos, b, off, len); pos += len; return len; }
Source:
<code>protected void disableDiscoveryProtocol(JChannel c) { <START> c.getProtocolStack().getProtocols().stream() <END> .filter(Discovery.class::isInstance) .forEach(p -> { if (!(p instanceof TEST_PING)) throw new IllegalStateException("TEST_PING required for this test."); ((TEST_PING) p).suspend(); }); }</code><technical_language>findProtocol() method. TEST_PING ping = c.getProtocolStack().findProtocol(TEST_PING.class); ping.suspend();</technical_language>

Target:
protected void disableDiscoveryProtocol(JChannel c) { ((TEST_PING)c.getProtocolStack().findProtocol(TEST_PING.class)).suspend(); }
Source:
<code>public void reloadData() { setContentShown(false); Log.d("TEST", "reloadData callleeeed"); loadReadme() <START> .compose(RxTools.handle(getActivity(), RepositoryService.LOAD_README, true)) <END> .subscribe(mReadmeConsumer, e -> { Log.d("TEST-RE", "error readme: " + e); }); loadPullRequestsCount() .compose(RxTools.handle(getActivity(), RepositoryService.LOAD_PULL_REQUESTS_COUNT, true)) .subscribe(mLoadPullRequestsCount, e -> { Log.d("TEST", "load pull request ERROR "); }); }</code><technical_language>RepositoryActivity compose method calls. explain here</technical_language>

Target:
private void reloadData() { setContentShown(false); loadReadme(true); loadPullRequestsCount(true); }
Source:
<code>protected void initChannel(SocketChannel ch) throws Exception { if (sslEngine != null) { <START> log.debug("adding ssl handler"); <END> ch.pipeline().addLast("ssl", new SslHandler(this.sslEngine)); } ch.pipeline().addLast("decoder", new HttpResponseDecoder()); ch.pipeline().addLast("encoder", new HttpRequestEncoder()); if (httpTraceLogEnabled) { ch.pipeline().addLast(Constants.HTTP_TRACE_LOG_HANDLER, new HTTPTraceLoggingHandler("tracelog.http.upstream", LogLevel.DEBUG)); } ch.pipeline().addLast(Constants.IDLE_STATE_HANDLER, new IdleStateHandler(socketTimeout, socketTimeout, 0, TimeUnit.MILLISECONDS)); childChannelContext.channel().pipeline().remove(Constants.IDLE_STATE_HANDLER); RedirectHandler redirectHandler = new RedirectHandler(originalChannelContext, sslEngine, httpTraceLogEnabled, maxRedirectCount); ch.pipeline().addLast(Constants.REDIRECT_HANDLER, redirectHandler); }</code><technical_language>wrap this isDebugEnabled()</technical_language>

Target:
protected void initChannel(SocketChannel ch) throws Exception { if (sslEngine != null) { if (log.isDebugEnabled()) { log.debug("adding ssl handler"); } ch.pipeline().addLast("ssl", new SslHandler(this.sslEngine)); } ch.pipeline().addLast("compressor", new HttpContentCompressor()); ch.pipeline().addLast("decoder", new HttpResponseDecoder()); ch.pipeline().addLast("encoder", new HttpRequestEncoder()); if (httpTraceLogEnabled) { ch.pipeline().addLast(Constants.HTTP_TRACE_LOG_HANDLER, new HTTPTraceLoggingHandler("tracelog.http.upstream", LogLevel.DEBUG)); } RedirectHandler redirectHandler = new RedirectHandler(sslEngine, httpTraceLogEnabled, maxRedirectCount, originalChannelContext, isIdleHandlerOfTargetChannelRemoved); ch.pipeline().addLast(Constants.REDIRECT_HANDLER, redirectHandler); }
Source:
<code>public void changeEmailAddress() { EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); String newEmailAddress = MailFunctions.getEmail(editPrefPage.getEmailAdress()); MailFunctions.deleteAllEmails(USERNAME, PASSWORD); <START> Assertion.assertNotEquals(newEmailAddress, editPrefPage.getEmailAdress(), <END> "New email and old email SHOULD NOT be the same"); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); Assertion.assertTrue(prefPage.getBannerNotifications().isNotificationMessageVisible(), "Notification message is not visible"); editPrefPage.enterEmailChangeLink(USERNAME, PASSWORD); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress, "Email address doesn't equal to new email address"); }</code><technical_language>is 'mail' 'email'? prefer 'email' consistent (EmailFunctions?)</technical_language>

Target:
public void changeEmailAddress() { EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); String newEmailAddress = EmailUtils.getEmail(editPrefPage.getEmailAdress()); EmailUtils.deleteAllEmails(USERNAME, PASSWORD); Assertion.assertNotEquals(newEmailAddress, editPrefPage.getEmailAdress(), "New email and old email SHOULD NOT be the same"); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); Assertion.assertTrue(prefPage.getBannerNotifications().isNotificationMessageVisible(), "Notification message is not visible"); editPrefPage.enterEmailChangeLink(USERNAME, PASSWORD); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress, "Email address doesn't equal to new email address"); }
Source:
<code>protected AuthenticationRequest createAuthenticationRequest(Authentication authentication) { String username = (String) authentication.getPrincipal(); String password = (String) authentication.getCredentials(); if (!Strings.hasText(username)){ <START> throw new AuthenticationServiceException("must have username and password"); <END> } return UsernamePasswordRequest.builder().setUsernameOrEmail(username).setPassword(password).build(); }</code><technical_language>This strictly true - Stormpath supports usernames email addresses for logins. "Login password required" generic</technical_language>

Target:
protected AuthenticationRequest createAuthenticationRequest(Authentication authentication) { String username = (String) authentication.getPrincipal(); String password = (String) authentication.getCredentials(); if (!Strings.hasText(username)){ throw new AuthenticationServiceException("Login and password required"); } return UsernamePasswordRequest.builder().setUsernameOrEmail(username).setPassword(password).build(); }
Source:
<code>public FactoryDto resolveFactory( @ApiParam(value = "Parameters provided to create factories") Map<String, String> parameters, @ApiParam( value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam(VALIDATE_QUERY_PARAMETER) Boolean validate) throws BadRequestException, ServerException { requiredNotNull(parameters, "Factory build parameters"); FactoryParametersResolver resolver = factoryParametersResolverHolder.getFactoryParametersResolver(parameters); if (resolver == null) { throw new BadRequestException(FACTORY_NOT_RESOLVABLE); } <START> FactoryDto resolvedFactory = resolver.createFactory(parameters); <END> if (validate) { acceptValidator.validateOnAccept(resolvedFactory); } return injectLinks(resolvedFactory); }</code><technical_language>removed null check for this. <LINK_0> I guess check for null</technical_language>

Target:
public FactoryDto resolveFactory( @ApiParam(value = "Parameters provided to create factories") Map<String, String> parameters, @ApiParam( value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam(VALIDATE_QUERY_PARAMETER) Boolean validate) throws BadRequestException, ServerException { requiredNotNull(parameters, "Factory build parameters"); FactoryDto resolvedFactory = factoryParametersResolverHolder .getFactoryParametersResolver(parameters) .createFactory(parameters); if (resolvedFactory == null) { throw new BadRequestException(FACTORY_NOT_RESOLVABLE); } if (validate) { acceptValidator.validateOnAccept(resolvedFactory); } return injectLinks(resolvedFactory); }
Source:
<code>public Set<String> getTestAnnotationProcessors() { ExperimentalExtension experimentalExtension = getOkbuck().getExperimentalExtension(); if (experimentalExtension.useAnnotationProcessorPlugin) { return getTestApts() .stream() <START> .filter(i -> !i.getAnnotationProcessors().isEmpty()) <END> .map(Scope::getAnnotationProcessorRulePath) .collect(Collectors.toSet()); } else { return getTestApt().getAnnotationProcessors(); } }</code><technical_language>a name i</technical_language>

Target:
public Set<String> getTestAnnotationProcessors() { ExperimentalExtension experimentalExtension = getOkbuck().getExperimentalExtension(); if (experimentalExtension.useAnnotationProcessorPlugin) { return getTestAptScopes() .stream() .filter(scope -> !scope.getAnnotationProcessors().isEmpty()) .map(Scope::getAnnotationProcessorsUID) .collect(Collectors.toSet()); } else { return getTestApt().getAnnotationProcessors(); } }
Source:
<code>public static StatisticsData getStatistics() { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); long totalTime = 0; ArrayList<StatisticsItem> feedTime = new ArrayList<>(); List<Feed> feeds = getFeedList(); for (Feed feed : feeds) { long feedPlayedTime = 0; long feedTotalTime = 0; long episodes = 0; long episodesStarted = 0; List<FeedItem> items = getFeed(feed.getId()).getItems(); for(FeedItem item : items) { FeedMedia media = item.getMedia(); <START> if(item.isPlayed()) { <END> feedPlayedTime += media.getDuration() / 1000; } else { feedPlayedTime += media.getPosition() / 1000; } if(item.isPlayed() || media.getPosition() != 0) { episodesStarted++; } feedTotalTime += media.getDuration() / 1000; episodes++; } feedTime.add(new StatisticsItem( feed, feedTotalTime, feedPlayedTime, episodes, episodesStarted)); totalTime += feedPlayedTime; } Collections.sort(feedTime, (item1, item2) -> { if(item1.timePlayed > item2.timePlayed) { return -1; } else if(item1.timePlayed < item2.timePlayed) { return 1; } else { return 0; } }); adapter.close(); return new StatisticsData(totalTime, feedTime); }</code><technical_language>check media != null (NullPointerException) [or if(media == null) { continue; } ]</technical_language>

Target:
public static StatisticsData getStatistics() { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); long totalTime = 0; List<StatisticsItem> feedTime = new ArrayList<>(); List<Feed> feeds = getFeedList(); for (Feed feed : feeds) { long feedPlayedTime = 0; long feedTotalTime = 0; long episodes = 0; long episodesStarted = 0; List<FeedItem> items = getFeed(feed.getId()).getItems(); for(FeedItem item : items) { FeedMedia media = item.getMedia(); if(media == null) { continue; } if(item.isPlayed()) { feedPlayedTime += media.getDuration() / 1000; } else { feedPlayedTime += media.getPosition() / 1000; } if(item.isPlayed() || media.getPosition() != 0) { episodesStarted++; } feedTotalTime += media.getDuration() / 1000; episodes++; } feedTime.add(new StatisticsItem( feed, feedTotalTime, feedPlayedTime, episodes, episodesStarted)); totalTime += feedPlayedTime; } Collections.sort(feedTime, (item1, item2) -> { if(item1.timePlayed > item2.timePlayed) { return -1; } else if(item1.timePlayed < item2.timePlayed) { return 1; } else { return 0; } }); adapter.close(); return new StatisticsData(totalTime, feedTime); }
Source:
<code>public boolean editIssueState(String repoId, int issueId, boolean isOpen) throws IOException { Issue updatedIssue = issueService.editIssueState( RepositoryId.createFromId(repoId), issueId, isOpen ); if (isOpen) { return updatedIssue.getState().equals(IssueService.STATE_OPEN); } else { return updatedIssue.getState().equals(IssueService.STATE_CLOSED); <START> } <END> }</code><technical_language>this? java return updatedIssue.getState().equals(isOpen ? IssueService.STATE_OPEN : IssueService.STATE_CLOSED)</technical_language>

Target:
public boolean editIssueState(String repoId, int issueId, boolean isOpen) throws IOException { Issue updatedIssue = issueService.editIssueState( RepositoryId.createFromId(repoId), issueId, isOpen ); return updatedIssue.getState().equals(isOpen ? IssueService.STATE_OPEN : IssueService.STATE_CLOSED); }
Source:
<code>public void connect(final long maxMsToWaitUntilConnected, Watcher watcher) throws ZkInterruptedException, ZkTimeoutException, IllegalStateException { if (isClosed()) { throw new IllegalStateException("ZkClient already closed!"); } boolean started = false; acquireEventLock(); try { setShutdownTrigger(false); IZkConnection zkConnection = getConnection(); _eventThread = new ZkEventThread(zkConnection.getServers()); _eventThread.start(); LOG.debug("ZkClient created with _uid {}, _eventThread {}", _uid, _eventThread.getId()); try { if (_monitorKey != null && !_monitorKey.isEmpty() && _monitorType != null && !_monitorType .isEmpty()) { _monitor = <START> new ZkClientMonitor(_monitorType, _monitorKey, _monitorInstanceName, _monitorRootPathOnly, <END> _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } if (isManagingZkConnection()) { zkConnection.connect(watcher); LOG.debug("Awaiting connection to Zookeeper server"); if (!waitUntilConnected(maxMsToWaitUntilConnected, TimeUnit.MILLISECONDS)) { throw new ZkTimeoutException( "Unable to connect to zookeeper server within timeout: " + maxMsToWaitUntilConnected); } } else { if (isConnectionClosed()) { throw new ZkClientException( "Unable to connect to zookeeper server with the specified ZkConnection"); } setCurrentState(KeeperState.SyncConnected); } started = true; } finally { getEventLock().unlock(); if (!started) { close(); } } }</code><technical_language>consider closing monitor avoid leakage. If part of code zk connection timeout throws exception, monitor closed</technical_language>

Target:
public void connect(final long maxMsToWaitUntilConnected, Watcher watcher) throws ZkInterruptedException, ZkTimeoutException, IllegalStateException { if (isClosed()) { throw new IllegalStateException("ZkClient already closed!"); } boolean started = false; acquireEventLock(); try { setShutdownTrigger(false); IZkConnection zkConnection = getConnection(); _eventThread = new ZkEventThread(zkConnection.getServers()); if (_monitor != null) { boolean result = _monitor.setAndInitZkEventThreadMonitor(_eventThread); if (!result) { LOG.error("register _eventThread monitor failed due to an existing one"); } } _eventThread.start(); LOG.debug("ZkClient created with _uid {}, _eventThread {}", _uid, _eventThread.getId()); if (isManagingZkConnection()) { zkConnection.connect(watcher); LOG.debug("Awaiting connection to Zookeeper server"); if (!waitUntilConnected(maxMsToWaitUntilConnected, TimeUnit.MILLISECONDS)) { throw new ZkTimeoutException( "Unable to connect to zookeeper server within timeout: " + maxMsToWaitUntilConnected); } } else { if (isConnectionClosed()) { throw new ZkClientException( "Unable to connect to zookeeper server with the specified ZkConnection"); } setCurrentState(KeeperState.SyncConnected); } started = true; } finally { getEventLock().unlock(); if (!started) { close(); } } }
Source:
<code>private void cleanUpSuperfluousComputer(Map<String, Node> nodeMap, ContainerNodeNameMap csmMerged, Instant snapshotInstant) { for (Node node : nodeMap.values()) { if (! (node instanceof DockerTransientNode)) { continue; } <START> this.checkForTimeout(snapshotInstant); <END> DockerTransientNode dtn = (DockerTransientNode) node; boolean seenOnDockerInstance = csmMerged.isContainerIdRegistered(dtn.getContainerId()); if (seenOnDockerInstance) { continue; } SlaveComputer computer = dtn.getComputer(); if (computer == null) { continue; } if (!computer.isOffline()) { continue; } LOGGER.info("{} has container ID {}, but the container does not exist in any docker cloud. Will remove node.", dtn, dtn.getContainerId()); try { removeNode(dtn); executionStatistics.nodesRemoved++; } catch (IOException e) { LOGGER.warn(String.format("Failed to remove orphaned %s.", dtn), e); executionStatistics.nodesRemovedFailed++; } } }</code><technical_language>Code style: This plugin code this necessary</technical_language>

Target:
private void cleanUpSuperfluousComputer(Map<String, Node> nodeMap, ContainerNodeNameMap csmMerged, Instant snapshotInstant) { for (Node node : nodeMap.values()) { if (! (node instanceof DockerTransientNode)) { continue; } checkForTimeout(snapshotInstant); DockerTransientNode dtn = (DockerTransientNode) node; boolean seenOnDockerInstance = csmMerged.isContainerIdRegistered(dtn.getContainerId()); if (seenOnDockerInstance) { continue; } SlaveComputer computer = dtn.getComputer(); if (computer == null) { continue; } if (!computer.isOffline()) { continue; } LOGGER.info("{} has container ID {}, but the container does not exist in any docker cloud. Will remove node.", dtn, dtn.getContainerId()); try { removeNode(dtn); executionStatistics.addNodeRemoved(); } catch (IOException e) { LOGGER.warn("Failed to remove orphaned node {}", dtn.toString(), e); executionStatistics.addNodeRemovedFailed(); } } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_history, container, false); rootView.setPadding(0, getContentTopOffsetPx(getActivity()), 0, 0); historyEntryList = (ListView) rootView.findViewById(R.id.history_entry_list); historyEmptyContainer = rootView.findViewById(R.id.history_empty_container); historyEmptyTitle = (TextView) rootView.findViewById(R.id.history_empty_title); historyEmptyMessage = (TextView) rootView.findViewById(R.id.history_empty_message); entryFilter = (EditText) rootView.findViewById(R.id.history_search_list); app.adjustDrawableToTheme(((ImageView) rootView.findViewById(R.id.history_empty_image)).getDrawable()); <START> <END> adapter = new HistoryEntryAdapter(getContext(), null, true); entryFilter.addTextChangedListener(textWatcher); historyEntryList.setAdapter(adapter); historyEntryList.setOnItemClickListener(itemClickListener); historyEntryList.setOnItemLongClickListener(itemLongClickListener); return rootView; }</code><technical_language>I adapter is independent of view initialized early onCreate() / onDestroy(). (This is aside, a request.)</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_history, container, false); rootView.setPadding(0, getContentTopOffsetPx(getActivity()), 0, 0); historyEntryList = (ListView) rootView.findViewById(R.id.history_entry_list); historyEmptyContainer = rootView.findViewById(R.id.history_empty_container); historyEmptyTitle = (TextView) rootView.findViewById(R.id.history_empty_title); historyEmptyMessage = (TextView) rootView.findViewById(R.id.history_empty_message); entryFilter = (EditText) rootView.findViewById(R.id.history_search_list); app.adjustDrawableToTheme(((ImageView) rootView.findViewById(R.id.history_empty_image)).getDrawable()); entryFilter.addTextChangedListener(textWatcher); historyEntryList.setAdapter(adapter); historyEntryList.setOnItemClickListener(itemClickListener); historyEntryList.setOnItemLongClickListener(itemLongClickListener); return rootView; }