auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>Iterable<TemporalField<Image>> updateImages(Channel newChannel, Channel existingChannel) { Map<ImageTheme, TemporalField<Image>> newImageMap = StreamSupport.stream( newChannel.getAllImages().spliterator(), false ) .collect(MoreCollectors.toImmutableMap( temporalImage -> temporalImage.getValue().getTheme(), temporalImage -> temporalImage )); Map<ImageTheme, TemporalField<Image>> existingImages = StreamSupport.stream(existingChannel.getAllImages().spliterator(), false) .map(existingImage -> newImageMap.getOrDefault( existingImage.getValue().getTheme(), existingImage )) .collect(MoreCollectors.toImmutableMap( temporalImage -> temporalImage.getValue().getTheme(), temporalImage -> temporalImage )); return ImmutableSet.<TemporalField<Image>>builder() .addAll(existingImages.values()) .addAll( newImageMap.entrySet().stream() <START> .filter(entry -> !existingImages.keySet().contains(entry.getKey())) <END> .map(Entry::getValue) .collect(Collectors.toSet())) .build(); }</code><technical_language>!existingImages.containsKey(entry.getKey())</technical_language>

Target:
Iterable<TemporalField<Image>> updateImages(Channel newChannel, Channel existingChannel) { Map<ImageTheme, TemporalField<Image>> newImageMap = StreamSupport.stream( newChannel.getAllImages().spliterator(), false ) .collect(MoreCollectors.toImmutableMap( temporalImage -> temporalImage.getValue().getTheme(), temporalImage -> temporalImage )); Map<ImageTheme, TemporalField<Image>> existingImages = StreamSupport.stream(existingChannel.getAllImages().spliterator(), false) .map(existingImage -> newImageMap.getOrDefault( existingImage.getValue().getTheme(), existingImage )) .collect(MoreCollectors.toImmutableMap( temporalImage -> temporalImage.getValue().getTheme(), temporalImage -> temporalImage )); return ImmutableSet.<TemporalField<Image>>builder() .addAll(existingImages.values()) .addAll( newImageMap.entrySet().stream() .filter(entry -> !existingImages.containsKey(entry.getKey())) .map(Entry::getValue) .collect(Collectors.toSet())) .build(); }
Source:
<code>private void deregisterIndexGauges(String storeId) { String prefix = storeId + SEPERATOR; registry.remove(MetricRegistry.name(Log.class, prefix + "CurrentCapacityUsed")); registry.remove(MetricRegistry.name(Log.class, prefix + "PercentageUsedCapacity")); registry.remove(MetricRegistry.name(Log.class, prefix + "CurrentSegmentCount")); registry.remove(MetricRegistry.name(Log.class, "ByteBufferForAppendTotalCount")); <START> registry.remove(MetricRegistry.name(Log.class, "UnderCompaction" + SEPERATOR + "ByteBufferForAppendTotalCount")); <END> }</code><technical_language>minor typo: SEPARATOR</technical_language>

Target:
private void deregisterIndexGauges(String storeId) { String prefix = storeId + SEPARATOR; registry.remove(MetricRegistry.name(Log.class, prefix + "CurrentCapacityUsed")); registry.remove(MetricRegistry.name(Log.class, prefix + "PercentageUsedCapacity")); registry.remove(MetricRegistry.name(Log.class, prefix + "CurrentSegmentCount")); registry.remove(MetricRegistry.name(Log.class, "ByteBufferForAppendTotalCount")); registry.remove(MetricRegistry.name(Log.class, "UnderCompaction" + SEPARATOR + "ByteBufferForAppendTotalCount")); }
Source:
<code>protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { if (parameters == null || !parameters.containsKey(KEY_SURVEY_GROUP_ID) <START> || parameters.get(KEY_SURVEY_GROUP_ID) == null) { <END> return Observable.error(new IllegalArgumentException("Missing survey group id")); } Long surveyGroupId = (Long) parameters.get(KEY_SURVEY_GROUP_ID); Double latitude = (Double) parameters.get(KEY_LATITUDE); Double longitude = (Double) parameters.get(KEY_LONGITUDE); Integer orderBy = (Integer) parameters.get(KEY_ORDER_BY); return surveyRepository.getDataPoints(surveyGroupId, latitude, longitude, orderBy); }</code><technical_language>necessary change observation if called parameters.get() satisfies cases i.e. if is key if is key</technical_language>

Target:
protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { if (parameters == null || parameters.get(KEY_SURVEY_GROUP_ID) == null) { return Observable.error(new IllegalArgumentException("Missing survey group id")); } Long surveyGroupId = (Long) parameters.get(KEY_SURVEY_GROUP_ID); Double latitude = (Double) parameters.get(KEY_LATITUDE); Double longitude = (Double) parameters.get(KEY_LONGITUDE); Integer orderBy = (Integer) parameters.get(KEY_ORDER_BY); return surveyRepository.getDataPoints(surveyGroupId, latitude, longitude, orderBy); }
Source:
<code>public static FormatStep hostnameFormatStep(final boolean leftJustify, final int minimumWidth, final boolean truncateBeginning, final int maximumWidth, final String precision) { <START> return hostnameFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, true); <END> }</code><technical_language>This precision account if other method return a fully qualified host name, this return instead of a substring of it</technical_language>

Target:
public static FormatStep hostnameFormatStep(final boolean leftJustify, final int minimumWidth, final boolean truncateBeginning, final int maximumWidth, final String precision) { return new SegmentedFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, precision) { public String getSegmentedSubject(final ExtLogRecord record) { return record.getHostName(); } }; }
Source:
<code><START> protected Channel createChannel(String hostString, int channelCount) throws IOException { <END> InetAddress host = getHost(hostString); Channel channels[] = new Channel[channelCount]; for (int i = 0; i < channelCount; i++) { ReconnectingChannel reconnectingChannel = createReconnectingChannel(host); clientCloseHandlers.add(reconnectingChannel); channels[i] = reconnectingChannel; } return wrapChannel(new ChannelPool(channels)); }</code><technical_language>Update doc of this method</technical_language>

Target:
protected Channel createChannel(String hostString, int channelCount) throws IOException { InetSocketAddress host = getSocketAddress(hostString); Channel channels[] = new Channel[channelCount]; for (int i = 0; i < channelCount; i++) { ReconnectingChannel reconnectingChannel = createReconnectingChannel(host); clientCloseHandlers.add(reconnectingChannel); channels[i] = reconnectingChannel; } return wrapChannel(new ChannelPool(channels)); }
Source:
<code>public void testGetMappedValue() { ConcurrentHashMap map = map5(); <START> assertNull(((ConcurrentHashMap.KeySetView)(map.keySet())).getMappedValue()); <END> try { map.keySet(null); shouldThrow(); } catch (NullPointerException success) ConcurrentHashMap.KeySetView set = map.keySet(one); assertFalse(set.add(one)); assertTrue(set.add(six)); assertTrue(set.add(seven)); assertTrue(set.getMappedValue() == one); assertTrue(map.get(one) != one); assertTrue(map.get(six) == one); assertTrue(map.get(seven) == one); }</code><technical_language>version of upstream has: assertNull(map.keySet().getMappedValue()); version match upstream revision. happened here</technical_language>

Target:
public void testGetMappedValue() { ConcurrentHashMap map = map5(); assertNull(((ConcurrentHashMap.KeySetView) map.keySet()).getMappedValue()); try { map.keySet(null); shouldThrow(); } catch (NullPointerException success) ConcurrentHashMap.KeySetView set = map.keySet(one); assertFalse(set.add(one)); assertTrue(set.add(six)); assertTrue(set.add(seven)); assertTrue(set.getMappedValue() == one); assertTrue(map.get(one) != one); assertTrue(map.get(six) == one); assertTrue(map.get(seven) == one); }
Source:
<code>public KafkaEightSimpleConsumerFirehoseFactory( @JsonProperty("brokerList") List<String> brokerList, @JsonProperty("partitionIdList") List<Integer> partitionIdList, @JsonProperty("clientId") String clientId, @JsonProperty("feed") String feed, @JsonProperty("queueBufferLength") Integer queueBufferLength, @JsonProperty("resetBehavior") String resetBehavior ) { this.brokerList = brokerList; this.partitionIdList = partitionIdList; this.clientId = clientId; this.feed = feed; <START> this.queueBufferLength = queueBufferLength == null ? 20000 : queueBufferLength; <END> log.info("queueBufferLength loaded as[%s]", this.queueBufferLength); this.earliest = "latest".equalsIgnoreCase(resetBehavior) ? false : true; log.info("Default behavior of cosumer set to earliest? [%s]", this.earliest); }</code><technical_language>define default a static final constant</technical_language>

Target:
public KafkaEightSimpleConsumerFirehoseFactory( @JsonProperty("brokerList") List<String> brokerList, @JsonProperty("partitionIdList") List<Integer> partitionIdList, @JsonProperty("clientId") String clientId, @JsonProperty("feed") String feed, @JsonProperty("queueBufferLength") Integer queueBufferLength, @JsonProperty("resetBehavior") String resetBehavior ) { this.brokerList = brokerList; this.partitionIdList = partitionIdList; this.clientId = clientId; this.feed = feed; this.queueBufferLength = queueBufferLength == null ? DEFAULT_QUEUE_BUFFER_LENGTH : queueBufferLength; log.info("queueBufferLength loaded as[%s]", this.queueBufferLength); this.earliest = RESET_TO_LATEST.equalsIgnoreCase(resetBehavior) ? false : true; log.info("Default behavior of cosumer set to earliest? [%s]", this.earliest); }
Source:
<code>public static InstallState getInstallState() { if (!Boolean.getBoolean("jenkins.install.runSetupWizard")) { if (Functions.getIsUnitTest()) { return InstallState.TEST; } if (Boolean.getBoolean("hudson.Main.development")) { return InstallState.DEVELOPMENT; } } VersionNumber lastRunVersion = new VersionNumber(getLastExecVersion()); if (lastRunVersion.compareTo(NEW_INSTALL_VERSION) == 0) { <START> if(!Jenkins.getInstance().getJobNames().isEmpty()) { END> return InstallState.UPGRADE; } return InstallState.NEW; } VersionNumber currentRunVersion = new VersionNumber(getCurrentExecVersion()); if (lastRunVersion.isOlderThan(currentRunVersion)) { return InstallState.UPGRADE; } else if (lastRunVersion.isNewerThan(currentRunVersion)) { return InstallState.DOWNGRADE; } else { return InstallState.RESTART; } }</code><technical_language>bug: this is reliable. I presume attempting detect case a user "did stuff" (meaning, created items) in Jenkins 1.x managed avoid saving /configure-possible, if unlikely. this check false if user created top-level _folders_ top-level _jobs_ (or subsequently moved jobs folders). getTopLevelItemNames more appropriate. more directly: java if (!Jenkins.getInstance().getItemMap().isEmpty()) { // some items configured (Note getAllItems() etc. is slightly slower, vulnerable inaccurate results in case caller is running non-ACL.SYSTEM authentication.)</technical_language>

Target:
public static InstallState getInstallState() { if (!Boolean.getBoolean("jenkins.install.runSetupWizard")) { if (Functions.getIsUnitTest()) { return InstallState.TEST; } if (Boolean.getBoolean("hudson.Main.development")) { return InstallState.DEVELOPMENT; } } VersionNumber lastRunVersion = new VersionNumber(getLastExecVersion()); if (lastRunVersion.compareTo(NEW_INSTALL_VERSION) == 0) { if (!Jenkins.getInstance().getItemMap().isEmpty()) { return InstallState.UPGRADE; } return InstallState.NEW; } VersionNumber currentRunVersion = new VersionNumber(getCurrentExecVersion()); if (lastRunVersion.isOlderThan(currentRunVersion)) { return InstallState.UPGRADE; } else if (lastRunVersion.isNewerThan(currentRunVersion)) { return InstallState.DOWNGRADE; } else { return InstallState.RESTART; } }
Source:
<code>private CoordinationUtils getCoordinationUtils() throws Exception { ApplicationConfig appConfig = new ApplicationConfig(config); String clazz = appConfig.getCoordinationServiceFactoryClass(); if (clazz != null) { CoordinationServiceFactory factory = ClassLoaderHelper.fromClassName(clazz); <START> String groupId = String.format("app-%s-%s", config.get(JobConfig.JOB_NAME()), config.get(JobConfig.JOB_ID(), "1")); <END> return factory.getCoordinationService(groupId, String.valueOf(processorId), config); } else { return null; } }</code><technical_language>Do APP_NAME instead of JOB_NAME? "borrowing" JOB_NAME APP_NAME now? a conclusion actual config variable name yet, I appreciate hard code names referring configure variable names directly. wrap ApplicationConfig.getAppName() method change in place. apply places want get unique ID for application</technical_language>

Target:
CoordinationUtils getCoordinationUtils() throws Exception { ApplicationConfig appConfig = new ApplicationConfig(config); String clazz = appConfig.getCoordinationServiceFactoryClass(); if (clazz != null) { CoordinationServiceFactory factory = ClassLoaderHelper.fromClassName(clazz); String groupId = String.format("app-%s-%s", appConfig.getAppName(), appConfig.getAppId()); return factory.getCoordinationService(groupId, uid, config); } else { return null; } }
Source:
<code>public void testParseFileSizeWithUnits() throws Exception { final SyndFeed feed = getSyndFeed("org/rometools/feed/module/mediarss/filesize-with-unit.xml"); final List<SyndEntry> entries = feed.getEntries(); final MediaEntryModule m1 = (MediaEntryModule) entries.get(0).getModule(MediaModule.URI); assertThat(m1.getMediaContents()[0].getFileSize(), is(valueOf(2).multiply(valueOf(1024).pow(3)).longValue())); final MediaEntryModule m2 = (MediaEntryModule) entries.get(1).getModule(MediaModule.URI); <START> assertThat(m2.getMediaContents()[0].getFileSize(), is(valueOf(1.1).multiply(valueOf(1024).pow(3)).longValue())); <END> final MediaEntryModule m3 = (MediaEntryModule) entries.get(2).getModule(MediaModule.URI); assertThat(m3.getMediaContents()[0].getFileSize(), is(valueOf(2).multiply(valueOf(1024).pow(2)).longValue())); final MediaEntryModule m4 = (MediaEntryModule) entries.get(3).getModule(MediaModule.URI); assertThat(m4.getMediaContents()[0].getFileSize(), is(2L)); final MediaEntryModule m5 = (MediaEntryModule) entries.get(4).getModule(MediaModule.URI); assertThat(m5.getMediaContents()[0].getFileSize(), is(valueOf(5.5).multiply(valueOf(1024).pow(4)).longValue())); final MediaEntryModule m6 = (MediaEntryModule) entries.get(5).getModule(MediaModule.URI); assertThat(m6.getMediaContents()[0].getFileSize(), is(valueOf(9000).multiply(valueOf(1024)).longValue())); }</code><technical_language>obvious testing here. a separate test for assert method name describe test is about</technical_language>

Target:
public void testParseFileSizeWithUnits() throws Exception { final SyndFeed feed = getSyndFeed("org/rometools/feed/module/mediarss/filesize-with-unit.xml"); final List<SyndEntry> entries = feed.getEntries(); final MediaEntryModule module = (MediaEntryModule) entries.get(0).getModule(MediaModule.URI); Long parsedFileSize = module.getMediaContents()[0].getFileSize(); assertThat(parsedFileSize, is(new BigDecimal(1000).pow(3).longValue())); }
Source:
<code>public static final void transform(Group group, Matrix4d m) { for (Atom atom : group.getAtoms()) { transform(atom, m); } for (Group altG : group.getAltLocs()) { <START> for (Atom atom : altG.getAtoms()) { <END> transform(atom, m); } } }</code><technical_language>Recursive call transform(g, m) here</technical_language>

Target:
public static final void transform(Group group, Matrix4d m) { for (Atom atom : group.getAtoms()) { transform(atom, m); } for (Group altG : group.getAltLocs()) { transform(altG, m); } }
Source:
<code>private PerfData testMyers(int characters) { PerfData ret = new PerfData(); String a = DiffTestDataGenerator.generateSequence(characters, 971, 3); String b = DiffTestDataGenerator.generateSequence(characters, 1621, 5); CharArray ac = new CharArray(a); CharArray bc = new CharArray(b); CharCmp cmp = new CharCmp(); int D = 0; int cpuTimeChanges = 0; long lastReadout = 0; long interimTime = 0; int repetitions = 0; stopwatch.start(); while (cpuTimeChanges < minCPUTimerTicks && interimTime < longTaskBoundary) { D = MyersDiff.INSTANCE.diff(cmp, ac, bc).size(); repetitions++; interimTime = stopwatch.readout(); if (interimTime != lastReadout) { cpuTimeChanges++; lastReadout = interimTime; } } ret.runningTime = stopwatch.stop() / repetitions; ret.N = ac.size() + bc.size(); ret.D = D; <START> System.out.println(ret.toString()); <END> return ret; }</code><technical_language>Forgotten debug call</technical_language>

Target:
private PerfData testMyers(int characters) { PerfData ret = new PerfData(); String a = DiffTestDataGenerator.generateSequence(characters, 971, 3); String b = DiffTestDataGenerator.generateSequence(characters, 1621, 5); CharArray ac = new CharArray(a); CharArray bc = new CharArray(b); CharCmp cmp = new CharCmp(); int D = 0; int cpuTimeChanges = 0; long lastReadout = 0; long interimTime = 0; int repetitions = 0; stopwatch.start(); while (cpuTimeChanges < minCPUTimerTicks && interimTime < longTaskBoundary) { D = MyersDiff.INSTANCE.diff(cmp, ac, bc).size(); repetitions++; interimTime = stopwatch.readout(); if (interimTime != lastReadout) { cpuTimeChanges++; lastReadout = interimTime; } } ret.runningTime = stopwatch.stop() / repetitions; ret.N = ac.size() + bc.size(); ret.D = D; return ret; }
Source:
<code>private void startPlugins() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_STARTUP); final IExtension[] extensions = point.getExtensions(); if (extensions.length == 0) { return; } int numProcessors = Runtime.getRuntime().availableProcessors(); <START> final JobGroup jobGroup = new JobGroup("Workbench early startup job group", numProcessors * 2, 1); END> new EarlyStartupJob(jobGroup) { @Override protected IStatus run(IProgressMonitor monitor) { HashSet<String> disabledPlugins = new HashSet<String>( Arrays.asList(getDisabledEarlyActivatedPlugins())); monitor.beginTask(WorkbenchMessages.Workbench_startingPlugins, extensions.length); for (int i = 0; i < extensions.length; ++i) { if (monitor.isCanceled() || !isRunning()) { return Status.CANCEL_STATUS; } final IExtension extension = extensions[i]; if (!disabledPlugins.contains(extension.getNamespace())) { new EarlyStartupJob(jobGroup) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(extension.getNamespaceIdentifier(), 1); SafeRunner.run(new EarlyStartupRunnable(extension)); monitor.done(); return Status.OK_STATUS; } }.schedule(); } monitor.worked(1); } monitor.done(); return Status.OK_STATUS; } }.schedule(); }</code><technical_language>"1" needs explanation. 42 extensions.length</technical_language>

Target:
private void startPlugins() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_STARTUP); final IExtension[] extensions = point.getExtensions(); if (extensions.length == 0) { return; } int numProcessors = Runtime.getRuntime().availableProcessors(); final JobGroup jobGroup = new JobGroup("Workbench early startup job group", numProcessors * 2, 1); new EarlyStartupJob(jobGroup) { @Override protected IStatus run(IProgressMonitor monitor) { HashSet<String> disabledPlugins = new HashSet<String>( Arrays.asList(getDisabledEarlyActivatedPlugins())); monitor.beginTask(WorkbenchMessages.Workbench_startingPlugins, extensions.length); for (int i = 0; i < extensions.length; ++i) { if (monitor.isCanceled() || !isRunning()) { return Status.CANCEL_STATUS; } final IExtension extension = extensions[i]; if (!disabledPlugins.contains(extension.getNamespace())) { new EarlyStartupJob(jobGroup) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(extension.getNamespaceIdentifier(), 1); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } SafeRunner.run(new EarlyStartupRunnable(extension)); monitor.done(); return Status.OK_STATUS; } }.schedule(); } monitor.worked(1); } monitor.done(); return Status.OK_STATUS; } }.schedule(); }
Source:
<code>public void evict(I id) { try { <START> this.dispatcher.executeOnGroup(new EvictCommand<>(id)); <END> } catch (CommandDispatcherException e) { InfinispanEjbLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } }</code><technical_language>this is a local-only scheduler, is need dispatch eviction command</technical_language>

Target:
public void evict(I id) { InfinispanEjbLogger.ROOT_LOGGER.tracef("Passivating stateful session bean %s", id); this.evictor.evict(id); }
Source:
<code>private int execute(CommandLine commandLine, int timeout) throws IOException { DefaultExecutor executor = new DefaultExecutor(); <START> ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout * 1000); <END> executor.setWatchdog(watchdog); executor.setExitValue(0); return executor.execute(commandLine); }</code><technical_language>TimeUnit.SECONDS.toMills(timeout)</technical_language>

Target:
private int execute(CommandLine commandLine, int timeout) throws IOException { DefaultExecutor executor = new DefaultExecutor(); ExecuteWatchdog watchdog = new ExecuteWatchdog(TimeUnit.SECONDS.toMillis(timeout)); executor.setWatchdog(watchdog); executor.setExitValue(0); return executor.execute(commandLine); }
Source:
<code>public SyncUserInfo retrieveInfoForUser(final String providerUserIdentity, final String provider) throws ObjectServerError { if (Util.isEmptyString(providerUserIdentity)) { <START> throw new IllegalArgumentException("Not-null 'providerUserIdentity' required."); <END> } if (Util.isEmptyString(provider)) { throw new IllegalArgumentException("None empty 'provider' required."); } if (!isAdmin()) { throw new IllegalArgumentException("SyncUser needs to be admin in order to lookup other users ID."); } AuthenticationServer authServer = SyncManager.getAuthServer(); LookupUserIdResponse response = authServer.retrieveUser(getSyncUser().getUserToken(), provider, providerUserIdentity, getAuthenticationUrl()); if (!response.isValid()) { if (response.getError().getErrorCode() == ErrorCode.NOT_FOUND) { return null; } else { throw response.getError(); } } else { return SyncUserInfo.fromLookupUserIdResponse(response); } }</code><technical_language>Not-null -> empty</technical_language>

Target:
public SyncUserInfo retrieveInfoForUser(final String providerUserIdentity, final String provider) throws ObjectServerError { if (Util.isEmptyString(providerUserIdentity)) { throw new IllegalArgumentException("'providerUserIdentity' cannot be empty."); } if (Util.isEmptyString(provider)) { throw new IllegalArgumentException("'provider' cannot be empty."); } if (!isAdmin()) { throw new IllegalArgumentException("SyncUser needs to be admin in order to lookup other users ID."); } AuthenticationServer authServer = SyncManager.getAuthServer(); LookupUserIdResponse response = authServer.retrieveUser(getSyncUser().getUserToken(), provider, providerUserIdentity, getAuthenticationUrl()); if (!response.isValid()) { if (response.getError().getErrorCode() == ErrorCode.NOT_FOUND) { return null; } else { throw response.getError(); } } else { return SyncUserInfo.fromLookupUserIdResponse(response); } }
Source:
<code>static Optional<Range> calculateRangeForPartitioningKey(HiveColumnHandle column, Type type, List<HivePartition> partitions) { if (!isRangeSupported(type)) { return Optional.empty(); } List<Double> values = partitions.stream() .map(HivePartition::getKeys) .map(keys -> keys.get(column)) .filter(value -> !value.isNull()) .map(NullableValue::getValue) .map(value -> convertPartitionValueToDouble(type, value)) .collect(toImmutableList()); if (values.isEmpty()) { return Optional.empty(); } <START> <END> double min = values.get(0); double max = values.get(0); for (Double value : values) { if (value > max) { max = value; } if (value < min) { min = value; } } return Optional.of(new Range(min, max)); }</code><technical_language>so? empty partitions</technical_language>

Target:
static Optional<DoubleRange> calculateRangeForPartitioningKey(HiveColumnHandle column, Type type, List<HivePartition> partitions) { if (!isRangeSupported(type)) { return Optional.empty(); } List<Double> values = partitions.stream() .map(HivePartition::getKeys) .map(keys -> keys.get(column)) .filter(value -> !value.isNull()) .map(NullableValue::getValue) .map(value -> convertPartitionValueToDouble(type, value)) .collect(toImmutableList()); if (values.isEmpty()) { return Optional.empty(); } double min = values.get(0); double max = values.get(0); for (Double value : values) { if (value > max) { max = value; } if (value < min) { min = value; } } return Optional.of(new DoubleRange(min, max)); }
Source:
<code>private void showSnackBarWithRetry() { progressBar.setVisibility(View.GONE); <START> if (onClickListener == null) { <END> onClickListener = view -> { setAchievements(); }; } ViewUtil.showDismissibleSnackBar(findViewById(android.R.id.content), R.string.achievements_fetch_failed, R.string.retry, onClickListener); }</code><technical_language>curious do need maintain View.OnClickListener do a null check. function set click listener add one. need care of singleton</technical_language>

Target:
private void showSnackBarWithRetry() { progressBar.setVisibility(View.GONE); ViewUtil.showDismissibleSnackBar(findViewById(android.R.id.content), R.string.achievements_fetch_failed, R.string.retry, view -> setAchievements()); }
Source:
<code>private void savePostAndFinish() { try { updatePostObject(false); } catch (IllegalEditorStateException e) { AppLog.e(T.EDITOR, "Impossible to save and publish the post, we weren't able to update it."); return; } boolean shouldSave = mPost.hasChanges(mOriginalPost) && (mPost.isPublishable() || !isNewPost()); if (shouldSave) { mPostSavedLocally = false; if (isNewPost()) { mPost.setPostStatus(PostStatus.toString(PostStatus.DRAFT)); if (mEditPostSettingsFragment != null) { mEditPostSettingsFragment.updateStatusSpinner(); } } if (mPost.getStatusEnum() != PostStatus.PUBLISHED && mPost.isPublishable()) { publishPost(); <START> } <END> else { savePostLocally(); } } if (isNewPost() && !mPost.isPublishable()) { WordPress.wpDB.deletePost(getPost()); } if (!mPostSavedLocally) { returnResult(shouldSave); finish(); } }</code><technical_language>merge } else in a single line [the Android style guide](<LINK_0> Thanks</technical_language>

Target:
private void savePostAndFinish() { boolean hasLocalChanges = mPost.isLocallyChanged() || mPost.isLocalDraft(); boolean isFirstTimePublish = isFirstTimePublish(); boolean postUpdateSuccessful = updatePostObject(); if (!postUpdateSuccessful) { return; } boolean hasChanges = PostUtils.postHasEdits(mOriginalPost, mPost); boolean isPublishable = PostUtils.isPublishable(mPost); boolean hasUnpublishedLocalDraftChanges = PostStatus.fromPost(mPost) == PostStatus.DRAFT && isPublishable && hasLocalChanges; boolean shouldSave = (hasChanges || hasUnpublishedLocalDraftChanges) && (isPublishable || !isNewPost()); saveResult(shouldSave, false); if (shouldSave) { if (isNewPost()) { mPost.setStatus(PostStatus.DRAFT.toString()); if (mEditPostSettingsFragment != null) { mEditPostSettingsFragment.updateStatusSpinner(); } } if (PostStatus.fromPost(mPost) != PostStatus.PUBLISHED && isPublishable && NetworkUtils.isNetworkAvailable(this)) { if (!hasFailedMedia()) { savePostOnlineAndFinishAsync(isFirstTimePublish); } } else { savePostLocallyAndFinishAsync(); } } else { if (!isPublishable && isNewPost()) { mDispatcher.dispatch(PostActionBuilder.newRemovePostAction(mPost)); } finish(); } }
Source:
<code>public static void setLanguage(String localeCode) { Configuration config = getInstance().getResources().getConfiguration(); Locale newLocale = LanguageUtil.getLocale(localeCode); config.locale = newLocale; getInstance().getResources().updateConfiguration(config, getInstance().getResources().getDisplayMetrics()); <START> AnkiDroidApp.getInstance().setupNotificationChannels(); <END> }</code><technical_language>A function called setLanguage() set language, more less... call setupNotificationChannels() immediately function is called putting function, right</technical_language>

Target:
public static void setLanguage(String localeCode) { Configuration config = getInstance().getResources().getConfiguration(); Locale newLocale = LanguageUtil.getLocale(localeCode); config.locale = newLocale; getInstance().getResources().updateConfiguration(config, getInstance().getResources().getDisplayMetrics()); }
Source:
<code>private Mono<Response<AnalyzeSentimentResultCollection>> getAnalyzedSentimentResponse( Iterable<TextDocumentInput> documents, AnalyzeSentimentOptions options, Context context) { return service.sentimentWithResponseAsync( new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), options == null ? null : options.getModelVersion(), options == null ? null : options.isIncludeStatistics(), options == null ? null : options.isIncludeOpinionMining(), context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Analyzed sentiment for a batch of documents - {}", response)) .doOnError(error -> logger.warning("Failed to analyze sentiment - {}", error)) .map(this::toAnalyzeSentimentResultCollectionResponse) <START> .onErrorMap(throwable -> mapToHttpResponseExceptionIfExist(throwable)); <END> }</code><technical_language>nit: replace lambda</technical_language>

Target:
private Mono<Response<AnalyzeSentimentResultCollection>> getAnalyzedSentimentResponse( Iterable<TextDocumentInput> documents, AnalyzeSentimentOptions options, Context context) { return service.sentimentWithResponseAsync( new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)), options == null ? null : options.getModelVersion(), options == null ? null : options.isIncludeStatistics(), options == null ? null : options.isIncludeOpinionMining(), context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE)) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Analyzed sentiment for a batch of documents - {}", response)) .doOnError(error -> logger.warning("Failed to analyze sentiment - {}", error)) .map(this::toAnalyzeSentimentResultCollectionResponse) .onErrorMap(Utility::mapToHttpResponseExceptionIfExist); }
Source:
<code>protected void executeQueryCommand() { List<DiskImage> diskImages = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getParameters().getStorageDomainId()); Map<Guid, DiskImage> diskImagesMap = new HashMap<Guid, DiskImage>(); for (DiskImage diskImage : diskImages) { if (diskImage.getactive()) { <START> diskImage.getSnapshots().add(DiskImage.copyOf(diskImage)); <END> diskImagesMap.put(diskImage.getId(), diskImage); } } for (DiskImage diskImage : diskImages) { if (!diskImage.getactive()) { diskImagesMap.get(diskImage.getId()).getSnapshots().add(diskImage); } } getQueryReturnValue().setReturnValue(new ArrayList<DiskImage>(diskImagesMap.values())); }</code><technical_language>need copy here</technical_language>

Target:
protected void executeQueryCommand() { List<DiskImage> diskImages = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getParameters().getStorageDomainId()); Map<Guid, DiskImage> diskImagesMap = new HashMap<Guid, DiskImage>(); for (DiskImage diskImage : diskImages) { if (diskImage.getactive()) { diskImage.getSnapshots().add(diskImage); diskImagesMap.put(diskImage.getId(), diskImage); } } for (DiskImage diskImage : diskImages) { if (!diskImage.getactive()) { diskImagesMap.get(diskImage.getId()).getSnapshots().add(diskImage); } } getQueryReturnValue().setReturnValue(new ArrayList<DiskImage>(diskImagesMap.values())); }
Source:
<code>public Set<SecurityGroup> listSecurityGroupsForNode(String id) { checkNotNull(id, "id"); <START> ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id); <END> String zone = zoneAndId.getZone(); String instanceId = zoneAndId.getId(); Optional<? extends ServerWithSecurityGroupsApi> serverApi = client.getServerWithSecurityGroupsExtensionForZone(zone); Optional<? extends SecurityGroupApi> sgApi = client.getSecurityGroupExtensionForZone(zone); if (!serverApi.isPresent() || !sgApi.isPresent()) { return ImmutableSet.of(); } ServerWithSecurityGroups instance = serverApi.get().get(instanceId); if (instance == null) { return ImmutableSet.of(); } Set<String> groupNames = instance.getSecurityGroupNames(); Set<? extends SecurityGroupInZone> rawGroups = sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInZone(zone)).toSet(); return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter)); }</code><technical_language>[minor] Combine lines</technical_language>

Target:
public Set<SecurityGroup> listSecurityGroupsForNode(String id) { ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id")); String zone = zoneAndId.getZone(); String instanceId = zoneAndId.getId(); Optional<? extends ServerWithSecurityGroupsApi> serverApi = api.getServerWithSecurityGroupsExtensionForZone(zone); Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone); if (!serverApi.isPresent() || !sgApi.isPresent()) { return ImmutableSet.of(); } ServerWithSecurityGroups instance = serverApi.get().get(instanceId); if (instance == null) { return ImmutableSet.of(); } Set<String> groupNames = instance.getSecurityGroupNames(); Set<? extends SecurityGroupInZone> rawGroups = sgApi.get().list().filter(nameIn(groupNames)).transform(groupToGroupInZone(zone)).toSet(); return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter)); }
Source:
<code>protected Object doWork() { validateArguments(); logger.info("Starting allelic panel of normals creation..."); <START> final AllelicPanelOfNormals allelicPoN = new AllelicPanelOfNormalsCreator(inputFiles).create(siteFrequency); <END> logger.info("Allelic panel of normals created."); logger.info("Writing allelic panel of normals to output HDF5 file..."); allelicPoN.write(outputFile, HDF5File.OpenMode.CREATE); logger.info("Allelic panel of normals written to " + outputFile + "."); if (outputTSVFile != null) { allelicPoN.write(outputTSVFile); logger.info("Allelic panel of normals written as tab-separated values to " + outputTSVFile + "."); } return "SUCCESS"; }</code><technical_language>I noticed in some other command line classes, total run times recorded. Is worth here</technical_language>

Target:
protected Object doWork() { validateArguments(); if (!new HDF5Library().load(null)) { throw new UserException.HardwareFeatureException("Cannot load the required HDF5 library. " + "HDF5 is currently supported on x86-64 architecture and Linux or OSX systems."); } logger.info("Starting allelic panel of normals creation..."); final AllelicPanelOfNormals allelicPoN = new AllelicPanelOfNormalsCreator(inputFiles).create(siteFrequencyThreshold); logger.info("Allelic panel of normals created."); logger.info("Writing allelic panel of normals to output HDF5 file..."); allelicPoN.write(outputFile, HDF5File.OpenMode.CREATE); logger.info("Allelic panel of normals written to " + outputFile + "."); if (outputTSVFile != null) { allelicPoN.write(outputTSVFile); logger.info("Allelic panel of normals written as tab-separated values to " + outputTSVFile + "."); } return "SUCCESS"; }
Source:
<code>public void visitFileExceptionWrapper(Path source, Path relativePath) { try { visitFile(source, relativePath); } catch (IOException ex) { <START> throw new RuntimeException(); <END> } }</code><technical_language>throw new RuntimeException(ex); wrap original exception message stacktrace is visible</technical_language>

Target:
public void visitFileExceptionWrapper(Path source, Path relativePath) { try { visitFile(source, relativePath); } catch (IOException ex) { throw new RuntimeException(ex); } }
Source:
<code>public synchronized void open(String partitionName) throws ObjectStoreException { <START> lock.lock(); <END> try { super.open(partitionName); } finally { lock.unlock(); } }</code><technical_language>ConcurrencyUtils#withLock</technical_language>

Target:
public void open(String partitionName) throws ObjectStoreException { lock.lock(); try { super.open(partitionName); } finally { lock.unlock(); } }
Source:
<code>static ILamiViewer createLamiChart(Composite parent, LamiResultTable resultTable, LamiChartModel chartModel) { switch (chartModel.getChartType()) { case BAR_CHART: return new LamiBarChartViewer(parent, resultTable, chartModel); case XY_SCATTER: return new LamiScatterViewer(parent, resultTable, chartModel); case PIE_CHART: default: <START> throw new UnsupportedOperationException(); <END> } }</code><technical_language>give this a description</technical_language>

Target:
static ILamiViewer createLamiChart(Composite parent, LamiResultTable resultTable, LamiChartModel chartModel) { switch (chartModel.getChartType()) { case BAR_CHART: return new LamiBarChartViewer(parent, resultTable, chartModel); case XY_SCATTER: return new LamiScatterViewer(parent, resultTable, chartModel); case PIE_CHART: default: throw new UnsupportedOperationException("Unsupported chart type: " + chartModel.toString()); } }
Source:
<code>public void process() throws Exception { while (streamTask.inputProcessor.isAvailable() && streamTask.mailboxProcessor.isMailboxLoopRunning()) { <START> processSingleStep(); <END> } }</code><technical_language>Kind of replicates checks. sense a boolean processSingleStep, execute a while(processSingleStep()) ;</technical_language>

Target:
public void process() throws Exception { while (processSingleStep()) { } }
Source:
<code>private static XeSource source(final Alias alias) throws IOException { final String email; final String newEmail; <START> if (alias.email().contains(EMAIL_SEPARATOR)) { <END> final String[] index = alias.email().split(EMAIL_SEPARATOR); email = index[0]; newEmail = index[1]; } else { email = alias.email(); newEmail = ""; } return new XeAppend( "alias", new XeDirectives( new Directives() .add("name").set(alias.name()).up() .add("locale").set(alias.locale().toString()).up() .add("photo").set(alias.photo().toString()).up() .add("email").set(email).up() .add("newEmail").set(newEmail) ) ); }</code><technical_language>@mkordas is need do this check split. If is splitting symbol in string get array single element string. Otherwise, string split. java final String newEmail; final String[] emails = alias.email().split("!") if (emails.length > 1) { email = emails[0]; newEmail = emails[1]; } else { email = alias.email(); newEmail = ""; } This simplify logic a bit EMAIL_SEPARATOR field unnecessary</technical_language>

Target:
private static XeSource source(final Alias alias) throws IOException { final String email; final String newEmail; final String[] emails = alias.email().split("!"); if (emails.length > 1) { email = emails[0]; newEmail = emails[1]; } else { email = alias.email(); newEmail = ""; } return new XeAppend( "alias", new XeDirectives( new Directives() .add("name").set(alias.name()).up() .add("locale").set(alias.locale().toString()).up() .add("photo").set(alias.photo().toString()).up() .add("email").set(email).up() .add("newEmail").set(newEmail) ) ); }
Source:
<code>public void handleCommand(ChannelUID channelUID, Command command) { try { if (channelUID.getId().equals(CHANNEL_DimmableLight)) { if (command instanceof PercentType) { PercentType commandString = ((PercentType) command); putlightDimmer(commandString.toString()); } else if (command instanceof DecimalType) { <START> IncreaseDecreaseType commandString = ((IncreaseDecreaseType) command); <END> putlightDimmer(commandString.toString()); System.err.println(command.toString()); } } else if (channelUID.getId().equals(CHANNEL_LCD)) { if (command instanceof StringType) { StringType commandString = ((StringType) command); putLCD(commandString.toString()); } } else if (channelUID.getId().equals(CHANNEL_WallSwitch)) { if (command instanceof OnOffType) { OnOffType commandString = ((OnOffType) command); putLightOnOff(commandString.toString()); } } else { logger.error("Linked Channel does not support PUT. Invalid channel linked "); } } catch (Exception ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Could not control device at IP address: " + this.getConfig().get("ipAddress")); } }</code><technical_language>command of type DecimalType cast IncreaseDecreaseType here</technical_language>

Target:
public void handleCommand(ChannelUID channelUID, Command command) { try { if (channelUID.getId().equals(CHANNEL_DimmableLight)) { if (command instanceof PercentType) { PercentType commandString = ((PercentType) command); putlightDimmer(commandString.toString()); } else if (command instanceof DecimalType) { IncreaseDecreaseType commandString = ((IncreaseDecreaseType) command); putlightDimmer(commandString.toString()); } } else if (channelUID.getId().equals(CHANNEL_LCD)) { if (command instanceof StringType) { StringType commandString = ((StringType) command); putLCD(commandString.toString()); } } else if (channelUID.getId().equals(CHANNEL_WallSwitch)) { if (command instanceof OnOffType) { OnOffType commandString = ((OnOffType) command); putLightOnOff(commandString.toString()); } } else { logger.error("Linked Channel does not support PUT. Invalid channel linked "); } } catch (Exception ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Could not control device at IP address: " + this.getConfig().get("ipAddress")); } }
Source:
<code>public EventFields read(Kryo kryo, Input input, Class<EventFields> eventFieldsClass) { int entries = intSerializer.read(kryo, input, Integer.class); for (int i = 0; i < entries; i++) { String key = null; try { key = stringSerializer.read(kryo, input, String.class); } catch (Throwable e) { <START> System.out.println(input); <END> throw new RuntimeException(e); } ColumnVisibility vis = new ColumnVisibility(valueSerializer.read(kryo, input, byte[].class)); byte[] value = valueSerializer.read(kryo, input, byte[].class); byte[] metadata = valueSerializer.read(kryo, input, byte[].class); put(key, new FieldValue(vis, value, metadata)); } return this; }</code><technical_language>reason System.out.println()</technical_language>

Target:
public EventFields read(Kryo kryo, Input input, Class<EventFields> eventFieldsClass) { int entries = intSerializer.read(kryo, input, Integer.class); for (int i = 0; i < entries; i++) { String key = stringSerializer.read(kryo, input, String.class); ColumnVisibility vis = new ColumnVisibility(valueSerializer.read(kryo, input, byte[].class)); byte[] value = valueSerializer.read(kryo, input, byte[].class); byte[] metadata = valueSerializer.read(kryo, input, byte[].class); put(key, new FieldValue(vis, value, metadata)); } return this; }
Source:
<code>ConnectionValidationResult testConnectivity(Object connection) { ConnectionHandler<Object> connectionHandler; <START> lock.lock(); <END> try { connectionHandler = connections.get(new Reference<>(connection)).getSecond(); } finally { lock.unlock(); } if (connectionHandler == null) { throw new IllegalArgumentException("Cannot validate a connection which was not generated through this " + ConnectionProvider.class.getSimpleName()); } return connectionManager.testConnectivity(connection, connectionHandler); }</code><technical_language>lock thread is test connectivity</technical_language>

Target:
ConnectionValidationResult testConnectivity(Object connection) { ConnectionHandler<Object> connectionHandler = connections.getIfPresent(new Reference<>(connection)).getSecond(); if (connectionHandler == null) { throw new IllegalArgumentException("Cannot validate a connection which was not generated through this " + ConnectionProvider.class.getSimpleName()); } return connectionManager.testConnectivity(connection, connectionHandler); }
Source:
<code>void updatePartitionWeightStats(Map<String, Integer> partitionWeightMap) { synchronized (_dynamicCapacityMetricsMap) { if (_dynamicCapacityMetricsMap.keySet().equals(partitionWeightMap.keySet())) { for (Map.Entry<String, Integer> entry : partitionWeightMap.entrySet()) { _dynamicCapacityMetricsMap.get(entry.getKey()).updateValue((long) entry.getValue()); } return; } _dynamicCapacityMetricsMap.clear(); <START> final String gaugeMetricSuffix = "Gauge"; <END> for (Map.Entry<String, Integer> entry : partitionWeightMap.entrySet()) { String capacityKey = entry.getKey(); _dynamicCapacityMetricsMap.put(capacityKey, new SimpleDynamicMetric<>(capacityKey + gaugeMetricSuffix, (long) entry.getValue())); } } updateAttributesInfo(buildAttributeList(), "Resource monitor for resource: " + getResourceName()); }</code><technical_language>nit, static final put class level</technical_language>

Target:
void updatePartitionWeightStats(Map<String, Integer> partitionWeightMap) { synchronized (_dynamicCapacityMetricsMap) { if (_dynamicCapacityMetricsMap.keySet().equals(partitionWeightMap.keySet())) { for (Map.Entry<String, Integer> entry : partitionWeightMap.entrySet()) { _dynamicCapacityMetricsMap.get(entry.getKey()).updateValue((long) entry.getValue()); } return; } _dynamicCapacityMetricsMap.clear(); for (Map.Entry<String, Integer> entry : partitionWeightMap.entrySet()) { String capacityKey = entry.getKey(); _dynamicCapacityMetricsMap.put(capacityKey, new SimpleDynamicMetric<>(capacityKey + GAUGE_METRIC_SUFFIX, (long) entry.getValue())); } } updateAttributesInfo(buildAttributeList(), "Resource monitor for resource: " + getResourceName()); }
Source:
<code>private FileVisitResult callback(Path absolutePath, ParserConfiguration configuration, Callback callback) throws IOException { <START> if (!Files.exists(absolutePath)) { <END> return TERMINATE; } Path localPath = root.relativize(absolutePath); Log.trace("Parsing %s", localPath); ParseResult<CompilationUnit> result = new JavaParser(configuration).parse(COMPILATION_UNIT, provider(absolutePath)); result.getResult().ifPresent(cu -> cu.setStorage(absolutePath)); switch (callback.process(localPath, absolutePath, result)) { case SAVE: result.getResult().ifPresent(cu -> save(cu, absolutePath)); case DONT_SAVE: return CONTINUE; case TERMINATE: return TERMINATE; default: throw new AssertionError("Return an enum defined in SourceRoot.Callback.Result"); } }</code><technical_language>this happen</technical_language>

Target:
private FileVisitResult callback(Path absolutePath, ParserConfiguration configuration, Callback callback) throws IOException { Path localPath = root.relativize(absolutePath); Log.trace("Parsing %s", localPath); ParseResult<CompilationUnit> result = new JavaParser(configuration).parse(COMPILATION_UNIT, provider(absolutePath)); result.getResult().ifPresent(cu -> cu.setStorage(absolutePath)); switch (callback.process(localPath, absolutePath, result)) { case SAVE: result.getResult().ifPresent(cu -> save(cu, absolutePath)); case DONT_SAVE: return CONTINUE; case TERMINATE: return TERMINATE; default: throw new AssertionError("Return an enum defined in SourceRoot.Callback.Result"); } }