auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private TokenCacheItem(final String authority, final AuthenticationResult authenticationResult) { if (authenticationResult == null) { throw new IllegalArgumentException("authenticationResult"); } if (StringExtensions.IsNullOrBlank(authority)) { throw new IllegalArgumentException("authority"); } mAuthority = authority; mExpiresOn = authenticationResult.getExpiresOn(); mIsMultiResourceRefreshToken = authenticationResult.getIsMultiResourceRefreshToken(); mTenantId = authenticationResult.getTenantId(); mUserInfo = authenticationResult.getUserInfo(); mRawIdToken = authenticationResult.getIdToken(); mRefreshtoken = authenticationResult.getRefreshToken(); mFamilyClientId = authenticationResult.getFamilyClientId(); <START> if (authenticationResult.getExtendedExpiresOn() != null) { <END> mExtendedExpiresOn = authenticationResult.getExtendedExpiresOn(); } }</code><technical_language>checking for null instead of assign? checking for null for other variables? This is confusing</technical_language>

Target:
private TokenCacheItem(final String authority, final AuthenticationResult authenticationResult) { if (authenticationResult == null) { throw new IllegalArgumentException("authenticationResult"); } if (StringExtensions.IsNullOrBlank(authority)) { throw new IllegalArgumentException("authority"); } mAuthority = authority; mExpiresOn = authenticationResult.getExpiresOn(); mIsMultiResourceRefreshToken = authenticationResult.getIsMultiResourceRefreshToken(); mTenantId = authenticationResult.getTenantId(); mUserInfo = authenticationResult.getUserInfo(); mRawIdToken = authenticationResult.getIdToken(); mRefreshtoken = authenticationResult.getRefreshToken(); mFamilyClientId = authenticationResult.getFamilyClientId(); mExtendedExpiresOn = authenticationResult.getExtendedExpiresOn(); }
Source:
<code>public void should_replace_old_job_with_regex() { String oldJobName = "MyJob01"; String newJobName = "MyJob02"; String renameRegex = "/MyJob\\d+/"; jenkins.jobs.create(FreeStyleJob.class, oldJobName); String jobDslScript = String.format("job('%s') { previousNames( %s ) }", newJobName, renameRegex); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, newJobName); assertThat(job, pageObjectExists()); <START> assertEquals(newJobName, job.name); <END> }</code><technical_language>a check name exist anymore</technical_language>

Target:
public void should_replace_old_job_with_regex() { String oldJobName = "MyJob01"; String newJobName = "MyJob02"; String renameRegex = "/MyJob\\d+/"; jenkins.jobs.create(FreeStyleJob.class, oldJobName); String jobDslScript = String.format("job('%s') { previousNames( %s ) }", newJobName, renameRegex); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, newJobName); Job oldJob = jenkins.jobs.get(Job.class, oldJobName); assertThat(job, pageObjectExists()); assertThat(oldJob, pageObjectDoesNotExist()); assertEquals(newJobName, job.name); }
Source:
<code>public GT_Block_Casings8() { super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE); for (int i = 0; i < 2; i = (i + 1)) { Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Robust HSS-G Machine Casing"); ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0)); ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1)); <START> ItemList.Casing_RobustHSSG.set(new ItemStack(this,1,0)); <END> }</code><technical_language>set meta</technical_language>

Target:
public GT_Block_Casings8() { super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE); for (int i = 0; i < 3; i = (i + 1)) { Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Robust HSS-G Machine Casing"); ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0)); ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1)); ItemList.Casing_RobustHSSG.set(new ItemStack(this,1,2)); }
Source:
<code><START> public String getSource(EnvVars env) { <END> return env.expand(source); }</code><technical_language>this need public? Please do introduce new public members cause</technical_language>

Target:
private String getSource(EnvVars env) { return env.expand(source); }
Source:
<code>protected String[] getMutablePropertyNames() { <START> return new String[] { "dateStopped", "voided", "dateVoided", "voidedBy", "voidReason" }; <END> }</code><technical_language>I create instead of in call. HashSet.contains feels faster array for 5 elements</technical_language>

Target:
protected String[] getMutablePropertyNames() { return MUTABLE_PROPERTY_NAMES; }
Source:
<code>public ActionResult execute() { <START> String newCourseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); <END> CourseCreateRequest courseCreateRequest = getAndValidateRequestBody(CourseCreateRequest.class); String newCourseName = courseCreateRequest.getCourseName(); String newCourseTimeZone = courseCreateRequest.getTimeZone(); try { logic.createCourseAndInstructor(userInfo.id, newCourseId, newCourseName, newCourseTimeZone); } catch (EntityAlreadyExistsException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_CONFLICT); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } String statusMessage = "The course has been added. Click <a href=\"/web/instructor/courses/enroll?courseid=" + newCourseId + "\">here</a> to add students to the course or click " + "<a href=\"/web/instructor/courses/edit?courseid=" + newCourseId + "\">here</a> to add other instructors." + "<br>If you don't see the course in the list below, please refresh the page after a few moments."; return new JsonResult(statusMessage); }</code><technical_language>COURSE_ID is identify resource CourseCreateRequest</technical_language>

Target:
public ActionResult execute() { CourseCreateRequest courseCreateRequest = getAndValidateRequestBody(CourseCreateRequest.class); String newCourseId = courseCreateRequest.getCourseId(); String newCourseName = courseCreateRequest.getCourseName(); String newCourseTimeZone = courseCreateRequest.getTimeZone(); try { logic.createCourseAndInstructor(userInfo.id, newCourseId, newCourseName, newCourseTimeZone); } catch (EntityAlreadyExistsException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_CONFLICT); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return new JsonResult(new CourseData(logic.getCourse(newCourseId))); }
Source:
<code>public void saveOrUpdateShouldBeUnsuccessfulWhenPositionIdIsNotANumber() throws Exception { given(this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)).willReturn(COMMON_INVALID_INPUT_MESSAGE); given(this.messageKeyResolver.resolveMessageOrDefault(POSITION_NOT_FOUND_ERROR_MESSAGE_KEY)).willReturn(POSITION_NOT_FOUND_ERROR_MESSAGE); <START> <END> this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", STRING_VALUE_ONE) .param("position.id", TEXT).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(REDIRECT_URL_FIELD_ERROR)) .andExpect(flash().attribute("positionErrorMessage", POSITION_NOT_FOUND_ERROR_MESSAGE)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(1L); then(this.positionService).should().getPositionDtoById(null); then(this.channelService).should().getChannelDtoById(1L); }</code><technical_language>is initialization for candidateService, positionService channelService</technical_language>

Target:
public void saveOrUpdateShouldBeUnsuccessfulWhenPositionIdIsNotANumber() throws Exception { given(this.candidateService.getCandidate(1L)).willReturn(new CandidateDTO()); given(this.positionService.getPositionDtoById(null)).willThrow(new AssertionError()); given(this.channelService.getChannelDtoById(1L)).willReturn(channelDTO); given(this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)).willReturn(COMMON_INVALID_INPUT_MESSAGE); given(this.messageKeyResolver.resolveMessageOrDefault(POSITION_NOT_FOUND_ERROR_MESSAGE_KEY)).willReturn(POSITION_NOT_FOUND_ERROR_MESSAGE); this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", STRING_VALUE_ONE) .param("position.id", TEXT).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(REDIRECT_URL_FIELD_ERROR)) .andExpect(flash().attributeCount(2)) .andExpect(flash().attribute("positionErrorMessage", POSITION_NOT_FOUND_ERROR_MESSAGE)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(1L); then(this.positionService).should().getPositionDtoById(null); then(this.channelService).should().getChannelDtoById(1L); }
Source:
<code><START> public HashSet<Zoie<BoboIndexReader, ?>> getZoieSystems() <END> { return _core.getZoieSystems(); }</code><technical_language>is a reason changing collection hashset</technical_language>

Target:
public Collection<Zoie<BoboIndexReader, ?>> getZoieSystems() { return _core.getZoieSystems(); }
Source:
<code>public T hasThisElement(final Object val) { Assert.parametersNotNull("val", val); <START> return addCriteria(FilterOperator.ELEMENT_MATCH, val, not); <END> }</code><technical_language>3rd param false 'not'? Is this fixing a bug</technical_language>

Target:
public T hasThisElement(final Object val) { Assert.parametersNotNull("val", val); return addCriteria(FilterOperator.ELEMENT_MATCH, val, false); }
Source:
<code>protected IStatus run(final IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); while (!monitor.isCanceled()) { try { long prevNbEvents = fTrace.getNbEvents(); Thread.sleep(250); long nbEvents = fTrace.getNbEvents(); setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + String.format("%,d", nbEvents) + ")"); long rate = (nbEvents - prevNbEvents) * 4; monitor.setTaskName(String.format("%,d", rate) + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); } catch (final InterruptedException e) { return Status.OK_STATUS; } } monitor.done(); return fException != null ? new Status(IStatus.ERROR, <START> "", fException.getMessage(), <END> fException) : Status.OK_STATUS; }</code><technical_language>Activator.PLUGIN_ID activator of tmf.core</technical_language>

Target:
protected IStatus run(final IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); while (!monitor.isCanceled()) { try { long prevNbEvents = fTrace.getNbEvents(); Thread.sleep(250); long nbEvents = fTrace.getNbEvents(); setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + String.format("%,d", nbEvents) + ")"); long rate = (nbEvents - prevNbEvents) * 4; monitor.setTaskName(String.format("%,d", rate) + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); } catch (final InterruptedException e) { return Status.OK_STATUS; } } monitor.done(); return fException != null ? new Status(IStatus.ERROR, Activator.PLUGIN_ID, fException.getMessage(), fException) : Status.OK_STATUS; }
Source:
<code>public BibtexExtractorViewModel(BibDatabaseContext bibdatabaseContext, DialogService dialogService, JabRefPreferences jabRefPreferences, FileUpdateMonitor fileUpdateMonitor, TaskExecutor taskExecutor, UndoManager undoManager, StateManager stateManager) { this.dialogService = dialogService; currentCitationfetcher = new GrobidCitationFetcher(jabRefPreferences.getImportFormatPreferences()); this.taskExecutor = taskExecutor; <START> this.bibEntryFormat = bibdatabaseContext.getMode(); <END> this.importHandler = new ImportHandler( dialogService, bibdatabaseContext, ExternalFileTypes.getInstance(), jabRefPreferences, fileUpdateMonitor, undoManager, stateManager); }</code><technical_language>I guess</technical_language>

Target:
public BibtexExtractorViewModel(BibDatabaseContext bibdatabaseContext, DialogService dialogService, JabRefPreferences jabRefPreferences, FileUpdateMonitor fileUpdateMonitor, TaskExecutor taskExecutor, UndoManager undoManager, StateManager stateManager) { this.dialogService = dialogService; currentCitationfetcher = new GrobidCitationFetcher(jabRefPreferences.getImportFormatPreferences()); this.taskExecutor = taskExecutor; this.importHandler = new ImportHandler( dialogService, bibdatabaseContext, ExternalFileTypes.getInstance(), jabRefPreferences, fileUpdateMonitor, undoManager, stateManager); }
Source:
<code>private void updateStackStatus(Stack stack, SyncResult result, List<ProviderSyncResult> providerSyncResults, int alreadyDeletedCount) { DetailedStackStatus status = getStackStatus(providerSyncResults, result, alreadyDeletedCount); if (status != stack.getStackStatus().getDetailedStackStatus()) { if (autoSyncConfig.isUpdateStatus()) { <START> if (!flowLogService.isOtherFlowRunning(stack.getId())) { <END> stackUpdater.updateStackStatus(stack, status, result.getMessage()); } else { LOGGER.debug(":::Auto sync::: do not update stack status because flow is running on freeipa stack {}", stack.getName()); } } else { LOGGER.info(":::Auto sync::: The stack status would be had to update from to {}", stack.getStackStatus().getDetailedStackStatus(), status); } } }</code><technical_language>here, code reach this part if flow is running</technical_language>

Target:
private void updateStackStatus(Stack stack, SyncResult result, List<ProviderSyncResult> providerSyncResults, int alreadyDeletedCount) { DetailedStackStatus status = getStackStatus(providerSyncResults, result, alreadyDeletedCount); if (status != stack.getStackStatus().getDetailedStackStatus()) { if (autoSyncConfig.isUpdateStatus()) { if (flowLogService.isOtherFlowRunning(stack.getId())) { throw new InterruptSyncingException(":::Auto sync::: interrupt syncing in updateStackStatus, flow is running on freeipa stack " + stack.getName()); } else { stackUpdater.updateStackStatus(stack, status, result.getMessage()); } } else { LOGGER.info(":::Auto sync::: The stack status would be had to update from to {}", stack.getStackStatus().getDetailedStackStatus(), status); } } }
Source:
<code>public static void saveRequest(final Context ctx, final AuthenticationRequest request, final String url) { final String methodName = ":saveRequest"; Logger.v(TAG + methodName, "ApplicationReceiver starts to save the request in shared preference."); SharedPreferences prefs = ctx.getSharedPreferences(INSTALL_REQUEST_TRACK_FILE, Activity.MODE_PRIVATE); if (prefs != null) { HashMap<String, String> parameters = StringExtensions.getUrlParameters(url); if (parameters != null && parameters.containsKey(INSTALL_UPN_KEY)) { <START> Logger.v(TAG + methodName, "Coming redirect contains the UNP, setting it on the request for both loginhint and broker account name."); <END> request.setLoginHint(parameters.get(INSTALL_UPN_KEY)); request.setBrokerAccountName(parameters.get(INSTALL_UPN_KEY)); } Editor prefsEditor = prefs.edit(); Gson gson = new Gson(); String jsonRequest = gson.toJson(request); prefsEditor.putString(INSTALL_REQUEST_KEY, jsonRequest); prefsEditor.apply(); } else { Logger.v(TAG + methodName, "SharePreference is null, nothing saved."); } }</code><technical_language>rename UNP UPN</technical_language>

Target:
public static void saveRequest(final Context ctx, final AuthenticationRequest request, final String url) { final String methodName = "saveRequest"; Logger.v(TAG + methodName, "ApplicationReceiver starts to save the request in shared preference."); SharedPreferences prefs = ctx.getSharedPreferences(INSTALL_REQUEST_TRACK_FILE, Activity.MODE_PRIVATE); if (prefs != null) { HashMap<String, String> parameters = StringExtensions.getUrlParameters(url); if (parameters != null && parameters.containsKey(INSTALL_UPN_KEY)) { Logger.v(TAG + methodName, "Coming redirect contains the UPN, setting it on the request for both loginhint and broker account name."); request.setLoginHint(parameters.get(INSTALL_UPN_KEY)); request.setBrokerAccountName(parameters.get(INSTALL_UPN_KEY)); } Editor prefsEditor = prefs.edit(); Gson gson = new Gson(); String jsonRequest = gson.toJson(request); prefsEditor.putString(INSTALL_REQUEST_KEY, jsonRequest); final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); prefsEditor.putLong(INSTALL_REQUEST_TIMESTAMP_KEY, calendar.getTimeInMillis()); prefsEditor.apply(); } else { Logger.v(TAG + methodName, "SharePreference is null, nothing saved."); } }
Source:
<code>private <T extends Described> T updateDescribed(T existing, T fetched) { <START> SetView<String> mergedAliasUrls = Sets.union(existing.getAliasUrls(), fetched.getAliasUrls()); <END> if (!mergedAliasUrls.equals(existing.getAliasUrls())) { existing.setAliasUrls(mergedAliasUrls); copyLastUpdated(fetched, existing); } SetView<Alias> mergedAliases = Sets.union(existing.getAliases(), fetched.getAliases()); if (!mergedAliases.equals(existing.getAliasUrls())) { existing.setAliases(mergedAliases); copyLastUpdated(fetched, existing); } return updateDescriptions(existing, fetched); }</code><technical_language>merge aliases, overwrite them. remove if change</technical_language>

Target:
private <T extends Described> T updateDescribed(T existing, T fetched) { SetView<String> mergedAliasUrls = Sets.union(existing.getAliasUrls(), fetched.getAliasUrls()); if (!mergedAliasUrls.equals(existing.getAliasUrls())) { existing.setAliasUrls(mergedAliasUrls); copyLastUpdated(fetched, existing); } if (fetched.getAliases() != null && !existing.getAliases().equals(fetched.getAliases())) { existing.setAliases(fetched.getAliases()); copyLastUpdated(fetched, existing); } return updateDescriptions(existing, fetched); }
Source:
<code>private void fetchJetpackSettings() { WordPress.getRestClientUtils().getJetpackSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { <START> AppLog.d(AppLog.T.API, "Received response to Jetpack Settings REST request."); <END> mRemoteSettings.localTableId = mSite.getId(); deserializeJetpackRestResponse(mSite, response); mSettings.copyFrom(mRemoteSettings); notifyUpdatedOnUiThread(null); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Jetpack Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }</code><technical_language>I do a good job this, I AppLog.v more valuable debug. I find interesting chose AppLog.w AppLog.e while handling error, I [has lowest priority overall](<LINK_0></technical_language>

Target:
private void fetchJetpackSettings() { WordPress.getRestClientUtils().getJetpackSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.v(AppLog.T.API, "Received response to Jetpack Settings REST request."); mRemoteSettings.localTableId = mSite.getId(); deserializeJetpackRestResponse(mSite, response); mSettings.copyFrom(mRemoteSettings); notifyUpdatedOnUiThread(null); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.e(AppLog.T.API, "Error response to Jetpack Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }
Source:
<code>public void nextTuple() { int emitCount = 0; for (Map.Entry<String, TestRecordsInformation> entry : testRecordsInformationPerOutputStream.entrySet()) { String outputStream = entry.getKey(); TestRecordsInformation info = entry.getValue(); Optional<Map<String, Object>> recordOptional = info.nextRecord(); if (recordOptional.isPresent()) { Map<String, Object> record = recordOptional.get(); StreamlineEventImpl streamlineEvent = new StreamlineEventImpl(record, testRunSource.getId()); LOG.debug("Emitting event to stream {}", streamlineEvent, outputStream); collector.emit(outputStream, new Values(streamlineEvent), streamlineEvent.getId()); emitCount++; } } if (emitCount == 0) { LOG.info("All iterations are completed or in sleep phase, sleeping..."); try { <START> Thread.sleep(1000); <END> } catch (InterruptedException e) { } } }</code><technical_language>if user 500 millis sleep time, is a chance honored sleep is hard-coded</technical_language>

Target:
public void nextTuple() { int emitCount = 0; boolean allOutputStreamsCompleted = true; for (Map.Entry<String, TestRecordsInformation> entry : testRecordsInformationPerOutputStream.entrySet()) { String outputStream = entry.getKey(); TestRecordsInformation info = entry.getValue(); if (info.isCompleted()) { continue; } allOutputStreamsCompleted = false; Optional<Map<String, Object>> recordOptional = info.nextRecord(); if (recordOptional.isPresent()) { Map<String, Object> record = recordOptional.get(); StreamlineEventImpl streamlineEvent = new StreamlineEventImpl(record, testRunSource.getId()); LOG.debug("Emitting event to stream {}", streamlineEvent, outputStream); collector.emit(outputStream, new Values(streamlineEvent), streamlineEvent.getId()); emitCount++; } } if (allOutputStreamsCompleted) { LOG.info("All iterations are completed, sleeping..."); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); } else if (emitCount == 0) { LOG.info("All output streams are finished last iteration and now in sleep phase, sleeping..."); Uninterruptibles.sleepUninterruptibly(testRunSource.getSleepMsPerIteration(), TimeUnit.MILLISECONDS); } }
Source:
<code>public List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options) throws IOException { <START> List<URIStatus> statuses = Arrays.stream(fileSystem.listStatus(toPath(path))).map(this::toUriStatus).collect(Collectors.toList()); <END> return statuses; }</code><technical_language>return</technical_language>

Target:
public List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options) throws IOException { return Arrays.stream(fileSystem.listStatus(toPath(path))).map(this::toUriStatus).collect(Collectors.toList()); }
Source:
<code>public Response toolsIndexGet(SecurityContext securityContext) { List<Entry> published = getPublished(); if (!config.getEsConfiguration().getHostname().isEmpty() && !published.isEmpty()) { try (RestClient restClient = RestClient .builder(new HttpHost(config.getEsConfiguration().getHostname(), config.getEsConfiguration().getPort(), "http")) .build()) { try { restClient.performRequest("DELETE", "/entry"); } catch (Exception e) { <START> LOG.info("Could not delete previous elastic search index, not an issue if this is cold start", e); <END> } URL url = Resources.getResource("queries/mapping.json"); String text = Resources.toString(url, StandardCharsets.UTF_8); HttpEntity mappingEntity = new NStringEntity(text, ContentType.APPLICATION_JSON); restClient.performRequest("PUT", "/entry", Collections.emptyMap(), mappingEntity); ElasticManager elasticManager = new ElasticManager(); elasticManager.bulkUpsert(published); } catch (IOException e) { LOG.error("Could not create elastic search index", e); throw new CustomWebApplicationException(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } return Response.ok().entity(published.size()).build(); } return Response.ok().entity(0).build(); }</code><technical_language>If potential issue, I suggest LOG.warn</technical_language>

Target:
public Response toolsIndexGet(SecurityContext securityContext) { List<Entry> published = getPublished(); if (!config.getEsConfiguration().getHostname().isEmpty() && !published.isEmpty()) { try (RestClient restClient = RestClient .builder(new HttpHost(config.getEsConfiguration().getHostname(), config.getEsConfiguration().getPort(), "http")) .build()) { try { restClient.performRequest("DELETE", "/entry"); } catch (Exception e) { LOG.warn("Could not delete previous elastic search index, not an issue if this is cold start", e); } URL url = Resources.getResource("queries/mapping.json"); String text = Resources.toString(url, StandardCharsets.UTF_8); HttpEntity mappingEntity = new NStringEntity(text, ContentType.APPLICATION_JSON); restClient.performRequest("PUT", "/entry", Collections.emptyMap(), mappingEntity); ElasticManager elasticManager = new ElasticManager(); elasticManager.bulkUpsert(published); } catch (IOException e) { LOG.error("Could not create elastic search index", e); throw new CustomWebApplicationException(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } return Response.ok().entity(published.size()).build(); } return Response.ok().entity(0).build(); }
Source:
<code>protected BooleanWritable toWritable(Integer value) throws IOException { <START> writable.set(value.intValue() == 1 ? true : false); <END> return writable; }</code><technical_language>if 1 0? exception</technical_language>

Target:
protected BooleanWritable toWritable(Integer value) throws IOException { int valueInt = value.intValue(); if (valueInt == 1 ) { writable.set(true); } else if (valueInt == 0) { writable.set(false); } else { throw new IllegalArgumentException("Only 1 and 0 could be convert to BooleanWritable!"); } return writable; }
Source:
<code>public IAnswerData getAnswer() { if (mBinaryName != null) { return new StringData(mBinaryName); <START> } else if (oversizedMediaSize > 0) { <END> return new InvalidData("", new IntegerData(oversizedMediaSize)); } return null; }</code><technical_language>this check happen first? mBinaryName null oversizedMediaSize > 0</technical_language>

Target:
public IAnswerData getAnswer() { if (oversizedMediaSize > 0) { return new InvalidData("", new IntegerData(oversizedMediaSize)); } else if (mBinaryName != null) { return new StringData(mBinaryName); } return null; }
Source:
<code>public void removeConsumer(final Consumer consumer) { synchronized (this) { consumersChanged = true; for (ConsumerHolder holder : consumerList) { if (holder.consumer == consumer) { if (holder.iter != null) { holder.iter.close(); } consumerList.remove(holder); break; } } if (consumerList.isEmpty()) { <START> supportsDirectDeliver = true; <END> } if (pos > 0 && pos >= consumerList.size()) { pos = consumerList.size() - 1; } if (consumerSet.remove(consumer)) { consumersCount.decrementAndGet(); } LinkedList<SimpleString> groupsToRemove = null; for (SimpleString groupID : groups.keySet()) { if (consumer == groups.get(groupID)) { if (groupsToRemove == null) { groupsToRemove = new LinkedList<>(); } groupsToRemove.add(groupID); } } if (groupsToRemove != null) { for (SimpleString groupID : groupsToRemove) { groups.remove(groupID); } } if (refCountForConsumers != null) { refCountForConsumers.decrement(); } noConsumers.decrementAndGet(); } }</code><technical_language>iterate consumers list set true if consumers support direct? e.g. 3 consumers, 2 core 1 amqp, amqp removes, leaving 2 core want direct. e.g. (pseudo) boolean supportsDirectDeliver = true; for (consumer : consumerList) { if (!consumer.supportsDirectDelivery()){ supportsDirectDeliver = false; } } this.supportsDirectDeliver = supportsDirectDeliver;</technical_language>

Target:
public void removeConsumer(final Consumer consumer) { synchronized (this) { consumersChanged = true; for (ConsumerHolder holder : consumerList) { if (holder.consumer == consumer) { if (holder.iter != null) { holder.iter.close(); } consumerList.remove(holder); break; } } this.supportsDirectDeliver = checkConsumerDirectDeliver(); if (pos > 0 && pos >= consumerList.size()) { pos = consumerList.size() - 1; } if (consumerSet.remove(consumer)) { consumersCount.decrementAndGet(); } LinkedList<SimpleString> groupsToRemove = null; for (SimpleString groupID : groups.keySet()) { if (consumer == groups.get(groupID)) { if (groupsToRemove == null) { groupsToRemove = new LinkedList<>(); } groupsToRemove.add(groupID); } } if (groupsToRemove != null) { for (SimpleString groupID : groupsToRemove) { groups.remove(groupID); } } if (refCountForConsumers != null) { refCountForConsumers.decrement(); } noConsumers.decrementAndGet(); } }
Source:
<code>public Runnable commit() { <START> return new Runnable() <END> { @Override public void run() { } }; }</code><technical_language>I a method in Runnables returns a do runnable</technical_language>

Target:
public Runnable commit() { return Runnables.getNoopRunnable(); }
Source:
<code>public void preload() { if (!enabled) return; AdvancedCacheLoader<Object, Object> preloadCl = null; for (CacheLoader l : loaders) { if (configMap.get(l).preload()) { if (!(l instanceof AdvancedCacheLoader)) { throw new PersistenceException("Cannot preload from cache loader '" + l.getClass().getName() + "' as it doesn't implement '" + AdvancedCacheLoader.class.getName() + "'"); } preloadCl = (AdvancedCacheLoader) l; if (preloadCl instanceof AdvancedAsyncCacheLoader) preloadCl = (AdvancedCacheLoader) ((AdvancedAsyncCacheLoader) preloadCl).undelegate(); break; } } if (preloadCl == null) return; long start = timeService.time(); final long maxEntries = getMaxEntries(); final AtomicInteger loadedEntries = new AtomicInteger(0); final AdvancedCache<Object, Object> flaggedCache = getCacheForStateInsertion(); Long insertAmount = Flowable.fromPublisher(preloadCl.publishEntries(null, true, true)) <START> .take(maxEntries).doOnNext(me -> { <END> Metadata metadata = me.getMetadata() != null ? ((InternalMetadataImpl) me.getMetadata()).actual() : null; preloadKey(flaggedCache, me.getKey(), me.getValue(), metadata); }).count().blockingGet(); this.preloaded = insertAmount < maxEntries; log.debugf("Preloaded %d keys in %s", loadedEntries.get(), Util.prettyPrintTime(timeService.timeDuration(start, MILLISECONDS))); }</code><technical_language>I prefer putting method call a separate line aligning them</technical_language>

Target:
public void preload() { if (!enabled) return; AdvancedCacheLoader<Object, Object> preloadCl = null; storesMutex.readLock().lock(); try { for (CacheLoader l : loaders) { if (configMap.get(l).preload()) { if (!(l instanceof AdvancedCacheLoader)) { throw new PersistenceException("Cannot preload from cache loader '" + l.getClass().getName() + "' as it doesn't implement '" + AdvancedCacheLoader.class.getName() + "'"); } preloadCl = (AdvancedCacheLoader) l; if (preloadCl instanceof AdvancedAsyncCacheLoader) preloadCl = (AdvancedCacheLoader) ((AdvancedAsyncCacheLoader) preloadCl).undelegate(); break; } } } finally { storesMutex.readLock().unlock(); } if (preloadCl == null) return; long start = timeService.time(); final long maxEntries = getMaxEntries(); final AtomicInteger loadedEntries = new AtomicInteger(0); final AdvancedCache<Object, Object> flaggedCache = getCacheForStateInsertion(); Long insertAmount = Flowable.fromPublisher(preloadCl.publishEntries(null, true, true)) .take(maxEntries) .doOnNext(me -> { Metadata metadata = me.getMetadata() != null ? ((InternalMetadataImpl) me.getMetadata()).actual() : null; preloadKey(flaggedCache, me.getKey(), me.getValue(), metadata); }).count().blockingGet(); this.preloaded = insertAmount < maxEntries; log.debugf("Preloaded %d keys in %s", loadedEntries.get(), Util.prettyPrintTime(timeService.timeDuration(start, MILLISECONDS))); }
Source:
<code><START> default void setUnmapped(final boolean unmapped) { <END> addFlag(SAMFlag.READ_UNMAPPED, unmapped); }</code><technical_language>I isMapped()</technical_language>

Target:
default void setUnmapped(final boolean unmapped) { setFlag(SAMFlag.READ_UNMAPPED, unmapped); }
Source:
<code>public static void setup() { CqlSession session = sessionRule.session(); session.execute( SimpleStatement.builder( "CREATE KEYSPACE IF NOT EXISTS " + DEFAULT_KEYSPACE + " " <START> + "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}") <END> .setExecutionProfile(sessionRule.slowProfile()) .build()); session.execute( SimpleStatement.builder( "CREATE TABLE " + DEFAULT_KEYSPACE + ".product_simple_default_ks(id uuid PRIMARY KEY, description text)") .setExecutionProfile(sessionRule.slowProfile()) .build()); session.execute( SimpleStatement.builder( "CREATE TABLE product_simple_without_ks(id uuid PRIMARY KEY, description text)") .setExecutionProfile(sessionRule.slowProfile()) .build()); session.execute( SimpleStatement.builder( "CREATE TABLE product_simple_default_ks(id uuid PRIMARY KEY, description text)") .setExecutionProfile(sessionRule.slowProfile()) .build()); mapper = new DefaultKeyspaceIT_InventoryMapperBuilder(session).build(); }</code><technical_language>Nit: String.format inject keyspace name, a bit more readable</technical_language>

Target:
public static void setup() { CqlSession session = sessionRule.session(); session.execute( SimpleStatement.builder( String.format( "CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}", DEFAULT_KEYSPACE)) .setExecutionProfile(sessionRule.slowProfile()) .build()); session.execute( SimpleStatement.builder( String.format( "CREATE TABLE %s.product_simple_default_ks(id uuid PRIMARY KEY, description text)", DEFAULT_KEYSPACE)) .setExecutionProfile(sessionRule.slowProfile()) .build()); session.execute( SimpleStatement.builder( "CREATE TABLE product_simple_without_ks(id uuid PRIMARY KEY, description text)") .setExecutionProfile(sessionRule.slowProfile()) .build()); session.execute( SimpleStatement.builder( "CREATE TABLE product_simple_default_ks(id uuid PRIMARY KEY, description text)") .setExecutionProfile(sessionRule.slowProfile()) .build()); mapper = new DefaultKeyspaceIT_InventoryMapperBuilder(session).build(); }
Source:
<code>private static void generateGetEstimatedSize(ClassDefinition definition, List<FieldDefinition> stateFields) { MethodDefinition method = definition.declareMethod(a(PUBLIC), "getEstimatedSize", type(long.class)); Variable estimatedSize = method.getScope().declareVariable(long.class, "estimatedSize"); method.getBody().append(estimatedSize.set(constantLong(0L))); for (FieldDefinition stateField : stateFields) { <START> BytecodeExpression state = method.getThis().getField(stateField); <END> method.getBody() .append(estimatedSize.set( createArithmeticBytecodeExpression( IADD, estimatedSize, state.invoke("getEstimatedSize", long.class)))); } method.getBody().append(estimatedSize.ret()); }</code><technical_language>inline</technical_language>

Target:
private static void generateGetEstimatedSize(ClassDefinition definition, List<FieldDefinition> stateFields) { MethodDefinition method = definition.declareMethod(a(PUBLIC), "getEstimatedSize", type(long.class)); Variable estimatedSize = method.getScope().declareVariable(long.class, "estimatedSize"); method.getBody().append(estimatedSize.set(constantLong(0L))); for (FieldDefinition stateField : stateFields) { method.getBody() .append(estimatedSize.set( BytecodeExpressions.add( estimatedSize, method.getThis().getField(stateField).invoke("getEstimatedSize", long.class)))); } method.getBody().append(estimatedSize.ret()); }
Source:
<code>public void validateCountryMinLength_shouldFailValue() { String invalidMaxLengthEmail = randomAlphanumeric(1); CreatePaymentRequest createPaymentRequest = createPaymentRequestBuilderWithAgreementId().country(invalidMaxLengthEmail).build(); expectedException.expect(PaymentValidationException.class); expectedException.expect(aValidationExceptionContaining("P0102", "Invalid attribute value: country. Must be exactly 2 characters length")); <START> paymentRequestValidator.validate(createPaymentRequest); <END> }</code><technical_language>great reducing duplication of tests test basically validation logic levels functionality covered deserialize_shouldThrowValidationException_whenReturnUrlIsAMalformedUrl test lost in migration</technical_language>

Target:
public void validateCountryMinLength_shouldFailValue() { String invalidMaxLengthEmail = randomAlphanumeric(1); CreatePaymentRequest createPaymentRequest = createPaymentRequestBuilderWithAgreementId().country(invalidMaxLengthEmail).build(); expectedException.expect(aValidationExceptionContaining("P0102", "Invalid attribute value: country. Must be exactly 2 characters length")); paymentRequestValidator.validate(createPaymentRequest); }
Source:
<code>private boolean isPermittedIpAddr(HttpRequestHeader requestHeader) { if (getOptionsParamApi().isPermittedAddress(requestHeader.getSenderAddress().getHostAddress())) { <START> if (! requestHeader.getHostName().equalsIgnoreCase("zap") && <END> ! requestHeader.getHostName().equalsIgnoreCase("localhost") && !getOptionsParamApi().isPermittedAddress(requestHeader.getHostName())) { logger.warn("Request to API URL " + requestHeader.getURI().toString() + " with host header " + requestHeader.getHostName() + " not permitted"); return false; } return true; } logger.warn("Request to API URL " + requestHeader.getURI().toString() + " from " + requestHeader.getSenderAddress().getHostAddress() + " not permitted"); return false; }</code><technical_language>add hostnames defaults instead of hardcode them</technical_language>

Target:
private boolean isPermittedIpAddr(HttpRequestHeader requestHeader) { if (getOptionsParamApi().isPermittedAddress(requestHeader.getSenderAddress().getHostAddress())) { if (getOptionsParamApi().isPermittedAddress(requestHeader.getHostName())) { logger.warn("Request to API URL " + requestHeader.getURI().toString() + " with host header " + requestHeader.getHostName() + " not permitted"); return false; } return true; } logger.warn("Request to API URL " + requestHeader.getURI().toString() + " from " + requestHeader.getSenderAddress().getHostAddress() + " not permitted"); return false; }
Source:
<code>public IntentToParticipate build() { if (OperatingSystem.SYNONYMS.containsKey(osName)) { osName = OperatingSystem.SYNONYMS.get(osName); <START> } <END> return new IntentToParticipate(study, phone, subpopGuid, scope, osName, consentSignature); }</code><technical_language>Is worth making a unit test (separate JSON test, buried in there) tests OS synonyms hooked up</technical_language>

Target:
public IntentToParticipate build() { if (OperatingSystem.SYNONYMS.containsKey(osName)) { osName = OperatingSystem.SYNONYMS.get(osName); } return new IntentToParticipate(studyId, phone, subpopGuid, scope, osName, consentSignature); }
Source:
<code>private void handleRefreshCapabilities(BrokerCommandCallback callback, AtomicBoolean processHardwareCapsNeeded, VDS vds, VDS oldVDS, VDSReturnValue caps) { if (caps.getSucceeded()) { Set<Version> hostVersions = null; Version clusterCompatibility = vds.getClusterCompatibilityVersion(); <START> if ( (hostVersions = vds.getSupportedClusterVersionsSet()) != null && hostVersions.contains(clusterCompatibility)) { <END> resourceManager.runVdsCommand(VDSCommandType.GetHardwareInfoAsync, new VdsIdAndVdsVDSCommandParametersBase(vds).withCallback( new VdsManagerGetHardwareInfoCallback(callback, processHardwareCapsNeeded, vds, oldVDS, vdsManager))); } else { vdsManager.postProcessRefreshCapabilities(callback, processHardwareCapsNeeded, vds, oldVDS); } } else if (caps.getExceptionObject() != null) { if (callback != null) { callback.onFailure(caps.getExceptionObject()); } throw caps.getExceptionObject(); } else { log.error("refreshCapabilities:GetCapabilitiesVDSCommand failed with no exception!"); if (callback != null) { callback.onFailure(caps.getExceptionObject()); } throw new RuntimeException(caps.getExceptionString()); } }</code><technical_language>moving line 67 here, rewriting condition as: Set<Version> hostVersions = vds.getSupportedClusterVersionsSet(); if (hostVersions != null && hostVersions.contains(clusterCompatibility)) { ... } a bit more readable defines scope of variable better</technical_language>

Target:
private void handleRefreshCapabilities(BrokerCommandCallback callback, AtomicBoolean processHardwareCapsNeeded, VDS vds, VDS oldVDS, VDSReturnValue caps) { if (caps.getSucceeded()) { Set<Version> hostVersions = vds.getSupportedClusterVersionsSet(); Version clusterCompatibility = vds.getClusterCompatibilityVersion(); if (hostVersions != null && hostVersions.contains(clusterCompatibility)) { resourceManager.runVdsCommand(VDSCommandType.GetHardwareInfoAsync, new VdsIdAndVdsVDSCommandParametersBase(vds).withCallback( Injector.injectMembers(new VdsManagerGetHardwareInfoCallback(callback, processHardwareCapsNeeded, vds, oldVDS, vdsManager)))); } else { vdsManager.postProcessRefreshCapabilities(callback, processHardwareCapsNeeded, vds, oldVDS); } } else if (caps.getExceptionObject() != null) { if (callback != null) { callback.onFailure(caps.getExceptionObject()); } throw caps.getExceptionObject(); } else { log.error("refreshCapabilities:GetCapabilitiesVDSCommand failed with no exception!"); if (callback != null) { callback.onFailure(caps.getExceptionObject()); } throw new RuntimeException(caps.getExceptionString()); } }
Source:
<code>public void hideWindow() { <START> if (window != null) { <END> Platform.runLater(window::hide); } }</code><technical_language>this called window is created? a bug if happens. initialise stage construction, show it? check for null everywhere. null checks communicate right intent, if possibly null point</technical_language>

Target:
public void hideWindow() { Platform.runLater(window::hide); }
Source:
<code>private void sendMessageToLocalTopicListener(TopicListener topicListener, String topic, String path) { String message = null; try { ZNRecord zNRecord = helixStore.get(path, null, AccessOption.PERSISTENT); if (zNRecord != null) { message = zNRecord.getSimpleField(MESSAGE_KEY); long startTimeMs = System.currentTimeMillis(); topicListener.onMessageReceive(topic, message); logger.trace("Message has been sent to TopicListener={} on topic={} with message={} using {}ms", topicListener, topic, message, System.currentTimeMillis() - startTimeMs); } else { logger.debug("TopicListener={} on topic={} should receive a message, but the corresponding ZNRecord is null", topicListener, topic); } } catch (Exception e) { <START> logger.warn("Failed to send message to TopicListener={} for topic={} with message={}", topicListener, topic, <END> message, e); } }</code><technical_language>error warn</technical_language>

Target:
private void sendMessageToLocalTopicListener(TopicListener topicListener, String topic, String path) { String message = null; try { ZNRecord zNRecord = helixStore.get(path, null, AccessOption.PERSISTENT); if (zNRecord != null) { message = zNRecord.getSimpleField(MESSAGE_KEY); long startTimeMs = System.currentTimeMillis(); topicListener.onMessage(topic, message); logger.trace("Message has been sent to TopicListener={} on topic={} with message={} using {}ms", topicListener, topic, message, System.currentTimeMillis() - startTimeMs); } else { logger.debug("TopicListener={} on topic={} should receive a message, but the corresponding ZNRecord is null", topicListener, topic); } } catch (Exception e) { logger.error("Failed to send message to TopicListener={} for topic={} with message={}", topicListener, topic, message, e); } }
Source:
<code>public Iterator<Rowboat> iterator() { final IntBuffer[] converterArray = FluentIterable .from(convertedDims) .transform( new Function<String, IntBuffer>() { @Override public IntBuffer apply(String input) { return converters.get(input); } } ).toArray(IntBuffer.class); return Iterators.transform( index.iterator(), new Function<Rowboat, Rowboat>() { int rowCount = 0; @Override public Rowboat apply(@Nullable Rowboat input) { int[][] dims = input.getDims(); int[][] newDims = new int[convertedDims.size()][]; for (int i = 0; i < convertedDims.size(); ++i) { IntBuffer converter = converterArray[i]; String dimName = convertedDims.get(i); if (converter == null) { continue; } <START> if (dims[i] == null) { <END> if (dimCardinalities.get(dimName) > 0) { newDims[i] = EMPTY_STR_DIM; } continue; } if (i >= dims.length) { continue; } newDims[i] = new int[dims[i].length]; for (int j = 0; j < dims[i].length; ++j) { if (!converter.hasRemaining()) { log.error("Converter mismatch! wtfbbq!"); } newDims[i][j] = converter.get(dims[i][j]); } } final Rowboat retVal = new Rowboat( input.getTimestamp(), newDims, input.getMetrics(), input.getRowNum() ); retVal.addRow(indexNumber, input.getRowNum()); return retVal; } } ); }</code><technical_language>dims[i] throw exception if i >= dims.length</technical_language>

Target:
public Iterator<Rowboat> iterator() { final IntBuffer[] converterArray = FluentIterable .from(convertedDims) .transform( new Function<String, IntBuffer>() { @Override public IntBuffer apply(String input) { return converters.get(input); } } ).toArray(IntBuffer.class); return Iterators.transform( index.iterator(), new Function<Rowboat, Rowboat>() { @Override public Rowboat apply(@Nullable Rowboat input) { int[][] dims = input.getDims(); int[][] newDims = new int[convertedDims.size()][]; for (int i = 0; i < convertedDims.size(); ++i) { IntBuffer converter = converterArray[i]; String dimName = convertedDims.get(i); if (converter == null) { continue; } if (i >= dims.length) { continue; } if (dims[i] == null) { if (dimCardinalities.get(dimName) > 0) { newDims[i] = EMPTY_STR_DIM; } continue; } newDims[i] = new int[dims[i].length]; for (int j = 0; j < dims[i].length; ++j) { if (!converter.hasRemaining()) { log.error("Converter mismatch! wtfbbq!"); } newDims[i][j] = converter.get(dims[i][j]); } } final Rowboat retVal = new Rowboat( input.getTimestamp(), newDims, input.getMetrics(), input.getRowNum() ); retVal.addRow(indexNumber, input.getRowNum()); return retVal; } } ); }
Source:
<code>public List<Chromosome> setup(StoppingCondition sc, int budget, String cut){ Properties.CRITERION = new Criterion[1]; Properties.CRITERION[0] = Criterion.BRANCH; Properties.ALGORITHM = Algorithm.CELLULARGA; Properties.POPULATION = 50; Properties.STOPPING_CONDITION = sc; Properties.SEARCH_BUDGET = budget; Properties.MINIMIZE = false; <START> Randomness.setSeed(10); <END> EvoSuite evosuite = new EvoSuite(); String targetClass = cut; Properties.TARGET_CLASS = targetClass; String[] command = new String[] {"-generateSuite", "-class", targetClass}; Object result = evosuite.parseCommandLine(command); Assert.assertNotNull(result); GeneticAlgorithm<?> ga = getGAFromResult(result); List<Chromosome> population = new ArrayList<Chromosome>(ga.getBestIndividuals()); return population; }</code><technical_language>need set _seed_, SystemTestBase class for you</technical_language>

Target:
public List<Chromosome> setup(StoppingCondition sc, int budget, String cut){ Properties.CRITERION = new Criterion[1]; Properties.CRITERION[0] = Criterion.BRANCH; Properties.ALGORITHM = Algorithm.CELLULARGA; Properties.POPULATION = 50; Properties.STOPPING_CONDITION = sc; Properties.SEARCH_BUDGET = budget; Properties.MINIMIZE = false; EvoSuite evosuite = new EvoSuite(); String targetClass = cut; Properties.TARGET_CLASS = targetClass; String[] command = new String[] {"-generateSuite", "-class", targetClass}; Object result = evosuite.parseCommandLine(command); Assert.assertNotNull(result); GeneticAlgorithm<?> ga = getGAFromResult(result); List<Chromosome> population = new ArrayList<Chromosome>(ga.getBestIndividuals()); return population; }
Source:
<code>public static IStatus removeXmlFile(File toDelete) { <START> if(!xmlFileIsActive(toDelete)) { <END> return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The XML file is not an active XML Analysis"); } File activeXMLFolder = new File(XmlUtils.getXmlFilesPath().toString()); File[] activeXMLs = activeXMLFolder.listFiles(); for(int i = 0; i < activeXMLs.length; i++) { if(activeXMLs[i].getName().equals(toDelete.getName())) { activeXMLs[i].delete(); break; } } return Status.OK_STATUS; }</code><technical_language>Missing whitespace if. forget ctrl-shift-f file committing (did I ctrl-alt-f yesterday? ctrl-shift)</technical_language>

Target:
public static IStatus removeXmlFile(File toDelete) { if (!xmlValidate(toDelete).isOK()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The XML file is not an active XML Analysis"); } File activeXMLFolder = new File(XmlUtils.getXmlFilesPath().toString()); File[] activeXMLs = activeXMLFolder.listFiles(); for (int i = 0; i < activeXMLs.length; i++) { if (activeXMLs[i].getName().equals(toDelete.getName())) { activeXMLs[i].delete(); break; } } return Status.OK_STATUS; }