auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void initialize() { initializeFields(); for (String[] <START> element : <END> fSyntaxColorListModel) { fHighlightingColorList.add(new HighlightingColorListItem(element[0], element[1], element[1] + AntEditorPreferenceConstants.EDITOR_BOLD_SUFFIX, element[1] + AntEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null)); } fHighlightingColorListViewer.setInput(fHighlightingColorList); fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0))); }</code><technical_language>rename colorModel</technical_language>

Target:
private void initialize() { initializeFields(); for (String[] colorModel : fSyntaxColorListModel) { fHighlightingColorList.add(new HighlightingColorListItem(colorModel[0], colorModel[1], colorModel[1] + AntEditorPreferenceConstants.EDITOR_BOLD_SUFFIX, colorModel[1] + AntEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null)); } fHighlightingColorListViewer.setInput(fHighlightingColorList); fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0))); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> return AuditLogType.VM_SET_TICKET; <END> }</code><technical_language>really? if failed</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.VM_SET_TICKET : AuditLogType.VM_SET_TICKET_FAILED; }
Source:
<code>public void complete(CompleteOperation op) { String buffer = op.getBuffer(); <START> List<String> candidates = op.getCompletionCandidates().stream().map(TerminalString::toString).collect(Collectors.toList()); <END> if(buffer.isEmpty()) { for(String name : context.getCommandRegistry().getCommandNames()) { Command command = context.getCommandRegistry().getCommand(name); if(command.isAvailable(context)) { candidates.add(name); } } } else { ProcessedCommand procCmd = new ProcessedCommand(buffer, op.getCursor()); if(!procCmd.isCommandComplete()) { for(String name : context.getCommandRegistry().getCommandNames()) { Command command = context.getCommandRegistry().getCommand(name); if(command.isAvailable(context) && name.startsWith(procCmd.getCommand())) { candidates.add(name); } } } else { Command command = context.getCommandRegistry().getCommand(procCmd.getCommand()); if(command.isAvailable(context)) { op.setOffset(op.getCursor()); for(Argument arg : procCmd.getArguments()) { if(arg.getOffset()<op.getCursor()) { op.setOffset(arg.getOffset()); } else { break; } } addPrefixMatches(procCmd.getCurrentArgument(), command.getOptions(), candidates); command.complete(context, procCmd, candidates); } } } Collections.sort(candidates); op.setCompletionCandidates(candidates); }</code><technical_language>2 concerns: - if toString is correct here. apply formatting options (color) string. I getCharacters is more correct. - CompleteOperation a method add candidates (addCompletionCandidate(String)), avoid stream collect them</technical_language>

Target:
public void complete(CompleteOperation op) { String buffer = op.getBuffer(); if(buffer.isEmpty()) { for(String name : context.getCommandRegistry().getCommandNames()) { Command command = context.getCommandRegistry().getCommand(name); if(command.isAvailable(context)) { op.addCompletionCandidate(name); } } } else { ProcessedCommand procCmd = new ProcessedCommand(buffer, op.getCursor()); if(!procCmd.isCommandComplete()) { for(String name : context.getCommandRegistry().getCommandNames()) { Command command = context.getCommandRegistry().getCommand(name); if(command.isAvailable(context) && name.startsWith(procCmd.getCommand())) { op.addCompletionCandidate(name); } } } else { Command command = context.getCommandRegistry().getCommand(procCmd.getCommand()); if(command.isAvailable(context)) { op.setOffset(op.getCursor()); for(Argument arg : procCmd.getArguments()) { if(arg.getOffset()<op.getCursor()) { op.setOffset(arg.getOffset()); } else { break; } } List<String> candidates = new ArrayList<>(); addPrefixMatches(procCmd.getCurrentArgument(), command.getOptions(), candidates); command.complete(context, procCmd, candidates); op.addCompletionCandidates(candidates); } } } }
Source:
<code>public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { List<Notification> notifications = event.getNotifications(); DRepresentationDescriptor representationDescriptor = null; Iterator<Notification> notifIterator = notifications.iterator(); while (notifIterator.hasNext() && representationDescriptor == null) { Notification notification = notifIterator.next(); Object notifier = notification.getNotifier(); boolean isRelatedToRepresentation = notifier instanceof DRepresentationElement || notifier instanceof DRepresentation; final DRepresentation representation; if (!isRelatedToRepresentation && notifier instanceof EObject) { representation = getDRepresentation((EObject) notifier); } else { representation = null; } if (isRelatedToRepresentation || representation != null) { RecordingCommand changeIdRecordingCommand = new RecordingCommand(transactionalEditingDomain) { @Override protected void doExecute() { <START> if (notifier instanceof DRepresentationElement) { SiriusHelper.updateChangeId((DRepresentationElement) notifier); } else if (notifier instanceof DRepresentation) { SiriusHelper.updateChangeId((DRepresentation) notifier); } else { SiriusHelper.updateChangeId(representation); } <END> } }; return changeIdRecordingCommand; } } return null; }</code><technical_language>get DRepDesc call updateChange descriptor</technical_language>

Target:
public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { List<Notification> notifications = event.getNotifications(); notifierWithoutRepresentationDescriptors = new HashSet<>(); Iterator<Notification> notifIterator = notifications.iterator(); while (notifIterator.hasNext()) { Notification notification = notifIterator.next(); Object notifier = notification.getNotifier(); final DRepresentationDescriptor representationDescriptor = getDRepresentationDescriptor((EObject) notifier); if (representationDescriptor != null) { RecordingCommand changeIdRecordingCommand = new RecordingCommand(transactionalEditingDomain) { @Override protected void doExecute() { RepresentationHelper.updateChangeId(representationDescriptor); } }; return changeIdRecordingCommand; } } return null; }
Source:
<code>protected void write(Object o, Encoder encoder) throws IOException { if (o == null || ((Map<String, Serializable>) o).isEmpty()) { encoder.writeIndex(NULL_SCHEMA_INDEX); encoder.writeNull(); } else { encoder.writeIndex(STRING_SCHEMA_INDEX); <START> String mapAsJson = new ObjectMapper().writeValueAsString(o); <END> encoder.writeString(mapAsJson); } }</code><technical_language>construct ObjectMapper time, put in a protected static final field</technical_language>

Target:
protected void write(Object o, Encoder encoder) throws IOException { if (o == null || ((Map<String, Serializable>) o).isEmpty()) { encoder.writeIndex(NULL_SCHEMA_INDEX); encoder.writeNull(); } else { encoder.writeIndex(STRING_SCHEMA_INDEX); String mapAsJson = MAPPER.writeValueAsString(o); encoder.writeString(mapAsJson); } }
Source:
<code>private InternalKeys() { <START> throw new AssertionError("InternalKeys is a constant container. Should not be instantiated"); <END> }</code><technical_language>Typical message is "No instances."</technical_language>

Target:
private InternalKeys() { throw new AssertionError("No instances."); }
Source:
<code><START> public JobConfig generateConfig(String executionPlanJson) { <END> Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); log.info("Job has generated configs {}", jobName, configs); configs.put(CONFIG_EXECUTION_PLAN, executionPlanJson); String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return new JobConfig(Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix))); }</code><technical_language>I understand this method signature. generateJobConfig executionPlanJson? Also, is added config</technical_language>

Target:
public JobConfig generateConfig(String executionPlanJson) { Map<String, String> configs = new HashMap<>(); configs.put(JobConfig.JOB_NAME(), jobName); List<String> inputs = inEdges.stream().map(edge -> edge.getFormattedSystemStream()).collect(Collectors.toList()); configs.put(TaskConfig.INPUT_STREAMS(), Joiner.on(',').join(inputs)); log.info("Job has generated configs {}", jobName, configs); configs.put(CONFIG_INTERNAL_EXECUTION_PLAN, executionPlanJson); String configPrefix = String.format(CONFIG_JOB_PREFIX, jobName); return new JobConfig(Util.rewriteConfig(extractScopedConfig(config, new MapConfig(configs), configPrefix))); }
Source:
<code>public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { CoordinatorStats stats = new CoordinatorStats(); Set<DataSegment> availableSegments = params.getAvailableSegments(); DruidCluster cluster = params.getDruidCluster(); if (!availableSegments.isEmpty()) { <START> for (NavigableSet<ServerHolder> serverHolders : cluster.getSortedHistoricalsByTier()) { <END> for (ServerHolder serverHolder : serverHolders) { ImmutableDruidServer server = serverHolder.getServer(); for (ImmutableDruidDataSource dataSource : server.getDataSources()) { for (DataSegment segment : dataSource.getSegments()) { if (!availableSegments.contains(segment)) { LoadQueuePeon queuePeon = params.getLoadManagementPeons().get(server.getName()); if (!queuePeon.getSegmentsToDrop().contains(segment)) { queuePeon.dropSegment( segment, new LoadPeonCallback() { @Override public void execute() { } } ); stats.addToTieredStat("unneededCount", server.getTier(), 1); } } } } } } } else { log.info( "Found 0 availableSegments, skipping the cleanup of segments from historicals. This is done to prevent a race condition in which the coordinator would drop all segments if it started running cleanup before it finished polling the metadata storage for available segments for the first time." ); } return params.buildFromExisting() .withCoordinatorStats(stats) .build(); }</code><technical_language>(Optional) this need other Collection<ServerHolder></technical_language>

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { CoordinatorStats stats = new CoordinatorStats(); Set<DataSegment> availableSegments = params.getAvailableSegments(); DruidCluster cluster = params.getDruidCluster(); if (!availableSegments.isEmpty()) { for (SortedSet<ServerHolder> serverHolders : cluster.getSortedHistoricalsByTier()) { for (ServerHolder serverHolder : serverHolders) { ImmutableDruidServer server = serverHolder.getServer(); for (ImmutableDruidDataSource dataSource : server.getDataSources()) { for (DataSegment segment : dataSource.getSegments()) { if (!availableSegments.contains(segment)) { LoadQueuePeon queuePeon = params.getLoadManagementPeons().get(server.getName()); if (!queuePeon.getSegmentsToDrop().contains(segment)) { queuePeon.dropSegment( segment, new LoadPeonCallback() { @Override public void execute() { } } ); stats.addToTieredStat("unneededCount", server.getTier(), 1); } } } } } } } else { log.info( "Found 0 availableSegments, skipping the cleanup of segments from historicals. This is done to prevent a race condition in which the coordinator would drop all segments if it started running cleanup before it finished polling the metadata storage for available segments for the first time." ); } return params.buildFromExisting() .withCoordinatorStats(stats) .build(); }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Constants.INTENT_REQUEST_CODE_SPEECH && resultCode == RESULT_OK) { List<String> results = data.getStringArrayListExtra( RecognizerIntent.EXTRA_RESULTS); <START> String spokenText = results.get(0); <END> getSearchFragment().searchAndUpdateText(spokenText); } else if (requestCode == Constants.INTENT_REQUEST_CODE_CONVERT && resultCode == RESULT_OK) { if (!data.hasExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA)) { super.onActivityResult(requestCode, resultCode, data); return; } final ScratchProgramData projectData = data.getParcelableExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA); final List<ScratchProgramData> projectList = new ArrayList<>(); projectList.add(projectData); convertProjects(projectList); } super.onActivityResult(requestCode, resultCode, data); }</code><technical_language>call data.getStringArrayListExtra(...).get(0) need create a list buffer return value</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Constants.INTENT_REQUEST_CODE_SPEECH && resultCode == RESULT_OK) { String spokenText = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS).get(0); getSearchFragment().searchAndUpdateText(spokenText); } else if (requestCode == Constants.INTENT_REQUEST_CODE_CONVERT && resultCode == RESULT_OK) { if (!data.hasExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA)) { super.onActivityResult(requestCode, resultCode, data); return; } final ScratchProgramData projectData = data.getParcelableExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA); final List<ScratchProgramData> projectList = new ArrayList<>(); projectList.add(projectData); convertProjects(projectList); } super.onActivityResult(requestCode, resultCode, data); }
Source:
<code>public int defaultTimeoutSeconds() { <START> return 600000; <END> }</code><technical_language>long read 10 entries :)</technical_language>

Target:
public int defaultTimeoutSeconds() { return 60; }
Source:
<code>private void pushWhenFinished(Job commitJob) { commitJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { <START> if (event.getResult().getSeverity() == IStatus.ERROR) { <END> return; } RemoteConfig config = SimpleConfigurePushDialog .getConfiguredRemote(repo); if (config == null) { Display.getDefault().syncExec(new Runnable() { public void run() { try { WizardDialog wizardDialog = new WizardDialog(shell, new PushWizard(repo)); wizardDialog.setHelpAvailable(true); wizardDialog.open(); } catch (URISyntaxException e) { Activator.handleError(NLS.bind(UIText.CommitUI_pushFailedMessage, e), e, true); } } }); } else { int timeout = Activator.getDefault().getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); PushOperationUI op = new PushOperationUI(repo, config.getName(), timeout, false); op.start(); } }}); }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
private void pushWhenFinished(Job commitJob) { commitJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (event.getResult().getSeverity() == IStatus.ERROR) return; RemoteConfig config = SimpleConfigurePushDialog .getConfiguredRemote(repo); if (config == null) { Display.getDefault().syncExec(new Runnable() { public void run() { try { WizardDialog wizardDialog = new WizardDialog( shell, new PushWizard(repo)); wizardDialog.setHelpAvailable(true); wizardDialog.open(); } catch (URISyntaxException e) { Activator.handleError(NLS.bind( UIText.CommitUI_pushFailedMessage, e), e, true); } } }); } else { int timeout = Activator.getDefault().getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); PushOperationUI op = new PushOperationUI(repo, config .getName(), timeout, false); op.start(); } } }); }
Source:
<code>public static boolean matchSubjectDnsName(X509Certificate certificate, String dnsName) { try { final Collection<List<?>> sans = certificate.getSubjectAlternativeNames(); if (sans != null) { <START> for (final List<?> san : sans) { <END> int generalName = (Integer) san.get(0); if (generalName == GeneralName.DNS_NAME.value) { String value = (String) san.get(1); if (dnsNameMatch(value, dnsName)) { return true; } } } } String cn = getPrincipalField(certificate.getSubjectX500Principal(), "CN"); if (dnsNameMatch(cn, dnsName)) { return true; } } catch (CertificateParsingException e) { } return false; }</code><technical_language>Generally avoid final key word for variable parameter if this is needed. reason</technical_language>

Target:
public static boolean matchSubjectDnsName(X509Certificate certificate, String dnsName) { try { Collection<List<?>> sans = certificate.getSubjectAlternativeNames(); if (sans != null) { for (List<?> san : sans) { int generalName = (Integer) san.get(0); if (generalName == GeneralName.DNS_NAME.value) { String value = (String) san.get(1); if (dnsNameMatch(value, dnsName)) { return true; } } } } String cn = getPrincipalField(certificate.getSubjectX500Principal(), "CN"); if (dnsNameMatch(cn, dnsName)) { return true; } } catch (CertificateParsingException e) { } return false; }
Source:
<code>public Iterator<MergeChunk> iterator() { return new Iterator<MergeChunk>() { int idx; public boolean hasNext() { return (idx < chunks.size()); } public MergeChunk next() { ConflictState state = ConflictState.NO_CONFLICT; <START> switch (chunks.get(idx++)) { <END> case 0: state = ConflictState.NO_CONFLICT; break; case 1: state = ConflictState.FIRST_CONFLICTING_RANGE; break; case 2: state = ConflictState.NEXT_CONFLICTING_RANGE; break; } int srcIdx = chunks.get(idx++); int begin = chunks.get(idx++); int end = chunks.get(idx++); return new MergeChunk(srcIdx, begin, end, state); } public void remove() { throw new UnsupportedOperationException(); } }; }</code><technical_language>This worries brittle ordering of enums of enum declaration. If moved around, this switch start reporting strange results. I if this better: private static final ConflictState[] states = ConflictState.values(); state = states[chunks.get(idx++)]; concern is faster slower switch. I suspect slower, hunch. :)</technical_language>

Target:
public Iterator<MergeChunk> iterator() { return new Iterator<MergeChunk>() { int idx; public boolean hasNext() { return (idx < chunks.size()); } public MergeChunk next() { ConflictState state = states[chunks.get(idx++)]; int srcIdx = chunks.get(idx++); int begin = chunks.get(idx++); int end = chunks.get(idx++); return new MergeChunk(srcIdx, begin, end, state); } public void remove() { throw new UnsupportedOperationException(); } }; }
Source:
<code>long maxArtifactSizeToBytes(EnforcerRuleHelper helper) throws EnforcerRuleException { String convertArtifactSize = maxArtifactSize; if (StringUtils.isEmpty(convertArtifactSize)) { helper .getLog() .info( String.format( "maxArtifactSize property not specified. Using default maxArtifactSize size: %s", DEFAULT_MAX_ARTIFACT_SIZE)); convertArtifactSize = DEFAULT_MAX_ARTIFACT_SIZE; } if (convertArtifactSize.endsWith(BYTES)) { return Long.parseLong(convertArtifactSize.split(BYTES)[0]); <START> } else if (convertArtifactSize.endsWith(KILO_BYTES)) { <END> return (long) (Double.parseDouble(convertArtifactSize.split(KILO_BYTES)[0]) * 1024); } else if (convertArtifactSize.endsWith(MEGA_BYTES)) { return (long) (Double.parseDouble(convertArtifactSize.split(MEGA_BYTES)[0]) * 1024 * 1024); } else { throw new EnforcerRuleException( String.format(UNKNOWN_ARTIFACT_SIZE_UNIT_MSG, BYTES, KILO_BYTES, MEGA_BYTES)); } }</code><technical_language>BUNDLE instead of JAR</technical_language>

Target:
long maxArtifactSizeToBytes(EnforcerRuleHelper helper) throws EnforcerRuleException { String convertArtifactSize = maxArtifactSize; if (StringUtils.isEmpty(convertArtifactSize)) { helper .getLog() .info( String.format( "maxArtifactSize property not specified. Using default maxArtifactSize size: %s", DEFAULT_MAX_ARTIFACT_SIZE)); convertArtifactSize = DEFAULT_MAX_ARTIFACT_SIZE; } try { return convertInputSize(convertArtifactSize); } catch (NumberFormatException e) { throw new EnforcerRuleException( String.format("Unparsable input size of %s", convertArtifactSize)); } }
Source:
<code>public void testFederateGetResults() throws Exception { List<String> sourceIds = ImmutableList.of("1"); QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, false, sourceIds, properties); Source mockSource = mock(Source.class); when(mockSource.getId()).thenReturn("1"); <START> when(mockSource.query(any(QueryRequest.class))).thenReturn(mockResponse); <END> List<Source> sourceList = ImmutableList.of(mockSource, mockSource, mockSource); when(mockResponse.getHits()).thenReturn((long) sourceList.size()); QueryResponse federateResponse = federateStrategy.federate(sourceList, fedQueryRequest); assertThat(federateResponse.getResults().size(), is(sourceList.size())); }</code><technical_language>put this line 2 mockSource lines a private method called setupMockSource code is needed in multiple tests</technical_language>

Target:
public void testFederateGetResults() throws Exception { QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, false, null, properties); Source mockSource1 = getMockSource(); Source mockSource2 = getMockSource(); Source mockSource3 = getMockSource(); List<Source> sourceList = ImmutableList.of(mockSource1, mockSource2, mockSource3); QueryResponse federateResponse = federateStrategy.federate(sourceList, fedQueryRequest); assertThat(federateResponse.getResults().size(), is(sourceList.size())); }
Source:
<code>public void onVcsRefresh(VcsRefreshEvent event) { JsVectorString branches = pVcsState_.get().getBranchInfo().getBranches().cast(); if (branches.length() != branches_.length()) { branches_ = branches.slice().cast(); <START> menuRebuildRequired_ = true; <END> } for (int i = 0; i < branches.length(); i++) { if (!StringUtil.equals(branches.get(i), branches_.get(i))) { branches_ = branches.slice(); menuRebuildRequired_ = true; break; } } }</code><technical_language>Nit: bail out here? (seems determined a rebuild is required need compare branch individually)</technical_language>

Target:
public void onVcsRefresh(VcsRefreshEvent event) { JsVectorString branches = pVcsState_.get().getBranchInfo().getBranches().cast(); if (branches.length() != branches_.length()) { branches_ = branches.slice().cast(); menuRebuildRequired_ = true; return; } for (int i = 0; i < branches.length(); i++) { if (!StringUtil.equals(branches.get(i), branches_.get(i))) { branches_ = branches.slice(); menuRebuildRequired_ = true; return; } } }
Source:
<code>public float op(float origin, float other) { <START> return FastMath.max(origin, other); <END> }</code><technical_language>min, max</technical_language>

Target:
public float op(float origin, float other) { return origin; }
Source:
<code>private void populateViews() { <START> AnalyticsTracker.track(AnalyticsTracker.Stat.CREATED_ACCOUNT); <END> mEmailAddress = mAccountStore.getAccount().getEmail(); mDisplayName = createDisplayNameFromEmail(); mUsername = !TextUtils.isEmpty(mAccountStore.getAccount().getUserName()) ? mAccountStore.getAccount().getUserName() : createUsernameFromEmail(); mHeaderDisplayName.setText(mDisplayName); mHeaderEmailAddress.setText(mEmailAddress); mEditTextDisplayName.setText(mDisplayName); mEditTextUsername.setText(mUsername); Bundle args = new Bundle(); args.putString(ARG_DISPLAY_NAME, mDisplayName); args.putString(ARG_EMAIL_ADDRESS, mEmailAddress); args.putString(ARG_PHOTO_URL, mPhotoUrl); args.putString(ARG_USERNAME, mUsername); args.putBoolean(ARG_IS_EMAIL_SIGNUP, mIsEmailSignup); setArguments(args); }</code><technical_language>WDYT leaving track trigger populateViews() method clear of side effect (it's a UI related method anyway) instead, do trigger 2 populateViews() call sites? Alternatively, a bit worried triggering this track late in process, wdyt adding track closer places this info earliest? I places in WPMainActivity for magiclink signup in SignupGoogleFragment in this PR</technical_language>

Target:
private void populateViews() { mEmailAddress = mAccountStore.getAccount().getEmail(); mDisplayName = createDisplayNameFromEmail(); mUsername = !TextUtils.isEmpty(mAccountStore.getAccount().getUserName()) ? mAccountStore.getAccount().getUserName() : createUsernameFromEmail(); mHeaderDisplayName.setText(mDisplayName); mHeaderEmailAddress.setText(mEmailAddress); mEditTextDisplayName.setText(mDisplayName); mEditTextUsername.setText(mUsername); Bundle args = new Bundle(); args.putString(ARG_DISPLAY_NAME, mDisplayName); args.putString(ARG_EMAIL_ADDRESS, mEmailAddress); args.putString(ARG_PHOTO_URL, mPhotoUrl); args.putString(ARG_USERNAME, mUsername); args.putBoolean(ARG_IS_EMAIL_SIGNUP, mIsEmailSignup); setArguments(args); }
Source:
<code>static private AbstractConfigValue findKeyOrNull(AbstractConfigObject self, String key, ConfigValueType expected, Path originalPath) { AbstractConfigValue v = self.peekAssumingResolved(key, originalPath); if (v == null) <START> throw new ConfigException.Missing(self.origin(), originalPath); <END> if (expected != null) v = DefaultTransformer.transform(v, expected); if (expected != null && (v.valueType() != expected && v.valueType() != ConfigValueType.NULL)) throw new ConfigException.WrongType(v.origin(), originalPath.render(), expected.name(), v.valueType().name()); else return v; }</code><technical_language>I Path.render() instead of making Path public. PR lgtm, thanks</technical_language>

Target:
static private AbstractConfigValue findKeyOrNull(AbstractConfigObject self, String key, ConfigValueType expected, Path originalPath) { AbstractConfigValue v = self.peekAssumingResolved(key, originalPath); if (v == null) throw new ConfigException.Missing(self.origin(), originalPath.render()); if (expected != null) v = DefaultTransformer.transform(v, expected); if (expected != null && (v.valueType() != expected && v.valueType() != ConfigValueType.NULL)) throw new ConfigException.WrongType(v.origin(), originalPath.render(), expected.name(), v.valueType().name()); else return v; }
Source:
<code>public File getLogFile() { if (job == null) { return null; <START> } else { <END> return new File(job.getRootDir(), "github-polling.log"); } }</code><technical_language>coding style, I else ("else return")</technical_language>

Target:
public File getLogFile() { try { return getLogFileForJob(notNull(job, "Job can't be null!")); } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
<code><START> public List<Client> getAllRegisteredNamespaces() { <END> return jdbi.withExtension(SqlitePaxosStateLog.Queries.class, SqlitePaxosStateLog.Queries::getAllNamespaces) .stream() .map(Client::of) .collect(Collectors.toList()); }</code><technical_language>above, a set</technical_language>

Target:
public Set<Client> getAllRegisteredNamespaces() { return jdbi.withExtension(SqlitePaxosStateLog.Queries.class, SqlitePaxosStateLog.Queries::getAllNamespaces) .stream() .map(Client::of) .collect(Collectors.toSet()); }
Source:
<code>public BodyPrint(final Response res) { <START> this.bytes = new IoChecked<>( <END> new Sticky<>( () -> { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] buf = new byte[4096]; try (InputStream body = res.body()) { while (true) { final int bts = body.read(buf); if (bts < 0) { break; } baos.write(buf, 0, bts); } } finally { baos.flush(); } return baos.toByteArray(); } ) ); }</code><technical_language>@fabriciofx need store byte of res: cactoos allows InputStream in of cases, methods</technical_language>

Target:
public BodyPrint(final Response res) { this.response = res; }
Source:
<code>protected void executeQueryCommand() { clusterId = getParameters().getClusterId(); if (clusterId == null) { <START> clusterId = volume.getClusterId(); <END> } Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID.toString()); } asyncTask = volume.getAsyncTask(); if (asyncTask == null) { getQueryReturnValue().setReturnValue(null); return; } getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } }</code><technical_language>volume null here, no? set</technical_language>

Target:
protected void executeQueryCommand() { clusterId = getParameters().getClusterId(); Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID.toString()); } if (clusterId == null) { clusterId = volume.getClusterId(); } asyncTask = volume.getAsyncTask(); if (asyncTask == null) { getQueryReturnValue().setReturnValue(null); return; } getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } }
Source:
<code>public Response revokeSingleToken(@PathParam("accountId") String accountId, JsonNode payload) { JsonNode jsonNode; if (payload == null || (jsonNode = payload.get("token_link")) == null) { return Response.status(BAD_REQUEST).entity(ImmutableMap.of("message","Missing fields: [token_link]")).build(); } Optional<String> revokedDate = authDao.revokeSingleToken(accountId, jsonNode.asText()); if (revokedDate.isPresent()) { return Response.ok(ImmutableMap.of("revoked", revokedDate.get())).build(); } <START> return Response.status(NOT_FOUND).entity(ImmutableMap.of("message","Could not revoke token")).build(); <END> }</code><technical_language>move a ResponseUtil method</technical_language>

Target:
public Response revokeSingleToken(@PathParam("accountId") String accountId, JsonNode payload) { JsonNode jsonNode; if (payload == null || (jsonNode = payload.get("token_link")) == null) { return badRequestResponse(logger, "Missing fields: [token_link]"); } return authDao.revokeSingleToken(accountId, jsonNode.asText()) .map(revokedDate -> ok(ImmutableMap.of("revoked", revokedDate)).build()) .orElseGet(() -> notFoundResponse(logger, "Could not revoke token")); }
Source:
<code>public void testDoubleForEachCacheInjected() { Cache<Double, String> cache = getCache(0); int range = 10; DoubleStream.iterate(0.0, d -> d + .5).limit(10).boxed().forEach(i -> cache.put(i, i + "-value")); assertEquals(range, cache.size()); CacheSet<Map.Entry<Double, String>> entrySet = cache.entrySet(); int cacheOffset = populateNextForEachStructure(cache); int offset = populateNextForEachStructure(new DoubleSummaryStatistics()); try { createStream(entrySet).mapToDouble(toDouble).forEach(new ForEachDoubleInjected(cacheOffset, offset)); DoubleSummaryStatistics stats = getForEachObject(offset); assertEquals(2.25, stats.getAverage()); assertEquals(0.0, stats.getMin()); assertEquals(4.5, stats.getMax()); assertEquals(10, stats.getCount()); <START> assertEquals(22.5, stats.getSum()); <END> } finally { clearForEachObject(cacheOffset); clearForEachObject(offset); } }</code><technical_language>a single method work a ForEachDoubleInjected a regular DoubleConsumer? [TestNG parameters](<LINK_0> avoid creating multiple test methods</technical_language>

Target:
public void testDoubleForEachCacheInjected() { Cache<Double, String> cache = getCache(0); int cacheOffset = populateNextForEachStructure(cache); int offset = populateNextForEachStructure(new DoubleSummaryStatistics()); try { testDoubleOperation(() -> { createStream(cache.entrySet()).mapToDouble(toDouble).forEach(new ForEachDoubleInjected<>(cacheOffset, offset)); return getForEachObject(offset); }, cache); } finally { clearForEachObject(cacheOffset); clearForEachObject(offset); } }
Source:
<code>protected int getCurrentOuterSnapshotVersion() { <START> return version; <END> }</code><technical_language>This method is relevant for writing snapshots restore. Therefore, this latest version, read older version. suggestion return VERSION;</technical_language>

Target:
protected int getCurrentOuterSnapshotVersion() { return VERSION; }
Source:
<code>public static String ensureTopicExists( AmazonSNS amazonSNS, ARN topicARN, AmazonPubsubSubscription subscription) { <START> String createdTopicARN = amazonSNS.createTopic(topicARN.getName()).getTopicArn(); <END> log.debug( (createdTopicARN.equals(topicARN.getArn())) ? "Reusing existing topic {}" : "Created topic {}", createdTopicARN); if (!subscription.getAccountIds().isEmpty()) { amazonSNS.setTopicAttributes( new SetTopicAttributesRequest() .withTopicArn(createdTopicARN) .withAttributeName("Policy") .withAttributeValue( buildSNSPolicy(new ARN(createdTopicARN), subscription.getAccountIds()).toJson())); } return createdTopicARN; }</code><technical_language>worth some retries this - I suspect topic creation is idempotentish safe retry</technical_language>

Target:
public static String ensureTopicExists( AmazonSNS amazonSNS, ARN topicARN, AmazonPubsubSubscription subscription) { String createdTopicARN = retrySupport.retry( () -> amazonSNS.createTopic(topicARN.getName()).getTopicArn(), MAX_RETRIES, RETRY_BACKOFF, EXPONENTIAL); log.debug( (createdTopicARN.equals(topicARN.getArn())) ? "Reusing existing topic {}" : "Created topic {}", createdTopicARN); if (!subscription.getAccountIds().isEmpty()) { amazonSNS.setTopicAttributes( new SetTopicAttributesRequest() .withTopicArn(createdTopicARN) .withAttributeName("Policy") .withAttributeValue( buildSNSPolicy(new ARN(createdTopicARN), subscription.getAccountIds()).toJson())); } return createdTopicARN; }
Source:
<code>public void process() { PerformanceMonitor.startActivity("Render World (Shadow Map)"); shadowMap.bind(); <START> setViewportToSizeOf(shadowMap); END> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GL11.glDisable(GL_CULL_FACE); camera.lookThrough(); shadowMapShader.enable(); worldRenderer.renderChunks(renderQueues.chunksOpaqueShadow, ChunkMesh.RenderPhase.OPAQUE, camera, WorldRendererImpl.ChunkRenderMode.SHADOW_MAP); playerCamera.lookThrough(); GL11.glEnable(GL_CULL_FACE); bindDisplay(); PerformanceMonitor.endActivity(); }</code><technical_language>Hmmmm. Reading shadowMap.setAsViewport() is happening object shadowMap viewport. a method affects instance is attached instance is "agent" something. In this case sense. theorethically for shadowMap.setViewportToItsSize() a bit convoluted. I prefer immediacy of setViewportToSizeOf(anFBO), plain English</technical_language>

Target:
public void process() { this.shadowMap = frameBuffersManager.getFBO("sceneShadowMap"); positionShadowMapCamera(); boolean processCondition = renderingConfig.isDynamicShadows() && worldRenderer.isFirstRenderingStageForCurrentFrame(); if (!processCondition) { return; } PerformanceMonitor.startActivity("Render World (Shadow Map)"); shadowMap.bind(); setViewportToSizeOf(shadowMap); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GL11.glDisable(GL_CULL_FACE); shadowMapCamera.lookThrough(); shadowMapShader.enable(); worldRenderer.renderChunks(renderQueues.chunksOpaqueShadow, ChunkMesh.RenderPhase.OPAQUE, shadowMapCamera, WorldRendererImpl.ChunkRenderMode.SHADOW_MAP); playerCamera.lookThrough(); GL11.glEnable(GL_CULL_FACE); bindDisplay(); PerformanceMonitor.endActivity(); }
Source:
<code>public void processElement(ProcessContext context) throws Exception { <START> LOG.trace("Persisting {}", Bytes.toString(context.element().getRow())); <END> mutator.mutate(context.element()); }</code><technical_language>consider: if (LOG.isTraceEnabled()) { ... }</technical_language>

Target:
public void processElement(ProcessContext context) throws Exception { Mutation mutation = context.element(); if (LOG.isTraceEnabled()) { LOG.trace("Persisting {}", Bytes.toString(mutation.getRow())); } mutator.mutate(mutation); }
Source:
<code>static void verifyMultipleReads(ColumnIndexDirectory columnDirectory, String column, int numIter) throws Exception { <START> for (int ii = 0; ii < numIter; ii++) { <END> PinotDataBuffer buf = ColumnIndexDirectoryTestHelper.getIndexBuffer(columnDirectory, column, ii); int numValues = (int) (buf.size() / 4); for (int j = 0; j < numValues; ++j) { Assert.assertEquals(buf.getInt(j * 4), j, "Inconsistent value at index: " + j); } } }</code><technical_language>good rename index variable</technical_language>

Target:
static void verifyMultipleReads(ColumnIndexDirectory columnDirectory, String column, int numIter) throws Exception { for (int i = 0; i < numIter; i++) { PinotDataBuffer buf = ColumnIndexDirectoryTestHelper.getIndexBuffer(columnDirectory, column, i); int numValues = (int) (buf.size() / 4); for (int j = 0; j < numValues; ++j) { Assert.assertEquals(buf.getInt(j * 4), j, "Inconsistent value at index: " + j); } } }
Source:
<code>public void run() { if (!partitionStateManager.isInitialized()) { return; } <START> if (!node.getClusterService().getClusterState().isJoinAllowed()) { <END> logger.fine("Will not repair partition table at the moment. " + "Cluster state does not allow new members to join."); return; } Map<Address, Collection<MigrationInfo>> promotions = removeUnknownAddressesAndCollectPromotions(); boolean success = promoteBackupsForMissingOwners(promotions); partitionServiceLock.lock(); try { if (success) { if (logger.isFinestEnabled()) { logger.finest("RepartitioningTask scheduled"); } migrationQueue.add(new RepartitioningTask()); } else { triggerControlTask(); } } finally { partitionServiceLock.unlock(); } }</code><technical_language>Is this check needed in MigrationRunnables modify partition table? Is needed in MigrateTask</technical_language>

Target:
public void run() { if (!partitionStateManager.isInitialized()) { return; } ClusterState clusterState = node.getClusterService().getClusterState(); if (!clusterState.isMigrationAllowed() && !clusterState.isPartitionPromotionAllowed()) { logger.fine("Will not repair partition table at the moment. " + "Cluster state does not allow to modify partition table."); return; } Map<Address, Collection<MigrationInfo>> promotions = removeUnknownAddressesAndCollectPromotions(); boolean success = promoteBackupsForMissingOwners(promotions); partitionServiceLock.lock(); try { if (success) { if (logger.isFinestEnabled()) { logger.finest("RepartitioningTask scheduled"); } migrationQueue.add(new RepartitioningTask()); } else { triggerControlTask(); } } finally { partitionServiceLock.unlock(); } }
Source:
<code>@Override protected void writeExternalData(ObjectOutput out) throws IOException { <START> throw new RuntimeException("TODO"); <END> }</code><technical_language>Please remove TODO check result is broken</technical_language>

Target:
@Override protected void writeExternalData(ObjectOutput out) throws IOException { out.writeObject(topVer); U.writeCollection(out, assignment); U.writeMap(out, primary); U.writeMap(out, backup); }
Source:
<code>private static void clear() { <START> flush(BriefcasePreferences.appScoped()); <END> Stream.of( PullTransferPanel.class, PushTransferPanel.class, PullPanel.class, PushPanel.class, ExportPanel.class ).map(BriefcasePreferences::forClass) .forEach(ClearPreferences::flush); }</code><technical_language>I this of Stream</technical_language>

Target:
private static void clear() { flush(BriefcasePreferences.appScoped()); Stream.of( PullPanel.class, PushPanel.class, ExportPanel.class ).map(BriefcasePreferences::forClass) .forEach(ClearPreferences::flush); }
Source:
<code>public <T extends Action> List<T> getActions(Class<T> type) { <START> List<T> _actions = Util.filter(getPersistedActions(), type); <END> for (TransientActionFactory<?> taf : TransientActionFactory.factoriesFor(getClass(), type)) { _actions.addAll(Util.filter(createFor(taf), type)); } return Collections.unmodifiableList(_actions); }</code><technical_language>I this reverted, account additions pre-TransientActionFactory implementations</technical_language>

Target:
public <T extends Action> List<T> getActions(Class<T> type) { List<T> _actions = Util.filter(getActions(), type); for (TransientActionFactory<?> taf : TransientActionFactory.factoriesFor(getClass(), type)) { _actions.addAll(Util.filter(createFor(taf), type)); } return Collections.unmodifiableList(_actions); }
Source:
<code>private String attributeKeyFrom(String key) { String formattedAttribute = Stream.of(key.split("\\.")) <START> .map(part -> Stream.of(part.split("-")).collect(Collectors.joining(" "))) <END> .collect(Collectors.joining(" ")); return WordUtils.capitalize(formattedAttribute); }</code><technical_language>map(part -> part.replaceAll("-", " "))</technical_language>

Target:
private String attributeKeyFrom(String key) { String formattedAttribute = Stream.of(key.split("\\.")) .map(part -> part.replaceAll("-", " ")) .collect(Collectors.joining(" ")); return WordUtils.capitalize(formattedAttribute); }
Source:
<code>public static void setUpConfiguration() { <START> projectId = TestHelper.getTestProperty(PROJECT_ID_KEY); <END> instanceId = TestHelper.getTestProperty(INSTANCE_ID_KEY); gcsPath = TestHelper.getTestProperty("google.dataflow.gcsPath"); gcsWorkDir = gcsPath + "/" + UUID.randomUUID().toString(); stagingLocation = gcsWorkDir + "/staging"; tempLocation = gcsWorkDir + "/temp"; }</code><technical_language>remove precondition checks</technical_language>

Target:
public static void setUpConfiguration() { projectId = TestHelper.getTestProperty(PROJECT_ID_KEY); instanceId = TestHelper.getTestProperty(INSTANCE_ID_KEY); gcsPath = TestHelper.getTestProperty("google.bigtable.dataflow.gcsPath"); gcsWorkDir = gcsPath + "/" + UUID.randomUUID().toString(); stagingLocation = gcsWorkDir + "/staging"; tempLocation = gcsWorkDir + "/temp"; }
Source:
<code>private boolean checkJoinGroupNode(StaticAnalysis sa, JoinGroupNode node, Set<IVariable<?>> projectedVars) { AtomicBoolean res = new AtomicBoolean(); <START> node.forEach(child -> { <END> res.compareAndSet(false, checkIfNodeProducesVars(sa, child, projectedVars)); }); return res.get(); }</code><technical_language>foreach in checkServiceNode()? do extra work if child contains variable more children</technical_language>

Target:
private boolean checkJoinGroupNode(StaticAnalysis sa, JoinGroupNode node, Set<IVariable<?>> projectedVars) { AtomicBoolean res = new AtomicBoolean(); node.forEach(child -> res.compareAndSet(false, checkIfNodeProducesVars(sa, child, projectedVars))); return res.get(); }
Source:
<code>public static void readFromNBT(NBTTagCompound nbt, String str, IInventory inventory) { NBTTagList var2 = nbt.getTagList(str, 10); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); int var5 = var4.getByte("Slot") & 255; if (var5 >= 0 && var5 < inventory.getSizeInventory()) { inventory.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4)); <END> <START> } } }</code><technical_language>This change sense variable names meaningless me</technical_language>

Target:
public static void readFromNBT(NBTTagCompound nbt, String str, IInventory inventory) { NBTTagList var2 = nbt.getTagList(str, 10); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); int var5 = var4.getByte("Slot") & 255; if (var5 < inventory.getSizeInventory()) { inventory.setInventorySlotContents(var5, new ItemStack(var4)); } } }
Source:
<code>public List<SinkRecord> flush() throws SQLException { if (records.isEmpty()) { log.debug("Records is empty"); return new ArrayList<>(); } <START> log.debug("Flushing Buffered Records", records.size()); <END> for (SinkRecord record : records) { preparedStatementBinder.bindRecord(record); } int totalUpdateCount = 0; boolean successNoInfo = false; for (int updateCount : preparedStatement.executeBatch()) { if (updateCount == Statement.SUCCESS_NO_INFO) { successNoInfo = true; continue; } totalUpdateCount += updateCount; } if (totalUpdateCount != records.size() && !successNoInfo) { switch (config.insertMode) { case INSERT: throw new ConnectException(String.format( "Update count (%d) did not sum up to total number of records inserted (%d)", totalUpdateCount, records.size() )); case UPSERT: case UPDATE: log.debug( "{} records:{} resulting in in totalUpdateCount:{}", config.insertMode, records.size(), totalUpdateCount ); break; default: throw new ConnectException("Unknown insert mode: " + config.insertMode); } } if (successNoInfo) { log.info( "{} records:{} , but no count of the number of rows it affected is available", config.insertMode, records.size() ); } final List<SinkRecord> flushedRecords = records; records = new ArrayList<>(); return flushedRecords; }</code><technical_language>Nit: suggestion log.debug("Flushing buffered records", records.size());</technical_language>

Target:
public List<SinkRecord> flush() throws SQLException { if (records.isEmpty()) { log.debug("Records is empty"); return new ArrayList<>(); } log.debug("Flushing buffered records", records.size()); for (SinkRecord record : records) { preparedStatementBinder.bindRecord(record); } int totalUpdateCount = 0; boolean successNoInfo = false; for (int updateCount : preparedStatement.executeBatch()) { if (updateCount == Statement.SUCCESS_NO_INFO) { successNoInfo = true; continue; } totalUpdateCount += updateCount; } if (totalUpdateCount != records.size() && !successNoInfo) { switch (config.insertMode) { case INSERT: throw new ConnectException(String.format( "Update count (%d) did not sum up to total number of records inserted (%d)", totalUpdateCount, records.size() )); case UPSERT: case UPDATE: log.debug( "{} records:{} resulting in in totalUpdateCount:{}", config.insertMode, records.size(), totalUpdateCount ); break; default: throw new ConnectException("Unknown insert mode: " + config.insertMode); } } if (successNoInfo) { log.info( "{} records:{} , but no count of the number of rows it affected is available", config.insertMode, records.size() ); } final List<SinkRecord> flushedRecords = records; records = new ArrayList<>(); return flushedRecords; }
Source:
<code>private EmailWrapper getEmailToStudent(StudentAttributes student, List<EmailWrapper> emailsSent) { for (EmailWrapper email : emailsSent) { <START> boolean emailSentToThisStudent = email.getFirstRecipient().equalsIgnoreCase(student.email); <END> if (emailSentToThisStudent) { return email; } } return null; }</code><technical_language>get rename this variable prefix is I guess</technical_language>

Target:
private EmailWrapper getEmailToStudent(StudentAttributes student, List<EmailWrapper> emailsSent) { for (EmailWrapper email : emailsSent) { boolean isEmailSentToThisStudent = email.getFirstRecipient().equalsIgnoreCase(student.email); if (isEmailSentToThisStudent) { return email; } } return null; }