auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.start(); startAcceptor(); <START> if (advancedNetworkingEnabled) { <END> if (metricsRegistryScheduled.compareAndSet(false, true)) { metricsRegistry.scheduleAtFixedRate(new RefreshNetworkStatsTask(), 1, SECONDS, ProbeLevel.INFO); } inboundNetworkStats.registerMetrics(metricsRegistry, "tcp.bytesReceived"); outboundNetworkStats.registerMetrics(metricsRegistry, "tcp.bytesSend"); } }</code><technical_language>I need this part</technical_language>

Target:
public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.start(); startAcceptor(); if (unifiedEndpointManager == null) { if (metricsRegistryScheduled.compareAndSet(false, true)) { metricsRegistry.scheduleAtFixedRate(new RefreshNetworkStatsTask(), 1, SECONDS, ProbeLevel.INFO); } aggregateEndpointManager.getInboundNetworkStats().registerMetrics(metricsRegistry, "tcp.bytesReceived"); aggregateEndpointManager.getOutboundNetworkStats().registerMetrics(metricsRegistry, "tcp.bytesSend"); } }
Source:
<code>public int getMaximumValue() { switch (relation) { case GREATER_THAN: case GREATER_THAN_OR_EQUAL: return Integer.MAX_VALUE; case LESS_THAN_OR_EQUAL: case EQUAL: return queryInt; case LESS_THAN: <START> if (queryInt == Integer.MIN_VALUE) { <END> return queryInt; } else { return queryInt - 1; } default: throw new IllegalStateException("Unknown relation " + relation); } }</code><technical_language>Ints.saturatedCast(queryInt - 1L);</technical_language>

Target:
public int getMaximumValue() { return range.max; }
Source:
<code>private <T> Task<Response<T>> createTaskWithTimeout(final String name, final Request<T> request, final RequestContext requestContext, RequestConfig config) { ConfigValue<Long> timeout = config.getTimeoutMs(); int configuredTimeout = timeout.getValue().intValue(); boolean hasPerRequestTimeout = hasRequestContextTimeout(requestContext); if (timeout.getValue() != null && timeout.getValue() > 0 && !hasPerRequestTimeout && _d2RequestTimeoutEnabled) { requestContext.putLocalAttr(R2Constants.REQUEST_TIMEOUT, configuredTimeout); requestContext.putLocalAttr(R2Constants.REQUEST_TIMEOUT_IGNORE_IF_HIGHER_THAN_DEFAULT, true); } Task<Response<T>> requestTask; if (RequestGroup.isBatchable(request, config)) { requestTask = createBatchableTask(name, request, requestContext, config); } else { requestTask = Task.async(name, () -> sendRequest(request, requestContext)); } <START> if (timeout.getValue() == null || timeout.getValue() <= 0 || hasPerRequestTimeout) { <END> return requestTask; } else { if (!_d2RequestTimeoutEnabled) { return withTimeout(requestTask, timeout); } else { String srcDesc = timeout.getSource().map(src -> " src: " + src).orElse(""); String timeoutTaskName = "withTimeout " + configuredTimeout + TimeUnitHelper.toString(TimeUnit.MILLISECONDS) + srcDesc; return withD2Timeout(requestTask, timeoutTaskName); } } }</code><technical_language>If request a timeout in requestContext parseq timeout is configured here, timeout request win. I enough context this feel natural</technical_language>

Target:
private <T> Task<Response<T>> createTaskWithTimeout(final String name, final Request<T> request, final RequestContext requestContext, RequestConfig config) { ConfigValue<Long> timeout = config.getTimeoutMs(); Task<Response<T>> requestTask; if (RequestGroup.isBatchable(request, config)) { requestTask = createBatchableTask(name, request, requestContext, config); } else { requestTask = Task.async(name, () -> sendRequest(request, requestContext)); } if (!needApplyTaskTimeout(requestContext, timeout)) { return requestTask; } else { return withTimeout(requestTask, timeout); } }
Source:
<code>protected void setDefaultProfileAttributes( <START> ILaunchConfigurationWorkingCopy wc) throws CoreException { <END> wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); }</code><technical_language>CoreException is actaully thrown this method body</technical_language>

Target:
protected void setDefaultProfileAttributes( ILaunchConfigurationWorkingCopy wc) { wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); }
Source:
<code>public SnippetType snippets() { <START> return annotation.snippets(); <END> }</code><technical_language>change this</technical_language>

Target:
public SnippetType snippets() { switch (annotation.snippets()) { case UNDERSCORE: return SnippetType.UNDERSCORE; case CAMELCASE: return SnippetType.CAMELCASE; default: throw new IllegalArgumentException("" + annotation.snippets()); } }
Source:
<code>private String getSourceMetricName(final String metricName, final RollupPeriod period) { Optional<RollupPeriod> sourcePeriod = period.nextSmallest(); while (sourcePeriod.isPresent() && !sourcePeriod.map(p -> _maxBackFillByPeriod.getOrDefault(p, 0) > 0).orElse(true)) { <START> sourcePeriod = sourcePeriod.flatMap(RollupPeriod::nextSmallest); <END> } return sourcePeriod.map(p -> getDestinationMetricName(metricName, p)).orElse(metricName); }</code><technical_language>Totally fair. Assuming behaved supported roll-ups enables 30min 1h? try 15min</technical_language>

Target:
private String getSourceMetricName(final String metricName, final RollupPeriod period) { Optional<RollupPeriod> sourcePeriod = period.nextSmallest(); while (sourcePeriod.isPresent() && _maxBackFillByPeriod.getOrDefault(sourcePeriod.get(), 0) == 0) { sourcePeriod = sourcePeriod.flatMap(RollupPeriod::nextSmallest); } return sourcePeriod.map(p -> getDestinationMetricName(metricName, p)).orElse(metricName); }
Source:
<code>public void process(Document document) { Element body = document.body(); CssParser cssParser = new CssParser(); for (Element element : Selector.select("[style]", body)) { String style = element.attr("style"); String newStyle = ""; List<CssRule> rules = null; CssRule newRule = null; if (style != null && style.length() > 0) { rules = cssParser.parseBlockContent(style); Iterator<CssRule> ruleIt = rules.iterator(); while (ruleIt.hasNext()) { CssRule rule = ruleIt.next(); if ("color".equals(rule.name)) { String color = rule.value; <START> Matcher invalidHexColorMatcher = Pattern.compile("^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$") END> .matcher(color); if (invalidHexColorMatcher.find()) { String newColor = "#" + color; ruleIt.remove(); newRule = new CssRule("color", newColor.trim(), 0, 0, 0, 0); } } } } if (rules != null && newRule != null) { newStyle = addRuleToStyle(newStyle, newRule); for (CssRule rule : rules) { newStyle = addRuleToStyle(newStyle, rule); } element.attr("style", newStyle); } } }</code><technical_language>this matcher subsequent code improved handle additional CSS markup !important</technical_language>

Target:
public void process(Document document) { Element body = document.body(); CssParser cssParser = new CssParser(); for (Element element : Selector.select("[style]", body)) { String style = element.attr("style"); String newStyle = ""; List<CssRule> rules = null; CssRule newRule = null; if (style != null && style.length() > 0) { rules = cssParser.parseBlockContent(style); Iterator<CssRule> ruleIt = rules.iterator(); while (ruleIt.hasNext()) { CssRule rule = ruleIt.next(); if ("color".equals(rule.name)) { String color = rule.value; Matcher invalidHexColorMatcher = Pattern.compile( "^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})(\\s+(!)\\s*important)?\\s*$") .matcher(color); if (invalidHexColorMatcher.find()) { String newColor = "#" + invalidHexColorMatcher.group(1); boolean importantExists = invalidHexColorMatcher.group(2) != null; if (importantExists) { newColor += " !important"; } ruleIt.remove(); newRule = new CssRule("color", newColor.trim(), 0, 0, 0, 0); } } } } if (rules != null && newRule != null) { newStyle = addRuleToStyle(newStyle, newRule); for (CssRule rule : rules) { newStyle = addRuleToStyle(newStyle, rule); } element.attr("style", newStyle); } } }
Source:
<code>protected void sql(String qry, @Nullable Predicate<List<List<?>>> validator) { List<List<?>> res = execSql(qry); if (validator != null) <START> validator.test(res); <END> }</code><technical_language>validation result is ignored. wrap Assert.assertTrue(). constants rows 115 118 changed long (0 -> 0L 1 -> 1L accordingly)</technical_language>

Target:
protected void sql(String qry, @Nullable Predicate<List<List<?>>> validator) { List<List<?>> res = execSql(qry); if (validator != null) Assert.assertTrue(validator.test(res)); }
Source:
<code>public String catalogName() { <START> return catalogName.names.get(0); <END> }</code><technical_language>suggestion return catalogName.getSimple();</technical_language>

Target:
public String catalogName() { return catalogName.getSimple(); }
Source:
<code>public IValueProperty convert(VDomainModelReference domainModelReference) { if (domainModelReference == null) { throw new IllegalArgumentException("The given VDomainModelReference must not be null."); } <START> if (!(domainModelReference instanceof VFeaturePathDomainModelReference)) { <END> throw new IllegalArgumentException( "domainModelReference must be instance of VFeaturePathDomainModelReference."); } final VFeaturePathDomainModelReference featurePathReference = (VFeaturePathDomainModelReference) domainModelReference; final List<EReference> referencePath = featurePathReference.getDomainModelEReferencePath(); if (referencePath.isEmpty()) { return EMFProperties.value(featurePathReference.getDomainModelEFeature()); } IEMFValueProperty emfValueProperty = EMFProperties.value(referencePath.get(0)); for (int i = 1; i < referencePath.size(); i++) { emfValueProperty = emfValueProperty.value(referencePath.get(i)); } return emfValueProperty.value(featurePathReference.getDomainModelEFeature()); }</code><technical_language>wouldn't: !VFeaturePathDomainModelReference.class.isInstance(domainModelReference) more readable !(...)</technical_language>

Target:
public IValueProperty convert(VDomainModelReference domainModelReference) { if (domainModelReference == null) { throw new IllegalArgumentException("The given VDomainModelReference must not be null."); } if (!VFeaturePathDomainModelReference.class.isInstance(domainModelReference)) { throw new IllegalArgumentException( "DomainModelReference must be an instance of VFeaturePathDomainModelReference."); } final VFeaturePathDomainModelReference featurePathReference = (VFeaturePathDomainModelReference) domainModelReference; final List<EReference> referencePath = featurePathReference.getDomainModelEReferencePath(); if (referencePath.isEmpty()) { return EMFProperties.value(featurePathReference.getDomainModelEFeature()); } IEMFValueProperty emfValueProperty = EMFProperties.value(referencePath.get(0)); for (int i = 1; i < referencePath.size(); i++) { emfValueProperty = emfValueProperty.value(referencePath.get(i)); } return emfValueProperty.value(featurePathReference.getDomainModelEFeature()); }
Source:
<code><START> private boolean useLatestSnapshotIfWithinDelay() <END> { DatabasePoll latestDatabasePoll = this.latestDatabasePoll; if (latestDatabasePoll instanceof PeriodicDatabasePoll) { Futures.getUnchecked(((PeriodicDatabasePoll) latestDatabasePoll).firstPollCompletionFuture); return true; } if (latestDatabasePoll instanceof OnDemandDatabasePoll) { long periodicPollDelayNanos = TimeUnit.MILLISECONDS.toNanos(periodicPollDelay.getMillis()); OnDemandDatabasePoll latestOnDemandPoll = (OnDemandDatabasePoll) latestDatabasePoll; boolean latestDatabasePollIsFresh = latestOnDemandPoll.nanosElapsedFromInitiation() < periodicPollDelayNanos; if (latestDatabasePollIsFresh) { Futures.getUnchecked(latestOnDemandPoll.pollCompletionFuture); return true; } } else { assert latestDatabasePoll == null; } return false; }</code><technical_language>nit: i name better, works new method named forceOrWaitOngoingDatabasePoll</technical_language>

Target:
boolean useLatestSnapshotIfWithinDelay() { DatabasePoll latestDatabasePoll = this.latestDatabasePoll; if (latestDatabasePoll instanceof PeriodicDatabasePoll) { Futures.getUnchecked(((PeriodicDatabasePoll) latestDatabasePoll).firstPollCompletionFuture); return true; } if (latestDatabasePoll instanceof OnDemandDatabasePoll) { long periodicPollDelayNanos = TimeUnit.MILLISECONDS.toNanos(periodicPollDelay.getMillis()); OnDemandDatabasePoll latestOnDemandPoll = (OnDemandDatabasePoll) latestDatabasePoll; boolean latestDatabasePollIsFresh = latestOnDemandPoll.nanosElapsedFromInitiation() < periodicPollDelayNanos; if (latestDatabasePollIsFresh) { Futures.getUnchecked(latestOnDemandPoll.pollCompletionFuture); return true; } } else { assert latestDatabasePoll == null; } return false; }
Source:
<code><START> public void testRemoveCacheCommandInNonOOB() throws Exception { <END> CacheRpcCommand command = new RemoveCacheCommand(cacheName, null, null, null); log.debugf("Testing " + command.getClass().getCanonicalName()); Message nonOobRequest = serialize(command, false); if (nonOobRequest == null) { log.debugf("Don't test " + command.getClass() + ". it is not Serializable"); return; } executorService.reset(); commandAwareRpcDispatcher.handle(nonOobRequest, null); Assert.assertEquals(executorService.hasExecutedCommand, command.isProcessedAsynchronously(), "Command " + command.getClass() + " dispatched wrongly."); }</code><technical_language>testRemoveCacheCommandInRegularThread? Edit: thinking some more, sound better..</technical_language>

Target:
public void testRemoveCacheCommandInNonOOB() throws Exception { CacheRpcCommand command = new RemoveCacheCommand(cacheName, null, null, null); log.debugf("Testing " + command.getClass().getCanonicalName()); Message nonOobRequest = serialize(command, false); if (nonOobRequest == null) { log.debugf("Don't test " + command.getClass() + ". it is not Serializable"); return; } executorService.reset(); commandAwareRpcDispatcher.handle(nonOobRequest, null); Assert.assertFalse(executorService.hasExecutedCommand, "Command " + command.getClass() + " dispatched wrongly."); }
Source:
<code>public Optional<MongoCodeListEntry> tryFind(Context data) { <START> if (data.containsKey(MongoCodeListEntry.ID.getName())) { <END> return mango.select(MongoCodeListEntry.class) .eq(MongoCodeListEntry.ID, data.getValue(MongoUserAccount.ID.getName()).asString()) .one(); } if (data.containsKey(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE).getName()) && data.containsKey(MongoCodeListEntry.CODE_LIST.getName())) { return mango.select(MongoCodeListEntry.class) .eq(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE), data.getValue(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE) .getName())) .eq(MongoCodeListEntry.CODE_LIST, data.getValue(MongoCodeListEntry.CODE_LIST.getName())) .one(); } return Optional.empty(); }</code><technical_language>s.a</technical_language>

Target:
public Optional<MongoCodeListEntry> tryFind(Context data) { if (data.containsKey(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE).getName()) && data.containsKey(MongoCodeListEntry.CODE_LIST.getName())) { return mango.select(MongoCodeListEntry.class) .eq(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE), data.getValue(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE) .getName())) .eq(MongoCodeListEntry.CODE_LIST, data.getValue(MongoCodeListEntry.CODE_LIST.getName())) .one(); } return Optional.empty(); }
Source:
<code>public boolean isAccelerometerNotifying() { TiSensorTagGattResources resource; if (this.isCC2650()) { resource = this.gattResources.get(MOVEMENT); <START> if (resource != null) { <END> return resource.getGattValueCharacteristic().isNotifying(); } else { return false; } } else { resource = this.gattResources.get(ACCELEROMETER); if (resource != null) { return resource.getGattValueCharacteristic().isNotifying(); } else { return false; } } }</code><technical_language>in branches of if, I put of if</technical_language>

Target:
public boolean isAccelerometerNotifying() { if (this.isCC2650()) { return isNotifying(MOVEMENT); } else { return isNotifying(ACCELEROMETER); } }
Source:
<code>public void beforeClass(final @Optional Boolean usingEncryption, final @Optional String testType) throws IOException { <START> if (testType.equals("buckets")) { <END> throw new SkipException("Directory tests will be skipped in Manta Buckets"); } config = new IntegrationTestConfigContext(); final String testName = this.getClass().getSimpleName(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePathWithoutSeparator(config, testName); }</code><technical_language>testType null, invert equals() check so: java if ("buckets".equals(testType)) {</technical_language>

Target:
public void beforeClass(final @Optional Boolean usingEncryption, final @Optional String testType) throws IOException { if ("buckets".equals(testType)) { throw new SkipException("Directory tests will be skipped in Manta Buckets"); } config = new IntegrationTestConfigContext(); final String testName = this.getClass().getSimpleName(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePathWithoutSeparator(config, testName); }
Source:
<code>public void updateIndexes(List<LookupDto> indexes) { Iterator<Lookup> it = getLookups().iterator(); while (it.hasNext()) { Lookup lookup = it.next(); boolean inNewList = false; for (LookupDto lookupDto : indexes) { if (Objects.equals(lookup.getId(), lookupDto.getId())) { inNewList = true; break; } } if (!inNewList) { it.remove(); } } for (LookupDto lookupDto : indexes) { Lookup lookup = getLookupById(lookupDto.getId()); List<Field> lookupFields = new ArrayList<>(); List<String> lookupFieldsOrder = new ArrayList<>(); for (LookupFieldDto lookupField : lookupDto.getLookupFields()) { Field field = getField(lookupField.getId()); if (!lookupFields.contains(field)) { lookupFields.add(field); } String lookupFieldName = LookupName.buildLookupFieldName(field.getName(), lookupField.getRelatedName()); lookupFieldsOrder.add(lookupFieldName); <START> if(lookupField.getName() != field.getName()) { <END> lookupField.setName(lookupFieldName); } } lookupDto.setFieldsOrder(lookupFieldsOrder); if (lookup == null) { Lookup newLookup = new Lookup(lookupDto, lookupFields); addLookup(newLookup); } else { lookup.update(lookupDto, lookupFields); } } }</code><technical_language>this happen</technical_language>

Target:
public void updateIndexes(List<LookupDto> indexes) { Iterator<Lookup> it = getLookups().iterator(); while (it.hasNext()) { Lookup lookup = it.next(); boolean inNewList = false; for (LookupDto lookupDto : indexes) { if (Objects.equals(lookup.getId(), lookupDto.getId())) { inNewList = true; break; } } if (!inNewList) { it.remove(); } } for (LookupDto lookupDto : indexes) { Lookup lookup = getLookupById(lookupDto.getId()); List<Field> lookupFields = new ArrayList<>(); List<String> lookupFieldsOrder = new ArrayList<>(); for (LookupFieldDto lookupField : lookupDto.getLookupFields()) { Field field = getField(lookupField.getId()); if (!lookupFields.contains(field)) { lookupFields.add(field); } String lookupFieldName = LookupName.buildLookupFieldName(field.getName(), lookupField.getRelatedName()); lookupFieldsOrder.add(lookupFieldName); lookupField.setName(lookupFieldName); } lookupDto.setFieldsOrder(lookupFieldsOrder); if (lookup == null) { Lookup newLookup = new Lookup(lookupDto, lookupFields); addLookup(newLookup); } else { lookup.update(lookupDto, lookupFields); } } }
Source:
<code>public ValueMatcher makeValueMatcher(final BaseLongColumnValueSelector selector, final String value) { final Long matchVal = DimensionHandlerUtils.convertObjectToLong(value); if (matchVal == null) { <START> return new ValueMatcher() <END> { @Override public boolean matches() { return selector.isNull(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; } final long matchValLong = matchVal; return new ValueMatcher() { @Override public boolean matches() { return selector.getLong() == matchValLong; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; }</code><technical_language>Identical code appears in variants (Long, Double Float), extracted utility ValueMatcher</technical_language>

Target:
public ValueMatcher makeValueMatcher(final BaseLongColumnValueSelector selector, final String value) { final Long matchVal = DimensionHandlerUtils.convertObjectToLong(value); if (matchVal == null) { return ValueMatcher.nullValueMatcher(selector); } final long matchValLong = matchVal; return new ValueMatcher() { @Override public boolean matches() { return selector.getLong() == matchValLong; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; }
Source:
<code>public <V> void execute(final Callback<V> callback) { checkNotNull("callback", callback); if (clipboardControl.hasElements()) { final CompositeCommandBuilder<AbstractCanvasHandler, CanvasViolation> commandBuilder = new CompositeCommandBuilder<>(); commandBuilder.addCommands(clipboardControl.getElements().stream() .filter(element -> element instanceof Node) .map(Element::asNode) .filter(Objects::nonNull) .map(node -> (Node<View<?>, Edge>) node) .map(node -> { String newParentUUID = getNewParentUUID(node); return canvasCommandFactory.cloneNode(node, newParentUUID, calculateNewLocation(node, newParentUUID), cloneNodeCallback()); }) .collect(Collectors.toList())); if (Objects.equals(commandBuilder.size(), 0)) { return; } final CommandResult<CanvasViolation> result = sessionCommandManager.execute(getCanvasHandler(), commandBuilder.build()); if (CommandUtils.isError(result)) { LOGGER.severe("Error pasting selection " + CommandUtils.toList(result.getViolations())); <START> callback.onError(null); <END> return; } fireSelectedElementEvent(); callback.onSuccess(); } }</code><technical_language>this implementation ask error state of Copy/Paste/Cut command execution is handled slightly differently. is wrong, I interested</technical_language>

Target:
public <V> void execute(final Callback<V> callback) { checkNotNull("callback", callback); if (clipboardControl.hasElements()) { final CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation> commandBuilder = new CompositeCommand.Builder<>(); commandBuilder.addCommands(clipboardControl.getElements().stream() .filter(element -> element instanceof Node) .map(Element::asNode) .filter(Objects::nonNull) .map(node -> (Node<View<?>, Edge>) node) .map(node -> { String newParentUUID = getNewParentUUID(node); return canvasCommandFactory.cloneNode(node, newParentUUID, calculateNewLocation(node, newParentUUID), cloneNodeCallback()); }) .collect(Collectors.toList())); if (Objects.equals(commandBuilder.size(), 0)) { return; } final CommandResult<CanvasViolation> result; if(wasNodesDeletedFromGraph()){ clipboardControl.getRollbackCommands().forEach(command -> command.undo(getCanvasHandler())); result = sessionCommandManager.execute(getCanvasHandler(), commandBuilder.build()); clipboardControl.getRollbackCommands().forEach(command -> command.execute(getCanvasHandler())); }else { result = sessionCommandManager.execute(getCanvasHandler(), commandBuilder.build()); } if (CommandUtils.isError(result)) { LOGGER.severe("Error on paste selection." + getCanvasViolations(result)); return; } fireSelectedElementEvent(); callback.onSuccess(); clear(); copySelectionSessionCommand.execute(); } }
Source:
<code>public void go() throws Exception; } <START> public static interface MIDExpectation { <END> public boolean expectMID(Message message); }</code><technical_language>camel case: MidExpectation</technical_language>

Target:
public void go() throws Exception; } public static interface MidExpectation { public boolean expectMID(Message message); }
Source:
<code>public String getSecIpsString() { final StringBuilder sb = new StringBuilder(); final List<String> ips = getSecIps(); if (ips == null) { <START> sb.append("0;"); <END> } else { for (final String ip : ips) { sb.append(ip).append(RULE_COMMAND_SEPARATOR); } } return sb.toString(); }</code><technical_language>RULE_COMMAND_SEPARATOR</technical_language>

Target:
public String getSecIpsString() { final StringBuilder sb = new StringBuilder(); final List<String> ips = getSecIps(); if (ips == null) { sb.append("0").append(RULE_COMMAND_SEPARATOR); } else { for (final String ip : ips) { sb.append(ip).append(RULE_COMMAND_SEPARATOR); } } return sb.toString(); }
Source:
<code>private void confirmSSLCertificateDialog() { try { log.info(this.cdk3 ? "CDK3 server adapter has extended timeout set to 720s" : "CDK 2.x server adapter has timeout set to 300s"); <START> new WaitUntil(new ShellIsAvailable(SSL_DIALOG_NAME), this.cdk3 ? TimePeriod.getCustom(720) : TimePeriod.getCustom(300)); <END> new DefaultShell(SSL_DIALOG_NAME); new PushButton("Yes").click(); log.info("SSL Certificate Dialog appeared during " + this.getLabel().getState().toString()); new WaitWhile(new ShellIsAvailable(SSL_DIALOG_NAME)); setCertificateAccepted(true); } catch (WaitTimeoutExpiredException ex) { String message ="WaitTimeoutExpiredException occured when handling Certificate dialog. " + "Dialog has not been shown"; log.error(message); throw new CDKServerException(message, ex); } }</code><technical_language>is reason custom timeouts here? understand..</technical_language>

Target:
private void confirmSSLCertificateDialog() { try { log.info(this.isCDK3() ? "CDK3 server adapter has extended timeout set to 720s" : "CDK 2.x server adapter has timeout set to 300s"); new WaitUntil(new ShellIsAvailable(SSL_DIALOG_NAME), this.isCDK3() ? TimePeriod.getCustom(720) : TimePeriod.VERY_LONG); new DefaultShell(SSL_DIALOG_NAME); new PushButton("Yes").click(); log.info("SSL Certificate Dialog appeared during " + this.getLabel().getState().toString()); new WaitWhile(new ShellIsAvailable(SSL_DIALOG_NAME)); setCertificateAccepted(true); } catch (WaitTimeoutExpiredException ex) { String message ="WaitTimeoutExpiredException occured when handling Certificate dialog. " + "Dialog has not been shown"; log.error(message); throw new CDKServerException(message, ex); } }
Source:
<code>public void should_return_endpoints_with_actuator_default_context_path_different_port() { contextRunner.withConfiguration(UserConfigurations.of(EndpointConfig.class)) .withPropertyValues("management.endpoint.health.enabled=true", "management.endpoint.info.enabled=true", "management.endpoints.web.exposure.include=info,health", <START> "management.servet.port=0", "server.servlet.context-path=foo") <END> .run(context -> { SkipPatternProvider skipPatternProvider = context .getBean(SkipPatternProvider.class); Pattern pattern = skipPatternProvider.skipPattern(); then(pattern.pattern()) .contains("/actuator/(health|health/.*|info|info/.*)"); }); }</code><technical_language>This is in a places. suggestion "management.server.port=0", "server.servlet.context-path=foo")</technical_language>

Target:
public void should_return_endpoints_with_actuator_default_context_path_different_port() { contextRunner.withConfiguration(UserConfigurations.of(ServerPropertiesConfig.class)) .withPropertyValues("management.server.port=0", "server.servlet.context-path=foo") .run(context -> { then(extractAllPatterns(context)).containsExactlyInAnyOrder( "/actuator/(health|health/.*|info|info/.*)", SleuthWebProperties.DEFAULT_SKIP_PATTERN); }); }
Source:
<code>public IntegerCopyNumberTransitionMatrixCollection cloneWithPaddedStates() { final IntegerCopyNumberTransitionMatrixCollection newCollection = new IntegerCopyNumberTransitionMatrixCollection(); if (!sexGenotypeAndContigToTransitionMatrixMap.isEmpty()) { final int highestCopyNumber = sexGenotypeAndContigToTransitionMatrixMap.values().stream() .mapToInt(IntegerCopyNumberTransitionMatrixData::getMaxCopyNumber) .max().getAsInt(); sexGenotypeAndContigToTransitionMatrixMap.keySet().stream() .forEach(key -> { <START> final IntegerCopyNumberTransitionMatrixData dat = sexGenotypeAndContigToTransitionMatrixMap.get(key); <END> newCollection.add(key.getSexGenotype(), key.getContig(), new IntegerCopyNumberTransitionMatrixData(dat.getTransitionMatrix(), highestCopyNumber - dat.getMaxCopyNumber())); }); } return newCollection; }</code><technical_language>dat -> data (unless rename IntegerCopyNumberTransitionMatrixData -> IntegerCopyNumberTransitionMatrix suggested)</technical_language>

Target:
public IntegerCopyNumberTransitionMatrixCollection cloneWithPaddedStates() { final IntegerCopyNumberTransitionMatrixCollection newCollection = new IntegerCopyNumberTransitionMatrixCollection(); if (!sexGenotypeAndContigToTransitionMatrixMap.isEmpty()) { final int highestCopyNumber = sexGenotypeAndContigToTransitionMatrixMap.values().stream() .mapToInt(IntegerCopyNumberTransitionMatrix::getMaxCopyNumber) .max().getAsInt(); sexGenotypeAndContigToTransitionMatrixMap.keySet() .forEach(key -> { final IntegerCopyNumberTransitionMatrix transitionMatrix = sexGenotypeAndContigToTransitionMatrixMap.get(key); newCollection.add(key.getSexGenotype(), key.getContig(), new IntegerCopyNumberTransitionMatrix(transitionMatrix.getTransitionMatrix(), highestCopyNumber - transitionMatrix.getMaxCopyNumber())); }); } return newCollection; }
Source:
<code>public DiscussionThreadViewHolder(View itemView) { super(itemView); threadTitleTextView = (TextView) itemView. findViewById(R.id.discussion_responses_thread_row_title_text_view); threadBodyTextView = (TextView) itemView. findViewById(R.id.discussion_responses_thread_row_body_text_view); threadVisibilityTextView = (TextView) itemView. findViewById(R.id.discussion_responses_thread_row_visibility_text_view); <START> actionsBar = itemView.findViewById(R.id.discussion_actions_bar); <END> authorLayoutViewHolder = new AuthorLayoutViewHolder(itemView.findViewById(R.id.discussion_user_profile_row)); numberResponsesViewHolder = new NumberResponsesViewHolder(itemView); socialLayoutViewHolder = new DiscussionSocialLayoutViewHolder(itemView); discussionReportViewHolder = new DiscussionReportViewHolder(itemView); }</code><technical_language>This start of views, root. Similarly in other view holders</technical_language>

Target:
public DiscussionThreadViewHolder(View itemView) { super(itemView); actionsBar = itemView.findViewById(R.id.discussion_actions_bar); threadTitleTextView = (TextView) itemView. findViewById(R.id.discussion_responses_thread_row_title_text_view); threadBodyTextView = (TextView) itemView. findViewById(R.id.discussion_responses_thread_row_body_text_view); threadVisibilityTextView = (TextView) itemView. findViewById(R.id.discussion_responses_thread_row_visibility_text_view); authorLayoutViewHolder = new AuthorLayoutViewHolder(itemView.findViewById(R.id.discussion_user_profile_row)); numberResponsesViewHolder = new NumberResponsesViewHolder(itemView); socialLayoutViewHolder = new DiscussionSocialLayoutViewHolder(itemView); discussionReportViewHolder = new DiscussionReportViewHolder(itemView); }
Source:
<code><START> private void addOrUpdateDayTruncatedActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) <END> { Date minEndTime = new Date(payload.startTime.getTime() - yonaProperties.getAnalysisService().getConflictInterval()); DayActivity dayActivity = getCachedDayActivity(payload, userAnonymized, matchingGoal); Activity activity = dayActivity == null ? null : dayActivity.getLastActivity(); if (activity == null || activity.getEndTime().before(minEndTime)) { addActivity(payload, userAnonymized, matchingGoal, dayActivity); } else if (payload.endTime.getTime() - activity.getEndTime().getTime() >= yonaProperties.getAnalysisService() .getUpdateSkipWindow() || payload.startTime.before(activity.getStartTime())) { updateActivity(payload, userAnonymized, matchingGoal, dayActivity, activity); } }</code><technical_language>Propose refactor this method move nitty gritty details separate methods: private void addOrUpdateDayTruncatedActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { DayActivity dayActivity = getCachedDayActivity(payload, userAnonymized, matchingGoal); Activity lastRegisteredActivity = dayActivity == null ? null : dayActivity.getLastActivity(); if (isInIntervalWithLastRegisteredActivity(lastRegisteredActivity, payload)) { addActivity(payload, userAnonymized, matchingGoal, dayActivity); } else if (isBeyondSkipWindowAfterLastRegisteredActivity(lastRegisteredActivity, payload)) { updateActivity(payload, userAnonymized, matchingGoal, dayActivity, lastRegisteredActivity); } } private boolean isBeyondSkipWindowAfterLastRegisteredActivity(Activity lastRegisteredActivity, ActivityPayload payload) { return payload.endTime.getTime() - lastRegisteredActivity.getEndTime().getTime() >= yonaProperties.getAnalysisService() .getUpdateSkipWindow() || payload.startTime.before(lastRegisteredActivity.getStartTime()); } private boolean isInIntervalWithLastRegisteredActivity(Activity lastRegisteredActivity, ActivityPayload payload) { Date minEndTime = new Date(payload.startTime.getTime() - yonaProperties.getAnalysisService().getConflictInterval()); return lastRegisteredActivity == null || lastRegisteredActivity.getEndTime().before(minEndTime); }</technical_language>

Target:
private void addOrUpdateDayTruncatedActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { DayActivityCacheResult dayActivity = getRegisteredDayActivity(payload, userAnonymized, matchingGoal); Activity lastRegisteredActivity = dayActivity.content == null ? null : dayActivity.content.getLastActivity(); if (canCombineWithLastRegisteredActivity(payload, lastRegisteredActivity)) { if (isBeyondSkipWindowAfterLastRegisteredActivity(payload, lastRegisteredActivity)) { updateActivityEndTime(payload, userAnonymized, matchingGoal, dayActivity, lastRegisteredActivity); } } else { addActivity(payload, userAnonymized, matchingGoal, dayActivity); } }
Source:
<code>public @Nullable <START> LatencyAnalysis getAnalysisModule() <END> { return fAnalysisModule; }</code><technical_language>TmfAbstractLatencyAnalysis</technical_language>

Target:
public @Nullable TmfAbstractLatencyAnalysis getAnalysisModule() { return fAnalysisModule; }
Source:
<code>public AccountService getAccountService() { try { long startTimeMs = System.currentTimeMillis(); logger.info("Starting a HelixAccountService"); HelixPropertyStore<ZNRecord> helixStore = <START> ClusterMapUtils.createHelixPropertyStore(accountServiceConfig.zkClientConnectString, storeConfig, null); <END> logger.info("HelixPropertyStore started with zkClientConnectString={}, zkClientSessionTimeoutMs={}, " + "zkClientConnectionTimeoutMs={}, rootPath={}", accountServiceConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, storeConfig.rootPath); ScheduledExecutorService scheduler = accountServiceConfig.updaterPollingIntervalMs > 0 ? Utils.newScheduler(1, HELIX_ACCOUNT_UPDATER_PREFIX, false) : null; HelixAccountService helixAccountService = new HelixAccountService(helixStore, accountServiceMetrics, notifier, scheduler, accountServiceConfig); long spentTimeMs = System.currentTimeMillis() - startTimeMs; logger.info("HelixAccountService started, took ms", spentTimeMs); accountServiceMetrics.startupTimeInMs.update(spentTimeMs); return helixAccountService; } catch (Exception e) { throw new IllegalStateException("Could not instantiate HelixAccountService", e); } }</code><technical_language>AccountService is exposed ClusterMap. Is this right do? (I remember if this discussed)</technical_language>

Target:
public AccountService getAccountService() { try { long startTimeMs = System.currentTimeMillis(); logger.info("Starting a HelixAccountService"); HelixPropertyStore<ZNRecord> helixStore = CommonUtils.createHelixPropertyStore(accountServiceConfig.zkClientConnectString, storeConfig, null); logger.info("HelixPropertyStore started with zkClientConnectString={}, zkClientSessionTimeoutMs={}, " + "zkClientConnectionTimeoutMs={}, rootPath={}", accountServiceConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, storeConfig.rootPath); ScheduledExecutorService scheduler = accountServiceConfig.updaterPollingIntervalMs > 0 ? Utils.newScheduler(1, HELIX_ACCOUNT_UPDATER_PREFIX, false) : null; HelixAccountService helixAccountService = new HelixAccountService(helixStore, accountServiceMetrics, notifier, scheduler, accountServiceConfig); long spentTimeMs = System.currentTimeMillis() - startTimeMs; logger.info("HelixAccountService started, took ms", spentTimeMs); accountServiceMetrics.startupTimeInMs.update(spentTimeMs); return helixAccountService; } catch (Exception e) { throw new IllegalStateException("Could not instantiate HelixAccountService", e); } }
Source:
<code>public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); try { boolean visible = waypoint != null && waypoint.getCoords() != null; menu.findItem(MENU_ID_NAVIGATION).setVisible(visible); menu.findItem(MENU_ID_DEFAULT_NAVIGATION).setVisible(visible); menu.findItem(MENU_ID_CACHES_AROUND).setVisible(visible); <START> boolean openGeocache = StringUtils.isEmpty(geocode) && !StringUtils.isEmpty(waypoint.getGeocode()); <END> menu.findItem(MENU_ID_OPEN_GEOCACHE).setVisible(openGeocache); } catch (Exception e) { } return true; }</code><technical_language>a hint: a isNotEmpty()-method</technical_language>

Target:
public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); try { boolean visible = waypoint != null && waypoint.getCoords() != null; menu.findItem(MENU_ID_NAVIGATION).setVisible(visible); menu.findItem(MENU_ID_DEFAULT_NAVIGATION).setVisible(visible); menu.findItem(MENU_ID_CACHES_AROUND).setVisible(visible); boolean openGeocache = StringUtils.isEmpty(geocode) && StringUtils.isNotEmpty(waypoint.getGeocode()); menu.findItem(MENU_ID_OPEN_GEOCACHE).setVisible(openGeocache); } catch (Exception e) { } return true; }
Source:
<code>private void createHelloWorldIfEligible(Module module) { ModuleRootManager rootManager = ModuleRootManager.getInstance(module); VirtualFile[] srcDirs = rootManager.getSourceRoots(); VirtualFile[] rootDirs = rootManager.getContentRoots(); if(rootDirs.length != 1 || srcDirs.length != 1) { return; } VirtualFile root = rootDirs[0]; VirtualFile src = srcDirs[0]; if(src.getChildren().length != 0) { return; } for(VirtualFile item:root.getChildren()) { if(item.getExtension() == "hxml") { return; } } ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { try { VirtualFile mainHx = src.createChildData(this, "Main.hx"); String mainHxSource = "class Main {\n" + " static public function main() {\n" + " trace(\"Hello, world!\");\n" + " }\n" + "}\n"; mainHx.setBinaryContent(mainHxSource.getBytes(StandardCharsets.UTF_8)); VirtualFile buildHxml = root.createChildData(this, "build.hxml"); String buildHxmlSource = "-cp src\n" + "-D analyzer-optimize\n" + "-main Main\n" + "--interp"; buildHxml.setBinaryContent(buildHxmlSource.getBytes(StandardCharsets.UTF_8)); createDefaultRunConfiguration(module, buildHxml.getPath()); FileEditorManager editorManager = FileEditorManager.getInstance(module.getProject()); editorManager.openFile(mainHx, true); } catch (IOException e) { } } }); <START> LOG.debug("Hey"); <END> }</code><technical_language>want leave this log in. log line in file, need LOG variable created top of this class</technical_language>

Target:
private void createHelloWorldIfEligible(Module module) { ModuleRootManager rootManager = ModuleRootManager.getInstance(module); VirtualFile[] srcDirs = rootManager.getSourceRoots(); VirtualFile[] rootDirs = rootManager.getContentRoots(); if(rootDirs.length != 1 || srcDirs.length != 1) { return; } VirtualFile root = rootDirs[0]; VirtualFile src = srcDirs[0]; if(src.getChildren().length != 0) { return; } for(VirtualFile item:root.getChildren()) { if(item.getExtension() == "hxml") { return; } } ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { try { VirtualFile mainHx = src.createChildData(this, "Main.hx"); String mainHxSource = "class Main {\n" + " static public function main() {\n" + " trace(\"Hello, world!\");\n" + " }\n" + "}\n"; mainHx.setBinaryContent(mainHxSource.getBytes(StandardCharsets.UTF_8)); VirtualFile buildHxml = root.createChildData(this, "build.hxml"); String buildHxmlSource = "-cp src\n" + "-D analyzer-optimize\n" + "-main Main\n" + "--interp"; buildHxml.setBinaryContent(buildHxmlSource.getBytes(StandardCharsets.UTF_8)); createDefaultRunConfiguration(module, buildHxml.getPath()); FileEditorManager editorManager = FileEditorManager.getInstance(module.getProject()); editorManager.openFile(mainHx, true); } catch (IOException e) { } } }); }
Source:
<code>public static boolean isAppleJDK() { <START> return JAVA_VM_VENDOR.toUpperCase().contains("apple"); <END> }</code><technical_language>toLowerCase</technical_language>

Target:
public static boolean isAppleJDK() { return JAVA_VM_VENDOR.toLowerCase().contains("apple"); }
Source:
<code>public static TransformersSubRegistration register(TransformationDescription description, SubsystemTransformerRegistration registration, ModelVersionRange range) { <START> final TransformersSubRegistration subRegistration = registration.registerModelTransformers(range, description.getResourceTransformer(), <END> description.getOperationTransformer(), description.isPlaceHolder()); for (final Map.Entry<String, OperationTransformer> entry : description.getOperationTransformers().entrySet()) { subRegistration.registerOperationTransformer(entry.getKey(), entry.getValue()); } for (final TransformationDescription child : description.getChildren()) { register(child, subRegistration); } subRegistration.discardOperations(description.getDiscardedOperations().toArray(new String[description.getDiscardedOperations().size()])); return subRegistration; }</code><technical_language>some wrapper registration avoid code duplication other register() method</technical_language>

Target:
public static TransformersSubRegistration register(TransformationDescription description, SubsystemTransformerRegistration registration, ModelVersionRange range) { final TransformersSubRegistration subRegistration = registration.registerModelTransformers(range, description.getResourceTransformer(), description.getOperationTransformer(), description.isPlaceHolder()); return getTransformersSubRegistration(description, subRegistration); }
Source:
<code>private Iterable<List<Episode>> getAsEpisodes(Iterable<List<Programme>> programmes) { <START> Iterable<List<Programme>> filteredProgrammes = Iterables.transform( <END> programmes, IS_EPISODES_LIST ); return Iterables.transform( filteredProgrammes, TO_EPISODES_LIST ); }</code><technical_language>filteredProgrammes is a bad name for this, I tell, Episodes, Programmes now</technical_language>

Target:
private Iterable<List<Episode>> getAsEpisodes(Iterable<List<Programme>> programmes) { Iterable<List<Programme>> episodes = Iterables.transform( programmes, isEpisodesList() ); return Iterables.transform( episodes, toEpisodesList() ); }
Source:
<code>public URL publicUrlForFilePath(final FilePath filePath) throws NonExistentItemException { <START> return amazonS3Client.generatePresignedUrl(bucketNameForFilePath(filePath), filePath.filename(), new DateTime() <END> .plusHours(1).toDate(), HttpMethod.GET); }</code><technical_language>DateTime.now() is preferred new DateTime()</technical_language>

Target:
public URL publicUrlForFilePath(final FilePath filePath) throws NonExistentItemException { return amazonS3Client.generatePresignedUrl(bucketNameForFilePath(filePath), filePath.filename(), DateTime.now() .plusHours(1).toDate(), HttpMethod.GET); }
Source:
<code><START> public Clusters list() { <END> ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (isFiltered()) { if (appMode == ApplicationMode.VirtOnly) { return mapVirtOnlyCollection(getBackendCollection(VdcQueryType.GetAllVdsGroups, new VdcQueryParametersBase())); } else { return mapCollection(getBackendCollection(VdcQueryType.GetAllVdsGroups, new VdcQueryParametersBase())); } } else { if (appMode == ApplicationMode.VirtOnly) { return mapVirtOnlyCollection(getBackendCollection(SearchType.Cluster)); } else { return mapCollection(getBackendCollection(SearchType.Cluster)); } } }</code><technical_language>prefer separating list in methods: 1. listall 2. listvirtonly return</technical_language>

Target:
public Clusters list() { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (appMode == ApplicationMode.VirtOnly) { return listVirtOnly(); } else { return listAll(); } }
Source:
<code>public void testInitialSizeZeroIsAllowed() throws Exception { try { <START> DataSourceFactory ds = getDataSourceFactory("yaml/empty_initial_pool.yml"); <END> assertThat(ds.getInitialSize()).isEqualTo(0); } catch (ConfigurationValidationException e) { e.printStackTrace(); fail(e.getMessage()); } }</code><technical_language>Surrounding statement try-catch gain anything. test fail anyway, if uncaught exception occurs</technical_language>

Target:
public void testInitialSizeZeroIsAllowed() throws Exception { DataSourceFactory ds = getDataSourceFactory("yaml/empty_initial_pool.yml"); assertThat(ds.getInitialSize()).isEqualTo(0); }
Source:
<code>private TreeViewer createTree(Composite composite) { Tree tree = toolkit.createTree(composite, SWT.FULL_SELECTION | SWT.MULTI); TreeViewer treeViewer = new TreeViewer(tree); TreeViewerColumn columnName = new TreeViewerColumn(treeViewer, SWT.LEFT); <START> columnName.getColumn().setText("File"); END> TreeViewerColumn columnModified = new TreeViewerColumn(treeViewer, SWT.LEFT); columnModified.getColumn().setText("Modified"); tree.setHeaderVisible(true); tree.getColumn(0).setWidth(250); tree.getColumn(1).setWidth(100); return treeViewer; }</code><technical_language>is this externalized? next too</technical_language>

Target:
private TreeViewer createTree(Composite composite) { Tree tree = toolkit.createTree(composite, SWT.FULL_SELECTION | SWT.MULTI); TreeViewer treeViewer = new TreeViewer(tree); TreeViewerColumn columnName = new TreeViewerColumn(treeViewer, SWT.LEFT); columnName.getColumn().setText(UIText.StagingView_Column_File); TreeViewerColumn columnModified = new TreeViewerColumn(treeViewer, SWT.LEFT); columnModified.getColumn().setText(UIText.StagingView_Column_Modified); tree.setHeaderVisible(true); tree.getColumn(0).setWidth(250); tree.getColumn(1).setWidth(100); return treeViewer; }