auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public WebElement getForm() { <START> return getDriver().findElement(By.id("export-form")); <END> }</code><technical_language>a constant for id name like: java @FindBy(id = "export-form") private WebElement exportForm;</technical_language>

Target:
public WebElement getForm() { return getDriver().findElement(By.id(FORM_ID)); }
Source:
<code>private void setGutenbergEnabledIfNeeded() { boolean newSitePopupNeeded = AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl()); if ((TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost) || newSitePopupNeeded) { SiteUtils.enableBlockEditor(mDispatcher, mSite); <START> Map<String, Object> properties = new HashMap<>(); <END> if (!newSitePopupNeeded) { properties.put("source", BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.name()); AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite, properties); } showGutenbergInformativeDialog(); } }</code><technical_language>but, move line Map<String, Object> properties = new HashMap<>(); conditional closer code it? need outside, right? While it, a blocker, WDYT introducing a helper method enum object quickly return a prefilled properties map? like: public enum BlockEditorEnabledSource { VIA_SITE_SETTINGS, ON_SITE_CREATION, ON_BLOCK_POST_OPENING; public Map<String, Object> asPropertyMap() { Map<String, Object> properties = new HashMap<>(); properties.put("source", name()); return properties; } } for example BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.asPropertyMap()</technical_language>

Target:
private void setGutenbergEnabledIfNeeded() { boolean showPopup = AppPrefs.shouldShowGutenbergInfoPopup(mSite.getUrl()); if (TextUtils.isEmpty(mSite.getMobileEditor()) && !mIsNewPost) { SiteUtils.enableBlockEditor(mDispatcher, mSite); AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, mSite, BlockEditorEnabledSource.ON_BLOCK_POST_OPENING.asPropertyMap()); showPopup = true; } if (showPopup) { showGutenbergInformativeDialog(); } }
Source:
<code>public Result execute(UIExecutionContext context) { AddonId addonId = CoordinateUtils.resolveCoordinate(named.getValue(),Versions.getSpecificationVersionFor(this),resolver); AddonId maxAddonId = addonId; try { Response<AddonId[]> resolveVersions = resolver.resolveVersions(addonId.getName()); for(AddonId id : resolveVersions.get()) { if(id.getVersion().compareTo(maxAddonId.getVersion()) > 0 ) { maxAddonId = id; } } <START> addonManager.install(maxAddonId).perform(); <END> return Results.success("Addon " + maxAddonId.toCoordinates() + " was installed successfully."); } catch (Throwable t) { return Results.fail("Addon " + maxAddonId.toCoordinates() + " could not be installed.", t); } }</code><technical_language>check if maxAddonId current</technical_language>

Target:
public Result execute(UIExecutionContext context) { AddonId addonId = CoordinateUtils.resolveCoordinate(named.getValue(), Versions.getSpecificationVersionFor(this.getClass()), resolver); AddonId maxAddonId = addonId; try { Response<AddonId[]> resolveVersions = resolver.resolveVersions(addonId.getName()); for (AddonId id : resolveVersions.get()) { if (id.getVersion().compareTo(maxAddonId.getVersion()) > 0) { maxAddonId = id; } } for (AddonRepository r : furnace.getRepositories()) { List<AddonId> listEnabled = r.listEnabled(); for (AddonId id : listEnabled) { if (id.equals(maxAddonId)) { return Results.fail("Addon " + maxAddonId.toCoordinates() + " is already installed with the most updated version."); } } } InstallRequest installRequest = addonManager.install(maxAddonId); UIPrompt prompt = context.getPrompt(); if (prompt.promptBoolean(installRequest.toString() + "\n Do you want to proceed?")) { installRequest.perform(); return Results.success("Addon " + maxAddonId.toCoordinates() + " was installed successfully."); } else { return Results.fail("Addon update aborted."); } } catch (Throwable t) { return Results.fail("Addon " + maxAddonId.toCoordinates() + " could not be installed.", t); } }
Source:
<code>public Response refreshRepo(){ AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal()); <START> notebookWsServer.broadcastReloadedNoteList(subject, null); <END> return new JsonResponse<>(Status.OK, "", null).build(); }</code><technical_language>nit; adding a log msg in other API does? e.g. LOG.info("Reloading notebook repository for user {}", subject.getUser());</technical_language>

Target:
public Response refreshRepo(){ AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal()); LOG.info("Reloading notebook repository for user {}", subject.getUser()); notebookWsServer.broadcastReloadedNoteList(subject, null); return new JsonResponse<>(Status.OK, "", null).build(); }
Source:
<code>public AclClassIdUtils(ConversionService conversionService) { if(conversionService != null) { this.conversionService = conversionService; } else { <START> GenericConversionService genericConversionService = new GenericConversionService(); <END> genericConversionService.addConverter(String.class, Long.class, new StringToLongConverter()); genericConversionService.addConverter(String.class, UUID.class, new StringToUUIDConverter()); this.conversionService = genericConversionService; } }</code><technical_language>this a bit easier read, @nenaraab, move this default construction default constructor. Users new XYZ() meaning "use reasonable defaults", this common new XYZ(null). If I call new XYZ(null), I I "override do default null". This code a bit easier read: java public AclClassIdUtils() { GenericConversionService ... this.conversionService = conversionService; } public AclClassIdUtils(ConversionService conversionService) { Assert.notNull(conversionService, "conversionService null"); this.conversionService = conversionService; } ... public final void setConversionService(ConversionService conversionService) { Assert.notNull(conversionService, "conversionService null"); this.conversionService = conversionService; }</technical_language>

Target:
public AclClassIdUtils(ConversionService conversionService) { Assert.notNull(conversionService, "conversionService must not be null"); this.conversionService = conversionService; }
Source:
<code>public OrcZlibDecompressor(OrcDataSourceId orcDataSourceId, int maxBufferSize) { <START> this.orcDataSourceId = orcDataSourceId; <END> this.maxBufferSize = maxBufferSize; }</code><technical_language>Check for null</technical_language>

Target:
public OrcZlibDecompressor(OrcDataSourceId orcDataSourceId, int maxBufferSize) { this.orcDataSourceId = requireNonNull(orcDataSourceId, "orcDataSourceId is null"); this.maxBufferSize = maxBufferSize; }
Source:
<code><START> public Class<? extends AtomicKeySetImpl> getJavaClass() { <END> return AtomicKeySetImpl.class; }</code><technical_language>getJavaClass() declare exact class. need for wildcards. here, everywhere</technical_language>

Target:
public Class<AtomicKeySetImpl> getJavaClass() { return AtomicKeySetImpl.class; }
Source:
<code>public Future<Response> apply(Request request, Service<Request, Response> service) { System.out.println("Request host:" + request.host().getOrElse(() -> "")); <START> System.out.println("Request params:"); <END> request.getParams().forEach(entry -> System.out.println("\t" + entry.getKey() + " : " + entry.getValue())); return service.apply(request); }</code><technical_language>if stdouts irrelevant remove</technical_language>

Target:
public Future<Response> apply(Request request, Service<Request, Response> service) { logger.info("Request host:" + request.host().getOrElse(() -> "")); logger.info("Request params:"); request.getParams().forEach(entry -> logger.info("\t" + entry.getKey() + " : " + entry.getValue())); return service.apply(request); }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getContext(), R.style.PocketPaintAlertDialog) .setIcon(permissionType.getIconResource()) .setMessage(R.string.permission_info_permanent_denial_text) .setPositiveButton("Settings", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { <START> startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:org.catrobat.paintroid"))); <END> new Intent(); } }) .setNegativeButton(android.R.string.cancel, null) .create(); }</code><technical_language>uri determined app id (which is set compile time). this lead settings of release app</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getContext(), R.style.PocketPaintAlertDialog) .setMessage(R.string.permission_info_permanent_denial_text) .setPositiveButton(R.string.dialog_settings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + context))); } }) .setNegativeButton(android.R.string.cancel, null) .create(); }
Source:
<code>public String getContentType() { <START> return "text/json"; <END> }</code><technical_language>gson instead of json</technical_language>

Target:
public String getContentType() { return "text/gson"; }
Source:
<code>public void updateIndex(Context context, boolean force, int type) { try { switch (type) { case Constants.ITEM: Iterator<Item> items = itemService.findAllUnfiltered(context); for (Item item : ImmutableList.copyOf(items)) { <START> indexContent(context, item, force); <END> } for (WorkspaceItem wsi : workspaceItemService.findAll(context)) { indexContent(context, wsi.getItem(), force); } for (WorkflowItem wfi : workflowItemService.findAll(context)) { indexContent(context, wfi.getItem(), force); } break; case Constants.COLLECTION: List<Collection> collections = collectionService.findAll(context); for (Collection collection : collections) { indexContent(context, collection, force); } break; case Constants.COMMUNITY: List<Community> communities = communityService.findAll(context); for (Community community : communities) { indexContent(context, community, force); } break; default: throw new IllegalArgumentException("No type known: " + type); } if (getSolr() != null) { getSolr().commit(); } } catch (Exception e) { log.error(e.getMessage(), e); } }</code><technical_language>I **very important** context.uncacheEntity(item) here. Otherwise, Hibernate items in-memory in current Hibernate session this lead memory issues in large repositories</technical_language>

Target:
public void updateIndex(Context context, boolean force, int type) { try { switch (type) { case Constants.ITEM: Iterator<Item> items = itemService.findAllUnfiltered(context); for (Item item : ImmutableList.copyOf(items)) { indexContent(context, item, force); context.uncacheEntity(item); } for (WorkspaceItem wsi : workspaceItemService.findAll(context)) { indexContent(context, wsi.getItem(), force); context.uncacheEntity(wsi); } for (WorkflowItem wfi : workflowItemService.findAll(context)) { indexContent(context, wfi.getItem(), force); context.uncacheEntity(wfi); } break; case Constants.COLLECTION: List<Collection> collections = collectionService.findAll(context); for (Collection collection : collections) { indexContent(context, collection, force); } break; case Constants.COMMUNITY: List<Community> communities = communityService.findAll(context); for (Community community : communities) { indexContent(context, community, force); } break; default: throw new IllegalArgumentException("No type known: " + type); } if (getSolr() != null) { getSolr().commit(); } } catch (Exception e) { log.error(e.getMessage(), e); } }
Source:
<code>private void saveUserIdFromAuthenticationResult(final AuthenticationResult authResult, final String authority) { mSharedPreference = getSharedPreferences(SHARED_PREFERENCE_STORE_USER_UNIQUEID, MODE_PRIVATE); <START> if (null != authResult) { <END> final SharedPreferences.Editor prefEditor = mSharedPreference.edit(); if (null != authResult.getAuthority()) { prefEditor.putString((authResult.getUserInfo().getDisplayableId().trim() + ":" + authority.trim() + ":authority").toLowerCase(), authResult.getAuthority().trim().toLowerCase()); } if (null != authResult.getUserInfo() && null != authResult.getUserInfo().getUserId()) { prefEditor.putString((authResult.getUserInfo().getDisplayableId().trim() + ":" + authority.trim() + ":userId").toLowerCase(), authResult.getUserInfo().getUserId().trim().toLowerCase()); } prefEditor.apply(); } }</code><technical_language>I necessarily a problem defensively checking if this parameter is null, I call out if onSuccess() called a null result, this far: throw NPE of onSuccess() log out accessToken. omit this check, this code get hit</technical_language>

Target:
private void saveUserIdFromAuthenticationResult(final AuthenticationResult authResult, final String authority) { mSharedPreference = getSharedPreferences(SHARED_PREFERENCE_STORE_USER_UNIQUEID, MODE_PRIVATE); if (null != authResult) { final SharedPreferences.Editor prefEditor = mSharedPreference.edit(); if (null != authResult.getAuthority()) { prefEditor.putString((authResult.getUserInfo().getDisplayableId().trim() + ":" + authority.trim() + ":authority").toLowerCase(), authResult.getAuthority().trim().toLowerCase()); } else { Logger.w(TAG, "The authority of " + "authentication result should not be null."); final Toast toast = Toast.makeText(mApplicationContext, "Warning: the result authority is null," + "Silent auth for Sovereign account will fail. ", Toast.LENGTH_SHORT); toast.show(); } if (null != authResult.getUserInfo() && null != authResult.getUserInfo().getUserId()) { prefEditor.putString((authResult.getUserInfo().getDisplayableId().trim() + ":" + authority.trim() + ":userId").toLowerCase(), authResult.getUserInfo().getUserId().trim().toLowerCase()); } else { Logger.w(TAG, "The userInfo of " + "authentication result should not be null."); final Toast toast = Toast.makeText(mApplicationContext, "Warning: the result userInfo is null. " + "Silent auth without userID will fail. ", Toast.LENGTH_SHORT); toast.show(); } prefEditor.apply(); } }
Source:
<code>public void update(Observable o, Object arg) { <START> log.warn("The Driver Station has been disconnected for greater than " + timeOut.get() + " Second(s)"); <END> previousDisconnectionTimestamp = lastPacketReceivedTimestamp; }</code><technical_language>lowercase second(s)</technical_language>

Target:
public void update(Observable o, Object arg) { log.warn("Connection with Driver Station restored. " + "The Robot was disconnected from the driver station for at least " + timeOut.get() + " second(s)."); previousDisconnectionTimestamp = lastPacketReceivedTimestamp; }
Source:
<code>public String processSubmit(@ModelAttribute("serviceRecord") SequencerServiceRecord record, ModelMap model, SessionStatus session) throws IOException { try { requestManager.saveSequencerServiceRecord(record); session.setComplete(); model.clear(); return "redirect:/miso/stats/sequencer/servicerecord/" + record.getId(); <START> } catch (IOException ex) { <END> log.debug("Failed to save Sequencer Service Record", ex); throw ex; } }</code><technical_language>I guess I a uncomfortable of checked exceptions here. This exception request manager (I think) tells a user is admin SequencerServiceRecord is is null. attempt recover exceptions get logged done useful this exception. some other ideas... ###### Options include: - throwing exceptions in place logging. - Throwing _RuntimeException_ instead bother catching get logging for free. - Attempting some sort of recovery if this exception is caught (forward 404 / 400 page). Personally checking inputs in API request manager. I call _sanitizing inputs_. try save if right, redirect a friendly "Nope 404 / 400" page. a user experience I think</technical_language>

Target:
public String processSubmit(@ModelAttribute("serviceRecord") SequencerServiceRecord record, ModelMap model, SessionStatus session) throws IOException { requestManager.saveSequencerServiceRecord(record); session.setComplete(); model.clear(); return "redirect:/miso/stats/sequencer/servicerecord/" + record.getId(); }
Source:
<code>public GetRecordsCache createRecordsFetcher(GetRecordsRetrievalStrategy getRecordsRetrievalStrategy, String shardId, IMetricsFactory metricsFactory) { if(dataFetchingStrategy.equals(DataFetchingStrategy.DEFAULT)) { return new BlockingGetRecordsCache(maxRecords, getRecordsRetrievalStrategy, idleMillisBetweenCalls); } else { return new PrefetchGetRecordsCache(maxPendingProcessRecordsInput, maxByteSize, maxRecordsCount, maxRecords, getRecordsRetrievalStrategy, Executors.newFixedThreadPool(1, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("prefetch-cache-" + shardId + "-%04d") .build()), <START> idleMillisBetweenCalls, metricsFactory, "processTask"); <END> } }</code><technical_language>ProcessTask processTask. Add 2 new parameters in new lines each</technical_language>

Target:
public GetRecordsCache createRecordsFetcher(GetRecordsRetrievalStrategy getRecordsRetrievalStrategy, String shardId, IMetricsFactory metricsFactory) { if(dataFetchingStrategy.equals(DataFetchingStrategy.DEFAULT)) { return new BlockingGetRecordsCache(maxRecords, getRecordsRetrievalStrategy, idleMillisBetweenCalls); } else { return new PrefetchGetRecordsCache(maxPendingProcessRecordsInput, maxByteSize, maxRecordsCount, maxRecords, getRecordsRetrievalStrategy, Executors.newFixedThreadPool(1, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("prefetch-cache-" + shardId + "-%04d") .build()), idleMillisBetweenCalls, metricsFactory, "ProcessTask"); } }
Source:
<code>protected void addAuthenticationToGSon(JsonWriter out, RepositoryLocation location) { try { <START> if (Boolean.parseBoolean(location.getProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY))) { <END> out.name("Bugzilla_api_key").value(location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY)); } else { UserCredentials credentials = getClient().getLocation().getCredentials(AuthenticationType.REPOSITORY); if (credentials == null) { throw new IllegalStateException("Authentication requested without valid credentials"); } out.name("Bugzilla_login").value(credentials.getUserName()); out.name("Bugzilla_password").value(credentials.getPassword()); } } catch (IOException e) { throw new IllegalStateException("Authentication requested with IOException", e); } }</code><technical_language>RepositoryLocation a getBooleanProperty method is nullsafe want</technical_language>

Target:
protected void addAuthenticationToGSon(JsonWriter out, RepositoryLocation location) { try { if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { out.name("Bugzilla_api_key").value(location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY)); } else { UserCredentials credentials = getClient().getLocation().getCredentials(AuthenticationType.REPOSITORY); if (credentials == null) { throw new IllegalStateException("Authentication requested without valid credentials"); } out.name("Bugzilla_login").value(credentials.getUserName()); out.name("Bugzilla_password").value(credentials.getPassword()); } } catch (IOException e) { throw new IllegalStateException("Authentication requested with IOException", e); } }
Source:
<code>public FuzzyCMeansModel cluster(SparseDistributedMatrix points, int k) throws MathIllegalArgumentException, ConvergenceException { GridArgumentCheck.notNull(points, "points"); if (k < 2) { throw new MathIllegalArgumentException("The number of clusters is less than 2"); } Vector[] centers = initializeCenters(points, k); MembershipsAndSums membershipsAndSums = null; int iteration = 0; boolean finished = false; while (!finished && iteration < cMeansMaxIterations) { MembershipsAndSums newMembershipsAndSums = calculateMembership(points, centers); Vector[] newCenters = calculateNewCenters(points, newMembershipsAndSums, k); if (stopCondition == StopCondition.STABLE_CENTERS) { finished = isFinished(centers, newCenters); } else { finished = isFinished(membershipsAndSums, newMembershipsAndSums); } centers = newCenters; membershipsAndSums = newMembershipsAndSums; iteration++; } <START> if (iteration == cMeansMaxIterations) { <END> throw new ConvergenceException("Fuzzy C-Means algorithm has not converged after " + Integer.toString(iteration) + " iterations"); } return new FuzzyCMeansModel(centers, measure); }</code><technical_language>Please check guideline: <LINK_0></technical_language>

Target:
@Override public FuzzyCMeansModel cluster(SparseDistributedMatrix points, int k) throws MathIllegalArgumentException, ConvergenceException { GridArgumentCheck.notNull(points, "points"); if (k < 2) throw new MathIllegalArgumentException("The number of clusters is less than 2"); Vector[] centers = initializeCenters(points, k); MembershipsAndSums membershipsAndSums = null; int iteration = 0; boolean finished = false; while (!finished && iteration < cMeansMaxIterations) { MembershipsAndSums newMembershipsAndSums = calculateMembership(points, centers); Vector[] newCenters = calculateNewCenters(points, newMembershipsAndSums, k); if (stopCond == StopCondition.STABLE_CENTERS) finished = isFinished(centers, newCenters); else finished = isFinished(membershipsAndSums, newMembershipsAndSums); centers = newCenters; membershipsAndSums = newMembershipsAndSums; iteration++; } if (iteration == cMeansMaxIterations) throw new ConvergenceException("Fuzzy C-Means algorithm has not converged after " + Integer.toString(iteration) + " iterations"); return new FuzzyCMeansModel(centers, measure); }
Source:
<code>public Map<String, Object> listMyReports() { final Map<String, Object> response = new HashMap<String, Object>(); List<ReportDto> results = new ArrayList<ReportDto>(); List<Report> reports = reportDao.listAllByCurrentUser(); if (reports != null) { for (Report r : reports) { ReportDto dto = new ReportDto(); <START> DtoMarshaller.copyToDto(r, dto); <END> results.add(dto); } } response.put("reports", results); return response; }</code><technical_language>Ditto replacing spring BeanUtils</technical_language>

Target:
public Map<String, Object> listMyReports() { final Map<String, Object> response = new HashMap<String, Object>(); List<ReportDto> results = new ArrayList<ReportDto>(); List<Report> reports = reportDao.listAllByCurrentUser(); if (reports != null) { for (Report r : reports) { ReportDto dto = new ReportDto(); BeanUtils.copyProperties(r, dto); dto.setKeyId(r.getKey().getId()); results.add(dto); } } response.put("reports", results); return response; }
Source:
<code>public void validateInvalidDestinationDomain() { StorageDomain srcStorageDomain = initStorageDomain(srcStorageId); <START> srcStorageDomain.setStatus(StorageDomainStatus.Active); <END> StorageDomain dstStorageDomain = initStorageDomain(dstStorageId); dstStorageDomain.setStorageDomainType(StorageDomainType.ISO); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); }</code><technical_language>I this removed :)</technical_language>

Target:
public void validateInvalidDestinationDomain() { StorageDomain srcStorageDomain = initStorageDomain(srcStorageId); StorageDomain dstStorageDomain = initStorageDomain(dstStorageId); dstStorageDomain.setStorageDomainType(StorageDomainType.ISO); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); }
Source:
<code><START> public ListObjectStream(List<T> items) { <END> this.items = items; this.i = 0; }</code><technical_language>need public in non-public class</technical_language>

Target:
ListObjectStream(List<T> items) { this.items = items; this.i = 0; }
Source:
<code>private Protos.ExecutorInfo.Builder newExecutorInfo(Configuration configuration) { return Protos.ExecutorInfo.newBuilder() .setExecutorId(Protos.ExecutorID.newBuilder().setValue(UUID.randomUUID().toString())) .setFrameworkId(configuration.getFrameworkId()) .setName("elasticsearch-executor-" + UUID.randomUUID().toString()) .setCommand(newCommandInfo(configuration)) .setContainer(Protos.ContainerInfo.newBuilder() .setType(Protos.ContainerInfo.Type.DOCKER) .setDocker(Protos.ContainerInfo.DockerInfo.newBuilder().setImage("mesos/elasticsearch-executor")) <START> .addVolumes(Protos.Volume.newBuilder().setContainerPath("/data").setHostPath("/var/lib/elasticsearch").setMode(Protos.Volume.Mode.RW).build()) <END> .build()); }</code><technical_language>mesos permission RW /data externally? /var/lib/elasticsearch exist</technical_language>

Target:
private Protos.ExecutorInfo.Builder newExecutorInfo(Configuration configuration) { return Protos.ExecutorInfo.newBuilder() .setExecutorId(Protos.ExecutorID.newBuilder().setValue(UUID.randomUUID().toString())) .setFrameworkId(configuration.getFrameworkId()) .setName("elasticsearch-executor-" + UUID.randomUUID().toString()) .setCommand(newCommandInfo(configuration)) .setContainer(Protos.ContainerInfo.newBuilder() .setType(Protos.ContainerInfo.Type.DOCKER) .setDocker(Protos.ContainerInfo.DockerInfo.newBuilder().setImage(configuration.getEexecutorImage()).setForcePullImage(configuration.getExecutorForcePullImage())) .addVolumes(Protos.Volume.newBuilder().setHostPath(SETTINGS_PATH_VOLUME).setContainerPath(SETTINGS_PATH_VOLUME).setMode(Protos.Volume.Mode.RO)) .addVolumes(Protos.Volume.newBuilder().setContainerPath(SETTINGS_DATA_VOLUME_CONTAINER).setHostPath(SETTINGS_DATA_VOLUME_HOST).setMode(Protos.Volume.Mode.RW).build()) .build()); }
Source:
<code><START> TypeScriptGenerator(Options opts) throws FileNotFoundException { <END> this.opts = opts; this.compiler = new Compiler(); compiler.disableThreads(); this.errorManager = new GentsErrorManager(System.err, ErrorFormat.MULTILINE.toFormatter(compiler, true), opts.debug); compiler.setErrorManager(errorManager); this.pathUtil = new PathUtil(opts.root); this.nameUtil = new NameUtil(compiler); if (opts.externsMapFile != null) { Type mapType = new TypeToken<Map<String, String>>(){}.getType(); JsonReader reader = new JsonReader(new FileReader(opts.externsMapFile)); externsMap = new Gson().fromJson(reader, mapType); } else { externsMap = ImmutableMap.of(); } }</code><technical_language>Please construct it, passing in file</technical_language>

Target:
TypeScriptGenerator(Options opts) { this.opts = opts; this.compiler = new Compiler(); compiler.disableThreads(); this.errorManager = new GentsErrorManager(System.err, ErrorFormat.MULTILINE.toFormatter(compiler, true), opts.debug); compiler.setErrorManager(errorManager); this.pathUtil = new PathUtil(opts.root); this.nameUtil = new NameUtil(compiler); }
Source:
<code>public static Filter convertToCNFFromQueryContext(Query query, Filter filter) { if (filter == null) { return null; } <START> boolean useCNF = (Boolean) query.getContextValue(CTX_KEY_USE_FILTER_CNF, false); <END> return useCNF ? convertToCNF(filter) : filter; }</code><technical_language>set true default</technical_language>

Target:
public static Filter convertToCNFFromQueryContext(Query query, Filter filter) { if (filter == null) { return null; } boolean useCNF = query.getContextBoolean(CTX_KEY_USE_FILTER_CNF, false); return useCNF ? convertToCNF(filter) : filter; }
Source:
<code><START> @Override public void setEnabled(boolean enabled) { <END> label.setEnabled(enabled); if (contentWidget instanceof HasEnabled) { HasEnabled enableableWidget = (HasEnabled) this.contentWidget; enableableWidget.setEnabled(enabled); } }</code><technical_language>typically write annotations separate line</technical_language>

Target:
public void setEnabled(boolean enabled) { label.setEnabled(enabled); if (contentWidget instanceof HasEnabled) { HasEnabled enableableWidget = (HasEnabled) this.contentWidget; enableableWidget.setEnabled(enabled); } }
Source:
<code>private Flux<FeedResponse<T>> byPage(CosmosPagedFluxOptions pagedFluxOptions, Context context) { final AtomicReference<Context> parentContext = new AtomicReference<>(Context.NONE); return this.optionsFluxFunction.apply(pagedFluxOptions).doOnSubscribe(ignoredValue -> { if (pagedFluxOptions.getTracerProvider().isEnabled()) { reactor.util.context.Context reactorContext = FluxUtil.toReactorContext(context); Objects.requireNonNull(reactorContext.hasKey(TracerProvider.MASTER_CALL)); Optional<Object> callerFunc = reactorContext.getOrEmpty(TracerProvider.NESTED_CALL); if (!callerFunc.isPresent()) { parentContext.set(pagedFluxOptions.getTracerProvider().startSpan(pagedFluxOptions.getTracerSpanName(), context.addData(TracerProvider.ATTRIBUTE_MAP, pagedFluxOptions.getTracingAttributes()), ProcessKind.DATABASE)); } } <START> }).doOnEach(responseSignal -> { <END> if (pagedFluxOptions.getTracerProvider().isEnabled()) { pagedFluxOptions.getTracerProvider().endSpan(parentContext.get(), Signal.complete(), 200); } }).doOnError(throwable -> { if (pagedFluxOptions.getTracerProvider().isEnabled()) { pagedFluxOptions.getTracerProvider().endSpan(parentContext.get(), Signal.error(throwable), 0); } }); }</code><technical_language>@trask thoughts expected behavior, if end span of element received</technical_language>

Target:
private Flux<FeedResponse<T>> byPage(CosmosPagedFluxOptions pagedFluxOptions, Context context) { final AtomicReference<Context> parentContext = new AtomicReference<>(Context.NONE); return this.optionsFluxFunction.apply(pagedFluxOptions).doOnSubscribe(ignoredValue -> { parentContext.set(pagedFluxOptions.getTracerProvider().startSpan(pagedFluxOptions.getTracerSpanName(), pagedFluxOptions.getDatabaseId(), pagedFluxOptions.getServiceEndpoint(), context)); }).doOnComplete(() -> { pagedFluxOptions.getTracerProvider().endSpan(parentContext.get(), Signal.complete(), HttpConstants.StatusCodes.OK); }).doOnError(throwable -> { pagedFluxOptions.getTracerProvider().endSpan(parentContext.get(), Signal.error(throwable), TracerProvider.ERROR_CODE); }); }
Source:
<code>public void testGetReadOnlyWithReadOnlyValuesAndAllowOnlyVisualChangesNotSet() { drgElement.setAllowOnlyVisualChange(false); checkIfItIsNotSet("Name"); checkIfItIsNotSet("AllowedAnswers"); checkIfItIsNotSet("Description"); checkIfItIsNotSet("Question"); checkIfItIsNotSet("DataType"); checkIfItIsNotSet("SourceType"); <START> checkIfItIsNotSet("LocationURI"); <END> }</code><technical_language>I extract constants testGetReadOnlyWithReadOnlyValuesAndAllowOnlyVisualChangesNotSet testGetReadOnlyWithReadOnlyValues collection/array iterate collection/array in checkIfItIsNotSet checkIfIsReadOnly</technical_language>

Target:
public void testGetReadOnlyWithReadOnlyValuesAndAllowOnlyVisualChangesNotSet() { drgElement.setAllowOnlyVisualChange(false); for (final String readonlyField : READONLY_FIELDS) { checkIfItIsNotSet(readonlyField); } }
Source:
<code>public CreateChangeDialog(final FocusWidget enableOnFailure, Project.NameKey project) { super(enableOnFailure, true, "Create Inline Change", "Description"); ProjectApi.getBranches(project, new GerritCallback<JsArray<BranchInfo>>() { @Override public void onSuccess(JsArray<BranchInfo> result) { branches = Natives.asList(result); } }); newChange = new SuggestBox(new HighlightSuggestOracle() { @Override protected void onRequestSuggestions(Request request, Callback done) { <START> LinkedList<BranchSuggestion> suggestions = new LinkedList<>(); <END> for (BranchInfo b : branches) { if (b.ref().contains(request.getQuery())) { suggestions.add(new BranchSuggestion(b)); } } done.onSuggestionsReady(request, new Response(suggestions)); } }); newChange.setWidth("100%"); newChange.getElement().getStyle().setProperty("boxSizing", "border-box"); message.setCharacterWidth(70); FlowPanel mwrap = new FlowPanel(); mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage()); mwrap.add(newChange); panel.insert(mwrap, 0); panel.insert(new SmallHeading("Select Branch for a new Change"), 0); }</code><technical_language>This fine ArrayList</technical_language>

Target:
public CreateChangeDialog(final FocusWidget enableOnFailure, Project.NameKey project) { super(enableOnFailure, true, "Create Inline Change", "Description"); ProjectApi.getBranches(project, new GerritCallback<JsArray<BranchInfo>>() { @Override public void onSuccess(JsArray<BranchInfo> result) { branches = Natives.asList(result); } }); newChange = new SuggestBox(new HighlightSuggestOracle() { @Override protected void onRequestSuggestions(Request request, Callback done) { List<BranchSuggestion> suggestions = new ArrayList<>(); for (BranchInfo b : branches) { if (b.ref().contains(request.getQuery())) { suggestions.add(new BranchSuggestion(b)); } } done.onSuggestionsReady(request, new Response(suggestions)); } }); newChange.setWidth("100%"); newChange.getElement().getStyle().setProperty("boxSizing", "border-box"); message.setCharacterWidth(70); FlowPanel mwrap = new FlowPanel(); mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage()); mwrap.add(newChange); panel.insert(mwrap, 0); panel.insert(new SmallHeading("Select Branch for a new Change"), 0); }
Source:
<code>private void validate() { <START> if (isValidationRunning() && onBeforeValidate()) { <END> loadingStarts(); sessionCommands.getValidateSessionCommand().execute(new ClientSessionCommand.Callback<Collection<DiagramElementViolation<RuleViolation>>>() { @Override public void onSuccess() { loadingCompleted(); endValidation(); } @Override public void onError(final Collection<DiagramElementViolation<RuleViolation>> violations) { AbstractDiagramEditorMenuSessionItems.this.onError(violations.toString()); endValidation(); } }); } }</code><technical_language>validate if validation is running</technical_language>

Target:
private void validate() { validationAction.validate(); }
Source:
<code>public FilteringXmlStreamWriter(XMLStreamWriter writer, String encoding) { this.writer = writer; <START> this.encoding = encoding != null ? encoding.toUpperCase() : null; <END> }</code><technical_language>please explain need store upper case please</technical_language>

Target:
public FilteringXmlStreamWriter(XMLStreamWriter writer, String encoding) { this.writer = writer; this.encoding = encoding; }
Source:
<code>public void init(Bundle savedInstanceState) { settings = getSharedPreferences("prefs", 0); firstRun = settings.getBoolean("firstRun", true); if (firstRun) { <START> IntroActivity1 first_fragment = new IntroActivity1(); <END> IntroActivity2 second_fragment = new IntroActivity2(); IntroActivity3 third_fragment = new IntroActivity3(); IntroActivity4 fourth_fragment = new IntroActivity4(); IntroActivity5 fifth_fragment = new IntroActivity5(); IntroActivity6 sixth_fragment = new IntroActivity6(); addSlide(first_fragment); addSlide(second_fragment); addSlide(third_fragment); addSlide(fourth_fragment); addSlide(fifth_fragment); addSlide(sixth_fragment); } else{ loadMainActivity(); } }</code><technical_language>do create variables for this? write addSlide(new IntroActivity1())instead</technical_language>

Target:
public void init(Bundle savedInstanceState) { sharedPreferences = getSharedPreferences("prefs", 0); isfirstRun = sharedPreferences.getBoolean("firstRun", true); if (isfirstRun) { addSlide(new IntroFragment(1)); addSlide(new IntroFragment(2)); addSlide(new IntroFragment(3)); addSlide(new IntroFragment(4)); addSlide(new IntroFragment(5)); addSlide(new IntroFragment(6)); } else { loadMainActivity(); } }
Source:
<code><START> ApacheHttpClientBuilder() { <END> this.socketTimeout = DEFAULT_CONNECTION_TIMEOUT; this.connectTimeout = DEFAULT_CONNECTION_TIMEOUT; this.connectionRequestTimeout = DEFAULT_CONNECTION_TIMEOUT; }</code><technical_language>public</technical_language>

Target:
protected ApacheHttpClientBuilder() { this.socketTimeout = DEFAULT_CONNECTION_TIMEOUT; this.connectTimeout = DEFAULT_CONNECTION_TIMEOUT; this.connectionRequestTimeout = DEFAULT_CONNECTION_TIMEOUT; }
Source:
<code>protected Class<?> findClass(String name) throws ClassNotFoundException { if (name.startsWith("org.modelmapper.internal.cglib")) return internalClassSpace.loadClass(name); for (ClassLoader additionalClassLoader : additionalClassLoaders) { try { return additionalClassLoader.loadClass(name); } <START> catch (ClassNotFoundException e) END> } throw new ClassNotFoundException(); }</code><technical_language>coding style: try { ... } catch (ClassNotFoundException e) { // mind... Attempt next class loader |</technical_language>

Target:
protected Class<?> findClass(String name) throws ClassNotFoundException { if (name.startsWith("org.modelmapper.internal.cglib")) return internalClassSpace.loadClass(name); for (ClassLoader additionalClassLoader : additionalClassLoaders) { try { return additionalClassLoader.loadClass(name); } catch (ClassNotFoundException e) { } } throw new ClassNotFoundException(name); }
Source:
<code>public ChannelOutboundHandlerAdapter createHttpResponseHandler() { return new ChannelOutboundHandlerAdapter() { @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { HttpResponse response = (HttpResponse) msg; <START> Span span = tracer.currentSpan(); <END> if (span == null) return; tracer.withSpanInScope(span).close(); handler.handleSend(response, null, span); super.write(ctx, msg, promise); } }; }</code><technical_language>I this work (due async framework). need do is add span ctx in channelRead success (but exception). extract here</technical_language>

Target:
public ChannelOutboundHandlerAdapter createHttpResponseHandler() { return new ChannelOutboundHandlerAdapter() { @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { HttpResponse response = (HttpResponse) msg; Span span = (Span) ctx.channel().attr(AttributeKey.valueOf(Span.class.getName())).get(); Throwable error = null; try (Tracer.SpanInScope ws = (Tracer.SpanInScope) ctx.channel() .attr(AttributeKey.valueOf(Tracer.SpanInScope.class.getName())) .get()) { ws.close(); super.write(ctx, msg, promise); } catch (Exception | Error e) { error = e; throw e; } finally { handler.handleSend(response, error, span); } } }; }
Source:
<code>private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { <START> if (this.isIdempotentPartitionPublishing) { <END> return amqpSendLink.getRemoteProperties().map(properties -> { this.setPartitionPublishingState( partitionId, (Long) properties.get(SymbolConstants.PRODUCER_ID), (Short) properties.get(SymbolConstants.PRODUCER_EPOCH), (Integer) properties.get(SymbolConstants.PRODUCER_SEQUENCE_NUMBER) ); return amqpSendLink; }); } else { return Mono.just(amqpSendLink); } }</code><technical_language>need this. implied is other variable name in this scope</technical_language>

Target:
private Mono<AmqpSendLink> updatePublishingState(String partitionId, AmqpSendLink amqpSendLink) { if (isIdempotentPartitionPublishing) { return amqpSendLink.getRemoteProperties().map(properties -> { setPartitionPublishingState( partitionId, (Long) properties.get(ClientConstants.PRODUCER_ID), (Short) properties.get(ClientConstants.PRODUCER_EPOCH), (Integer) properties.get(ClientConstants.PRODUCER_SEQUENCE_NUMBER) ); return amqpSendLink; }); } else { return Mono.just(amqpSendLink); } }
Source:
<code>public APIVersion getAPIVersion() { APIVersion apiVersion = getParameter(API_VERSION_ATTRIBUTE_NAME); <START> return apiVersion != null ? apiVersion : APIVersion.latest(); <END> }</code><technical_language>do about: suggestion return Objects.requireNonNullElseGet(apiVersion, APIVersion::latest);</technical_language>

Target:
public APIVersion getAPIVersion() { APIVersion apiVersion = getParameter(API_VERSION_ATTRIBUTE_NAME); return Objects.requireNonNullElseGet(apiVersion, APIVersion::latest); }
Source:
<code>public AmmoStorage(int tonnage, EquipmentType et, int shots, Campaign c) { super(tonnage, et, -1, 1.0, c); this.shots = shots; <START> if (type instanceof AmmoType) { this.munition = ((AmmoType) type).getMunitionType(); } <END> }</code><technical_language>Formatting odd..</technical_language>

Target:
public AmmoStorage(int tonnage, EquipmentType et, int shots, Campaign c) { super(tonnage, et, -1, 1.0, c); this.shots = shots; this.munition = getType().getMunitionType(); }
Source:
<code>static int parseFastForwardLimit(String fastForwardLine) { String text = fastForwardLine.trim().substring(2, fastForwardLine.length() - 2).trim(); try { int limit = Integer.parseInt(text); <START> condition(limit > 0, "fast-forward limit must be greater than zero, it is: " + limit); <END> return limit; } catch (NumberFormatException e) { return Integer.MAX_VALUE; } }</code><technical_language>put actual limit _inline_: "fast-forward limit [%s] greater zero"</technical_language>

Target:
static int parseFastForwardLimit(String fastForwardLine) { String text = fastForwardLine.trim().substring(2, fastForwardLine.length() - 2).trim(); try { int limit = Integer.parseInt(text); condition(limit > 0, () -> format("fast-forward(%d) limit must be greater than zero", limit)); return limit; } catch (NumberFormatException e) { return Integer.MAX_VALUE; } }
Source:
<code>public String[] getExtensions() { <START> return m_extensions; <END> }</code><technical_language>CollectionUtility.unmodifiableList()</technical_language>

Target:
public List<String> getExtensions() { return CollectionUtility.unmodifiableList(m_extensions); }
Source:
<code>public void testCompareMetrics(final Object value1, final Object value2, final boolean expectedEqual, final String expectedDescription, final Double marcValue) { final CompareMetrics compareMetrics = new CompareMetrics(); <START> CompareMetrics.MetricToAllowableRelativeChange = new HashMap<>(); <END> if (marcValue != null) { CompareMetrics.MetricToAllowableRelativeChange.put("M", marcValue); } final CompareMetrics.SimpleResult result = compareMetrics.compareMetricValues(value1, value2, "M"); Assert.assertEquals(result.equal, expectedEqual); Assert.assertEquals(result.description, expectedDescription); }</code><technical_language>If MetricToAllowableRelativeChange static for testing, able do this instead compareMetrics.METRIC_ALLOWABLE_RELATIVE_CHANGE = Collections.singletonList("M:" + marcValue); compareMetrics.customCommandLineValidation();</technical_language>

Target:
public void testCompareMetrics(final Object value1, final Object value2, final boolean expectedEqual, final String expectedDescription, final Double marcValue) { final CompareMetrics compareMetrics = new CompareMetrics(); CompareMetrics.MetricToAllowableRelativeChange.clear(); compareMetrics.METRIC_ALLOWABLE_RELATIVE_CHANGE = Collections.singletonList("M:" + marcValue); compareMetrics.customCommandLineValidation(); final CompareMetrics.SimpleResult result = compareMetrics.compareMetricValues(value1, value2, "M"); Assert.assertEquals(result.equal, expectedEqual); Assert.assertEquals(result.description, expectedDescription); }
Source:
<code>public GraphQLRequestScope( DataStoreTransaction transaction, User user, ElideSettings elideSettings, GraphQLProjectionInfo projectionInfo ) { super("/", null, transaction, user, new MultivaluedHashMap<>(), elideSettings); this.projectionInfo = projectionInfo; if (projectionInfo.getProjections().size() > 0) { <START> this.setEntityProjection(projectionInfo.getProjections().entrySet().iterator().next().getValue()); <END> } }</code><technical_language>set this random. I if set this null mention this is unused in GraphQL</technical_language>

Target:
public GraphQLRequestScope( DataStoreTransaction transaction, User user, ElideSettings elideSettings, GraphQLProjectionInfo projectionInfo ) { super("/", null, transaction, user, new MultivaluedHashMap<>(), elideSettings); this.projectionInfo = projectionInfo; this.setEntityProjection(null); }
Source:
<code><START> public Optional<Map<String, String>> renderManifestMap(Formatter formatter, Submission submission) throws Exception { <END> Map<String, String> renderMap = new HashMap<String, String>(); Context context = new Context(Locale.getDefault()); formatter.populateContext(context, submission); Optional<Map<String, String>> templates = Optional.of(formatter.getTemplates()); Optional<String> dcContent = Optional.empty(); if (templates.isPresent() && templates.get().size() > 0) { for (Map.Entry<String, String> template : templates.get().entrySet()) { dcContent = Optional.of(templateEngine.process(template.getValue(), context)); if (dcContent.isPresent()) { renderMap.put(template.getKey(), dcContent.get()); } } } return Optional.of(renderMap); }</code><technical_language>this returning object is null, refactor Optional return Map<String, String></technical_language>

Target:
public Map<String, String> renderManifestMap(Formatter formatter, Submission submission) throws Exception { Map<String, String> renderMap = new HashMap<String, String>(); Context context = new Context(Locale.getDefault()); formatter.populateContext(context, submission); Map<String, String> templates = formatter.getTemplates(); for (Map.Entry<String, String> template : templates.entrySet()) { renderMap.put(template.getKey(), templateEngine.process(template.getValue(), context)); } return renderMap; }
Source:
<code>public AwayColoursManager(final DMDircMBassador eventBus, @GlobalConfig final AggregateConfigProvider config, @PluginDomain(AwayColoursPlugin.class) final String domain, @GlobalConfig final ColourManager colourManager) { this.eventBus = eventBus; this.colourManager = colourManager; <START> binder = new ConfigBinder(config, domain); <END> }</code><technical_language>config.getBinder().withDefaultDomain(domain) ... ConfigBinder ctors package private ... :)</technical_language>

Target:
public AwayColoursManager(final DMDircMBassador eventBus, @GlobalConfig final AggregateConfigProvider config, @PluginDomain(AwayColoursPlugin.class) final String domain, @GlobalConfig final ColourManager colourManager) { this.eventBus = eventBus; this.colourManager = colourManager; binder = config.getBinder().withDefaultDomain(domain); }
Source:
<code>public void registerColumns() { for (XViewerColumn xCol : Arrays.asList(Name, Method_Number, Execution_Number, Namespace, Coverage_Percent, Coverage_Method, Work_Product_Task, Coverage_Rationale, Coverage_Test_Units, Assignees_Col, Notes_Col, <START> Parent_Coverage_Unit, Line_Number, Location, Full_Path)) { <END> XViewerColumn newXCol = xCol.copy(); if (xCol.equals(CoverageXViewerFactory.Coverage_Rationale) || xCol.equals(CoverageXViewerFactory.Method_Number) || xCol.equals(CoverageXViewerFactory.Execution_Number) || xCol.equals(CoverageXViewerFactory.Coverage_Method) || xCol.equals(CoverageXViewerFactory.Coverage_Percent) || xCol.equals(CoverageXViewerFactory.Assignees_Col) || xCol.equals(CoverageXViewerFactory.Notes_Col)) { newXCol.setShow(true); } if (xCol.equals(CoverageXViewerFactory.Work_Product_Task)) { newXCol.setShow(false); } registerColumns(newXCol); } }</code><technical_language>leave guid in table. allows items uniquely identified if need search for artifact/item corresponds. need remove this table, report</technical_language>

Target:
public void registerColumns() { for (XViewerColumn xCol : Arrays.asList(Name, Method_Number, Execution_Number, Namespace, Coverage_Percent, Coverage_Method, Work_Product_Task, Coverage_Rationale, Coverage_Test_Units, Assignees_Col, Notes_Col, Parent_Coverage_Unit, Line_Number, Location, Full_Path, Guid)) { XViewerColumn newXCol = xCol.copy(); if (xCol.equals(CoverageXViewerFactory.Coverage_Rationale) || xCol.equals(CoverageXViewerFactory.Method_Number) || xCol.equals(CoverageXViewerFactory.Execution_Number) || xCol.equals(CoverageXViewerFactory.Coverage_Method) || xCol.equals(CoverageXViewerFactory.Coverage_Percent) || xCol.equals(CoverageXViewerFactory.Assignees_Col) || xCol.equals(CoverageXViewerFactory.Notes_Col)) { newXCol.setShow(true); } if (xCol.equals(CoverageXViewerFactory.Work_Product_Task)) { newXCol.setShow(false); } registerColumns(newXCol); } }