auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void animateChange() { if( mItemMap.isEmpty() ) return; final ViewTreeObserver observer = this.getViewTreeObserver(); if( !observer.isAlive() ) return; observer.addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { if( !observer.isAlive() ) return true; observer.removeOnPreDrawListener( this ); AnimatedListView listView = AnimatedListView.this; boolean animationRunning = false; int firstVisiblePosition = listView.getFirstVisiblePosition(); int nCount = Math.min( listView.getChildCount(), getAdapter().getCount() - firstVisiblePosition ); for( int i = 0; i < nCount; i += 1 ) { int position = firstVisiblePosition + i; long itemId = getAdapter().getItemId( position ); View child = listView.getChildAt( i ); int topAfterLayout = child.getTop(); int delta; if( mItemMap.containsKey( itemId ) ) { int topBeforeLayout = mItemMap.get( itemId ).top; delta = topBeforeLayout - topAfterLayout; } else { if( i == 0 ) { delta = -child.getHeight() - listView.getDividerHeight(); } else { delta = 0; child.setScaleY( 0.f ); child.animate() .setDuration( MOVE_DURATION ) .scaleY( 1.f ); animationRunning = true; } } if( delta != 0 ) { child.setTranslationY( delta ); child.animate() .setDuration( MOVE_DURATION ) .translationY( 0 ); animationRunning = true; } } <START> if( animationRunning ) <END> { } else { } return false; } } ); }</code><technical_language>if / else removed</technical_language>

Target:
public void animateChange() { if( mItemMap.isEmpty() ) return; final ViewTreeObserver observer = this.getViewTreeObserver(); if( !observer.isAlive() ) return; observer.addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { if( !observer.isAlive() ) return true; observer.removeOnPreDrawListener( this ); AnimatedListView listView = AnimatedListView.this; int firstVisiblePosition = listView.getFirstVisiblePosition(); int nCount = Math.min( listView.getChildCount(), getAdapter().getCount() - firstVisiblePosition ); for( int i = 0; i < nCount; i += 1 ) { int position = firstVisiblePosition + i; long itemId = getAdapter().getItemId( position ); View child = listView.getChildAt( i ); int topAfterLayout = child.getTop(); int delta; if( mItemMap.containsKey( itemId ) ) { int topBeforeLayout = mItemMap.get( itemId ).top; delta = topBeforeLayout - topAfterLayout; } else { if( i == 0 ) { delta = -child.getHeight() - listView.getDividerHeight(); } else { delta = 0; child.setScaleY( 0.f ); child.animate() .setDuration( MOVE_DURATION ) .scaleY( 1.f ); } } if( delta != 0 ) { child.setTranslationY( delta ); child.animate() .setDuration( MOVE_DURATION ) .translationY( 0 ); } } return false; } } ); }
Source:
<code>public void updateCachedIssue(TurboIssue issue){ TurboIssue tIssue = getIssueWithId(issue.getId()); if(tIssue != null){ tIssue.copyValues(issue); <START> logger.info("Updated issue: " + issue.getId()); <END> }else{ issues.add(0, issue); logger.info("Added issue: " + issue.getId()); } }</code><technical_language>This kind of detailed logs done debug level. Furthermore, try record changed (i.e. new values). helpful in debugging cases of 'missing labels' etc</technical_language>

Target:
public void updateCachedIssue(TurboIssue issue){ TurboIssue tIssue = getIssueWithId(issue.getId()); if(tIssue != null){ tIssue.copyValues(issue); logger.debug("Updated issue: " + issue.getId()); }else{ issues.add(0, issue); logger.info("Added issue: " + issue.getId()); } }
Source:
<code>public void put(Datum values) { <START> this.clear(); <END> System.arraycopy(values, 0, this.values, 0, values.length); }</code><technical_language>please explain clear() need call</technical_language>

Target:
public void put(Datum values) { clearOffset(); System.arraycopy(values, 0, this.values, 0, values.length); }
Source:
<code>private Object fetchRelationship(Environment context) { EntityDictionary dictionary = context.requestScope.getDictionary(); Class parentClass = context.parentResource.getResourceClass(); String fieldName = context.field.getName(); if(dictionary.getRelationshipType(parentClass, fieldName).isToOne()) { <START> DataStoreTransaction tx = context.requestScope.getTransaction(); <END> Object obj = tx.getRelation(tx, context.parentResource.getObject(), context.field.getName(), null, null, null, context.requestScope); return new PersistentResource(obj, context.parentResource, context.requestScope.getUUIDFor(obj), context.requestScope); } else { return fetchEntity(context); } }</code><technical_language>need persistent resource (instead of data store), ensure security is invoked</technical_language>

Target:
private Object fetchRelationship(Environment context) { String fieldName = context.field.getName(); Set<PersistentResource> relations = context.parentResource.getRelationCheckedFiltered(fieldName); Boolean isToOne = context.parentResource.getRelationshipType(fieldName).isToOne(); if(isToOne) { return relations.iterator().next(); } else { return relations; } }
Source:
<code>protected void ExecuteVdsBrokerCommand() { glusterTaskReturn = getBroker().glusterVolumeRemoveBricksStart(getParameters().getVolumeName(), getParameters().getBrickDirectories().toArray(new String[0]), getParameters().getReplicaCount(), getParameters().isForceRemove()); task = glusterTaskReturn.getGlusterTask(); setReturnValue(task); <START> proceedProxyReturnValue(); <END> }</code><technical_language>call processProxyReturnValue() setting return value. setting of retunr statement</technical_language>

Target:
protected void ExecuteVdsBrokerCommand() { glusterTaskReturn = getBroker().glusterVolumeRemoveBricksStart(getParameters().getVolumeName(), getParameters().getBrickDirectories().toArray(new String[0]), getParameters().getReplicaCount(), getParameters().isForceRemove()); task = glusterTaskReturn.getGlusterTask(); proceedProxyReturnValue(); setReturnValue(task); }
Source:
<code>public static void writeOrCreate(Path path, List<Abbreviation> abbreviations, Charset encoding) throws IOException { try (OutputStreamWriter writer = new OutputStreamWriter(Files.newOutputStream(path), encoding); CSVPrinter csvPrinter = new CSVPrinter(writer, AbbreviationFormat.getCSVFormat())) { for (Abbreviation entry : abbreviations) { <START> if (entry.shortestUniqueAbbreviationProperty().get().trim().isEmpty()) { <END> csvPrinter.printRecord(entry.getName(), entry.getAbbreviation()); } else { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation(), entry.getShortestUniqueAbbreviation()); } } } }</code><technical_language>ensure in data model of abbreviation strings stored trimmed? Then, caller of get need care of trimming</technical_language>

Target:
public static void writeOrCreate(Path path, List<Abbreviation> abbreviations, Charset encoding) throws IOException { try (OutputStreamWriter writer = new OutputStreamWriter(Files.newOutputStream(path), encoding); CSVPrinter csvPrinter = new CSVPrinter(writer, AbbreviationFormat.getCSVFormat())) { for (Abbreviation entry : abbreviations) { if (entry.shortestUniqueAbbreviationProperty().get().isEmpty()) { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation()); } else { csvPrinter.printRecord(entry.getName(), entry.getAbbreviation(), entry.getShortestUniqueAbbreviation()); } } } }
Source:
<code>private URL getInlineRules() throws CoreException, CheckstylePluginException { PlexusConfiguration config = getParameterValue("checkstyleRules", XmlPlexusConfiguration.class); if (config == null || ((config = config.getChild(0)) == null)) { return null; } Bundle bundle = FrameworkUtil.getBundle(getClass()); IPath stateLocation = Platform.getStateLocation(bundle); <START> File dir = stateLocation.toFile(); <END> File checkstyleFile = new File(dir, projectName + "_inline_checkstyle.xml"); try (Writer writer = new FileWriter(checkstyleFile)){ writer.write(CHECKSTYLE_CONFIG_FILE_HEADER); writer.write(config.toString()); return checkstyleFile.toURI().toURL(); } catch (IOException e) { CheckstylePluginException.rethrow(e, "Error while extracting inline rules."); return null; } }</code><technical_language>@Serranya is this? familiar Eclipse, is some place meant host this kind of generated file</technical_language>

Target:
private URL getInlineRules() throws CoreException, CheckstylePluginException { PlexusConfiguration config = getParameterValue("checkstyleRules", XmlPlexusConfiguration.class); if (config == null) { return null; } if (config.getChildCount() > 1) { throw new CheckstylePluginException("Currently only one root module is supported"); } if ((config = config.getChild(0)) == null) { return null; } IPath stateLocation = Activator.getDefault().getStateLocation(); File dir = stateLocation.toFile(); File checkstyleFile = new File(dir, projectName + "_inline_checkstyle.xml"); try (Writer writer = new FileWriter(checkstyleFile)){ writer.write(CHECKSTYLE_CONFIG_FILE_HEADER); writer.write(config.toString()); return checkstyleFile.toURI().toURL(); } catch (IOException e) { CheckstylePluginException.rethrow(e, "Error while extracting inline rules."); return null; } }
Source:
<code>private String findNuageVspCmsIdForDevice(long deviceId, ConfigurationVO cmsIdConfig) { String configValue = cmsIdConfig.getValue(); if (StringUtils.isNotBlank(configValue)) { String[] configuredNuageVspDevices = configValue.split(";"); for (String configuredNuageVspDevice : configuredNuageVspDevices) { if (configuredNuageVspDevice.startsWith(deviceId + ":")) { <START> return configuredNuageVspDevice.split(":")[1]; <END> } } } return null; }</code><technical_language>is is : character? result of split call checked ensure length is 2 avoid ArrayIndexOutOfBounds. Also, if array is a length of 2, IllegalStateException thrown</technical_language>

Target:
private String findNuageVspCmsIdForDevice(long deviceId, ConfigurationVO cmsIdConfig) { String configValue = cmsIdConfig.getValue(); if (!Strings.isNullOrEmpty(configValue)) { String[] configuredNuageVspDevices = configValue.split(";"); for (String configuredNuageVspDevice : configuredNuageVspDevices) { if (configuredNuageVspDevice.startsWith(deviceId + ":")) { String[] split = configuredNuageVspDevice.split(":"); if (split.length != 2 || (split.length > 1 && Strings.isNullOrEmpty(split[1]))) { throw new IllegalArgumentException("The configured CMS ID for Nuage VSP device " + deviceId + " is in an incorrect format"); } return split[1]; } } } return null; }
Source:
<code>public void handle() { final TaskDetails details = running.get(taskId); if (details == null) { log.warn("Got location notice for task [%s] that isn't running...", taskId); return; } details.location = location; try { log.info("Updating task [%s] announcement to with location [%s]", taskId, location); <START> workerCuratorCoordinator.updateAnnouncement( <END> TaskAnnouncement.create( details.task, details.status, details.location ) ); } catch (Exception e) { log.makeAlert(e, "Failed to update task announcement") .addData("task", taskId) .emit(); } }</code><technical_language>nit: skip this announcement if details.location location</technical_language>

Target:
public void handle() { final TaskDetails details = running.get(taskId); if (details == null) { log.warn("Got location notice for task [%s] that isn't running...", taskId); return; } if (!Objects.equals(details.location, location)) { details.location = location; try { log.info("Updating task [%s] announcement with location [%s]", taskId, location); workerCuratorCoordinator.updateTaskStatusAnnouncement( TaskAnnouncement.create( details.task, details.status, details.location ) ); } catch (Exception e) { log.makeAlert(e, "Failed to update task announcement") .addData("task", taskId) .emit(); } } }
Source:
<code><START> public void testFallbackToJobOptions() throws Exception { <END> final Namespace cmdlineOptions = mock(Namespace.class); when(cmdlineOptions.getString("deployment-group-name")).thenReturn(null); when(cmdlineOptions.getInt("parallelism")).thenReturn(null); when(cmdlineOptions.getLong("timeout")).thenReturn(null); when(cmdlineOptions.getLong("rollout_timeout")).thenReturn(10L); when(cmdlineOptions.getBoolean("async")).thenReturn(true); when(cmdlineOptions.getBoolean("migrate")).thenReturn(null); when(cmdlineOptions.getBoolean("overlap")).thenReturn(null); when(cmdlineOptions.getString("token")).thenReturn(null); when(cmdlineOptions.getBoolean("ignore_failures")).thenReturn(null); when(client.rollingUpdate(anyString(), any(JobId.class), any(RolloutOptions.class))) .thenReturn(immediateFuture(new RollingUpdateResponse(RollingUpdateResponse.Status.OK))); when(client.deploymentGroupStatus(GROUP_NAME)).then(new ResponseAnswer( statusResponse(DeploymentGroupStatusResponse.Status.ACTIVE, null, makeHostStatus("host1", JOB_ID, TaskStatus.State.RUNNING)) )); String optionString = "(parallelism=123, timeout=456, overlap=true, " + "token=my_token_from_job_options, ignoreFailures=true)"; command.runWithJob(cmdlineOptions, client, out, false, JOB, null); assertThat(baos.toString(), containsString(optionString)); }</code><technical_language>set some of CLI args check a merge of CLI args job rollout options correct precedence</technical_language>

Target:
public void testFallbackToJobOptions() throws Exception { final Namespace cmdlineOptions = mock(Namespace.class); when(cmdlineOptions.getString("deployment-group-name")).thenReturn(null); when(cmdlineOptions.getInt("parallelism")).thenReturn(null); when(cmdlineOptions.getLong("timeout")).thenReturn(null); when(cmdlineOptions.getLong("rollout_timeout")).thenReturn(10L); when(cmdlineOptions.getBoolean("async")).thenReturn(true); when(cmdlineOptions.getBoolean("migrate")).thenReturn(null); when(cmdlineOptions.getBoolean("overlap")).thenReturn(null); when(cmdlineOptions.getString("token")).thenReturn("cli_token"); when(cmdlineOptions.getBoolean("ignore_failures")).thenReturn(null); when(client.rollingUpdate(anyString(), any(JobId.class), any(RolloutOptions.class))) .thenReturn(immediateFuture(new RollingUpdateResponse(RollingUpdateResponse.Status.OK))); when(client.deploymentGroupStatus(GROUP_NAME)).then(new ResponseAnswer( statusResponse(DeploymentGroupStatusResponse.Status.ACTIVE, null, makeHostStatus("host1", JOB_ID, TaskStatus.State.RUNNING)) )); String optionString = "(parallelism=123, timeout=456, overlap=true, " + "token=cli_token, ignoreFailures=true)"; command.runWithJob(cmdlineOptions, client, out, false, JOB, null); assertThat(baos.toString(), containsString(optionString)); }
Source:
<code>public void whenUpdateView_thenViewShouldReflectChanges() { TwoWayCurrentHourAttribute attribute = new TwoWayCurrentHourAttribute(); int newCurrentHourValue = RandomValues.anyInteger(); <START> attribute.updateView(view, newCurrentHourValue); <END> assertThat(view.getCurrentHour(), is(newCurrentHourValue)); }</code><technical_language>I wrong - view is private in AbstractTimePickerAttributeTest is accessible here</technical_language>

Target:
public void whenUpdateView_thenViewShouldReflectChanges() { TwoWayCurrentHourAttribute attribute = new TwoWayCurrentHourAttribute(); int newCurrentHourValue = RandomValues.integerBetween(1,24); attribute.updateView(view, newCurrentHourValue); assertThat(view.getCurrentHour(), is(newCurrentHourValue)); }
Source:
<code>public static boolean shouldSlaveBeRetained(JCloudsSlave slave) { String templateName = slave.getId().getTemplateName(); String cloudName = slave.getId().getCloudName(); if (templateName != null && cloudName != null) { JCloudsCloud cloud = JCloudsCloud.getByName(cloudName); if (cloud != null) { JCloudsSlaveTemplate template = cloud.getTemplate(templateName); if (template != null) { SlaveOptions slaveOptions = template.getEffectiveSlaveOptions(); Integer instancesMin = slaveOptions.getInstancesMin(); JCloudsComputer computer = slave.getComputer(); Integer retentionTime = slaveOptions.getRetentionTime(); if (instancesMin > 0 && computer != null) { if (retentionTime != 0 && (template.getActiveNodesTotal(false) - 1) < instancesMin) { return true; } if (retentionTime == 0 && !computer.isUsed() && (template.getActiveNodesTotal(true) - 1) < instancesMin) { return true; } } else { if(computer !=null && retentionTime == 0) { <START> return !Jenkins.getInstanceOrNull().getQueue().getBuildableItems(computer).isEmpty(); <END> } } } } } return false; }</code><technical_language>getInstanceOrNull explicitly permits null reference is blow right getQueue() is called. chance is real this is a periodic task invoked time Jenkins is shutting down. method throws exceptions (no matter name is in this version) simply do care for phony exceptions (that sense compared NPE) scenario in mind do in case is null</technical_language>

Target:
public static boolean shouldSlaveBeRetained(JCloudsSlave slave) { String templateName = slave.getId().getTemplateName(); String cloudName = slave.getId().getCloudName(); if (templateName != null && cloudName != null) { JCloudsCloud cloud = JCloudsCloud.getByName(cloudName); if (cloud != null) { JCloudsSlaveTemplate template = cloud.getTemplate(templateName); if (template != null) { SlaveOptions slaveOptions = template.getEffectiveSlaveOptions(); Integer instancesMin = slaveOptions.getInstancesMin(); JCloudsComputer computer = slave.getComputer(); Integer retentionTime = slaveOptions.getRetentionTime(); if (instancesMin > 0 && computer != null) { if (retentionTime != 0 && (template.getActiveNodesTotal(false) - 1) < instancesMin) { return true; } if (retentionTime == 0 && !computer.isUsed() && (template.getActiveNodesTotal(true) - 1) < instancesMin) { return true; } } else { if (computer != null && retentionTime == 0 && Jenkins.getInstanceOrNull() != null) { return !Jenkins.getInstanceOrNull().getQueue().getBuildableItems(computer).isEmpty(); } } } } } return false; }
Source:
<code>public void findMissingEnumNames() { boolean foundMissingKeys = false; List<ConfigurationValues> missingKeys = new ArrayList<ConfigurationValues>(); for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!configValuesEnumNames.contains(configValue.toString())) { log.error("Found missing key: {}", configValue); <START> foundMissingKeys = true; <END> missingKeys.add(configValue); break; } } assertFalse("Found missing keys: " + missingKeys, foundMissingKeys); }</code><technical_language>I guess need this boolean anymore</technical_language>

Target:
public void findMissingEnumNames() { Set<ConfigurationValues> missingKeys = new TreeSet<ConfigurationValues>(); for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!configValuesEnumNames.contains(configValue.toString())) { log.error("Found missing key: {}", configValue); missingKeys.add(configValue); } } assertTrue("Found missing keys: " + missingKeys, missingKeys.isEmpty()); }
Source:
<code>public void startElement(TagNode node) { node.getAttributes() .stream() .filter(attribute -> StringUtils.startsWith(attribute.getName(), "on")) <START> .filter(attribute -> LITERAL_EXPRESION_PATTERN.matcher(attribute.getValue()).find() && !attribute.getValue().contains(DISPLAY_CONTEXT_ATTRIBUTE)) <END> .forEach(attribute -> createViolation(node.getStartLinePosition(), VIOLATION_MESSAGE)); }</code><technical_language>please extract method, for readability</technical_language>

Target:
public void startElement(TagNode node) { node.getAttributes() .stream() .filter(attribute -> StringUtils.startsWith(attribute.getName(), EVENT_ATTRIBUTE_PREFIX)) .filter(this::notContainsDisplayContext) .forEach(attribute -> createViolation(node.getStartLinePosition(), VIOLATION_MESSAGE)); }
Source:
<code>void fetchNext() { while (cursor.hasNext()) { K key = cursor.next(); VersionedValue data = cursor.getValue(); if (data != null) { Object currentValue = data.getCurrentValue(); if (currentValue != null <START> || transactionId != TransactionStore.getTransactionId(data.getOperationId())) { <END> registerCurrent(key, currentValue); return; } } } current = null; }</code><technical_language>I think, I wrong here, more obvious split. If some other transaction deleted entry, this condition true, wrong, if transaction committed (committing), is closed yet. committingTransactions bit mask consulted well</technical_language>

Target:
void fetchNext() { while (cursor.hasNext()) { K key = cursor.next(); VersionedValue data = cursor.getValue(); if (data != null) { Object currentValue = data.getCurrentValue(); if (currentValue != null) { registerCurrent(key, currentValue); return; } if (useNewSnapshot) { long id = data.getOperationId(); if (id != 0) { int tx = TransactionStore.getTransactionId(id); if (transactionId != tx && !committingTransactions.get(tx)) { registerCurrent(key, currentValue); return; } } } } } current = null; }
Source:
<code>public List<UserMembership> searchUserMembershipsFromQuery(String query){ List<UserMembership> organizations = new ArrayList<>(); String userId = userInfoService.currentUser().getUserId(); List<UserMembership> userMemberships = userMembershipService.getMembershipsOfUser(userId); <START> for(UserMembership userMembership : userMemberships){ <END> if(userMembership.getOrganizationName().toLowerCase().contains(query.toLowerCase())){ organizations.add(userMembership); } } return organizations; }</code><technical_language>a more readable : List<UserMembership> organizations = userMemberships .stream() .filter(userMembership -> userMembership.getOrganizationName().toLowerCase().contains(query.toLowerCase())) .collect(Collectors.toList());</technical_language>

Target:
public List<UserMembership> searchUserMembershipsFromQuery(String query){ String userId = userInfoService.currentUser().getUserId(); List<UserMembership> userMemberships = new ArrayList<>(userMembershipService.getMembershipsOfUser(userId)); UserMembership personalMembership = new UserMembership(); personalMembership.setId(userId); personalMembership.setAdmin(true); personalMembership.setOrganizationId(userId); personalMembership.setOrganizationName("Personal"); userMemberships.add(personalMembership); Pattern p = Pattern.compile(query, Pattern.LITERAL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); return userMemberships .stream() .filter(userMembership -> p.matcher(userMembership.getOrganizationName()).find()) .collect(Collectors.toList()); }
Source:
<code>public Long runAsync(final ImportContext context, final ImportFilter filter, final boolean init) { RequestAttributes parentRequestAttributes = RequestContextHolder.getRequestAttributes(); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Thread parentThread = Thread.currentThread(); return jobs.submit(new Job<ImportContext>() { @Override protected ImportContext call(ProgressMonitor monitor) throws Exception { try { RequestContextHolder.setRequestAttributes(parentRequestAttributes); <START> SecurityContextHolder.getContext().setAuthentication(auth); <END> if (init) { init(context, true); } run(context, filter, monitor); return context; } finally { if (Thread.currentThread() != parentThread) { RequestContextHolder.resetRequestAttributes(); } } } @Override public String toString() { return "Processing import " + context.getId(); } }); }</code><technical_language>I reset anywhere, risks cross-request pollution in case? not, if this is get in new auth is set, I wanted sure. If check RequestContextHolder path, reset in finally block</technical_language>

Target:
public Long runAsync(final ImportContext context, final ImportFilter filter, final boolean init) { final RequestAttributes parentRequestAttributes = RequestContextHolder.getRequestAttributes(); final Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Thread parentThread = Thread.currentThread(); return jobs.submit(new Job<ImportContext>() { @Override protected ImportContext call(ProgressMonitor monitor) throws Exception { final Authentication oldAuth = SecurityContextHolder.getContext().getAuthentication(); try { RequestContextHolder.setRequestAttributes(parentRequestAttributes); SecurityContextHolder.getContext().setAuthentication(auth); if (init) { init(context, true); } run(context, filter, monitor); return context; } finally { if (Thread.currentThread() != parentThread) { RequestContextHolder.resetRequestAttributes(); SecurityContextHolder.getContext().setAuthentication(oldAuth); } } } @Override public String toString() { return "Processing import " + context.getId(); } }); }
Source:
<code>public MutableBoundedValue<Integer> durability() { return SpongeValueBuilder.boundedBuilder(Keys.ITEM_DURABILITY) .minimum(0) .maximum(Integer.MAX_VALUE) <START> .defaultValue(60) <END> .actualValue(this.durability) .build(); }</code><technical_language>This default for items, I dependent ItemStack provided DataProcessor/ValueProcessor</technical_language>

Target:
public MutableBoundedValue<Integer> durability() { return SpongeValueBuilder.boundedBuilder(Keys.ITEM_DURABILITY) .minimum(0) .maximum(Integer.MAX_VALUE) .defaultValue(this.defaultDurability) .actualValue(this.durability) .build(); }
Source:
<code><START> private int getReadCount(FilterSamReads filterTest) throws Exception { <END> final SamReader samReader = SamReaderFactory.makeDefault().open(filterTest.OUTPUT); final SAMRecordIterator iter = samReader.iterator(); int count = 0; while (iter.hasNext()) { iter.next(); ++ count; } iter.close(); samReader.close(); return count; }</code><technical_language>I this is a great function java 8-ify (stream count iterator), if want practice</technical_language>

Target:
private long getReadCount(FilterSamReads filterTest) throws Exception { final SamReader samReader = SamReaderFactory.makeDefault().open(filterTest.OUTPUT); long count = StreamSupport.stream(samReader.spliterator(), false) .count(); samReader.close(); return count; }
Source:
<code>private void deleteOldPacks(Collection<PackFile> oldPacks, Collection<PackFile> newPacks, boolean ignoreErrors) throws IOException { int deleteOptions = FileUtils.RETRY | FileUtils.SKIP_MISSING; if (ignoreErrors) deleteOptions |= FileUtils.IGNORE_ERRORS; oldPackLoop: for (PackFile oldPack : oldPacks) { String oldName = oldPack.getPackName(); for (PackFile newPack : newPacks) if (oldName.equals(newPack.getPackName())) continue oldPackLoop; <START> FileUtils.delete(nameFor(oldName, ".pack"), deleteOptions); <END> FileUtils.delete(nameFor(oldName, ".idx"), deleteOptions); } }</code><technical_language>Windows this fail if JGit pack open. need ensure object directory closes pack delete it. PackFile.close() do right thing. I think. :-)</technical_language>

Target:
private void deleteOldPacks(Collection<PackFile> oldPacks, Collection<PackFile> newPacks, boolean ignoreErrors) throws IOException { int deleteOptions = FileUtils.RETRY | FileUtils.SKIP_MISSING; if (ignoreErrors) deleteOptions |= FileUtils.IGNORE_ERRORS; oldPackLoop: for (PackFile oldPack : oldPacks) { String oldName = oldPack.getPackName(); for (PackFile newPack : newPacks) if (oldName.equals(newPack.getPackName())) continue oldPackLoop; oldPack.close(); FileUtils.delete(nameFor(oldName, ".pack"), deleteOptions); FileUtils.delete(nameFor(oldName, ".idx"), deleteOptions); } }
Source:
<code><START> public final void testRetrieveRepo() throws Exception { <END> final String name = "reponame"; MatcherAssert.assertThat( new DyRepos(this.region(name)).get(name).name(), Matchers.equalTo(name) ); }</code><technical_language>.. remove final modifier method. easier for future tests</technical_language>

Target:
public void testRetrieveRepo() throws Exception { final String name = "reponame"; MatcherAssert.assertThat( new DyRepos(this.region(name)).get(name).name(), Matchers.equalTo(name) ); }
Source:
<code>static RestSessionCollection sessionCollection( ProjectStore ps, List<StoredSessionWithLastAttempt> sessions) { ProjectMap projs = ps.getProjectsByIdList( sessions.stream() .map(Session::getProjectId) .collect(Collectors.toList())); List<RestSession> collection = sessions.stream() .map(session -> { try { return session(session, projs.get(session.getProjectId()).getName()); } catch (ResourceNotFoundException ex) { <START> return null; <END> } }) .filter(a -> a != null) .collect(Collectors.toList()); return RestSessionCollection.builder() .sessions(collection) .build(); }</code><technical_language>throw instead of ignoring exception</technical_language>

Target:
static RestSessionCollection sessionCollection( ProjectStore ps, List<StoredSessionWithLastAttempt> sessions) { ProjectMap projs = ps.getProjectsByIdList( sessions.stream() .map(Session::getProjectId) .collect(Collectors.toList())); List<RestSession> collection = sessions.stream() .map(session -> { try { return session(session, projs.get(session.getProjectId()).getName()); } catch (ResourceNotFoundException ex) { throw new IllegalStateException(String.format(ENGLISH, "An session id=%d references a nonexistent project id=%d", session.getId(), session.getProjectId())); } }) .collect(Collectors.toList()); return RestSessionCollection.builder() .sessions(collection) .build(); }
Source:
<code>public void visitToken(DetailAST ast) { if (isInterfaceMember(ast)) { <START> if (ast.getType() == TokenTypes.METHOD_DEF) { <END> processMethod(ast); } if (ast.getType() == TokenTypes.VARIABLE_DEF) { processField(ast); } if (ast.getType() == TokenTypes.CLASS_DEF || ast.getType() == TokenTypes.INTERFACE_DEF || ast.getType() == TokenTypes.ENUM_DEF) { processNestedType(ast); } } }</code><technical_language>this a switch</technical_language>

Target:
public void visitToken(DetailAST ast) { if (ScopeUtil.isInInterfaceBlock(ast) && !ScopeUtil.isInCodeBlock(ast)) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: processMethod(ast); break; case TokenTypes.VARIABLE_DEF: processField(ast); break; case TokenTypes.CLASS_DEF: case TokenTypes.INTERFACE_DEF: case TokenTypes.ENUM_DEF: processNestedType(ast); break; default: throw new IllegalStateException(ast.toString()); } } }
Source:
<code>public Object setFlag(HttpServletRequest request, HttpServletResponse responseToClient, @PathVariable(value = "action") String action, @RequestParam(value = "categoryTerm", required = true) String categoryTerm, @RequestParam(value = "articleDoi", required = true) String articleDoi) throws IOException { ApiAddress.Builder address = ApiAddress.builder("articles").embedDoi(articleDoi).addToken("categories") .addParameter("flag", action) .addParameter("categoryTerm", categoryTerm); String authId = request.getRemoteUser(); if (authId != null) { String userId = userApi.getUserIdFromAuthId(authId); address.addParameter("userId", userId); } articleApi.postObject(address.build(), null); <START> return ImmutableMap.of(); <END> }</code><technical_language>a 200 response code trigger success()</technical_language>

Target:
public void setFlag(HttpServletRequest request, HttpServletResponse responseToClient, @PathVariable(value = "action") String action, @RequestParam(value = "categoryTerm", required = true) String categoryTerm, @RequestParam(value = "articleDoi", required = true) String articleDoi) throws IOException { ApiAddress.Builder address = ApiAddress.builder("articles").embedDoi(articleDoi).addToken("categories") .addParameter("flag", action) .addParameter("categoryTerm", categoryTerm); String authId = request.getRemoteUser(); if (authId != null) { String userId = userApi.getUserIdFromAuthId(authId); address.addParameter("userId", userId); } articleApi.postObject(address.build(), null); }
Source:
<code>public boolean isOvershadowed(Interval interval, VersionType version) <START> { <END> TimelineEntry entry = completePartitionsTimeline.get(interval); if (entry != null) { return versionComparator.compare(version, entry.getVersion()) < 0; } Interval lower = completePartitionsTimeline.floorKey( new Interval(interval.getStartMillis(), JodaUtils.MAX_INSTANT)); if (lower == null || !lower.overlaps(interval)) { return false; } Interval prev = null; Interval curr = lower; do { if (curr == null || (prev != null && curr.getStartMillis() > prev.getEndMillis()) || versionComparator.compare(version, completePartitionsTimeline.get(curr).getVersion()) >= 0 ) { return false; } prev = curr; curr = completePartitionsTimeline.higherKey(curr); } while (interval.getEndMillis() > prev.getEndMillis()); return true; }</code><technical_language>other methods in this class protected a readLock, I need similar protection here</technical_language>

Target:
public boolean isOvershadowed(Interval interval, VersionType version) { try { lock.readLock().lock(); TimelineEntry entry = completePartitionsTimeline.get(interval); if (entry != null) { return versionComparator.compare(version, entry.getVersion()) < 0; } Interval lower = completePartitionsTimeline.floorKey( new Interval(interval.getStartMillis(), JodaUtils.MAX_INSTANT) ); if (lower == null || !lower.overlaps(interval)) { return false; } Interval prev = null; Interval curr = lower; do { if (curr == null || (prev != null && curr.getStartMillis() > prev.getEndMillis()) || versionComparator.compare(version, completePartitionsTimeline.get(curr).getVersion()) >= 0 ) { return false; } prev = curr; curr = completePartitionsTimeline.higherKey(curr); } while (interval.getEndMillis() > prev.getEndMillis()); return true; } finally { lock.readLock().unlock(); } }
Source:
<code>public static Slice substr(@SqlType(StandardTypes.VARBINARY) Slice slice, @SqlType(StandardTypes.BIGINT) long start) { if (start == 0 || slice.length() == 0) { <START> return Slices.EMPTY_SLICE; <END> } int startByte = Ints.saturatedCast(start); if (startByte > 0) { int indexStart = startByte - 1; if (indexStart >= slice.length()) { return Slices.EMPTY_SLICE; } return slice.slice(indexStart, slice.length() - indexStart); } startByte += slice.length(); if (startByte < 0) { return Slices.EMPTY_SLICE; } return slice.slice(startByte, slice.length() - startByte); }</code><technical_language>static import EMPTY_SLICE remove Slices. here. for other places</technical_language>

Target:
public static Slice substr(@SqlType(StandardTypes.VARBINARY) Slice slice, @SqlType(StandardTypes.BIGINT) long start) { return substr(slice, start, slice.length() - start + 1); }
Source:
<code>private void addIpv6BootProtocol(Map<String, Object> opts, HostNetwork attachment) { final Ipv6BootProtocol ipv6BootProtocol = attachment.getIpv6BootProtocol(); opts.put(DHCPV6_BOOT_PROTOCOL, IPV6_DHCP_PROTOCOL_SET.contains(ipv6BootProtocol)); opts.put(DHCPV6_AUTOCONF, IPV6_AUTOCONF_PROTOCOL_SET.contains(ipv6BootProtocol)); if (Ipv6BootProtocol.STATIC_IP == ipv6BootProtocol) { putIfNotEmpty(opts, "ipv6addr", getIpv6Address(attachment)); <START> opts.put("ipv6gateway", attachment.isDefaultRoute() && attachment.getIpv6Gateway() != null ? attachment.getIpv6Gateway() : IpAddressPredicate.UNSPECIFIED_IPV6); <END> } }</code><technical_language>nit: formatting</technical_language>

Target:
private void addIpv6BootProtocol(Map<String, Object> opts, HostNetwork attachment) { final Ipv6BootProtocol ipv6BootProtocol = attachment.getIpv6BootProtocol(); opts.put(DHCPV6_BOOT_PROTOCOL, IPV6_DHCP_PROTOCOL_SET.contains(ipv6BootProtocol)); opts.put(DHCPV6_AUTOCONF, IPV6_AUTOCONF_PROTOCOL_SET.contains(ipv6BootProtocol)); if (Ipv6BootProtocol.STATIC_IP == ipv6BootProtocol) { putIfNotEmpty(opts, "ipv6addr", getIpv6Address(attachment)); opts.put("ipv6gateway", selectIpv6Gateway(attachment)); } }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SexGenotypeContigPairKey that = (SexGenotypeContigPairKey) o; if (sexGenotype != null ? !sexGenotype.equals(that.sexGenotype) : that.sexGenotype != null) return false; return contig != null ? contig.equals(that.contig) : that.contig == null; }</code><technical_language>Null checks in hashcode necessary</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SexGenotypeContigPairKey that = (SexGenotypeContigPairKey) o; if (sexGenotype.equals(that.sexGenotype) && contig.equals(that.contig)) { return true; } else { return false; } }
Source:
<code>public void testConfirmFlagEffects() { new MockUp<sqlline.Commands>() { @Mock private int getUserAnswer( String question, int... allowedAnswers) throws IOException { return 'y'; } }; SqlLine line = new SqlLine(); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); assertEquals("default", line.getOpts().getConfirmPattern()); String script = "CREATE TABLE dummy_test(pk int);\n" + "INSERT INTO dummy_test(pk) VALUES(1);\n" + "INSERT INTO dummy_test(pk) VALUES(2);\n" + "INSERT INTO dummy_test(pk) VALUES(3);\n" + "DELETE FROM dummy_test;\n" + "DROP TABLE dummy_test;\n"; checkScriptFile(script, true, equalTo(SqlLine.Status.OK), containsString(" ")); script = "!set confirm true\n" + script; checkScriptFile(script, true, equalTo(SqlLine.Status.OK), containsString(" ")); <START> <END> }</code><technical_language>verify interaction/non-interaction mocks for handling delete/drops</technical_language>

Target:
public void testConfirmFlagEffects() { new MockUp<sqlline.Commands>() { @Mock public int getUserAnswer( String question, int... allowedAnswers) { return 'n'; } }; SqlLine line = new SqlLine(); assertEquals(Boolean.FALSE, line.getOpts().getConfirm()); assertEquals("default", line.getOpts().getConfirmPattern()); String script = "CREATE TABLE dummy_test(pk int);\n" + "INSERT INTO dummy_test(pk) VALUES(1);\n" + "INSERT INTO dummy_test(pk) VALUES(2);\n" + "INSERT INTO dummy_test(pk) VALUES(3);\n" + "DELETE FROM dummy_test;\n" + "DROP TABLE dummy_test;\n"; checkScriptFile(script, true, equalTo(SqlLine.Status.OK), containsString(" ")); script = "!set confirm true\n" + script; checkScriptFile(script, true, equalTo(SqlLine.Status.OTHER), containsString(line.loc("abort-action"))); }
Source:
<code>public void <START> testNoAttachmentOnEdgeSelectionWithPreferenceDisabled() <END> { }</code><technical_language>Do forget check is link enablement/disablement of preference. separated tests current stat f class, do control order of tests</technical_language>

Target:
public void testNoAttachmentOnEdgeSelectionWithPreferenceDisabled() { testAttachmentOnEdgeSelection(false); }
Source:
<code>public void readLevels(String levelPath, boolean isCustom) { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = factory.newDocumentBuilder(); Document doc = dBuilder.parse(new File(levelPath)); doc.getDocumentElement().normalize(); NodeList levels = doc.getElementsByTagName("LevelName"); for (int i = 0; i < levels.getLength(); i++) { Node n = levels.item(i); String custom; if (isCustom) { custom = "/Custom"; <START> } else { <END> custom = ""; } String s = "src/main/resources/level/" + custom + n.getTextContent(); levelList.add(s); } currentLevel = 0; } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>this "Custom/"? if string s (below) a double slash side slash other side</technical_language>

Target:
public void readLevels(String levelPath, boolean isCustom) { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = factory.newDocumentBuilder(); Document doc = dBuilder.parse(new File(levelPath)); doc.getDocumentElement().normalize(); NodeList levels = doc.getElementsByTagName("LevelName"); for (int i = 0; i < levels.getLength(); i++) { Node n = levels.item(i); String custom; if (isCustom) { custom = "Custom/"; } else { custom = ""; } String s = "src/main/resources/level/" + custom + n.getTextContent(); levelList.add(s); } currentLevel = 0; } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>public void wsdlToWsImportTest() { ImportFromFileSystemWizard.openWizard() .setPath("resources/wsdl") .setFolder(PROJECT_NAME) .selectFile("Hello.wsdl") .finish(); WsdlWebImportWizard.openWizard() .setModelName("WsdlToWS") .setProject(PROJECT_NAME) .importFromWorkspace(PROJECT_NAME,"Hello.wsdl") .nextPage() .nextPage() .nextPage() .nextPage() .finish(); new WorkbenchShell(); WsdlWebImportWizard.openWizard() .setModelName("WsdlToWS2") .setProject(PROJECT_NAME) <START> .importFromURL("<LINK_0>", null, null, false) <END> .nextPage() .nextPage() .nextPage() .nextPage() .finish(); assertTrue(modelExplorer.containsItem(PROJECT_NAME,"WsdlToWS.xmi")); assertTrue(modelExplorer.containsItem(PROJECT_NAME,"WsdlToWS2Responses.xmi")); }</code><technical_language>Please, do hard code internal URL in public repository</technical_language>

Target:
public void wsdlToWsImportTest() { Properties properties = teiidServer.getServerConfig().getConnectionProfile(ConnectionProfileConstants.SOAP).asProperties(); ImportFromFileSystemWizard.openWizard() .setPath("resources/wsdl") .setFolder(PROJECT_NAME) .selectFile("Hello.wsdl") .finish(); WsdlWebImportWizard.openWizard() .setModelName("WsdlToWS") .setProject(PROJECT_NAME) .importFromWorkspace(PROJECT_NAME,"Hello.wsdl") .nextPage() .nextPage() .nextPage() .nextPage() .finish(); new WorkbenchShell(); WsdlWebImportWizard.openWizard() .setModelName("WsdlToWS2") .setProject(PROJECT_NAME) .importFromURL(properties.getProperty("url"), null, null, false) .nextPage() .nextPage() .nextPage() .nextPage() .finish(); assertTrue(modelExplorer.containsItem(PROJECT_NAME,"WsdlToWS.xmi")); assertTrue(modelExplorer.containsItem(PROJECT_NAME,"WsdlToWS2Responses.xmi")); }
Source:
<code>public void setup() throws IOException { <START> complexGeometry = GeoFunctions.stGeometryFromText(Slices.utf8Slice(loadPolygon("large_polygon.txt"))); <END> simpleGeometry = GeoFunctions.stGeometryFromText(Slices.utf8Slice("POLYGON ((1 1, 4 1, 1 4))")); }</code><technical_language>static import stGeometryFromText utf8Slice</technical_language>

Target:
public void setup() throws IOException { complexGeometry = stGeometryFromText(utf8Slice(loadPolygon("large_polygon.txt"))); simpleGeometry = stGeometryFromText(utf8Slice("POLYGON ((1 1, 4 1, 1 4))")); }
Source:
<code>public void testNestedLoad() throws IOException { File tempFile = File.createTempFile("json", null); tempFile.deleteOnExit(); FileWriter writer = new FileWriter(tempFile); <START> writer.write("{\"entities\":{\"hashtags\":[{\"indices\":[0,0],\"text\":\"test1\"},{\"indices\":[0,0],\"text\":\"test2\"}],\"user_mentions\":[],\"urls\":[]}}"); <END> writer.close(); PigServer pigServer = UnitTestUtil.makePigServer(); logAndRegisterQuery(pigServer, "data = load '" + tempFile.getAbsolutePath() + "' using com.twitter.elephantbird.pig.load.JsonLoader() as (json: map[]);"); logAndRegisterQuery(pigServer, "a = foreach data generate json#'entities'#'hashtags' as h;"); logAndRegisterQuery(pigServer, "b = foreach a generate flatten(h) as h;"); logAndRegisterQuery(pigServer, "c = foreach b generate h#'text' as h;"); Iterator<Tuple> tuples = pigServer.openIterator("c"); int count = 0; String[] hashtags = {"test1","test2"}; while(tuples.hasNext()) { Tuple t = tuples.next(); Assert.assertEquals(hashtags[count], t.get(0).toString()); count++; } Assert.assertEquals(2, count); }</code><technical_language>format better</technical_language>

Target:
public void testNestedLoad() throws IOException { File tempFile = File.createTempFile("json", null); tempFile.deleteOnExit(); FileWriter writer = new FileWriter(tempFile); writer.write( "{" + " \"entities\": {" + " \"hashtags\": [" + " {\"indices\": [0,0], \"text\": \"test1\"}," + " {\"indices\": [0,0], \"text\": \"test2\"}" + " ]," + " \"user_mentions\": []," + " \"urls\": []" + " }" + "}"); writer.close(); PigServer pigServer = UnitTestUtil.makePigServer(); pigServer.getPigContext().getProperties().setProperty(JsonLoader.NESTED_LOAD_KEY, "true"); logAndRegisterQuery(pigServer, "data = load '" + tempFile.getAbsolutePath() + "' using com.twitter.elephantbird.pig.load.JsonLoader() as (json: map[]);"); logAndRegisterQuery(pigServer, "a = foreach data generate json#'entities'#'hashtags' as h;"); logAndRegisterQuery(pigServer, "b = foreach a generate flatten(h) as h;"); logAndRegisterQuery(pigServer, "c = foreach b generate h#'text' as h;"); Iterator<Tuple> tuples = pigServer.openIterator("c"); int count = 0; String[] hashtags = {"test1","test2"}; while(tuples.hasNext()) { Tuple t = tuples.next(); Assert.assertEquals(hashtags[count], t.get(0).toString()); count++; } Assert.assertEquals(2, count); }
Source:
<code>void should_fail_if_actual_does_not_contain_any_files_matching_the_given_pathMatcherPattern() { Path fooDir = createDirectory(tempDir, "foo", "foo2.data"); createDirectory(fooDir, "foo3"); expectAssertionError( () -> files.assertIsDirectoryRecursivelyContaining(INFO, tempDirAsFile, TXT_EXTENSION_PATTERN)); verify(failures) .failure(INFO, directoryShouldContain(tempDirAsFile, toAbsolutePaths(list(new File(tempDirAsFile, "foo"), <START> new File(tempDirAsFile, <END> "foo/foo2.data"), new File(tempDirAsFile, "foo/foo3") )), TXT_EXTENSION_PATTERN_DESCRIPTION)); }</code><technical_language>directoryShouldContain error message is explicit fact directory explored recursively</technical_language>

Target:
void should_fail_if_actual_does_not_contain_any_files_matching_the_given_pathMatcherPattern() { Path fooDir = createDirectory(tempDir, "foo", "foo2.data"); createDirectory(fooDir, "foo3"); expectAssertionError( () -> files.assertIsDirectoryRecursivelyContaining(INFO, tempDirAsFile, TXT_EXTENSION_PATTERN)); verify(failures) .failure(INFO, directoryShouldContainRecursively(tempDirAsFile, toAbsolutePaths(list(new File(tempDirAsFile, "foo"), new File(tempDirAsFile, "foo/foo2.data"), new File(tempDirAsFile, "foo/foo3") )), TXT_EXTENSION_PATTERN_DESCRIPTION)); }
Source:
<code><START> private void setUpdatedVersions(Set<Version> prevVersions, Set<Version> versions, DateTime now) { <END> Map<String, Broadcast> prevBroadcasts = previousBroadcasts(prevVersions); Map<String, Location> prevLocations = previousLocations(prevVersions); for (Version version : versions) { for (Broadcast broadcast : version.getBroadcasts()) { Broadcast prevBroadcast = prevBroadcasts.get(broadcast.getSourceId()); if(prevBroadcast == null || !equal(prevBroadcast, broadcast)) { broadcast.setLastUpdated(now); } else { broadcast.setLastUpdated(prevBroadcast.getLastUpdated()); } } for (Encoding encoding : version.getManifestedAs()) { for (Location location : encoding.getAvailableAt()) { Location prevLocation = prevLocations.get(location.getUri()); if(prevLocation == null || !equal(prevLocation, location)) { location.setLastUpdated(now); } else { location.setLastUpdated(prevLocation.getLastUpdated()); } } } } }</code><technical_language>need set Version lastUpdated time</technical_language>

Target:
private void setUpdatedVersions(Set<Version> prevVersions, Set<Version> versions, DateTime now) { Map<String, Version> prevVersionsMap = prevVersionsMap(prevVersions); Map<String, Broadcast> prevBroadcasts = previousBroadcasts(prevVersions); for (Version version : versions) { Version prevVersion = prevVersionsMap.get(version.getCanonicalUri()); setLastUpdatedTime(version, prevVersion, now); for (Broadcast broadcast : version.getBroadcasts()) { Broadcast prevBroadcast = prevBroadcasts.get(broadcast.getSourceId()); if(prevBroadcast != null && equal(prevBroadcast, broadcast) && prevBroadcast.getLastUpdated() != null) { broadcast.setLastUpdated(prevBroadcast.getLastUpdated()); } else { broadcast.setLastUpdated(now); } } Set<Encoding> prevEncodings = getPreviousEncodings(prevVersion); for (Encoding encoding : version.getManifestedAs()) { Optional<Encoding> prevEncoding = Iterables.tryFind(prevEncodings, isEqualTo(encoding)); setLastUpdatedTime(encoding, prevEncoding, now); setLocationsLastUpdatedTime(prevEncoding, encoding.getAvailableAt(), now); } } }
Source:
<code>private int getEnvClasspathIndex(String[] env) { if (env != null) { for (int i = 0; i < env.length; i++) { if (env[i].regionMatches(true, 0, <START> "CLASSPATH=", 0, <END> 10)) { return i; } } } return -1; }</code><technical_language>above, strings defined constants</technical_language>

Target:
private int getEnvClasspathIndex(String[] env) { if (env != null) { for (int i = 0; i < env.length; i++) { if (env[i].regionMatches(true, 0, CLASSPATH_ENV_VAR_PREFIX, 0, 10)) { return i; } } } return -1; }
Source:
<code><START> public Invalid(E error) { <END> this.error = error; }</code><technical_language>Please constructor private consistent other controls. Instances created Validation API</technical_language>

Target:
private Invalid(E error) { this.error = error; }