auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void doFilter(RefUpdatedEvent hook) throws IOException { String gitComment = getComment(hook.refUpdate.project, hook.refUpdate.newRev); log.debug("Git commit " + hook.refUpdate.newRev + ": " + gitComment); URL gitUrl = getGitUrl(hook); <START> if (gitUrl == null) { <END> return; } String[] issues = getIssueIds(gitComment); for (String issue : issues) { log.debug("Adding GitWeb URL " + gitUrl + " to issue " + issue); its.addRelatedLink(issue, gitUrl, "Git: " + hook.refUpdate.newRev); } }</code><technical_language>Instead of returning, put block lines 66-73 if (gitUrl != null) {</technical_language>

Target:
public void doFilter(RefUpdatedEvent hook) throws IOException { String gitComment = getComment(hook.refUpdate.project, hook.refUpdate.newRev); log.debug("Git commit " + hook.refUpdate.newRev + ": " + gitComment); URL gitUrl = getGitUrl(hook); if (gitUrl != null) { String[] issues = getIssueIds(gitComment); for (String issue : issues) { log.debug("Adding GitWeb URL " + gitUrl + " to issue " + issue); its.addRelatedLink(issue, gitUrl, "Git: " + hook.refUpdate.newRev); } } }
Source:
<code>public SimpleRangeStats getRangeStatsOfAllRanges(final RangeFacetExpression<T> facetExpression) { final String facetResultPath = facetExpression.resultPath(); final boolean facetIsOfTypeAllRanges = Optional.ofNullable(facetExpression.value()) .map(v -> v.trim().equals(":range(* to \"0\"),(\"0\" to *)")) .orElse(false); if (facetIsOfTypeAllRanges) { final RangeFacetResult facetResult = getRangeFacetResult(facetResultPath); return getSimpleRangeStats(facetResult.getRanges()); } else { <START> throw new ClassCastException("Facet result is not of type RangeFacetResult for all ranges, i.e. (* to \"0\"),(\"0\" to *): " + facetResultPath); <END> } }</code><technical_language>InvalidArgumentException</technical_language>

Target:
public SimpleRangeStats getRangeStatsOfAllRanges(final RangeFacetExpression<T> facetExpression) { final String facetResultPath = facetExpression.resultPath(); final boolean facetIsOfTypeAllRanges = Optional.ofNullable(facetExpression.value()) .map(v -> v.trim().equals(":range(* to \"0\"),(\"0\" to *)")) .orElse(false); if (facetIsOfTypeAllRanges) { final RangeFacetResult facetResult = getRangeFacetResult(facetResultPath); return getSimpleRangeStats(facetResult.getRanges()); } else { throw new IllegalArgumentException("Facet result is not of type RangeFacetResult for all ranges, i.e. (* to \"0\"),(\"0\" to *): " + facetResultPath); } }
Source:
<code>protected void performDefaults() { for (String[] <START> element : <END> fAppearanceColorListModel) { String key = element[1]; PreferenceConverter.setValue(getPreferenceStore(), key, PreferenceConverter.getDefaultColor(getPreferenceStore(), key)); } handleAppearanceColorListSelection(); super.performDefaults(); }</code><technical_language>rename colorModel</technical_language>

Target:
protected void performDefaults() { for (String[] colorModel : fAppearanceColorListModel) { String key = colorModel[1]; PreferenceConverter.setValue(getPreferenceStore(), key, PreferenceConverter.getDefaultColor(getPreferenceStore(), key)); } handleAppearanceColorListSelection(); super.performDefaults(); }
Source:
<code>public void completeIntent(Plugin plugin) { <START> Preconditions.checkState( intents.containsKey( plugin ) && intents.get( plugin ).get() != 0, "Plugin %s has not registered intents for event %s", plugin, this ); <END> if ( intents.get( plugin ).decrementAndGet() == 0 ) { if ( fired.get() ) { if ( latch.decrementAndGet() == 0 ) { done.done( (T) this, null ); } } else { latch.decrementAndGet(); } } }</code><technical_language>0</technical_language>

Target:
public void completeIntent(Plugin plugin) { AtomicInteger intentCount = intents.get( plugin ); Preconditions.checkState( intentCount != null && intentCount.get() > 0, "Plugin %s has not registered intents for event %s", plugin, this ); intentCount.decrementAndGet(); if ( fired.get() ) { if ( latch.decrementAndGet() == 0 ) { done.done( (T) this, null ); } } else { latch.decrementAndGet(); } }
Source:
<code>private static String generateRandomStringWithLength(int length) { byte[] array = new byte[length]; ThreadLocalRandom.current().nextBytes(array); <START> return new String(array, Charset.forName("UTF-8")); <END> }</code><technical_language>StandardCharsets.UTF_8 (static import UTF_8)</technical_language>

Target:
private static String generateRandomStringWithLength(int length) { byte[] array = new byte[length]; ThreadLocalRandom.current().nextBytes(array); return new String(array, UTF_8); }
Source:
<code><START> protected Optional<Producer<K, V>> maybeGetKafkaProducer(DatastreamTask task) { <END> Producer<K, V> producer = _kafkaProducer; if (producer == null) { producer = initializeProducer(task); } return Optional.ofNullable(producer); }</code><technical_language>I overriding this in Bounded implementation, this protected</technical_language>

Target:
private Optional<Producer<K, V>> maybeGetKafkaProducer(DatastreamTask task) { Producer<K, V> producer = _kafkaProducer; if (producer == null) { producer = initializeProducer(task); } return Optional.ofNullable(producer); }
Source:
<code>private static ResourceMapping[] getResourceMappings(IResource[] resources) { List<ResourceMapping> result = new ArrayList<ResourceMapping>(); for (IResource resource : resources) { <START> result.add(getResourceMapping(resource)); <END> } return result.toArray(new ResourceMapping[result.size()]); }</code><technical_language>style nit: braces for single line block</technical_language>

Target:
private static ResourceMapping[] getResourceMappings(IResource[] resources) { List<ResourceMapping> result = new ArrayList<ResourceMapping>(); for (IResource resource : resources) result.add(getResourceMapping(resource)); return result.toArray(new ResourceMapping[result.size()]); }
Source:
<code>protected String getFilterString() { String filterString = super.getFilterString(); <START> if (filterString.indexOf("*") != 0 && filterString.indexOf("?") != 0 END> && filterString.indexOf(".") != 0) { filterString = "*" + filterString; } return filterString; }</code><technical_language>search for references FilteredTree.initialText some classes of FilteredTree special treatment for case filter field contains initialText changing this if (!filterText.getText().equals(initialText) && filterString.indexOf("*") != 0 //$NON-NLS-1$ && filterString.indexOf("?") != 0 //$NON-NLS-1$ && filterString.indexOf(".") != 0) {//$NON-NLS-1$ fixes problem while initialText is displayed result list is shown</technical_language>

Target:
protected String getFilterString() { String filterString = super.getFilterString(); if (!filterText.getText().equals(initialText) && filterString.indexOf("*") != 0 && filterString.indexOf("?") != 0 && filterString.indexOf(".") != 0) { filterString = "*" + filterString; } return filterString; }
Source:
<code>private void checkLocationServiceStatus() { LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); boolean gps = false; boolean network = false; try{ gps = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); }catch(Exception ex){ } try{ network = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER); }catch(Exception ex){ <START> <END> } if (!gps && !network) { promptLocationService(); } }</code><technical_language>Empty catch blocks spaces brackets. catch exception method is throwing exceptions, if possible. In catch blocks log error message</technical_language>

Target:
private void checkLocationServiceStatus() { LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); boolean gps = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean network = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!gps && !network) { promptLocationService(); } }
Source:
<code>public boolean add(Node<A, S> node) { while(stateNodeMap.containsKey(node.state())) { Node<A,S> toDelete = (stateNodeMap.get(node.state())).higher(node); <START> if(toDelete == null) { <END> break; } remove(toDelete); } boolean inserted = queue.add(node); if (inserted) { addToStateNodeMap(node.state(), node); } return inserted; }</code><technical_language>Instead of higher() tailSet(node, false) more compactly</technical_language>

Target:
public boolean add(Node<A, S> node) { removeNodesOfLowerPriority(node); if(contains(node)) { incrementCount(node); return true; } boolean inserted = queue.add(node); if (inserted) { incrementCount(node); inserted = addToStateNodeMap(node.state(), node); } return inserted; }
Source:
<code>@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String tenant = null; HttpServletRequest req = (HttpServletRequest) request; HttpSession session = req.getSession(); String studyOid = req.getHeader("studyOid"); if (StringUtils.isEmpty(studyOid)) { tenant = getRequestSchema(req, session); if (StringUtils.isEmpty(tenant)) { if (req.getAttribute(CURRENT_TENANT_ID) != null) { tenant = (String) req.getAttribute(CURRENT_TENANT_ID); } else if (session != null && session.getAttribute(CURRENT_TENANT_ID) != null) { tenant = (String) session.getAttribute(CURRENT_TENANT_ID); } } } else { request.setAttribute("studyOid", studyOid); } if (StringUtils.isEmpty(tenant)) { tenant = defaultTenant; } req.setAttribute(tenantKey, tenant); if (session != null) { session.setAttribute(tenantKey, tenant); } <START> request.setAttribute("enableEmbeddedReports", CoreResources.getField("insight.enableEmbeddedReports")); <END> chain.doFilter(req, response); }</code><technical_language>rename datainfo property "enableEmbeddedReports". need word insight want this generic easier replace insight some other reporting tool</technical_language>

Target:
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String tenant = null; HttpServletRequest req = (HttpServletRequest) request; HttpSession session = req.getSession(); String studyOid = req.getHeader("studyOid"); if (StringUtils.isEmpty(studyOid)) { tenant = getRequestSchema(req, session); if (StringUtils.isEmpty(tenant)) { if (req.getAttribute(CURRENT_TENANT_ID) != null) { tenant = (String) req.getAttribute(CURRENT_TENANT_ID); } else if (session != null && session.getAttribute(CURRENT_TENANT_ID) != null) { tenant = (String) session.getAttribute(CURRENT_TENANT_ID); } } } else { request.setAttribute("studyOid", studyOid); } if (StringUtils.isEmpty(tenant)) { tenant = defaultTenant; } req.setAttribute(tenantKey, tenant); if (session != null) { session.setAttribute(tenantKey, tenant); } request.setAttribute("enableEmbeddedReports", CoreResources.getField("enableEmbeddedReports")); chain.doFilter(req, response); }
Source:
<code>public void scrollToElement(WebElement element, int offset) { js.executeScript( <START> "window.scroll(0, " + (element.getLocation().getY() - offset) + ");" <END> ); }</code><technical_language>instead of breaking strings arguments this: java int elementPosition = element.getLocation().getY - offset; js.executeScript("window.scroll(0,arguments[0])", elementPosition);</technical_language>

Target:
public void scrollToElement(WebElement element, int offset) { int elementPosition = element.getLocation().getY() - offset; js.executeScript( "window.scroll(0,arguments[0])", elementPosition ); }
Source:
<code>public static boolean validate(final String rule) throws InvalidParameterValueException { <START> if (Strings.isNullOrEmpty(rule) || !rule.matches(ALLOWED_PATTERN)) { <END> throw new InvalidParameterValueException("Invalid rule provided. Only API names and wildcards are allowed."); } return true; }</code><technical_language>Extract this validation logic immutable class, Rule, encapsulate this validation logic provide strong type specification in layers. Also, improve performance, represent ALLOWED_PATTERN a Pattern pre-compile it. match operation is compiling expression is expensive</technical_language>

Target:
private static boolean validate(final String rule) { if (Strings.isNullOrEmpty(rule) || !ALLOWED_PATTERN.matcher(rule).matches()) { throw new InvalidParameterValueException("Only API names and wildcards are allowed, invalid rule provided: " + rule); } return true; }
Source:
<code>public List<MetricFamilySamples> collect() { ArrayList<MetricFamilySamples> samples = new ArrayList<MetricFamilySamples>(); for (PublicMetrics publicMetrics : this.publicMetrics) { <START> <END> for (Metric<?> metric : publicMetrics.metrics()) { String name = Collector.sanitizeMetricName(metric.getName()); double value = metric.getValue().doubleValue(); MetricFamilySamples metricFamilySamples = new MetricFamilySamples( name, Type.GAUGE, name, Collections.singletonList( new MetricFamilySamples.Sample( name, new ArrayList<String>(), new ArrayList<String>(), value) ) ); samples.add(metricFamilySamples); } } return samples; }</code><technical_language>Please revert formatting changes here, adding noise PR</technical_language>

Target:
public List<MetricFamilySamples> collect() { ArrayList<MetricFamilySamples> samples = new ArrayList<MetricFamilySamples>(); for (PublicMetrics publicMetrics : this.publicMetrics) { for (Metric<?> metric : publicMetrics.metrics()) { String name = Collector.sanitizeMetricName(metric.getName()); double value = metric.getValue().doubleValue(); MetricFamilySamples metricFamilySamples = new MetricFamilySamples( name, Type.GAUGE, name, Collections.singletonList( new MetricFamilySamples.Sample(name, Collections.<String>emptyList(), Collections.<String>emptyList(), value))); samples.add(metricFamilySamples); } } return samples; }
Source:
<code>public void before() throws IOException { conf = new Configuration(); shell = new FsShell(conf); lfs = FileSystem.getLocal(conf); testRootDir = lfs.makeQualified(new Path(GenericTestUtils.getTempPath( "testFsShellCopy"))); <START> if (lfs.exists(testRootDir)) { <END> lfs.delete(testRootDir, true); } lfs.mkdirs(testRootDir); lfs.setWorkingDirectory(testRootDir); dstPath = new Path(testRootDir, "dstFile"); lfs.create(dstPath).close(); Random random = new Random(); for (int i = 0; i < 10; i++) { OutputStream out = lfs.create(new Path(testRootDir, "file-" + i)); out.write(random.nextInt()); out.close(); } }</code><technical_language>call delete probe. ContractTestUtils method checks delete() return</technical_language>

Target:
public void before() throws IOException { conf = new Configuration(); shell = new FsShell(conf); lfs = FileSystem.getLocal(conf); testRootDir = lfs.makeQualified(new Path(GenericTestUtils.getTempPath( "testFsShellCopy"))); lfs.delete(testRootDir, true); lfs.mkdirs(testRootDir); lfs.setWorkingDirectory(testRootDir); dstPath = new Path(testRootDir, "dstFile"); lfs.create(dstPath).close(); Random random = new Random(); for (int i = 0; i < 10; i++) { OutputStream out = lfs.create(new Path(testRootDir, String.format("file-%02d", i))); out.write(random.nextInt()); out.close(); } }
Source:
<code>private static Caching create(String name, int ttl, List<CachingRule> rules) { <START> return builder().name(name).ttl(ttl).rules(rules).build(); <END> }</code><technical_language>enforce immutability in lists ImmutableList.copyOf list is null</technical_language>

Target:
static Caching create(String name, int ttl, List<CachingRule> rules) { return builder().name(name).ttl(ttl).rules(rules).build(); }
Source:
<code>public void setBounds(int x, int y, int width, int height) { Dimension previousSize = getSize(); super.setBounds(x, y, width, height); Dimension currentSize = getSize(); synchronized (myGraphicsLayoutRendererLock) { if (myGraphicsLayoutRenderer != null && !currentSize.equals(previousSize)) { <START> myGraphicsLayoutRenderer.setSize(width, <END> (myCurrentWidth < width) ? 1 : height); myCurrentWidth = width; } } }</code><technical_language>pass 1, -1, calculates right size</technical_language>

Target:
public void setBounds(int x, int y, int width, int height) { Dimension previousSize = getSize(); super.setBounds(x, y, width, height); Dimension currentSize = getSize(); synchronized (myGraphicsLayoutRendererLock) { if (myGraphicsLayoutRenderer != null && !currentSize.equals(previousSize)) { myGraphicsLayoutRenderer.setSize(width, 1); } } }
Source:
<code>public IAnswerData getAnswer(){ if(monthTxt.getText().toString().equals("") || dayTxt.getText().toString().equals("") || yearTxt.getText().toString().equals("")){ setFocus(getContext()); return new InvalidData(Localization.get("empty.fields"), new DateData(selectedDate.getTime())); } if(Integer.parseInt(yearTxt.getText().toString()) < MIN_YEAR){ setFocus(getContext()); return new InvalidData(Localization.get("low.year"), new DateData(selectedDate.getTime())); } if(!monthList.contains(monthTxt.getText().toString())){ setFocus(getContext()); return new InvalidData(Localization.get("invalid.month"), new DateData(selectedDate.getTime())); } if(Integer.parseInt(dayTxt.getText().toString()) > selectedDate.getActualMaximum(Calendar.DAY_OF_MONTH)){ setFocus(getContext()); <START> return new InvalidData(Localization.get("high.date") + String.valueOf(selectedDate.getActualMaximum(Calendar.DAY_OF_MONTH)), new DateData(selectedDate.getTime())); <END> } if(Integer.parseInt(yearTxt.getText().toString()) > maxYear){ setFocus(getContext()); return new InvalidData(Localization.get("high.year") + String.valueOf(maxYear), new DateData(selectedDate.getTime())); } return super.getAnswer(); }</code><technical_language>localization parameters</technical_language>

Target:
public IAnswerData getAnswer(){ setFocus(getContext()); String month = (String) monthSpinner.getSelectedItem(); String day = dayText.getText().toString(); String year = yearText.getText().toString(); if(month.isEmpty() && day.isEmpty() && year.isEmpty()){ return null; } if(month.isEmpty() || day.isEmpty() || year.isEmpty()){ return new InvalidDateData(Localization.get("calendar.empty.fields"), new DateData(calendar.getTime()), day, month, year); } if(Integer.parseInt(year) < MINYEAR){ return new InvalidDateData(Localization.get("calendar.low.year"), new DateData(calendar.getTime()), day, month, year); } if(Integer.parseInt(day) > calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){ return new InvalidDateData(Localization.get("calendar.high.date") + " " + String.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)), new DateData(calendar.getTime()), day, month, year); } if(Integer.parseInt(day)< 1){ return new InvalidDateData(Localization.get("calendar.low.date"), new DateData(calendar.getTime()), day, month, year); } if(Integer.parseInt(year) > maxYear){ return new InvalidDateData(Localization.get("calendar.high.year") + " " + String.valueOf(maxYear), new DateData(calendar.getTime()), day, month, year); } return super.getAnswer(); }
Source:
<code>public void setRunningForecastsToFailed(String jobId, ActionListener<Boolean> listener) { QueryBuilder forecastQuery = QueryBuilders.boolQuery() .filter(QueryBuilders.termQuery(Result.RESULT_TYPE.getPreferredName(), ForecastRequestStats.RESULT_TYPE_VALUE)) .filter(QueryBuilders.termQuery(Job.ID.getPreferredName(), jobId)) .filter(QueryBuilders.termsQuery(ForecastRequestStats.STATUS.getPreferredName(), ForecastRequestStats.ForecastRequestStatus.SCHEDULED.toString(), ForecastRequestStats.ForecastRequestStatus.STARTED.toString())); UpdateByQueryRequest request = new UpdateByQueryRequest(AnomalyDetectorsIndex.resultsWriteAlias(jobId)) .setQuery(forecastQuery) .setIndicesOptions(IndicesOptions.lenientExpandOpen()) .setAbortOnVersionConflict(false) .setMaxRetries(3) .setRefresh(true) <START> .setScript(new Script("ctx._source.forecast_status='failed'")); <END> client.execute(UpdateByQueryAction.INSTANCE, request, ActionListener.wrap( response -> { LOGGER.info("[{}] set forecasts to failed", jobId, response.getUpdated()); if (response.getBulkFailures().size() > 0) { LOGGER.warn( "[{}] failed to set forecasts to failed. Bulk failures experienced {}", jobId, response.getTotal() - response.getUpdated(), response.getBulkFailures().stream().map(BulkItemResponse.Failure::getMessage).collect(Collectors.toList()) ); } listener.onResponse(true); }, listener::onFailure )); }</code><technical_language>is a string array field called forecast_messages add a reason for failure</technical_language>

Target:
public void setRunningForecastsToFailed(String jobId, ActionListener<Boolean> listener) { QueryBuilder forecastQuery = QueryBuilders.boolQuery() .filter(QueryBuilders.termQuery(Result.RESULT_TYPE.getPreferredName(), ForecastRequestStats.RESULT_TYPE_VALUE)) .filter(QueryBuilders.termQuery(Job.ID.getPreferredName(), jobId)) .filter(QueryBuilders.termsQuery(ForecastRequestStats.STATUS.getPreferredName(), ForecastRequestStats.ForecastRequestStatus.SCHEDULED.toString(), ForecastRequestStats.ForecastRequestStatus.STARTED.toString())); UpdateByQueryRequest request = new UpdateByQueryRequest(AnomalyDetectorsIndex.resultsWriteAlias(jobId)) .setQuery(forecastQuery) .setIndicesOptions(IndicesOptions.lenientExpandOpen()) .setAbortOnVersionConflict(false) .setMaxRetries(3) .setRefresh(true) .setScript(new Script("ctx._source.forecast_status='failed';" + "ctx._source.forecast_messages=['" + JOB_FORECAST_NATIVE_PROCESS_KILLED + "']")); client.execute(UpdateByQueryAction.INSTANCE, request, ActionListener.wrap( response -> { LOGGER.info("[{}] set forecasts to failed", jobId, response.getUpdated()); if (response.getBulkFailures().size() > 0) { LOGGER.warn( "[{}] failed to set forecasts to failed. Bulk failures experienced {}", jobId, response.getTotal() - response.getUpdated(), response.getBulkFailures().stream().map(BulkItemResponse.Failure::getMessage).collect(Collectors.toList()) ); } listener.onResponse(true); }, listener::onFailure )); }
Source:
<code><START> @Deprecated public void setSkipBroker(boolean skip) { <END> mSkipBroker = skip; }</code><technical_language>Well, happen if user deprecated method? need compatible, right</technical_language>

Target:
@Deprecated public void setSkipBroker(boolean skip) { mUseBroker = !skip; }
Source:
<code>public String getStringValue() { <START> throw throwUnsupportedOperationException(); <END> }</code><technical_language>throw throw method named "createUnsupportedOperationException"</technical_language>

Target:
public String getStringValue() { throw createUnsupportedOperationException(); }
Source:
<code>public void execute() { new StoredList.UserInterface(getContext()).promptForListSelection(R.string.cache_menu_move_list, new Action1<Integer>() { @Override public void call(final Integer newListId) { MoveToListCommand.this.newListId = newListId; final String newListName = StoredList.getListById(newListId).getTitle(); <START> MoveToListCommand.super.setProgressMessage(String.format(getContext().getString(R.string.command_move_caches_progress), newListName)); <END> MoveToListCommand.super.execute(); } }, true, currentListId); }</code><technical_language>Please variable arguments version of getString() instead of String.format</technical_language>

Target:
public void execute() { new StoredList.UserInterface(getContext()).promptForListSelection(R.string.cache_menu_move_list, new Action1<Integer>() { @Override public void call(final Integer newListId) { MoveToListCommand.this.newListId = newListId; final String newListName = StoredList.getListById(newListId).getTitle(); MoveToListCommand.super.setProgressMessage(getContext().getString(R.string.command_move_caches_progress, newListName)); MoveToListCommand.super.execute(); } }, true, currentListId); }
Source:
<code>public void smokeTestSmileSupport() throws Exception { try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder() .setSingleExtraProperty("experimental.internal-communication.binary-transport-enabled", "true") .build()) { <START> queryRunner.execute("SELECT * FROM lineitem LIMIT 10"); <END> } }</code><technical_language>try run bigger here, more stages tasks</technical_language>

Target:
public void smokeTestSmileSupport() throws Exception { try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder() .setSingleExtraProperty("experimental.internal-communication.binary-transport-enabled", "true") .build()) { queryRunner.execute("SELECT sum(l.extendedprice * l.discount) AS revenue " + "FROM lineitem l WHERE" + " l.shipdate >= DATE '1994-01-01'" + " AND l.shipdate < DATE '1994-01-01' + INTERVAL '1' YEAR" + " AND l.discount BETWEEN .06 - 0.01 AND .06 + 0.01" + " AND l.quantity < 24"); } }
Source:
<code>public void removeFirstNode() { List<String> changes = new LinkedList<>(); String code = "class A { int a; int b; int c; int d; int e; }"; CompilationUnit cu = JavaParser.parse(code); ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); cd.getMembers().register(createObserver(changes)); cd.getMembers().removeFirst(); assertEquals(Arrays.asList("'int a;' REMOVAL in list at 0"), changes); assertEquals(cd.getMembers().size(), 4); for (int i = 3; i >= 0; i--) { assertTrue(cd.getMembers().removeFirst()); assertEquals(cd.getMembers().size(), i); } assertFalse(cd.getMembers().removeFirst()); <START> assertEquals(cd.getMembers().size(), 0); <END> }</code><technical_language>Thorough</technical_language>

Target:
public void removeFirstNode() { List<String> changes = new LinkedList<>(); String code = "class A { int a; int b; int c; int d; int e; }"; CompilationUnit cu = JavaParser.parse(code); ClassOrInterfaceDeclaration cd = cu.getClassByName("A").get(); cd.getMembers().register(createObserver(changes)); cd.getMembers().removeFirst(); assertEquals(Arrays.asList("'int a;' REMOVAL in list at 0"), changes); assertEquals(cd.getMembers().size(), 4); for (int i = 3; i >= 0; i--) { assertTrue(cd.getMembers().removeFirst() != null); assertEquals(cd.getMembers().size(), i); } assertEquals(cd.getMembers().size(), 0); }
Source:
<code>public void pingConnection() { Button testConnectionButton = new PushButton("Test Connection"); testConnectionButton.click(); new WaitUntil(new ShellWithTextIsAvailable("Success")); <START> new PushButton("OK").click(); <END> }</code><technical_language>a note. RedDeer "shortcut" for this - OkButton (as CancelButton, FinishButton, NextButton, YesButton etc.). is need edit this... FYI</technical_language>

Target:
public void pingConnection() { Button testConnectionButton = new PushButton("Test Connection"); testConnectionButton.click(); new WaitUntil(new ShellWithTextIsAvailable("Success")); new OkButton().click(); }
Source:
<code>public static AbstractFileOutputOperator checkpoint(AbstractFileOutputOperator writer, long windowId) { <START> if (windowId >= 0) { <END> writer.beforeCheckpoint(windowId); } Kryo kryo = new Kryo(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); Output loutput = new Output(bos); kryo.writeObject(loutput, writer); loutput.close(); Input lInput = new Input(bos.toByteArray()); @SuppressWarnings("unchecked") AbstractFileOutputOperator checkPointedWriter = kryo.readObject(lInput, writer.getClass()); lInput.close(); return checkPointedWriter; }</code><technical_language>Nitpick: windowId > Stateless.WindowId</technical_language>

Target:
public static AbstractFileOutputOperator checkpoint(AbstractFileOutputOperator writer, long windowId) { if (windowId >= Stateless.WINDOW_ID) { writer.beforeCheckpoint(windowId); } Kryo kryo = new Kryo(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); Output loutput = new Output(bos); kryo.writeObject(loutput, writer); loutput.close(); Input lInput = new Input(bos.toByteArray()); @SuppressWarnings("unchecked") AbstractFileOutputOperator checkPointedWriter = kryo.readObject(lInput, writer.getClass()); lInput.close(); return checkPointedWriter; }
Source:
<code>public ActivityCalendar(final String calendarName, final Date activatePassiveCalendarTime, final List<SeasonProfile> seasonProfileList) { <START> super(); <END> this.calendarName = calendarName; this.activatePassiveCalendarTime = new Date(activatePassiveCalendarTime.getTime()); this.seasonProfileList = new ArrayList<>(seasonProfileList); }</code><technical_language>Remarks similar classes in OSGP/Shared apply well. For instance removing unnecessary lines super call, kinds of null checks fields null in equals hashCode reversing order in compareTo if this is intended</technical_language>

Target:
public ActivityCalendar(final String calendarName, final Date activatePassiveCalendarTime, final List<SeasonProfile> seasonProfileList) { this.calendarName = calendarName; this.activatePassiveCalendarTime = new Date(activatePassiveCalendarTime.getTime()); this.seasonProfileList = new ArrayList<>(seasonProfileList); }
Source:
<code>public void setAccumuloUser(String user) { <START> Preconditions.checkNotNull(user); <END> set("sc.cloudbase.username", user); }</code><technical_language>Objects.requireNonNull this is built Java 8 instead of Guava</technical_language>

Target:
public void setAccumuloUser(String user) { Preconditions.checkNotNull(user); set(CLOUDBASE_USER, user); }
Source:
<code>public ResolveOrFetchResult<Item> resolveOrFetchItem(Iterable<Broadcast> broadcasts) throws NitroException { if (Iterables.isEmpty(broadcasts)) { return ResolveOrFetchResult.empty(); } Iterable<PidReference> episodeRefs = toEpisodeRefs(broadcasts); ImmutableSet<String> itemUris = toItemUris(episodeRefs); ResolvedContent resolvedItems = resolve(itemUris); Set<PidReference> toFetch = Sets.newHashSet(); for (PidReference pidReference : episodeRefs) { Maybe<Identified> maybeId = resolvedItems.asMap().get(toItemUri(pidReference)); if (!maybeId.hasValue() || fullFetchPermitted.apply((Item)maybeId.requireValue())) { log.trace("Will fetch item with PID reference Nitro", pidReference.getPid()); toFetch.add(pidReference); } } Iterator<List<Item>> fetchedItemListIterator = contentAdapter .fetchEpisodes(toFetch) .iterator(); ImmutableSet.Builder<Item> fetchedItemSet = ImmutableSet.builder(); <START> while (fetchedItemListIterator.hasNext()) { <END> List<Item> itemList = fetchedItemListIterator.next(); for (Item item : itemList) { fetchedItemSet.add(item); } } return mergeItemsWithExisting( fetchedItemSet.build(), ImmutableSet.copyOf( Iterables.filter(resolvedItems.getAllResolvedResults(), Item.class) ) ); }</code><technical_language>Iterable in a for-each loop</technical_language>

Target:
public ResolveOrFetchResult<Item> resolveOrFetchItem(Iterable<Broadcast> broadcasts) throws NitroException { if (Iterables.isEmpty(broadcasts)) { return ResolveOrFetchResult.empty(); } Iterable<PidReference> episodeRefs = toEpisodeRefs(broadcasts); ImmutableSet<String> itemUris = toItemUris(episodeRefs); ResolvedContent resolvedItems = resolve(itemUris); Set<PidReference> toFetch = Sets.newHashSet(); for (PidReference pidReference : episodeRefs) { Maybe<Identified> maybeId = resolvedItems.asMap().get(toItemUri(pidReference)); if (!maybeId.hasValue() || fullFetchPermitted.apply((Item)maybeId.requireValue())) { log.trace("Will fetch item with PID reference Nitro", pidReference.getPid()); toFetch.add(pidReference); } } Iterable<List<Item>> fetchedItems = contentAdapter.fetchEpisodes(toFetch); ImmutableSet<Item> fetchedItemSet = ImmutableSet.copyOf( Iterables.concat( fetchedItems ) ); return mergeItemsWithExisting( fetchedItemSet, ImmutableSet.copyOf( Iterables.filter(resolvedItems.getAllResolvedResults(), Item.class) ) ); }
Source:
<code>private static String getLanguageLevelOption(LanguageLevel level) { <START> return level.getCompilerComplianceDefaultOption(); END> }</code><technical_language>clean in this commit</technical_language>

Target:
private static String getLanguageLevelOption(LanguageLevel level) { return JpsJavaSdkType.complianceOption(level.toJavaVersion()); }
Source:
<code>protected StyledString getStyledTextFor(Repository repository) throws IOException { File directory = repository.getDirectory(); StyledString string = new StyledString(); if (!repository.isBare()) string.append(directory.getParentFile().getName()); else string.append(directory.getName()); string.append( " - " + directory.getAbsolutePath(), StyledString.QUALIFIER_STYLER); <START> String branch = repository.getBranch(); <END> if (repository.getRepositoryState() != RepositoryState.SAFE) branch += " - " + repository.getRepositoryState().getDescription(); string.append(" [" + branch + "]", StyledString.DECORATIONS_STYLER); return string; }</code><technical_language>do following? removes branch string += performed creates unneeded extra string. string.append(' '); string.append('[', StyledString.DECORATIONS_STYLER); string.append(repository.getBranch(), StyledString.DECORATIONS_STYLER); RepositoryState state = repository.getRepositoryState(); if (state != RepositoryState.SAFE) { string.append(" - ", StyledString.DECORATIONS_STYLER); string.append(state.getDescription(), StyledString.DECORATIONS_STYLER); } string.append(']', StyledString.DECORATIONS_STYLER);</technical_language>

Target:
protected StyledString getStyledTextFor(Repository repository) throws IOException { File directory = repository.getDirectory(); StyledString string = new StyledString(); if (!repository.isBare()) string.append(directory.getParentFile().getName()); else string.append(directory.getName()); string.append(" - ", StyledString.QUALIFIER_STYLER); string.append(directory.getAbsolutePath(), StyledString.QUALIFIER_STYLER); String branch = repository.getBranch(); string.append(" "); string.append("[", StyledString.DECORATIONS_STYLER); string.append(branch, StyledString.DECORATIONS_STYLER); RepositoryState repositoryState = repository.getRepositoryState(); if (repositoryState != RepositoryState.SAFE) { string.append(" - ", StyledString.DECORATIONS_STYLER); string.append(repositoryState.getDescription(), StyledString.DECORATIONS_STYLER); } string.append("]", StyledString.DECORATIONS_STYLER); return string; }
Source:
<code>public void interpretUrl() { try { <START> this.url = changeVariable.interpretString(sprite); <END> } catch (InterpretationException interpretationException) { Log.d(getClass().getSimpleName(), "Couldn't interpret formula", interpretationException); } }</code><technical_language>rule of thumb this. necessary code verbose harder read excessively</technical_language>

Target:
public void interpretUrl() { try { url = formula.interpretString(sprite); } catch (InterpretationException interpretationException) { Log.d(getClass().getSimpleName(), "Couldn't interpret formula", interpretationException); } }
Source:
<code>public void setMemberIds_shouldSupportLargeCohorts() { int cohortSize = 100000; Cohort c = new Cohort(); Set<Integer> ids = new HashSet<>(); for (int i=0; i<cohortSize; i++) { ids.add(i); } long startTime = System.currentTimeMillis(); c.setMemberIds(ids); long endTime = System.currentTimeMillis(); double secondsToSet = (endTime - startTime)/1000; <START> Assertions.assertTrue(secondsToSet < 5, "Setting cohort of size " + cohortSize + " took " + secondsToSet + " seconds"); <END> }</code><technical_language>need call Assertions.assertTrue imported assertTrue in line 30</technical_language>

Target:
public void setMemberIds_shouldSupportLargeCohorts() { int cohortSize = 100000; Cohort c = new Cohort(); Set<Integer> ids = new HashSet<>(); for (int i=0; i<cohortSize; i++) { ids.add(i); } long startTime = System.currentTimeMillis(); c.setMemberIds(ids); long endTime = System.currentTimeMillis(); double secondsToSet = (endTime - startTime)/1000; assertTrue(secondsToSet < 5, "Setting cohort of size " + cohortSize + " took " + secondsToSet + " seconds"); }
Source:
<code>public void test_without_jsr305() { Collection<File> classpath = JavaCheckVerifier.classpathFromDirectory("target/test-jars").stream() .filter(file -> !(file.getName().startsWith("jsr305-") || file.getName().startsWith("annotations-"))) .collect(Collectors.toList()); <START> JavaCheckVerifier.verify("src/test/files/se/ConditionAlwaysTrueOrFalseWithoutJSR305.java", new BooleanGratuitousExpressionsCheck(), classpath); <END> }</code><technical_language>This test is robust : include class need test case happening</technical_language>

Target:
public void test_without_jsr305() { List<File> classpath = FileUtils.listFiles(new File("target/test-jars"), new String[] {"jar"}, true).stream() .filter(file -> file.getName().startsWith("spring-core-") || file.getName().startsWith("spring-web-")) .collect(Collectors.toList()); classpath.add(new File("target/test-classes")); JavaCheckVerifier.verify("src/test/files/se/SpringNullableAndNonNullAnnotationsWithoutJSR305.java", new BooleanGratuitousExpressionsCheck(), classpath); }
Source:
<code>private void initializeHandler(Thing thing) { if (!isHandlerRegistered(thing)) { return; } Lock lock = getLockForThing(thing.getUID()); try { lock.lock(); if (ThingHandlerHelper.isHandlerInitialized(thing)) { logger.debug("Attempt to initialize the already initialized thing '{}' will be ignored.", thing.getUID()); return; } if (isInitializing(thing)) { logger.debug("Attempt to initialize a handler twice for thing '{}' at the same time will be ignored.", thing.getUID()); return; } ThingHandler handler = thing.getHandler(); if (handler == null) { throw new IllegalStateException("Handler should not be null here"); } else { if (handler.getThing() != thing) { logger.debug("The model of is inconsistent [thing.getHandler().getThing() != thing]", thing.getUID()); } } ThingType thingType = getThingType(thing); applyDefaultConfiguration(thing, thingType); <START> if (isThingDisabled(thing)) { <END> setDisabled(thing, true); } else { if (isInitializable(thing, thingType)) { setThingStatus(thing, buildStatusInfo(ThingStatus.INITIALIZING, ThingStatusDetail.NONE)); doInitializeHandler(thing.getHandler()); } else { logger.debug("Thing '{}' not initializable, check required configuration parameters.", thing.getUID()); setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.HANDLER_CONFIGURATION_PENDING)); } } } finally { lock.unlock(); } }</code><technical_language>placing here, decided UNINITIALIZED/DISABLED _have_ a handler instance - reasons is</technical_language>

Target:
private void initializeHandler(Thing thing) { if (storage != null && storage.containsKey(thing.getUID().getAsString()) && !storage.get(thing.getUID().getAsString())) { logger.debug("Thing '{}' will not be initialized. It is marked as disabled.", thing.getUID()); return; } if (!isHandlerRegistered(thing)) { return; } Lock lock = getLockForThing(thing.getUID()); try { lock.lock(); if (ThingHandlerHelper.isHandlerInitialized(thing)) { logger.debug("Attempt to initialize the already initialized thing '{}' will be ignored.", thing.getUID()); return; } if (isInitializing(thing)) { logger.debug("Attempt to initialize a handler twice for thing '{}' at the same time will be ignored.", thing.getUID()); return; } ThingHandler handler = thing.getHandler(); if (handler == null) { throw new IllegalStateException("Handler should not be null here"); } else { if (handler.getThing() != thing) { logger.warn("The model of is inconsistent [thing.getHandler().getThing() != thing]", thing.getUID()); } } ThingType thingType = getThingType(thing); applyDefaultConfiguration(thing, thingType); if (isInitializable(thing, thingType)) { setThingStatus(thing, buildStatusInfo(ThingStatus.INITIALIZING, ThingStatusDetail.NONE)); doInitializeHandler(thing.getHandler()); } else { logger.debug("Thing '{}' not initializable, check required configuration parameters.", thing.getUID()); setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.HANDLER_CONFIGURATION_PENDING)); } } finally { lock.unlock(); } }
Source:
<code><START> public S3Exception(S3ErrorCode error) { <END> this(error, error.getMessage(), (Throwable) null, ImmutableMap.<String, String>of()); }</code><technical_language>public visibility? I requests need subpackage move main package reduce visibility here</technical_language>

Target:
S3Exception(S3ErrorCode error) { this(error, error.getMessage(), (Throwable) null, ImmutableMap.<String, String>of()); }
Source:
<code>public void runOneAtATimeExplorationUsersMemoryEnvironment() throws Exception { String testName = "WfMSTest"; int expectedNumExperiments = 16; String testID = testModelDAO.addTestModel(testName, user); String testDefinitionString = IOUtils.toString(TestFiles.getTestExplorationOneAtATimeUsersMemoryEnvironmentInputStream(), StandardCharsets.UTF_8); CountDownLatch countDownLatch = setUpExplorationMocks(testID, expectedNumExperiments, testDefinitionString); testTaskScheduler.handleTestState(testID); countDownLatch.await(10, TimeUnit.SECONDS); executorService.awaitTermination(1, TimeUnit.SECONDS); Assert.assertEquals(0, countDownLatch.getCount()); Assert.assertEquals(BenchFlowTestModel.BenchFlowTestState.TERMINATED, testModelDAO.getTestState(testID)); List<Integer> expectedIndices = new ArrayList<>(); for (int i = 0; i < expectedNumExperiments; i++) { expectedIndices.add(i); } <START> <END> Assert.assertEquals(expectedIndices, explorationModelDAO.getExplorationPointIndices(testID)); String deploymentDescriptor1 = IOUtils.toString(minioService.getExperimentDeploymentDescriptor( testID + BenchFlowConstants.MODEL_ID_DELIMITER + 1), StandardCharsets.UTF_8); Assert.assertTrue(deploymentDescriptor1.contains("mem_limit: 500m")); Assert.assertTrue(deploymentDescriptor1.contains("SIZE_OF_THREADPOOL=1")); Assert.assertTrue(deploymentDescriptor1.contains("AN_ENUM=A")); }</code><technical_language>assertion for entire space, point unit test do that</technical_language>

Target:
public void runOneAtATimeExplorationUsersMemoryEnvironment() throws Exception { String testName = "WfMSTest"; int expectedNumExperiments = 16; String testID = testModelDAO.addTestModel(testName, user); String testDefinitionString = IOUtils.toString(TestFiles.getTestExplorationOneAtATimeUsersMemoryEnvironmentInputStream(), StandardCharsets.UTF_8); CountDownLatch countDownLatch = setUpExplorationMocks(testID, expectedNumExperiments, testDefinitionString); testTaskScheduler.handleTestState(testID); countDownLatch.await(10, TimeUnit.SECONDS); executorService.awaitTermination(1, TimeUnit.SECONDS); Assert.assertEquals(0, countDownLatch.getCount()); Assert.assertEquals(BenchFlowTestModel.BenchFlowTestState.TERMINATED, testModelDAO.getTestState(testID)); List<Integer> expectedIndices = new ArrayList<>(); for (int i = 0; i < expectedNumExperiments; i++) { expectedIndices.add(i); } Assert.assertEquals(expectedIndices, explorationModelDAO.getExecutedExplorationPointIndices(testID)); String deploymentDescriptor1 = IOUtils.toString(minioService.getExperimentDeploymentDescriptor( testID + BenchFlowConstants.MODEL_ID_DELIMITER + 1), StandardCharsets.UTF_8); Assert.assertTrue(deploymentDescriptor1.contains("mem_limit: 500m")); Assert.assertTrue(deploymentDescriptor1.contains("SIZE_OF_THREADPOOL=1")); Assert.assertTrue(deploymentDescriptor1.contains("AN_ENUM=A")); }
Source:
<code>public static boolean isCommandsFile(FileDescriptor file) { final String fqn = file.getName(); final int startIndexOfFileName = fqn.lastIndexOf(PROTO_FILE_SEPARATOR) + 1; final String fileName = fqn.substring(startIndexOfFileName); <START> final boolean isCommandsFile = fileName.contains(COMMANDS_FILE_SUBSTRING); <END> return isCommandsFile; }</code><technical_language>name constant COMMANDS_FILE_SUFFIX instead of ...SUBSTRING</technical_language>

Target:
public static boolean isCommandsFile(FileDescriptor file) { final String fqn = file.getName(); final int startIndexOfFileName = fqn.lastIndexOf(FILE_PATH_SEPARATOR) + 1; final int endIndexOfFileName = fqn.lastIndexOf(FILE_EXTENSION_SEPARATOR); final String fileName = fqn.substring(startIndexOfFileName, endIndexOfFileName); final boolean isCommandsFile = fileName.endsWith(FILE_NAME_SUFFIX); return isCommandsFile; }
Source:
<code>public int hashCode() { <START> return Objects.hash(getGroupID(), <END> getArtifactID(), getVersion(), getScope()); }</code><technical_language>here, please check of Objects type is in client-side</technical_language>

Target:
public int hashCode() { int result = getGroupID().hashCode(); result = 31 * result + getArtifactID().hashCode(); result = 31 * result + getVersion().hashCode(); result = 31 * result + (getScope() != null ? getScope().hashCode() : 0); return result; }
Source:
<code>public Alert alert() { try { return Wait().until(alertIsPresent()); } catch (TimeoutException e) { <START> throw new NoAlertPresentException(); <END> } }</code><technical_language>forget wrap original exception: throw new NoAlertPresentException(e);</technical_language>

Target:
public Alert alert() { try { return Wait().until(alertIsPresent()); } catch (TimeoutException e) { throw new NoAlertPresentException("Alert not found", e); } }
Source:
<code>protected List<AttributeStatement> createUserNameAttributeStatements(final CallbackProperties properties) { final List<AttributeStatement> statements = new ArrayList<>(); final List<Attribute> attributes = new ArrayList<>(); final List<String> userNameValues = new ArrayList<>(); final String nameConstruct = properties.getUserFullName(); <START> if (nameConstruct.length() > 0) { <END> LOG.debug("UserName: {}", nameConstruct); userNameValues.add(nameConstruct); attributes.add(OpenSAML2ComponentBuilder.getInstance().createAttribute(null, SamlConstants.USERNAME_ATTR, null, userNameValues)); } else { LOG.warn("No information provided to fill in user name attribute"); } if (!attributes.isEmpty()) { statements.addAll(OpenSAML2ComponentBuilder.getInstance().createAttributeStatement(attributes)); } return statements; }</code><technical_language>Consider StringUtils.hasLength(str) check</technical_language>

Target:
protected List<AttributeStatement> createUserNameAttributeStatements(final CallbackProperties properties) { final List<AttributeStatement> statements = new ArrayList<>(); final List<Attribute> attributes = new ArrayList<>(); final List<String> userNameValues = new ArrayList<>(); final String nameConstruct = properties.getUserFullName(); if (StringUtils.isNotEmpty(nameConstruct)) { LOG.debug("UserName: {}", nameConstruct); userNameValues.add(nameConstruct); attributes.add(OpenSAML2ComponentBuilder.getInstance().createAttribute(null, SamlConstants.USERNAME_ATTR, null, userNameValues)); } else { LOG.warn("No information provided to fill in user name attribute"); } if (!attributes.isEmpty()) { statements.addAll(OpenSAML2ComponentBuilder.getInstance().createAttributeStatement(attributes)); } return statements; }
Source:
<code>public void shouldDeleteDiagnosis() { String uuid = "4e663d66-6b78-11e0-93c3-18a905e044dc"; Diagnosis diagnosis = diagnosisDAO.getDiagnosisByUuid(uuid); Assert.assertNotNull(diagnosis); diagnosisDAO.deleteDiagnosis(diagnosis); Assert.assertNull(diagnosisDAO.getDiagnosisByUuid(uuid)); <START> } <END></code><technical_language>format bracket appropriately</technical_language>

Target:
public void shouldDeleteDiagnosis() { String uuid = "4e663d66-6b78-11e0-93c3-18a905e044dc"; Diagnosis diagnosis = diagnosisDAO.getDiagnosisByUuid(uuid); assertNotNull(diagnosis); diagnosisDAO.deleteDiagnosis(diagnosis); assertNull(diagnosisDAO.getDiagnosisByUuid(uuid)); }
Source:
<code>protected void viewerSelectionChanged(SelectionChangedEvent event) { <START> actionBar.updateControls(); <END> }</code><technical_language>need check for actionbar null</technical_language>

Target:
protected void viewerSelectionChanged(SelectionChangedEvent event) { if (actionBar != null) { actionBar.updateControls(); } }