auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void executeVdsBrokerCommand() { <START> String volumeName = getParameters().getVolumeName(); <END> result = getBroker().glusterVolumeRebalanceStatus(volumeName); proceedProxyReturnValue(); GlusterVolumeTaskStatusEntity entity = result.getStatusDetails(); entity.setStatusTime(new Date()); setReturnValue(entity); }</code><technical_language>is stop happening all. status!</technical_language>

Target:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); result = getBroker().glusterVolumeRebalanceStop(volumeName); proceedProxyReturnValue(); GlusterVolumeTaskStatusEntity entity = result.getStatusDetails(); entity.setStatusTime(new Date()); setReturnValue(entity); }
Source:
<code>private static void instantiateTemplateRule(String ruleTemplateKey, String instantiationKey, String params, Set<String> activatedRuleKeys) { if (!SUBSET_OF_ENABLED_RULES.isEmpty() && !SUBSET_OF_ENABLED_RULES.contains(instantiationKey)) { return; } activatedRuleKeys.add(instantiationKey); SonarClient sonarClient = orchestrator.getServer().adminWsClient(); <START> String post2 = sonarClient.post("/api/rules/create", ImmutableMap.<String, Object>builder() <END> .put("name", instantiationKey) .put("markdown_description", instantiationKey) .put("severity", "INFO") .put("status", "READY") .put("template_key", "squid:" + ruleTemplateKey) .put("custom_key", instantiationKey) .put("prevent_reactivation", "true") .put("params", "name=\"" + instantiationKey + "\";key=\"" + instantiationKey + "\";markdown_description=\"" + instantiationKey + "\";" + params) .build()); String post = sonarClient.get("api/rules/app"); String profileKey = null; Map map = GSON.fromJson(post, Map.class); for (Map qp : ((List<Map>) map.get("qualityprofiles"))) { if ("rules".equals(qp.get("name"))) { profileKey = (String) qp.get("key"); break; } } if (StringUtils.isEmpty(profileKey)) { LOG.error("Could not retrieve profile key : Template rule " + ruleTemplateKey + " has not been activated"); } else { String activateRuleResponse = sonarClient.post("api/qualityprofiles/activate_rule", ImmutableMap.of( "profile_key", profileKey, "rule_key", "squid:" + instantiationKey, "severity", "INFO", "params", "")); LOG.warn(activateRuleResponse); } }</code><technical_language>Useless variable post2</technical_language>

Target:
private static void instantiateTemplateRule(String ruleTemplateKey, String instantiationKey, String params, Set<String> activatedRuleKeys) { if (!SUBSET_OF_ENABLED_RULES.isEmpty() && !SUBSET_OF_ENABLED_RULES.contains(instantiationKey)) { return; } activatedRuleKeys.add(instantiationKey); SonarClient sonarClient = orchestrator.getServer().adminWsClient(); sonarClient.post("/api/rules/create", ImmutableMap.<String, Object>builder() .put("name", instantiationKey) .put("markdown_description", instantiationKey) .put("severity", "INFO") .put("status", "READY") .put("template_key", "squid:" + ruleTemplateKey) .put("custom_key", instantiationKey) .put("prevent_reactivation", "true") .put("params", "name=\"" + instantiationKey + "\";key=\"" + instantiationKey + "\";markdown_description=\"" + instantiationKey + "\";" + params) .build()); String post = sonarClient.get("api/rules/app"); String profileKey = null; Map map = GSON.fromJson(post, Map.class); for (Map qp : ((List<Map>) map.get("qualityprofiles"))) { if ("rules".equals(qp.get("name"))) { profileKey = (String) qp.get("key"); break; } } if (StringUtils.isEmpty(profileKey)) { LOG.error("Could not retrieve profile key : Template rule " + ruleTemplateKey + " has not been activated"); } else { String activateRuleResponse = sonarClient.post("api/qualityprofiles/activate_rule", ImmutableMap.of( "profile_key", profileKey, "rule_key", "squid:" + instantiationKey, "severity", "INFO", "params", "")); LOG.warn(activateRuleResponse); } }
Source:
<code>public DefaultFileRegion(File f, long position, long count) { <START> this.f = ObjectUtil.checkNotNull(f, "file"); <END> this.position = checkPositiveOrZero(position, "position"); this.count = checkPositiveOrZero(count, "count"); }</code><technical_language>nit: this "f"</technical_language>

Target:
public DefaultFileRegion(File f, long position, long count) { this.f = ObjectUtil.checkNotNull(f, "f"); this.position = checkPositiveOrZero(position, "position"); this.count = checkPositiveOrZero(count, "count"); }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) <END> return true; if (!(o instanceof AddCinderStorageDomainParameters)) return false; AddCinderStorageDomainParameters that = (AddCinderStorageDomainParameters) o; return Objects.equals(driverName, that.driverName) && Objects.equals(driverOptions, that.driverOptions); }</code><technical_language>please add {}. fails checkstyle validation</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AddCinderStorageDomainParameters)) { return false; } AddCinderStorageDomainParameters that = (AddCinderStorageDomainParameters) o; return Objects.equals(driverName, that.driverName) && Objects.equals(driverOptions, that.driverOptions); }
Source:
<code>protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<String> iterator = failedToCreate.keySet().iterator(); while (iterator.hasNext()) { String itemName = iterator.next(); PersistedItem persistedItem = failedToCreate.get(itemName); ActiveItem item = itemFactory.createItem(persistedItem.itemType, itemName); if (item != null) { <START> failedToCreate.remove(itemName); <END> configureItem(persistedItem, item); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }</code><technical_language>this break iterator</technical_language>

Target:
protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<Entry<String, PersistedItem>> iterator = failedToCreate.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, PersistedItem> entry = iterator.next(); String itemName = entry.getKey(); PersistedItem persistedItem = entry.getValue(); ActiveItem item = itemFactory.createItem(persistedItem.itemType, itemName); if (item != null) { iterator.remove(); configureItem(persistedItem, item); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }
Source:
<code>void onClickFab(){ Bundle bundle = new Bundle(); bundle.putString("state", "From Home"); AlertSetupFragment alertSetupFragment = new AlertSetupFragment(); alertSetupFragment.setArguments(bundle); <START> adapter.addFragment(alertSetupFragment,"Setup Alert"); <END> adapter.notifyDataSetChanged(); floatingActionButton.setVisibility(View.GONE); }</code><technical_language>I this "Setup Trigger". externalised strings.xml though</technical_language>

Target:
void onClickFab(){ startActivity(new Intent(getApplicationContext(), TriggerSetupActivity.class)); }
Source:
<code>public static void createGeoTiffForGrid(GridDataset gridDataset, GridDatatype grid, int timeIndex, String filename) throws GeoTiffUtilException { try { Array data = grid.readDataSlice(timeIndex, 0, -1, -1); GeotiffWriter writer = new GeotiffWriter(filename); writer.writeGrid(gridDataset, grid, data, false); <START> writer.close(); <END> } catch (Exception e) { throw new GeoTiffUtilException(GeoTiffUtilExceptionID.GEOTIFFWRITER_EXCEPTION, "GeoTiffUtils", "generateGeoTiffZipFromGrid", "Unable to generate Tiff image from grid [" + gridDataset.getLocationURI() + "]. Exception: " + e.getMessage()); } }</code><technical_language>close in a finally</technical_language>

Target:
public static void createGeoTiffForGrid(GridDataset gridDataset, GridDatatype grid, int timeIndex, String filename) throws GeoTiffUtilException { GeotiffWriter writer = null; try { Array data = grid.readDataSlice(timeIndex, 0, -1, -1); writer = new GeotiffWriter(filename); writer.writeGrid(gridDataset, grid, data, false); } catch (Exception e) { throw new GeoTiffUtilException(GeoTiffUtilExceptionID.GEOTIFFWRITER_EXCEPTION, "GeoTiffUtils", "generateGeoTiffZipFromGrid", "Unable to generate Tiff image from grid [" + gridDataset.getLocationURI() + "]. Exception: " + e.getMessage()); } finally { if(writer != null) { try { writer.close(); } catch (IOException e) { LOGGER.error("GeoTiffUtils.createGeoTiffForGrid() Exception: Unable to close GeotiffWriter. Exception: " + e.getMessage()); } } } }
Source:
<code>public static String reduceConsumerOffsetsResponses(Map<String, String> responses, Logger logger) { Map<String, KafkaConsumerOffsetsResponse> result = new HashMap<>(); responses.forEach((instance, json) -> { List<KafkaConsumerOffsetsResponse> responseList; try { responseList = JsonUtils.fromJson(json, new TypeReference<List<KafkaConsumerOffsetsResponse>>() { }); } catch (Exception e) { logger.error("Invalid response from instance {}", json, instance); <START> return; <END> } responseList.forEach(response -> { if (response.getConsumerOffsets() == null || StringUtils.isBlank(response.getConsumerGroupId())) { logger.warn("Empty consumer offset map from instance {}. Ignoring the result", instance); return; } KafkaConsumerOffsetsResponse reducedResponse = result.computeIfAbsent(response.getConsumerGroupId(), k -> new KafkaConsumerOffsetsResponse(response.getConsumerGroupId())); Map<String, Map<Integer, Long>> consumerOffsets = response.getConsumerOffsets(); consumerOffsets.forEach((topic, partitionOffsets) -> { Map<String, Map<Integer, Long>> reducedConsumerOffsets = reducedResponse.getConsumerOffsets(); Map<Integer, Long> reducedPartitionOffsets = reducedConsumerOffsets.computeIfAbsent(topic, k -> new HashMap<>()); reducedPartitionOffsets.putAll(partitionOffsets); }); }); }); return JsonUtils.toJson(result.values()); }</code><technical_language>supposed return empty String? this compile</technical_language>

Target:
public static String reduceConsumerOffsetsResponses(Map<String, String> responses, Logger logger) { Map<String, KafkaConsumerOffsetsResponse> result = new HashMap<>(); responses.forEach((instance, json) -> { List<KafkaConsumerOffsetsResponse> responseList; try { responseList = JsonUtils.fromJson(json, new TypeReference<List<KafkaConsumerOffsetsResponse>>() { }); } catch (Exception e) { logger.error("Invalid response from instance {}", json, instance); return; } responseList.forEach(response -> { if (response.getConsumerOffsets() == null || response.getConsumerOffsets().isEmpty()) { logger.warn("Empty consumer offset map from instance {}. Ignoring the result", instance); } else if (StringUtils.isBlank(response.getConsumerGroupId())) { logger.warn("Invalid consumer group id from instance {}, Ignoring the result", instance); } else { KafkaConsumerOffsetsResponse reducedResponse = result.computeIfAbsent(response.getConsumerGroupId(), k -> new KafkaConsumerOffsetsResponse(response.getConsumerGroupId())); Map<String, Map<Integer, Long>> consumerOffsets = response.getConsumerOffsets(); consumerOffsets.forEach((topic, partitionOffsets) -> { Map<String, Map<Integer, Long>> reducedConsumerOffsets = reducedResponse.getConsumerOffsets(); Map<Integer, Long> reducedPartitionOffsets = reducedConsumerOffsets.computeIfAbsent(topic, k -> new HashMap<>()); reducedPartitionOffsets.putAll(partitionOffsets); }); } }); }); return JsonUtils.toJson(result.values()); }
Source:
<code>public void aboutToBeShown() { super.aboutToBeShown(); this.getController().onNewLabel(new IConsumer<String>() { @Override public void apply(String value) { if (!label.isDisposed() && !(label.getText() != null && label.getText().equals(value))) { label.setText(Objects.firstNonNull(value, "")); EEFWidgetStyle style = getWidgetStyle(); <START> @SuppressWarnings("unchecked") <END> List<EEFConditionalStyle> conditionalStyles = getWidgetConditionalStyles(); if (conditionalStyles != null && !conditionalStyles.isEmpty()) { style = getConditionalStyle(conditionalStyles); } if (style != null) { setLabelFontStyle(style); } } } }); this.getController().onNewHelp(new IConsumer<String>() { @Override public void apply(String value) { if (help != null && !help.isDisposed() && !(help.getText() != null && help.getText().equals(value))) { help.setToolTipText(Objects.firstNonNull(value, "")); } } }); }</code><technical_language>removed :)</technical_language>

Target:
public void aboutToBeShown() { super.aboutToBeShown(); this.getController().onNewLabel(new IConsumer<String>() { @Override public void apply(String value) { if (!label.isDisposed() && !(label.getText() != null && label.getText().equals(value))) { label.setText(Objects.firstNonNull(value, "")); EEFWidgetStyle style = getWidgetStyle(); List<EEFConditionalStyle> conditionalStyles = getWidgetConditionalStyles(); if (conditionalStyles != null && !conditionalStyles.isEmpty()) { style = getConditionalStyle(conditionalStyles, style); } if (style != null) { setLabelFontStyle(style); } } } }); this.getController().onNewHelp(new IConsumer<String>() { @Override public void apply(String value) { if (help != null && !help.isDisposed() && !(help.getText() != null && help.getText().equals(value))) { help.setToolTipText(Objects.firstNonNull(value, "")); } } }); }
Source:
<code>protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); try (final AbstractFeatureReader<Interval, LineIterator> intervalsReader = AbstractFeatureReader.getFeatureReader(INPUT.getPath(), new IntervalListCodec(), false); <START> final BufferedWriter out = IOUtil.openFileForBufferedWriting(OUTPUT)) { <END> Iterable<Interval> intervalIterable = intervalsReader.iterator(); if (SORT) { final SortingCollection<Interval> sortedIntervals = SortingCollection.newInstance(Interval.class, new IntervalCodec(((SAMFileHeader)intervalsReader.getHeader()).getSequenceDictionary()), Interval::compareTo, 500000, OUTPUT.toPath()); for (final Interval i: intervalsReader.iterator()) { sortedIntervals.add(i); } intervalIterable = sortedIntervals; } for (final Interval i : intervalIterable) { final String strand = i.isNegativeStrand() ? "-" : "+"; final List<?> fields = CollectionUtil.makeList(i.getContig(), i.getStart()-1, i.getEnd(), i.getName(), SCORE, strand); out.append(fields.stream().map(String::valueOf).collect(Collectors.joining("\t"))); out.newLine(); } out.close(); return 0; } catch (IOException ioe) { throw new RuntimeIOException(ioe); } }</code><technical_language>causing hold in place takes load (I running intervallist a <1 G vcf running for 3 hours...) takes 3 minutes</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); try (final AbstractFeatureReader<Interval, LineIterator> intervalsReader = AbstractFeatureReader.getFeatureReader(INPUT.getPath(), new IntervalListCodec(), false); CloseableIterator<Interval> intervalsToUse = getSortedIntervals(intervalsReader); final BufferedWriter out = IOUtil.openFileForBufferedWriting(OUTPUT)) { intervalsToUse.stream().forEach(i -> generateOutput(i, out)); return 0; } catch (Exception e) { throw new RuntimeIOException(e); } }
Source:
<code>public static <T> Collection<T> findAmongst(Class<T> clazz, Collection<?> instances) { Collection<T> matches = new ArrayList<>(instances.size()); for (Object instance : instances) { <START> if (clazz.isInstance(instance)) { <END> matches.add(clazz.cast(instance)); } } return matches; }</code><technical_language>cleaner rewrite this as: java return instances.stream().filter(clazz::isInstance).map(clazz::cast).collect(toList());</technical_language>

Target:
public static <T> Collection<T> findAmongst(Class<T> clazz, Collection<?> instances) { return findStreamAmongst(clazz, instances) .collect(Collectors.toList()); }
Source:
<code>public void editExchange() { agreeOverwriteExchange = false; formExchange = new ExchangeType(); if (selectedExchange != null) { formExchange.setCertificateAlias(selectedExchange.getCertificateAlias()); formExchange.setUrl(selectedExchange.getUrl()); formExchange.setDisabled(selectedExchange.isDisabled()); formExchange.setKey(selectedExchange.getKey()); formExchange.setName(selectedExchange.getName()); formExchange.setSniName(selectedExchange.getSniName()); formExchange.setTLSVersions(selectedExchange.getTLSVersions()); formExchange.setType(selectedExchange.getType()); <START> formExchange.setUrl(selectedExchange.getUrl()); <END> } }</code><technical_language>Duplicate entry</technical_language>

Target:
public void editExchange() { isEditing = true; formExchange = new ExchangeType(); if (selectedExchange != null) { setDlgHeader("Editing " + selectedExchange.getName()); formExchange.setCertificateAlias(selectedExchange.getCertificateAlias()); formExchange.setUrl(selectedExchange.getUrl()); formExchange.setDisabled(selectedExchange.isDisabled()); formExchange.setKey(selectedExchange.getKey()); formExchange.setName(selectedExchange.getName()); formExchange.setSniName(selectedExchange.getSniName()); formExchange.setTLSVersions(selectedExchange.getTLSVersions()); formExchange.setType(selectedExchange.getType()); } }
Source:
<code>public DoubleColumnSelector makeDoubleColumnSelector( IncrementalIndexStorageAdapter.EntryHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerDoubleColumnSelector implements DoubleColumnSelector { @Override public double get() { final Object[] dims = currEntry.getKey().getDims(); if (dimIndex >= dims.length) { <START> return 0.0f; <END> } long longVal = (Long) dims[dimIndex]; return (double) longVal; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerDoubleColumnSelector(); }</code><technical_language>0.0</technical_language>

Target:
public DoubleColumnSelector makeDoubleColumnSelector( IncrementalIndexStorageAdapter.EntryHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerDoubleColumnSelector implements DoubleColumnSelector { @Override public double get() { final Object[] dims = currEntry.getKey().getDims(); if (dimIndex >= dims.length) { return 0.0; } long longVal = (Long) dims[dimIndex]; return (double) longVal; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerDoubleColumnSelector(); }
Source:
<code>protected void onPostExecute(Boolean result) { <START> String title_resource = context.getResources().getString(R.string.nominating_for_Deletion); <END> String success_resource = context.getResources().getString(R.string.success); String successfully_nominated_resource = context.getResources().getString(R.string.successfully_nominated); String for_deletion_resource = context.getResources().getString(R.string.for_deletion); String failed_resource = context.getResources().getString(R.string.failed); String could_not_request_deletion_resource = context.getResources().getString(R.string.could_not_request_deletion); String message; String title = title_resource; if (result){ title += ":"+success_resource; message = successfully_nominated_resource + media.getDisplayTitle() + for_deletion_resource+"."; } else { title += ":"+failed_resource; message = could_not_request_deletion_resource+"."; } notificationBuilder.setDefaults(DEFAULT_ALL) .setContentTitle(title) .setStyle(new NotificationCompat.BigTextStyle() .bigText(message)) .setSmallIcon(R.drawable.ic_launcher) .setProgress(0,0,false) .setOngoing(false) .setPriority(PRIORITY_HIGH); notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build()); }</code><technical_language>uppercase? Please other string typographical conventions, thanks :-)</technical_language>

Target:
protected void onPostExecute(Boolean result) { String title_resource = context.getResources().getString(R.string.nominating_for_deletion); String success_resource = context.getResources().getString(R.string.success); String successfully_nominated_resource = context.getResources().getString(R.string.successfully_nominated); String for_deletion_resource = context.getResources().getString(R.string.for_deletion); String failed_resource = context.getResources().getString(R.string.failed); String could_not_request_deletion_resource = context.getResources().getString(R.string.could_not_request_deletion); String could_not_request_point = context.getResources().getString(R.string.point); String message; String title = title_resource; if (result){ title += ":"+success_resource; message = successfully_nominated_resource + media.getDisplayTitle() + for_deletion_resource+could_not_request_point; } else { title += ":"+failed_resource; message = could_not_request_deletion_resource+could_not_request_point; } notificationBuilder.setDefaults(DEFAULT_ALL) .setContentTitle(title) .setStyle(new NotificationCompat.BigTextStyle() .bigText(message)) .setSmallIcon(R.drawable.ic_launcher) .setProgress(0,0,false) .setOngoing(false) .setPriority(PRIORITY_HIGH); String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/File:" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW , Uri.parse(urlForDelete)); PendingIntent pendingIntent = PendingIntent.getActivity(context , 1 , browserIntent , PendingIntent.FLAG_UPDATE_CURRENT); notificationBuilder.setContentIntent(pendingIntent); notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build()); }
Source:
<code>public List<Section> processResult(ApiResult result) throws Throwable { if(result.asObject().has("error")){ <START> throw new ApiException(new JSONException((String)result.asObject().getJSONObject("error").get("code"))); <END> } JSONObject mobileView = result.asObject().optJSONObject("mobileview"); pageProperties = new PageProperties(mobileView); if (mobileView.has("redirected")) { title = new PageTitle(mobileView.optString("redirected"), title.getSite()); } else if (mobileView.has("normalizedtitle")) { title = new PageTitle(mobileView.optString("normalizedtitle"), title.getSite()); } return super.processResult(result); }</code><technical_language>this is a generic error, in SectionsFetchTask itself. catch weird egdge cases page is deleted in gap section fetch requests. onCatch here. this exception class</technical_language>

Target:
public List<Section> processResult(ApiResult result) throws Throwable { JSONObject mobileView = result.asObject().optJSONObject("mobileview"); if(mobileView != null){ pageProperties = new PageProperties(mobileView); if (mobileView.has("redirected")) { title = new PageTitle(mobileView.optString("redirected"), title.getSite()); } else if (mobileView.has("normalizedtitle")) { title = new PageTitle(mobileView.optString("normalizedtitle"), title.getSite()); } } return super.processResult(result); }
Source:
<code>public void end() { try { <START> position = motionController.getInputSafely(); <END> } catch (InvalidSensorException e) { position = 0; updateStatus(CHECK_NAME, SystemStatus.FAIL, e); } if (Math.abs(motionController.getSetpoint() - position) > ERROR_THRESHOLD) { updateStatus(CHECK_NAME, SystemStatus.FAIL, new Exception("DISTANCE DRIVEN NOT WITHIN ERROR THRESHOLD")); } chassisMove.cancel(); motionController.disable(); motionController.reset(); runOnce = false; }</code><technical_language>suggestion position = this.motionController.getInputSafely();</technical_language>

Target:
public void end() { try { position = motionController.getInputSafely(); } catch (InvalidSensorException e) { position = 0; updateStatusFail(CHECK_NAME, e); } if (Math.abs(motionController.getSetpoint() - position) > errorThreshold) { updateStatusFail(CHECK_NAME, new Exception("DISTANCE DRIVEN NOT WITHIN ERROR THRESHOLD")); } chassisMove.cancel(); motionController.disable(); motionController.reset(); runOnce = false; outputStatuses(); }
Source:
<code>public float getPlayerPosition(){ Player player = null; <START> for(WorldObject w : world.getObjects()){ <END> if(w instanceof Player){ player = (Player) w; } } return player.getX(); }</code><technical_language>World a getPlayer method is more efficient this</technical_language>

Target:
public float getPlayerPosition(){ return world.getPlayer().getX(); }
Source:
<code>public static <K, V> Predicate<EventJournalMapEvent<K, V>> mapPutEvents() { <START> return new MapPutEventsPredicate<>(); <END> }</code><technical_language>require JDK8, remain JDK6 compatible types here</technical_language>

Target:
public static <K, V> Predicate<EventJournalMapEvent<K, V>> mapPutEvents() { return new MapPutEventsPredicate<K, V>(); }
Source:
<code>private void deleteDownloadedVideos() { <START> if (isUserLoginWithDifferentAccount()) { Executor executor = Executors.newSingleThreadExecutor(); executor.execute(() -> TestpressDatabase.Companion.invoke(this).clearAllTables()); DownloadService.sendRemoveAllDownloads(this, VideoDownloadService.class, false); TestpressSDKDatabase.clearDatabase(this); } <END> }</code><technical_language>This method deleteDownloadedVideos is checking deleting</technical_language>

Target:
private void deleteDownloadedVideos() { Executor executor = Executors.newSingleThreadExecutor(); executor.execute(() -> TestpressDatabase.Companion.invoke(this).clearAllTables()); DownloadService.sendRemoveAllDownloads(this, VideoDownloadService.class, false); TestpressSDKDatabase.clearDatabase(this); }
Source:
<code>public AuthResponse logInUsingFacebook(String accessToken) throws Exception { <START> final AuthResponse response = serviceManager.loginByFacebook(accessToken); <END> finishSocialLogIn(response, LoginPrefs.AuthBackend.FACEBOOK); return response; }</code><technical_language>delete deprecated loginByFacebook? for google</technical_language>

Target:
public AuthResponse logInUsingFacebook(String accessToken) throws Exception { return finishSocialLogIn(accessToken, LoginPrefs.AuthBackend.FACEBOOK); }
Source:
<code>private TableOperatorWrapper<?> visitUnionTransformation( UnionTransformation<RowData> transform) { TableOperatorWrapper<?> wrapper = new TableOperatorWrapper<>( SimpleOperatorFactory.of(new UnionStreamOperator()), genSubOperatorName(transform), transform.getInputs().stream().map(Transformation::getOutputType).collect(Collectors.toList()), transform.getOutputType()); int numberOfHeadInput = 0; for (Transformation<?> input : transform.getInputs()) { int inputIdx = inputTransforms.indexOf(input); if (inputIdx >= 0) { <START> numberOfHeadInput ++; <END> orderedInputTransforms.add(input); inputSpecs.add(createInputSpec(readOrders[inputIdx], wrapper, 1)); } else { TableOperatorWrapper<?> inputWrapper = visit(input); wrapper.addInput(inputWrapper, 1); } } if (numberOfHeadInput > 0) { headWrappers.add(wrapper); } return wrapper; }</code><technical_language>extra space</technical_language>

Target:
private TableOperatorWrapper<?> visitUnionTransformation( UnionTransformation<RowData> transform) { TableOperatorWrapper<?> wrapper = new TableOperatorWrapper<>( SimpleOperatorFactory.of(new UnionStreamOperator()), genSubOperatorName(transform), transform.getInputs().stream().map(Transformation::getOutputType).collect(Collectors.toList()), transform.getOutputType()); int numberOfHeadInput = 0; for (Transformation<?> input : transform.getInputs()) { int inputIdx = inputTransforms.indexOf(input); if (inputIdx >= 0) { numberOfHeadInput++; processInput(input, inputIdx, wrapper, 1); } else { TableOperatorWrapper<?> inputWrapper = visit(input); wrapper.addInput(inputWrapper, 1); } } if (numberOfHeadInput > 0) { headWrappers.add(wrapper); } return wrapper; }
Source:
<code>private void validatePluginProperties(RuleAwarePluginProfileCommand command, RuleAwarePluginProfile newPluginProfile) { try { ValidationResult result = command.validateUsingExtension(newPluginProfile.getPluginId(), newPluginProfile.getConfiguration().getConfigurationAsMap(true)); addErrorsToConfiguration(result, newPluginProfile); }catch (RecordNotFoundException e) { newPluginProfile.addError("pluginId", String.format("Plugin with id `%s` is not found.", newPluginProfile.getPluginId())); }catch (Exception e) { } <START> } <END></code><technical_language>add <LINK_0></technical_language>

Target:
private void validatePluginProperties(RuleAwarePluginProfileCommand command, RuleAwarePluginProfile newPluginProfile) { try { ValidationResult result = command.validateUsingExtension(newPluginProfile.getPluginId(), newPluginProfile.getConfiguration().getConfigurationAsMap(true)); addErrorsToConfiguration(result, newPluginProfile); }catch (RecordNotFoundException e) { newPluginProfile.addError("pluginId", String.format("Plugin with id `%s` is not found.", newPluginProfile.getPluginId())); } catch (GoPluginFrameworkException e) { newPluginProfile.addError("pluginId", e.getMessage()); }catch (Exception e) { } }
Source:
<code>protected void configureServlets() { bind(KeycloakAuthenticationFilter.class).in(Singleton.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/oauth/callback/?|/system/state/?)$).*") .through(KeycloakAuthenticationFilter.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/oauth/callback/?|/system/state/?)$).*") .through(KeycloakEnvironmentInitalizationFilter.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/api/oauth/callback/?)$).*") .through(IdentityIdLoggerFilter.class); <START> filterRegex("/user(/password|/)?").through(UnavailableResourceInMultiUserFilter.class); <END> filterRegex("/profile/.*/attributes").through(UnavailableResourceInMultiUserFilter.class); }</code><technical_language>pattern /user(/password|/)?$ ? (add extra $ a end)</technical_language>

Target:
protected void configureServlets() { bind(KeycloakAuthenticationFilter.class).in(Singleton.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/oauth/callback/?|/system/state/?)$).*") .through(KeycloakAuthenticationFilter.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/oauth/callback/?|/system/state/?)$).*") .through(KeycloakEnvironmentInitalizationFilter.class); filterRegex("^(?!.*(/docs/))(?!.*(/keycloak/settings/?|/api/oauth/callback/?)$).*") .through(IdentityIdLoggerFilter.class); filterRegex("^/user(/password/?|/)?$").through(UnavailableResourceInMultiUserFilter.class); filterRegex("^/profile/(.*/)?attributes$").through(UnavailableResourceInMultiUserFilter.class); }
Source:
<code>BinaryContent transform(Attribute attribute) throws CatalogTransformerException { BinaryContent transformedContent = null; ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread() .setContextClassLoader(getClass().getClassLoader()); ByteArrayOutputStream os = new ByteArrayOutputStream(BUFFER_SIZE); Marshaller marshaller = CONTEXT.createMarshaller(); <START> marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); <END> marshaller.setEventHandler(new DefaultValidationEventHandler()); try { marshaller.marshal(GeometryAdapter.marshalFrom(attribute), os); } catch (RuntimeException e) { throw new CatalogTransformerException("Failed to marshall geometry data", e); } ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray()); transformedContent = new BinaryContentImpl(bais, new MimeType(TEXT_XML)); } catch (JAXBException e) { throw new CatalogTransformerException("Failed JAXB Transformation", e); } catch (MimeTypeParseException e) { throw new CatalogTransformerException( "Failed Transformation with MimeType Parsing error", e); } finally { Thread.currentThread().setContextClassLoader(tccl); } return transformedContent; }</code><technical_language>while this increases readability, hurt performance</technical_language>

Target:
static BinaryContent transform(Attribute attribute) throws CatalogTransformerException { BinaryContent transformedContent = null; ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread() .setContextClassLoader(GeometryTransformer.class.getClassLoader()); ByteArrayOutputStream os = new ByteArrayOutputStream(BUFFER_SIZE); Marshaller marshaller = CONTEXT.createMarshaller(); marshaller.setEventHandler(new DefaultValidationEventHandler()); try { marshaller.marshal(GeometryAdapter.marshalFrom(attribute), os); } catch (RuntimeException e) { throw new CatalogTransformerException("Failed to marshall geometry data", e); } ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray()); transformedContent = new BinaryContentImpl(bais, new MimeType(TEXT_XML)); } catch (JAXBException e) { throw new CatalogTransformerException("Failed JAXB Transformation", e); } catch (MimeTypeParseException e) { throw new CatalogTransformerException( "Failed Transformation with MimeType Parsing error", e); } finally { Thread.currentThread().setContextClassLoader(tccl); } return transformedContent; }
Source:
<code>public void allowJsonRefInContext(String jsonReferenceContext, boolean allow) { ArrayNode definition = jsonRefContexts.get(jsonReferenceContext); if (definition == null) { throw new IllegalArgumentException("Invalid JSON Reference Context: " + jsonReferenceContext); } <START> int lastIndex = definition.size() - 1; <END> JsonNode lastElement = definition.get(lastIndex); boolean alreadyHasJsonReference = refToJsonReferenceNode.equals(lastElement); if (allow) { if (!alreadyHasJsonReference) { definition.add(refToJsonReferenceNode.deepCopy()); } } else { if (alreadyHasJsonReference) { definition.remove(lastIndex); } } }</code><technical_language>crazy assumption this oneOf element. I in current code be, assumption unwittingly violated in some future code, leading sporadic failures. do a List#contains test entire oneOf array. Slightly slower, this preferences change</technical_language>

Target:
public void allowJsonRefInContext(String jsonReferenceContext, boolean allow) { if (jsonRefContexts.get(jsonReferenceContext) == null) { throw new IllegalArgumentException("Invalid JSON Reference Context: " + jsonReferenceContext); } if (VALIDATION_REF_SECURITY_DEFINITIONS_OBJECT.equals(jsonReferenceContext)) { allowJsonRefInSecurityDefinitionsObject(allow); return; } ArrayNode definition = (ArrayNode) jsonRefContexts.get(jsonReferenceContext); List<JsonNode> children = Lists.newArrayList(definition.elements()); int indexOfJsonReference = children.indexOf(refToJsonReferenceNode); boolean alreadyHasJsonReference = indexOfJsonReference > -1; if (allow) { if (!alreadyHasJsonReference) { definition.add(refToJsonReferenceNode.deepCopy()); } } else { if (alreadyHasJsonReference) { definition.remove(indexOfJsonReference); } } }
Source:
<code>public synchronized void start() { if (hasBeenStarted) { <START> throw new IllegalThreadStateException("Thread already started."); END> } hasBeenStarted = true; VMThread.create(this, stackSize); }</code><technical_language>TODO remove</technical_language>

Target:
public synchronized void start() { checkNotStarted(); hasBeenStarted = true; VMThread.create(this, stackSize); }
Source:
<code>public void saveSearchFilterSettings(final String filterName, final Consumer<String> callback) { final FilterSettings settings = getDataSetQueryHelper().getCurrentTableSettings(); settings.setTableName(filterName); settings.setTableDescription(filterName); filterSettingsManager.saveFilterIntoPreferences(settings, state -> { if (state) { <START> getListView().getListGrid().getGridPreferencesStore().setPreferenceKey(settings.getKey()); <END> getListView().getListGrid().saveGridPreferences(); callback.accept(null); } else { callback.accept(Constants.INSTANCE.FilterWithSameNameAlreadyExists()); } }); }</code><technical_language>@nmirasch do need do this? set right</technical_language>

Target:
public void saveSearchFilterSettings(final String filterName, final Consumer<String> callback) { final FilterSettings settings = getDataSetQueryHelper().getCurrentTableSettings(); settings.setTableName(filterName); settings.setTableDescription(filterName); filterSettingsManager.saveFilterIntoPreferences(settings, state -> { if (state) { getListView().getListGrid().getGridPreferencesStore().setPreferenceKey(settings.getKey()); getListView().getListGrid().saveGridToUserPreferences(); callback.accept(null); } else { callback.accept(Constants.INSTANCE.FilterWithSameNameAlreadyExists()); } }); }
Source:
<code>private DataNode<ModuleData> createModuleData( @NotNull DataNode<ProjectData> projectInfoDataNode, @NotNull String targetName, @NotNull TargetInfo targetInfo, @NotNull PantsCompileOptionsExecutor executor ) { final String moduleName = PantsUtil.getCanonicalModuleName(targetName); final ModuleData moduleData = new ModuleData( targetName, PantsConstants.SYSTEM_ID, ModuleTypeId.JAVA_MODULE, moduleName, projectInfoDataNode.getData().getIdeProjectFileDirectoryPath() + "/" + moduleName, new File(executor.getBuildRoot(), targetName).getAbsolutePath() ); final DataNode<ModuleData> moduleDataNode = projectInfoDataNode.createChild(ProjectKeys.MODULE, moduleData); if(targetInfo.isPythonTarget()) { <START> moduleDataNode.createChild(ModuleSdkData.KEY, new ModuleSdkData("python")); END> } else { DataNode<ProjectSdkData> sdk = ExternalSystemApiUtil.find(projectInfoDataNode, ProjectSdkData.KEY); if(sdk != null){ ModuleSdkData moduleSdk = new ModuleSdkData(sdk.getData().getSdkName()); moduleDataNode.createChild(ModuleSdkData.KEY, moduleSdk); } } final TargetMetadata metadata = new TargetMetadata(PantsConstants.SYSTEM_ID, moduleName); metadata.setTargetAddresses(ContainerUtil.map(targetInfo.getAddressInfos(), TargetAddressInfo::getTargetAddress)); metadata.setTargetAddressInfoSet(targetInfo.getAddressInfos()); metadata.setLibraryExcludes(targetInfo.getExcludes()); moduleDataNode.createChild(TargetMetadata.KEY, metadata); return moduleDataNode; }</code><technical_language>Is a good name for sdk if separate sdk for project some modules? generate sdk custom name set it</technical_language>

Target:
private DataNode<ModuleData> createModuleData( @NotNull DataNode<ProjectData> projectInfoDataNode, @NotNull String targetName, @NotNull TargetInfo targetInfo, @NotNull PantsCompileOptionsExecutor executor ) { final String moduleName = PantsUtil.getCanonicalModuleName(targetName); final ModuleData moduleData = new ModuleData( targetName, PantsConstants.SYSTEM_ID, ModuleTypeId.JAVA_MODULE, moduleName, projectInfoDataNode.getData().getIdeProjectFileDirectoryPath() + "/" + moduleName, new File(executor.getBuildRoot(), targetName).getAbsolutePath() ); final DataNode<ModuleData> moduleDataNode = projectInfoDataNode.createChild(ProjectKeys.MODULE, moduleData); if(targetInfo.isPythonTarget()) { String sdkName = String.format("Python for %s", projectInfoDataNode.getData().getExternalName()); moduleDataNode.createChild(ModuleSdkData.KEY, new ModuleSdkData(sdkName)); } else { DataNode<ProjectSdkData> sdk = ExternalSystemApiUtil.find(projectInfoDataNode, ProjectSdkData.KEY); if(sdk != null){ ModuleSdkData moduleSdk = new ModuleSdkData(sdk.getData().getSdkName()); moduleDataNode.createChild(ModuleSdkData.KEY, moduleSdk); } } final TargetMetadata metadata = new TargetMetadata(PantsConstants.SYSTEM_ID, moduleName); metadata.setTargetAddresses(ContainerUtil.map(targetInfo.getAddressInfos(), TargetAddressInfo::getTargetAddress)); metadata.setTargetAddressInfoSet(targetInfo.getAddressInfos()); metadata.setLibraryExcludes(targetInfo.getExcludes()); moduleDataNode.createChild(TargetMetadata.KEY, metadata); return moduleDataNode; }
Source:
<code><START> public static ColumnDef build(String name, String charset, String type, int pos, boolean signed, String enumValues[], Long columnLength) { <END> switch(type) { case "datetime": case "timestamp": return new DateTimeColumnDef(name, type, pos, columnLength); default: return build(name, charset, type, pos, signed, enumValues); } }</code><technical_language>need for a polymorphic build function -- pass null for columnLength in cases it</technical_language>

Target:
public static ColumnDef build(String name, String charset, String type, int pos, boolean signed, String enumValues[], Long columnLength) { switch(type) { case "tinyint": case "smallint": case "mediumint": case "int": return new IntColumnDef(name, type, pos, signed); case "bigint": return new BigIntColumnDef(name, type, pos, signed); case "tinytext": case "text": case "mediumtext": case "longtext": case "varchar": case "char": return new StringColumnDef(name, type, pos, charset); case "tinyblob": case "blob": case "mediumblob": case "longblob": case "binary": case "varbinary": return new StringColumnDef(name, type, pos, "binary"); case "geometry": case "geometrycollection": case "linestring": case "multilinestring": case "multipoint": case "multipolygon": case "polygon": case "point": return new GeometryColumnDef(name, type, pos); case "float": case "double": return new FloatColumnDef(name, type, pos); case "decimal": return new DecimalColumnDef(name, type, pos); case "date": return new DateColumnDef(name, type, pos); case "datetime": case "timestamp": return new DateTimeColumnDef(name, type, pos, columnLength); case "time": return new TimeColumnDef(name, type, pos, columnLength); case "year": return new YearColumnDef(name, type, pos); case "enum": return new EnumColumnDef(name, type, pos, enumValues); case "set": return new SetColumnDef(name, type, pos, enumValues); case "bit": return new BitColumnDef(name, type, pos); default: throw new IllegalArgumentException("unsupported column type " + type); } }
Source:
<code>public static boolean supportsAdd(int type) { switch (type) { case Value.BYTE: case Value.DECIMAL: case Value.DOUBLE: case Value.FLOAT: case Value.INT: case Value.LONG: case Value.SHORT: return true; default: <START> if (JdbcUtils.customDataTypesHandler != null) { <END> return JdbcUtils.customDataTypesHandler.supportsAdd(type); } return false; } }</code><technical_language>This wrong: ask customDataTypesHandler builtin types</technical_language>

Target:
public static boolean supportsAdd(int type) { switch (type) { case Value.BYTE: case Value.DECIMAL: case Value.DOUBLE: case Value.FLOAT: case Value.INT: case Value.LONG: case Value.SHORT: return true; case Value.BOOLEAN: case Value.TIME: case Value.DATE: case Value.TIMESTAMP: case Value.TIMESTAMP_TZ: case Value.BYTES: case Value.UUID: case Value.STRING: case Value.STRING_IGNORECASE: case Value.STRING_FIXED: case Value.BLOB: case Value.CLOB: case Value.NULL: case Value.JAVA_OBJECT: case Value.UNKNOWN: case Value.ARRAY: case Value.RESULT_SET: case Value.GEOMETRY: return false; default: if (JdbcUtils.customDataTypesHandler != null) { return JdbcUtils.customDataTypesHandler.supportsAdd(type); } return false; } }
Source:
<code>public TypeProvider getTypes() { <START> return TypeProvider.fromVariables(variables.entrySet().stream() <END> .map(entry -> new VariableReferenceExpression(entry.getKey(), entry.getValue())) .collect(toImmutableList())); }</code><technical_language>I a worried performance of this change here. getTypes frequently, time a copy of existing types. changing viewof copy change behavior. optimizer rule call getTypes assign a member variable, newly added variable in optimization rule missing in copied TypeProvider. change TypeProvider store Map<String, Type> well? need Symbol well. other place copied TypeProvider is areExpressionsEquivalent method. I if need convert variable input though. I variable name is unique in TypeProvider, I translate integer in canonicalize expression</technical_language>

Target:
public TypeProvider getTypes() { return TypeProvider.viewOf(variables); }
Source:
<code>public void attachmentStandalone() throws IOException, URISyntaxException { byte[] bytesToDB = "binary data".getBytes(); ByteArrayInputStream bytesIn = new ByteArrayInputStream(bytesToDB); Response response = db.saveAttachment(bytesIn, "foo.txt", "text/plain"); Document doc = db.find(Document.class, response.getId()); assertTrue(doc.getAttachments().containsKey("foo.txt")); HttpConnection conn = Http.GET(new DatabaseURIHelper(db.getDBUri()) .attachmentUri(response.getId(), "foo.txt")); InputStream in = clientResource.get().executeRequest(conn).responseAsInputStream(); try { <START> ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); <END> int n; while ((n = in.read()) != -1) { bytesOut.write(n); } bytesOut.flush(); byte[] bytesFromDB = bytesOut.toByteArray(); assertArrayEquals(bytesToDB, bytesFromDB); } finally { in.close(); } }</code><technical_language>I test code, this strictly domain of this PR, tests read write 1 byte a time _really_ slow</technical_language>

Target:
public void attachmentStandalone() throws IOException, URISyntaxException { byte[] bytesToDB = "binary data".getBytes(); ByteArrayInputStream bytesIn = new ByteArrayInputStream(bytesToDB); Response response = db.saveAttachment(bytesIn, "foo.txt", "text/plain"); Document doc = db.find(Document.class, response.getId()); assertTrue(doc.getAttachments().containsKey("foo.txt")); HttpConnection conn = Http.GET(new DatabaseURIHelper(db.getDBUri()) .attachmentUri(response.getId(), "foo.txt")); InputStream in = clientResource.get().executeRequest(conn).responseAsInputStream(); try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); IOUtils.copy(in, bytesOut); byte[] bytesFromDB = bytesOut.toByteArray(); assertArrayEquals(bytesToDB, bytesFromDB); } finally { in.close(); } }
Source:
<code>public void testSchema() { Schema schema = udf_.outputSchema(null); assertNotNull(schema); <START> assertEquals("{map: map[chararray]}", schema.toString()); <END> }</code><technical_language>'map' name problematic. e.g. line results in error : a = load 'a.txt' (map : [chararray]);</technical_language>

Target:
public void testSchema() { Schema schema = udf_.outputSchema(null); assertNotNull(schema); assertEquals("{json: map[chararray]}", schema.toString()); }
Source:
<code>public void edit(final VolumeRebalanceStatusModel object) { driver.edit(object); rebalanceHostsTable.asEditor().edit(object.getRebalanceSessions()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { PropertyChangedEventArgs e = (PropertyChangedEventArgs) args; if (e.PropertyName.equals("STATUS_UPDATED")) { status.setText(constants.rebalanceComplete()); <START> status.setVisible(object.isStatusAvailable()); <END> } else if (e.PropertyName.equals("STOP_TIME_UPDATED")) { stopTimePanel.setVisible(object.isStopTimeVisible()); status.setVisible(object.isStatusAvailable()); } } }); }</code><technical_language>visibility decided inside, setText moved localize()</technical_language>

Target:
public void edit(final VolumeRebalanceStatusModel object) { driver.edit(object); rebalanceHostsTable.asEditor().edit(object.getRebalanceSessions()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { PropertyChangedEventArgs e = (PropertyChangedEventArgs) args; if (e.PropertyName.equals("STATUS_UPDATED")) { status.setVisible(object.isStatusAvailable()); } else if (e.PropertyName.equals("STOP_TIME_UPDATED")) { stopTimePanel.setVisible(object.isStopTimeVisible()); status.setVisible(object.isStatusAvailable()); } } }); }