auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SchemaType getRootType() { <START> if (rootType != null) <END> { return rootType; } try { SchemaGlobalElement rootElement = schemas.findRootElement(rootElementName); if (rootElement != null) { rootType = rootElement.getType(); return rootType; } } catch (XmlException e) { throw new MetaDataGenerationException(e); } return null; }</code><technical_language>this concurrently used? If so, thread safe</technical_language>

Target:
public SchemaType getRootType() { if (rootType == null) { synchronized (this) { if (rootType == null) { rootType = getRootTypeFromSchemas(); } } } return rootType; }
Source:
<code>public R transform(K k, V v) { Span span = kafkaStreamsTracing.nextSpan(processorContext); if (!span.isNoop()) { span.name(spanName); span.start(); } Tracer.SpanInScope ws = tracer.withSpanInScope(span); Throwable error = null; try { return delegateTransformer.transform(k, v); <START> } catch (Throwable e) { <END> error = e; throw e; } finally { kafkaStreamsTracing.injector.inject(span.context(), processorContext.headers()); if (error != null) span.error(error); span.finish(); ws.close(); } }</code><technical_language>call propogateIfFatal catching Throwable</technical_language>

Target:
public R transform(K k, V v) { Span span = kafkaStreamsTracing.nextSpan(processorContext); if (!span.isNoop()) { span.name(spanName); span.start(); } Tracer.SpanInScope ws = tracer.withSpanInScope(span); Throwable error = null; try { return delegateTransformer.transform(k, v); } catch (Throwable e) { error = e; propagateIfFatal(e); throw e; } finally { kafkaStreamsTracing.injector.inject(span.context(), processorContext.headers()); if (error != null) span.error(error); span.finish(); ws.close(); } }
Source:
<code>public boolean askRetryForNetworkIssue(Throwable ex) { if (CommonsPlugin.isJUnitTest()) { return false; } if (donnotRetryByCancel) { return false; } final AtomicBoolean retry = new AtomicBoolean(false); try { if (askUserForNetworkIssueSemaphore.availablePermits() <= 0) { askUserForNetworkIssueSemaphore.acquire(); askUserForNetworkIssueSemaphore.release(); return askUserForNetworkIssueRetryCache; } askUserForNetworkIssueSemaphore.acquire(); DisplayUtils.syncExecInNewUIThread(new Runnable() { @Override public void run() { <START> Shell shell = new Shell(); <END> retry.set(askRetryForNetworkIssueInDialog(shell, ex)); shell.dispose(); } }); } catch (Throwable t) { ExceptionHandler.process(t); } finally { askUserForNetworkIssueRetryCache = retry.get(); if (askUserForNetworkIssueSemaphore.availablePermits() <= 0) { askUserForNetworkIssueSemaphore.release(); } } return askUserForNetworkIssueRetryCache; }</code><technical_language>I remember is issue Linux if new shell dirrectly, please test works Linux</technical_language>

Target:
public boolean askRetryForNetworkIssue(Throwable ex) { if (CommonsPlugin.isJUnitTest()) { return false; } if (donnotRetryByCancel) { return false; } final AtomicBoolean retry = new AtomicBoolean(false); try { if (askUserForNetworkIssueSemaphore.availablePermits() <= 0) { askUserForNetworkIssueSemaphore.acquire(); askUserForNetworkIssueSemaphore.release(); return askUserForNetworkIssueRetryCache; } askUserForNetworkIssueSemaphore.acquire(); if (Display.getCurrent() == null) { try { Display defaultDisplay = Display.getDefault(); if (defaultDisplay.getThread().getState() == Thread.State.RUNNABLE) { defaultDisplay.syncExec(new Runnable() { @Override public void run() { retry.set(askRetryForNetworkIssueInDialog(DisplayUtils.getDefaultShell(), ex)); } }); } else { final DeviceData deviceData = Display.getDefault().getDeviceData(); DisplayUtils.syncExecInNewUIThread(new Runnable() { @Override public void run() { Shell shell = DisplayUtils.getDefaultShell(false); retry.set(askRetryForNetworkIssueInDialog(shell, ex)); shell.dispose(); } }, deviceData); } } catch (Exception e) { ExceptionHandler.process(e); } } else { retry.set(askRetryForNetworkIssueInDialog(DisplayUtils.getDefaultShell(), ex)); } } catch (Throwable t) { ExceptionHandler.process(t); } finally { askUserForNetworkIssueRetryCache = retry.get(); if (askUserForNetworkIssueSemaphore.availablePermits() <= 0) { askUserForNetworkIssueSemaphore.release(); } } return askUserForNetworkIssueRetryCache; }
Source:
<code>public static Expression systemEnvironmentExpression(final String propertyName, final String defaultValue) { return new ExpressionAdapter() { public Object evaluate(Exchange exchange) { String text = simpleExpression(propertyName.toUpperCase(Locale.ROOT)).evaluate(exchange, String.class); <START> String answer = System.getenv(text); <END> if (answer == null) { String text2 = simpleExpression(defaultValue).evaluate(exchange, String.class); answer = text2; } return answer; } @Override public String toString() { return "systemEnvironment(" + propertyName.toUpperCase(Locale.ROOT) + ")"; } }; }</code><technical_language>text is upper cased, result of simple expression</technical_language>

Target:
public static Expression systemEnvironmentExpression(final String propertyName, final String defaultValue) { return new ExpressionAdapter() { public Object evaluate(Exchange exchange) { String text = simpleExpression(propertyName).evaluate(exchange, String.class); String answer = System.getenv(text.toUpperCase()); if (answer == null) { String text2 = simpleExpression(defaultValue).evaluate(exchange, String.class); answer = text2; } return answer; } @Override public String toString() { return "systemEnvironment(" + propertyName + ")"; } }; }
Source:
<code>public static void output(@AggregationState DigestAndPercentileArrayState state, BlockBuilder out) { QuantileDigest digest = state.getDigest(); if (digest == null || digest.getCount() == 0.0) { out.appendNull(); } else { List<Long> bounds = digest.getQuantiles(state.getPercentiles()); <START> Double mean = digestToTruncatedMean(digest, bounds, new QuantileDigestFunctions.RealMiddleFunction()); <END> if (mean == null) { out.appendNull(); } else { REAL.writeLong(out, floatToRawIntBits(mean.floatValue())); } } }</code><technical_language>I a public static constant for middle functions</technical_language>

Target:
public static void output(@AggregationState DigestAndPercentileArrayState state, BlockBuilder out) { QuantileDigest digest = state.getDigest(); if (digest == null || digest.getCount() == 0.0) { out.appendNull(); } else { List<Long> bounds = digest.getQuantiles(state.getPercentiles()); Double mean = digestToTruncatedMean(digest, bounds, REAL_MIDDLE_FUNCTION); if (mean == null) { out.appendNull(); } else { REAL.writeLong(out, floatToRawIntBits(mean.floatValue())); } } }
Source:
<code>public boolean isSpatialJoin() { <START> return criteria.isEmpty() && filter.isPresent() && type == INNER; <END> }</code><technical_language>This return true for non-spatial inequality join, no</technical_language>

Target:
public boolean isSpatialJoin() { return spatialJoin; }
Source:
<code>public int compareTo(InstructorFeedbackResultsParticipantPanel o) { if (isHasResponses == o.isHasResponses) { return name.compareTo(o.name); <START> } else { <END> return isHasResponses ? -1 : 1; } }</code><technical_language>remove else</technical_language>

Target:
public int compareTo(InstructorFeedbackResultsParticipantPanel o) { if (isHasResponses == o.isHasResponses) { return name.compareTo(o.name); } return isHasResponses ? -1 : 1; }
Source:
<code>public RootDSEData(DirContext dirContext) throws NamingException { SearchControls controls = RootDSEQueryInfo.createSearchControls(); String query = RootDSEQueryInfo.ROOT_DSE_LDAP_QUERY; NamingEnumeration<SearchResult> searchResults = dirContext.search("", query, controls); while (searchResults.hasMoreElements()) { SearchResult searchResult = searchResults.nextElement(); Attributes attributes = searchResult.getAttributes(); Attribute attribute = attributes.get(RootDSEQueryInfo.DEFAULT_NAMING_CONTEXT_RESULT_ATTRIBUTE); <START> if (attribute != null) { <END> domainDN = (String) attribute.get(); ldapProviderType = LdapProviderType.activeDirectory; } else { Attribute namingContextAttribute = attributes.get(RootDSEQueryInfo.NAMING_CONTEXTS_RESULT_ATTRIBUTE); Attribute rhdsAttribute = attributes.get(RootDSEQueryInfo.RHDS_PROPERTY); if (namingContextAttribute != null) { domainDN = getDefaultNamingContextFromNamingContexts(namingContextAttribute); if (rhdsAttribute != null) { ldapProviderType = LdapProviderType.rhds; } else { ldapProviderType = LdapProviderType.ipa; } } } } }</code><technical_language>I notice iterating elements is unnecessary bogus. provider type break. nice wrap this block a method LdapProviderType provider = getProvider(Attributes attributes) if (provider != null) { break;}</technical_language>

Target:
public RootDSEData(DirContext dirContext) throws NamingException { SearchControls controls = RootDSEQueryInfo.createSearchControls(); String query = RootDSEQueryInfo.ROOT_DSE_LDAP_QUERY; NamingEnumeration<SearchResult> searchResults = dirContext.search("", query, controls); boolean succeeded = false; while (searchResults.hasMoreElements() && !succeeded) { SearchResult searchResult = searchResults.nextElement(); Attributes attributes = searchResult.getAttributes(); succeeded = applyDomainAttributes(attributes); } }
Source:
<code>private String getVersionString(Class<?> serviceClass) { List<String> versions = new ArrayList<>(2); String maybeRemotingVersion = this.getClass().getPackage().getImplementationVersion(); if (maybeRemotingVersion != null) { versions.add("http-remoting " + maybeRemotingVersion); } String maybeServiceVersion = serviceClass.getPackage().getImplementationVersion(); if (maybeServiceVersion != null) { <START> versions.add(String.format("Service API %s %s", serviceClass.getSimpleName(), maybeServiceVersion)); <END> } return Joiner.on(",").join(versions); }</code><technical_language>try avoid String.format this hot path do String concat avoid expensive format parsing</technical_language>

Target:
private String getVersionString(Class<?> serviceClass) { List<String> versions = new ArrayList<>(2); String maybeServiceVersion = serviceClass.getPackage().getImplementationVersion(); if (maybeServiceVersion != null) { versions.add("Service API " + serviceClass.getSimpleName() + " " + maybeServiceVersion); } String maybeRemotingVersion = this.getClass().getPackage().getImplementationVersion(); if (maybeRemotingVersion != null) { versions.add("http-remoting " + maybeRemotingVersion); } return Joiner.on(";").join(versions); }
Source:
<code>private boolean checkNoDisksBasedOnTemplateDisks() { <START> List<String> disksInfo = null; <END> for (DiskImage diskImage : imageTemplates) { List<DiskImage> basedDisks = getDiskImageDAO().getAllSnapshotsForParent(diskImage.getImageId()); for (DiskImage basedDisk : basedDisks) { if (disksInfo == null) { disksInfo = new LinkedList<>(); } disksInfo.add(String.format("Disk Alias: %s, Disk Id: %s ", basedDisk.getDiskAlias(), basedDisk.getId())); } } if (disksInfo != null) { return failCanDoAction(VdcBllMessages.VMT_CANNOT_REMOVE_DETECTED_DERIVED_DISKS, String.format("$disksInfo %s", String.format(StringUtils.join(disksInfo, "%n")))); } return true; }</code><technical_language>initialize here..</technical_language>

Target:
private boolean checkNoDisksBasedOnTemplateDisks() { List<String> disksInfo = null; for (DiskImage diskImage : imageTemplates) { List<DiskImage> basedDisks = getDiskImageDAO().getAllSnapshotsForParent(diskImage.getImageId()); for (DiskImage basedDisk : basedDisks) { if (disksInfo == null) { disksInfo = new LinkedList<>(); } disksInfo.add(String.format("%s (%s) ", basedDisk.getDiskAlias(), basedDisk.getId())); } } if (disksInfo != null) { return failCanDoAction(VdcBllMessages.VMT_CANNOT_REMOVE_DETECTED_DERIVED_DISKS, String.format("$disksInfo %s", String.format(StringUtils.join(disksInfo, "%n")))); } return true; }
Source:
<code><START> protected Set<MambuEntity> getSupportedEntities() { <END> return supportedEntities; }</code><technical_language>Is add @Override annotation here</technical_language>

Target:
public static MambuEntityType[] getSupportedEntities() { return supportedEntities; }
Source:
<code><START> public void setAbbrev(final int abbrev) { <END> this.abbreviationLength = abbrev; }</code><technical_language>return command type chain calls</technical_language>

Target:
public DescribeCommand setAbbrev(final int abbrev) throws IllegalArgumentException { checkCallable(); if (abbrev < 0 || abbrev == 1 || abbrev > 40) { throw new IllegalArgumentException( JGitText.get().describeInvalidAbbreviation); } this.abbreviationLength = abbrev; return this; }
Source:
<code>public void onCrdLastFinishedVersionReceived(AffinityTopologyVersion lastFinishedVer, AffinityTopologyVersion pendingVer, boolean receivedSingleMsg) { log.warning("Received check response from coordinator: " + "[lastFinishedVer=" + lastFinishedVer + ", pendingVer=" + pendingVer + ", receivedSingleMsg=" + receivedSingleMsg + ", localExchId=" + exchId + "]"); boolean failLocal; if (lastFinishedVer.compareTo(exchId.topologyVersion()) >= 0) failLocal = true; else if (pendingVer.equals(exchId.topologyVersion()) && !receivedSingleMsg) failLocal = true; else if (pendingVer.equals(exchId.topologyVersion()) && receivedSingleMsg) return; else <START> failLocal = false; <END> if (failLocal) cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, new IgniteException( "Coordinator topology version is greater than local."))); else cctx.discovery().failNode(crd.id(), null); }</code><technical_language>I asked 4 people read this message, understand this means. I regular user understand this message in logs. please add more details too</technical_language>

Target:
public void onCrdLastFinishedVersionReceived(AffinityTopologyVersion lastFinishedVer, AffinityTopologyVersion pendingVer, boolean receivedSingleMsg) { log.warning("Received check response from coordinator: " + "[lastFinishedVer=" + lastFinishedVer + ", pendingVer=" + pendingVer + ", receivedSingleMsg=" + receivedSingleMsg + ", localExchId=" + exchId + "]"); boolean failLoc; if (lastFinishedVer.compareTo(exchId.topologyVersion()) >= 0) failLoc = true; else if (pendingVer.equals(exchId.topologyVersion()) && !receivedSingleMsg) failLoc = true; else if (pendingVer.equals(exchId.topologyVersion()) && receivedSingleMsg) return; else failLoc = false; if (failLoc) cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, new IgniteException( "Coordinator topology version is greater than local."))); else cctx.discovery().failNode(crd.id(), null); }
Source:
<code>String value() default ""; EmptyHandling onEmpty() default EmptyHandling.THROW; enum EmptyHandling { VOID, NULL, THROW; <START> public static final String valueNotHandledMessage = "EmptyHandling type on BindList not handled. Please report this to the jdbi developers."; <END> }</code><technical_language>This message part of API. I move internal package expose it</technical_language>

Target:
String value() default ""; EmptyHandling onEmpty() default EmptyHandling.THROW; enum EmptyHandling { VOID, NULL, THROW; }
Source:
<code><START> public WordnetLemmaReader(String wordnetPath) { <END> try { if (IOUtils.lsResources(WordnetLemmaReader.class, wordnetPath).size() == 0) { logger.error("Wordnet path does not point to a directory."); System.exit(-1); } } catch (URISyntaxException | IOException e) { logger.error("Error while trying to access Wordnet."); System.exit(-1); } nounLemmas = new HashMap<>(); verbLemmas = new HashMap<>(); adjectiveLemmas = new HashMap<>(); adverbLemmas = new HashMap<>(); try { List<String> list = LineIO.readFromClasspath(wordnetPath + "/noun.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); nounLemmas.put(wordLemma[0], wordLemma[1]); } list = LineIO.readFromClasspath(wordnetPath + "/verb.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); verbLemmas.put(wordLemma[0], wordLemma[1]); } list = LineIO.readFromClasspath(wordnetPath + "/adj.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); adjectiveLemmas.put(wordLemma[0], wordLemma[1]); } list = LineIO.readFromClasspath(wordnetPath + "/adv.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); adverbLemmas.put(wordLemma[0], wordLemma[1]); } } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>exiting, STDERR</technical_language>

Target:
public WordnetLemmaReader(String wordnetPath) { try { if (IOUtils.lsResources(WordnetLemmaReader.class, wordnetPath).size() == 0) { System.err.println("Wordnet path does not point to a directory."); System.exit(-1); } } catch (URISyntaxException | IOException e) { System.err.println("Error while trying to access Wordnet."); System.exit(-1); } nounLemmas = new HashMap<>(); verbLemmas = new HashMap<>(); adjectiveLemmas = new HashMap<>(); adverbLemmas = new HashMap<>(); try { List<String> list = LineIO.readFromClasspath(wordnetPath + "/noun.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); nounLemmas.put(wordLemma[0], wordLemma[1]); } list = LineIO.readFromClasspath(wordnetPath + "/verb.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); verbLemmas.put(wordLemma[0], wordLemma[1]); } list = LineIO.readFromClasspath(wordnetPath + "/adj.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); adjectiveLemmas.put(wordLemma[0], wordLemma[1]); } list = LineIO.readFromClasspath(wordnetPath + "/adv.exc"); for (String wordLemmas : list) { String[] wordLemma = wordLemmas.split("\\s+"); adverbLemmas.put(wordLemma[0], wordLemma[1]); } } catch (IOException e) { e.printStackTrace(); } }
Source:
<code><START> protected static DbFacade getDbFacade() { <END> return DbFacade.getInstance(); }</code><technical_language>can'y this private</technical_language>

Target:
private static DbFacade getDbFacade() { return DbFacade.getInstance(); }
Source:
<code>public void ended() { <START> this.onCompletionListener.onCompletion(this); <END> }</code><technical_language>listener null, i issue i tested music playback</technical_language>

Target:
public void ended() { if(this.onCompletionListener != null) this.onCompletionListener.onCompletion(this); }
Source:
<code>private AbstractSelectTreeViewer(Composite parent, TriStateFilteredCheckboxTree checkboxTree, int legendIndex, String id) { super(parent, checkboxTree.getViewer()); TreeViewer treeViewer = checkboxTree.getViewer(); treeViewer.setComparator(COMPARATOR); if (treeViewer instanceof CheckboxTreeViewer) { ((CheckboxTreeViewer) treeViewer).addCheckStateListener(new CheckStateChangedListener()); } fCheckboxTree = checkboxTree; fLegendIndex = legendIndex; fId = id; <START> checkboxTree.setPreCheckStateListener(new ManyEntriesSelectedDialogPreCheckedListener(checkboxTree)); <END> }</code><technical_language>I prefer if listener added in TmfChartView.coupleSelectViewer(). Many... listener in package. AbstractSelectTreeViewer need a addPreCheckListener() getFilteredCheckboxTree() method</technical_language>

Target:
private AbstractSelectTreeViewer(Composite parent, TriStateFilteredCheckboxTree checkboxTree, int legendIndex, String id) { super(parent, checkboxTree.getViewer()); TreeViewer treeViewer = checkboxTree.getViewer(); treeViewer.setComparator(COMPARATOR); if (treeViewer instanceof CheckboxTreeViewer) { ((CheckboxTreeViewer) treeViewer).addCheckStateListener(new CheckStateChangedListener()); } fCheckboxTree = checkboxTree; fLegendIndex = legendIndex; fId = id; }
Source:
<code>private void addInitialOperations(DeviceIdentifier deviceIdentifier, String deviceType) throws DeviceManagementException { DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance(). getDeviceManagementProvider(); DeviceManagementService deviceManagementService = pluginRepository.getDeviceManagementService(deviceType, this.getTenantId()); InitialOperationConfig init = deviceManagementService.getInitialOperationConfig(); List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>(); deviceIdentifiers.add(deviceIdentifier); if (init != null) { List<String> initialOperations = init.getOperations(); if (initialOperations != null) { for (String str : initialOperations) { CommandOperation operation = new CommandOperation(); operation.setEnabled(true); operation.setType(Operation.Type.COMMAND); operation.setCode(str); try { deviceManagementProviderService. addOperation(deviceType, <START> operation, deviceIdentifiers); <END> } catch (OperationManagementException e) { throw new DeviceManagementException( "Unable to find the device with the id: '" + deviceIdentifier.getId(), e); } catch (InvalidDeviceException e) { throw new DeviceManagementException( "Unable to find the device with the id: '" + deviceIdentifier.getId(), e); } } } } }</code><technical_language>Please re-check formatting</technical_language>

Target:
private void addInitialOperations(DeviceIdentifier deviceIdentifier, String deviceType) throws DeviceManagementException { DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance(). getDeviceManagementProvider(); DeviceManagementService deviceManagementService = pluginRepository.getDeviceManagementService(deviceType, this.getTenantId()); InitialOperationConfig init = deviceManagementService.getInitialOperationConfig(); List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>(); deviceIdentifiers.add(deviceIdentifier); if (init != null) { List<String> initialOperations = init.getOperations(); if (initialOperations != null) { for (String str : initialOperations) { CommandOperation operation = new CommandOperation(); operation.setEnabled(true); operation.setType(Operation.Type.COMMAND); operation.setCode(str); try { deviceManagementProviderService.addOperation(deviceType, operation, deviceIdentifiers); } catch (OperationManagementException e) { throw new DeviceManagementException("Unable to add the operation for the device with the id: '" + deviceIdentifier.getId(), e); } catch (InvalidDeviceException e) { throw new DeviceManagementException("Unable to find the device with the id: '" + deviceIdentifier.getId(), e); } } } } }
Source:
<code>private Collection<V> valuesForPagingPredicate(Predicate predicate) { PagingPredicateImpl pagingPredicate = unwrapPagingPredicate(predicate); pagingPredicate.setIterationType(IterationType.VALUE); ClientMessage request = MapValuesWithPagingPredicateCodec.encodeRequest(name, toData(predicate)); ClientMessage response = invokeWithPredicate(request, predicate); List<Entry> resultList = new ArrayList<>(); MapValuesWithPagingPredicateCodec.decodeResponse(response, (keyData, valueData) -> { K key = toObject(keyData); V value = toObject(valueData); <START> resultList.add(new AbstractMap.SimpleEntry<>(key, value)); <END> }); return (Collection<V>) getSortedQueryResultSet(resultList, pagingPredicate, IterationType.VALUE); }</code><technical_language>This SimpleImmutableEntry</technical_language>

Target:
private Collection<V> valuesForPagingPredicate(Predicate predicate) { PagingPredicateImpl pagingPredicate = unwrapPagingPredicate(predicate); pagingPredicate.setIterationType(IterationType.VALUE); ClientMessage request = MapValuesWithPagingPredicateCodec.encodeRequest(name, toData(predicate)); ClientMessage response = invokeWithPredicate(request, predicate); List<Entry> resultList = new ArrayList<>(); MapValuesWithPagingPredicateCodec.decodeResponse(response, (keyData, valueData) -> { K key = toObject(keyData); V value = toObject(valueData); resultList.add(new AbstractMap.SimpleImmutableEntry<>(key, value)); }); return (Collection<V>) getSortedQueryResultSet(resultList, pagingPredicate, IterationType.VALUE); }
Source:
<code>private static ImmutableMap<String, String> parseAlternates(IniFile config) { if (!config.contains("alternates")) { return ImmutableMap.of(); } ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); PropertySet section = config.getSection("alternates"); <START> for (String key : section.keys()) { <END> String value = section.getValue(key); builder.put(key, value); } return builder.build(); }</code><technical_language>this done more neatly a stream map entries</technical_language>

Target:
private static ImmutableMap<String, String> parseAlternates(IniFile config) { if (!config.contains(ALTERNATES_SECTION)) { return ImmutableMap.of(); } ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); PropertySet section = config.getSection(ALTERNATES_SECTION); for (String key : section.keys()) { builder.put(key, section.getValue(key)); } return builder.build(); }
Source:
<code>boolean start(File workingDir, String filename) { try { createProgressFile(workingDir, filename); <START> watchDogThread = new Thread(new ProgressFileReaderThread(Duration.ofMillis(PASchedulerProperties.SCHEDULER_PROGRESS_FILE_READER_POLL_TIMEOUT.getValueAsInt()))); <END> watchDogThread.setName(ProgressFileReaderThread.class.getName()); watchDogThread.start(); progress = 0; return true; } catch (IOException e) { logger.warn("Error while creating progress file. Progress will not be reported.", e); return false; } }</code><technical_language>PASchedulerProperties in this context this code is executed node</technical_language>

Target:
boolean start(File workingDir, String filename) { try { createProgressFileIfNeeded(workingDir, filename); String propertyValue = System.getProperty(TaskLauncher.PROGRESS_FILE_READER_PERIOD, DEFAULT_POLLER_PERIOD.toString()); Long periodInMs; try { periodInMs = Long.parseLong(propertyValue); } catch (NumberFormatException e) { logger.warn(String.format("Incorect property %s value: %s, using default value: %s.", TaskLauncher.PROGRESS_FILE_READER_PERIOD, propertyValue, DEFAULT_POLLER_PERIOD.toString())); periodInMs = DEFAULT_POLLER_PERIOD; } scheduledExecutorService.scheduleAtFixedRate(this::readValue, 0, periodInMs, TimeUnit.MILLISECONDS); progress = 0; return true; } catch (IOException e) { logger.warn("Error while creating progress file. Progress will not be reported.", e); return false; } }
Source:
<code><START> public ResponseEntity<?> setDefaultStorage(@PathVariable("id") final String id, final NativeWebRequest request) { <END> if (!adminService.isAdmin(AuthorizationService.Operation.WRITE)) { return status(FORBIDDEN).build(); } final Storage storage = storageService.setDefaultStorage(id); return status(OK).body(storage); }</code><technical_language>declare throws please</technical_language>

Target:
public ResponseEntity<?> setDefaultStorage(@PathVariable("id") final String id, final NativeWebRequest request) throws PluginException, NoSuchStorageException, InternalNakadiException { if (!adminService.isAdmin(AuthorizationService.Operation.WRITE)) { return status(FORBIDDEN).build(); } final Storage storage = storageService.setDefaultStorage(id); return status(OK).body(storage); }
Source:
<code>public void close(final ChannelHandlerContext context, final ChannelPromise promise) { this.traceOperation(context, "close"); if (!this.closingExceptionally) { this.completeAllPendingRequestsExceptionally(context, ON_CLOSE); } else { logger.debug("{} closed exceptionally", context); } final SslHandler sslHandler = context.pipeline().get(SslHandler.class); if (sslHandler != null) { try { sslHandler.closeOutbound(); } catch (Exception exception) { <START> if (exception instanceof SSLException) { <END> logger.debug( "SslException when attempting to close the outbound SSL connection: {}", exception.toString()); } else { logger.warn( "Exception when attempting to close the outbound SSL connection: {}", exception.toString()); throw exception; } } } context.close(promise); }</code><technical_language>Do similar happen for reactor http code paths also</technical_language>

Target:
public void close(final ChannelHandlerContext context, final ChannelPromise promise) { this.traceOperation(context, "close"); if (!this.closingExceptionally) { this.completeAllPendingRequestsExceptionally(context, ON_CLOSE); } else { logger.debug("{} closed exceptionally", context); } final SslHandler sslHandler = context.pipeline().get(SslHandler.class); if (sslHandler != null) { try { sslHandler.closeOutbound(); } catch (Exception exception) { if (exception instanceof SSLException) { logger.debug( "SslException when attempting to close the outbound SSL connection: ", exception); } else { logger.warn( "Exception when attempting to close the outbound SSL connection: ", exception); throw exception; } } } context.close(promise); }
Source:
<code>public OrganisationListWriter(EntityListWriter<Person> personListWriter) { <START> this.personListWriter = personListWriter; <END> }</code><technical_language>checkNotNull</technical_language>

Target:
public OrganisationListWriter(EntityListWriter<Person> personListWriter) { this.personListWriter = checkNotNull(personListWriter); }
Source:
<code>public Response addAll(Collection<Map<String, Object>> events) { <START> if (closed || inputFinished) { <END> throw new IllegalStateException("Cannot add events to closed firehose!"); } log.debug("Adding %,d events to firehose: %s", events.size(), serviceName); try { if (writer == null) { writer = new PrintWriter(dataFile); } for (final Map<String, Object> event : events) { parser.parse(event); writer.println(objectMapper.writeValueAsString(event)); } writer.flush(); return Response.ok().entity(ImmutableMap.of("eventCount", events.size())).build(); } catch (IOException e) { return Response.serverError().entity(ImmutableMap.of("error", e.getMessage())).build(); } }</code><technical_language>in general thinking thread safety... if a separate thread is setting state of variables, want volatile some general level of thread safety in them. TimedShutdownFirehose some examples of this I think</technical_language>

Target:
public Response addAll(Collection<Map<String, Object>> events) { if (closed || inputFinished) { throw new IllegalStateException("Cannot add events to closed firehose!"); } log.debug("Adding %,d events to firehose: %s", events.size(), serviceName); try { for (final Map<String, Object> event : events) { parser.parse(event); writer.println(objectMapper.writeValueAsString(event)); } writer.flush(); return Response.ok().entity(ImmutableMap.of("eventCount", events.size())).build(); } catch (IOException e) { return Response.serverError().entity(ImmutableMap.of("error", e.getMessage())).build(); } }
Source:
<code>public void onlyAvailableOfflineOption(){ <START> Intent i = new Intent(this, FileDisplayActivity.class); <END> i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.putExtra(EXTRA_ONLY_AVAILABLE_OFFLINE, true); startActivity(i); }</code><technical_language>more descriptive variables i -> intent</technical_language>

Target:
public void onlyAvailableOfflineOption(){ Intent intent = new Intent(this, FileDisplayActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(EXTRA_ONLY_AVAILABLE_OFFLINE, true); startActivity(intent); }
Source:
<code>protected void writeOVirtSection(StringBuilder configBuilder) { configBuilder.append("\n[ovirt]") .append("\nhost=").append(engineHost) .append("\nvm-guid=").append(vmId.toString()) <START> .append("\njsessionid=").append(sessionId) <END> .append("\nadmin=").append(Boolean.valueOf(admin)); }</code><technical_language>I call this jsessionid, sessionId passing in is jsessionid of rest api</technical_language>

Target:
protected void writeOVirtSection(StringBuilder configBuilder) { configBuilder.append("\n[ovirt]") .append("\nhost=").append(engineHost) .append("\nvm-guid=").append(vmId.toString()) .append("\njsessionid=").append(sessionId) .append("\nadmin=").append(admin ? 1 : 0); }
Source:
<code>@Override public void parseArguments(CommandArgIterator argIter) { if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); <START> if ("--force".equalsIgnoreCase(arg)) { <END> force = true; argIter.nextArg(""); } } }</code><technical_language>define force command static var</technical_language>

Target:
@Override public void parseArguments(CommandArgIterator argIter) { if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { force = true; argIter.nextArg(""); } } }
Source:
<code>protected void executeCommand() { getVdsGroup().setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); getVdsGroup().setDetectEmulatedMachine(true); DbFacade.getInstance().getVdsGroupDao().save(getVdsGroup()); <START> if (!getVdsGroup().getFencingPolicy().isFencingEnabled()) { <END> AuditLogableBase alb = new AuditLogableBase(); alb.setVdsGroupId(getVdsGroup().getId()); AuditLogDirector.log(alb, AuditLogType.FENCING_DISABLED_IN_CLUSTER_POLICY); } if (getParameters().getVdsGroup().getStoragePoolId() != null) { final String networkName = NetworkUtils.getEngineNetwork(); List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForDataCenter( getParameters().getVdsGroup().getStoragePoolId()); Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network network) { return network.getName().equals(networkName); } }); if (net != null) { DbFacade.getInstance().getNetworkClusterDao().save( new NetworkCluster(getParameters().getVdsGroup().getId(), net.getId(), NetworkStatus.OPERATIONAL, true, true, true)); } } setActionReturnValue(getVdsGroup().getId()); setSucceeded(true); }</code><technical_language>Define this block a protected method in VdsGroupOperationCommandBase call</technical_language>

Target:
protected void executeCommand() { getVdsGroup().setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); getVdsGroup().setDetectEmulatedMachine(true); DbFacade.getInstance().getVdsGroupDao().save(getVdsGroup()); alertIfFencingDisabled(); if (getParameters().getVdsGroup().getStoragePoolId() != null) { final String networkName = NetworkUtils.getEngineNetwork(); List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForDataCenter( getParameters().getVdsGroup().getStoragePoolId()); Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network network) { return network.getName().equals(networkName); } }); if (net != null) { DbFacade.getInstance().getNetworkClusterDao().save( new NetworkCluster(getParameters().getVdsGroup().getId(), net.getId(), NetworkStatus.OPERATIONAL, true, true, true)); } } setActionReturnValue(getVdsGroup().getId()); setSucceeded(true); }
Source:
<code>public void close() throws IOException { <START> fFileInputStream.close(); <END> }</code><technical_language>close fFileChannel in here. closing input streams closes it, a local reference close() for completion's sake (and future class-wide resource leak analyzers happy)</technical_language>

Target:
public void close() throws IOException { fFileChannel.close(); fFileInputStream.close(); }
Source:
<code>public CloseableIterator<Journal.JournalEntry> getJournalEntryIterator() { Journal.JournalEntry entry = Journal.JournalEntry.newBuilder().setUpdateDatabaseInfo( toJournalProto(getDatabaseInfo(), mName)).build(); return CloseableIterator.noopCloseable( Iterators.concat(Iterators.singletonIterator(entry), <START> getTableIterator(), getTablePartitionsIterator())); <END> }</code><technical_language>Is perfectly fine output tables individual partition batches</technical_language>

Target:
public CloseableIterator<Journal.JournalEntry> getJournalEntryIterator() { Journal.JournalEntry entry = Journal.JournalEntry.newBuilder().setUpdateDatabaseInfo( toJournalProto(getDatabaseInfo(), mName)).build(); return CloseableIterator.noopCloseable( Iterators.concat(Iterators.singletonIterator(entry), getTableIterator())); }
Source:
<code>public String getUuidProperty() { <START> return null; <END> }</code><technical_language>is this returning null instead of a uuid other resource tests</technical_language>

Target:
public String getUuidProperty() { return IDENTIFIER_SOURCE_UUID; }
Source:
<code><START> public void setReviewInput(ReviewInput reviewInput) { fReviewInput.setLabels(reviewInput.getLabels()); fReviewInput.setMessage(reviewInput.getMessage()); } <END></code><technical_language>fReviewInput = reviewInput</technical_language>

Target:
public void setReviewInput(ReviewInput reviewInput) { fReviewInput = reviewInput; }
Source:
<code><START> private PhysicalOperation createSpatialLookupJoin(JoinNode node, <END> PlanNode probeNode, Symbol probeSymbol, PlanNode buildNode, Symbol buildSymbol, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<Expression> joinFilter, LocalExecutionPlanContext context) { PhysicalOperation probeSource = probeNode.accept(this, context); PagesSpatialIndexFactory pagesSpatialIndexFactory = createPagesSpatialIndexFactory(node, buildNode, buildSymbol, probeSource.getLayout(), joinFilter, context); OperatorFactory operator = createSpatialLookupJoin(node, probeNode, probeSource, probeSymbol, pagesSpatialIndexFactory, spatialRelationshipTest, context); ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); List<Symbol> outputSymbols = node.getOutputSymbols(); for (int i = 0; i < outputSymbols.size(); i++) { Symbol symbol = outputSymbols.get(i); outputMappings.put(symbol, i); } return new PhysicalOperation(operator, outputMappings.build(), probeSource); }</code><technical_language>fmt: new line JoinNode node,</technical_language>

Target:
private PhysicalOperation createSpatialLookupJoin( JoinNode node, PlanNode probeNode, Symbol probeSymbol, PlanNode buildNode, Symbol buildSymbol, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<Expression> joinFilter, LocalExecutionPlanContext context) { PhysicalOperation probeSource = probeNode.accept(this, context); PagesSpatialIndexFactory pagesSpatialIndexFactory = createPagesSpatialIndexFactory(node, buildNode, buildSymbol, probeSource.getLayout(), spatialRelationshipTest, joinFilter, context); OperatorFactory operator = createSpatialLookupJoin(node, probeNode, probeSource, probeSymbol, pagesSpatialIndexFactory, context); ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); List<Symbol> outputSymbols = node.getOutputSymbols(); for (int i = 0; i < outputSymbols.size(); i++) { Symbol symbol = outputSymbols.get(i); outputMappings.put(symbol, i); } return new PhysicalOperation(operator, outputMappings.build(), probeSource); }
Source:
<code>public final void write() throws IOException { if ( !writeChecksumFile ) { return; } Timer.Context writeTimer = metricRegistry == null ? null : metricRegistry.timer( CHECKSUM_WRITE ).time(); try { logger.info( "Writing file: {}", checksumExtension, checksumTransfer ); <START> Timer.Context openTimer = metricRegistry == null ? null : metricRegistry.timer( CHECKSUM_WRITE ).time(); <END> try (PrintStream out = new PrintStream( checksumTransfer.openOutputStream( TransferOperation.GENERATE ) )) { openTimer.stop(); out.print( getDigestHex() ); } } finally { if ( writeTimer != null ) { writeTimer.stop(); } } }</code><technical_language>this CHECKSUM_WRITE_OPEN</technical_language>

Target:
public final void write() throws IOException { if ( !writeChecksumFile ) { return; } Timer.Context writeTimer = timerProvider.apply( CHECKSUM_WRITE ); try { logger.info( "Writing file: {}", checksumExtension, checksumTransfer ); Timer.Context openTimer = timerProvider.apply( CHECKSUM_WRITE_OPEN ); try (PrintStream out = new PrintStream( checksumTransfer.openOutputStream( TransferOperation.GENERATE ) )) { if ( openTimer != null ) { openTimer.stop(); } out.print( getDigestHex() ); } } finally { if ( writeTimer != null ) { writeTimer.stop(); } } }
Source:
<code>public void createSampleBoard(boolean isDialogShown) { logger.info("Creating " + SAMPLE_BOARD); panelControl.closeAllPanels(); List<PanelInfo> panelData = new ArrayList<>(); for (int i = 0; i < SAMPLE_PANEL_NAMES.size(); i++) { panelData.add(new PanelInfo(SAMPLE_PANEL_NAMES.get(i), SAMPLE_PANEL_FILTERS.get(i))); } createBoard(panelData, SAMPLE_BOARD); panelControl.selectPanel(0); triggerBoardSaveEventSequence(SAMPLE_BOARD); if (isDialogShown){ DialogMessage.showInformationDialog("Auto-create Board - " + SAMPLE_BOARD, SAMPLE_BOARD_DIALOG); <START> } <END> }</code><technical_language>do need a dialog here? New users this dialog</technical_language>

Target:
public void createSampleBoard(boolean isDialogShown) { logger.info("Creating " + SAMPLE_BOARD); panelControl.closeAllPanels(); List<PanelInfo> panelData = new ArrayList<>(); for (Map.Entry<String, String> entry : getSamplePanelDetails().entrySet()) { panelData.add(new PanelInfo(entry.getKey(), entry.getValue())); } createBoard(panelData, SAMPLE_BOARD); panelControl.selectPanel(0); triggerBoardSaveEventSequence(SAMPLE_BOARD); if (isDialogShown){ DialogMessage.showInformationDialog("Auto-create Board - " + SAMPLE_BOARD, SAMPLE_BOARD_DIALOG); } }
Source:
<code>public static byte[] encode(EhcacheEntityResponse response) { switch (response.getType()) { case FAILURE: Failure failure = (Failure)response; byte[] failureMsg = LifeCycleOpCodec.marshall(failure.getCause()); ByteBuffer buffer = ByteBuffer.allocate(OP_CODE_OFFSET + failureMsg.length); buffer.put(EhcacheEntityResponse.Type.FAILURE.getOpCode()); buffer.put(failureMsg); return buffer.array(); case SUCCESS: buffer = ByteBuffer.allocate(OP_CODE_OFFSET); buffer.put(EhcacheEntityResponse.Type.SUCCESS.getOpCode()); return buffer.array(); case GET_RESPONSE: GetResponse getResponse = (GetResponse)response; byte[] encodedChain = ChainCodec.encode(getResponse.getChain()); int chainLen = encodedChain.length; buffer = ByteBuffer.allocate(OP_CODE_OFFSET + chainLen); buffer.put(EhcacheEntityResponse.Type.GET_RESPONSE.getOpCode()); buffer.put(encodedChain); return buffer.array(); default: <START> throw new UnsupportedOperationException("The operation is not supported"); <END> } }</code><technical_language>please include more details EhcacheEntityResponse</technical_language>

Target:
public static byte[] encode(EhcacheEntityResponse response) { switch (response.getType()) { case FAILURE: Failure failure = (Failure)response; byte[] failureMsg = LifeCycleOpCodec.marshall(failure.getCause()); ByteBuffer buffer = ByteBuffer.allocate(OP_CODE_OFFSET + failureMsg.length); buffer.put(EhcacheEntityResponse.Type.FAILURE.getOpCode()); buffer.put(failureMsg); return buffer.array(); case SUCCESS: buffer = ByteBuffer.allocate(OP_CODE_OFFSET); buffer.put(EhcacheEntityResponse.Type.SUCCESS.getOpCode()); return buffer.array(); case GET_RESPONSE: GetResponse getResponse = (GetResponse)response; byte[] encodedChain = ChainCodec.encode(getResponse.getChain()); int chainLen = encodedChain.length; buffer = ByteBuffer.allocate(OP_CODE_OFFSET + chainLen); buffer.put(EhcacheEntityResponse.Type.GET_RESPONSE.getOpCode()); buffer.put(encodedChain); return buffer.array(); default: throw new UnsupportedOperationException("The operation is not supported : " + response.getType()); } }
Source:
<code>private void checkIfHostComponentsInDeleteFriendlyState(ServiceComponentHostRequest request, Cluster cluster) throws AmbariException { Service service = cluster.getService(request.getServiceName()); ServiceComponent component = service.getServiceComponent(request.getComponentName()); ServiceComponentHost componentHost = component.getServiceComponentHost(request.getHostname()); if (!componentHost.canBeRemoved()) { <START> throw new AmbariException("Host Component cannot be removede. Component in undeletable state." <END> + ", clusterName=" + request.getClusterName() + ", serviceName=" + request.getServiceName() + ", componentName=" + request.getComponentName() + ", hostname=" + request.getHostname() + ", request=" + request + ", currentState=" + componentHost.getState()); } }</code><technical_language>replace Current host component state prohibiting component removal</technical_language>

Target:
private void checkIfHostComponentsInDeleteFriendlyState(ServiceComponentHostRequest request, Cluster cluster) throws AmbariException { Service service = cluster.getService(request.getServiceName()); ServiceComponent component = service.getServiceComponent(request.getComponentName()); ServiceComponentHost componentHost = component.getServiceComponentHost(request.getHostname()); if (!componentHost.canBeRemoved()) { throw new AmbariException("Current host component state prohibiting component removal." + ", clusterName=" + request.getClusterName() + ", serviceName=" + request.getServiceName() + ", componentName=" + request.getComponentName() + ", hostname=" + request.getHostname() + ", request=" + request + ", state=" + componentHost.getState()); } }
Source:
<code>private void validateServiceComponent() { IHeader header = getHeader(ICoreConstants.SERVICE_COMPONENT); if (header == null) <START> return; <END> if (getHeader(Constants.BUNDLE_ACTIVATIONPOLICY) != null) return; report(PDECoreMessages.BundleErrorReporter_serviceComponentLazyStart, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_SERVICECOMPONENT_MISSING_LAZY, PDEMarkerFactory.CAT_OTHER); }</code><technical_language>New code brackets</technical_language>

Target:
private void validateServiceComponent() { IHeader header = getHeader(ICoreConstants.SERVICE_COMPONENT); if (header == null) { return; } if (getHeader(Constants.BUNDLE_ACTIVATIONPOLICY) != null) { return; } report(PDECoreMessages.BundleErrorReporter_serviceComponentLazyStart, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_SERVICECOMPONENT_MISSING_LAZY, PDEMarkerFactory.CAT_OTHER); }
Source:
<code>public void write(I aggregateId, Snapshot snapshot) { checkNotClosed(); checkNotNull(aggregateId); checkNotNull(snapshot); final AggregateStorageRecord record = AggregateStorageRecord.newBuilder() <START> .setTimestamp(checkIsPositive(snapshot.getTimestamp(), "Snapshot timestamp")) <END> .setEventType(SNAPSHOT_TYPE_NAME) .setEventId("") .setVersion(snapshot.getVersion()) .setSnapshot(snapshot) .build(); writeRecord(aggregateId, record); }</code><technical_language>checkIsPositive() in group of other preconditions start of method? a bit surprising here</technical_language>

Target:
public void write(I aggregateId, Snapshot snapshot) { checkNotClosed(); checkNotNull(aggregateId); checkNotNull(snapshot); final Timestamp timestamp = checkPositive(snapshot.getTimestamp(), "Snapshot timestamp"); final AggregateStorageRecord record = AggregateStorageRecord.newBuilder() .setTimestamp(timestamp) .setEventType(SNAPSHOT_TYPE_NAME) .setEventId("") .setVersion(snapshot.getVersion()) .setSnapshot(snapshot) .build(); writeRecord(aggregateId, record); }
Source:
<code>private Key generateKey() { try { KeyGenerator kgen = KeyGenerator.getInstance(CIPHER_ALGORITHM); kgen.init(128, new SecureRandom(toBytes(KEY))); SecretKey secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded(); return new SecretKeySpec(enCodeFormat, CIPHER_ALGORITHM); } catch (Exception e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>throw error? if null is returned</technical_language>

Target:
private Key generateKey() { try { KeyGenerator kgen = KeyGenerator.getInstance(CIPHER_ALGORITHM); kgen.init(128, new SecureRandom(toBytes(KEY))); SecretKey secretKey = kgen.generateKey(); byte[] enCodeFormat = secretKey.getEncoded(); return new SecretKeySpec(enCodeFormat, CIPHER_ALGORITHM); } catch (Exception e) { LOG.warn("Cannot generate key for decryption", e); } return null; }