auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public JasmineResult execute(URL runnerUrl, File junitXmlReport, WebDriver driver, int timeout, boolean debug, Log log, String format) { try { if (!(driver instanceof JavascriptExecutor)) { throw new RuntimeException("The provided web driver can't execute JavaScript: " + driver.getClass()); } JavascriptExecutor executor = (JavascriptExecutor) driver; driver.get(runnerUrl.toString()); this.waitForRunnerToFinish(driver, timeout, debug, log); this.checkForConsoleErrors(driver, log); JasmineResult jasmineResult = new JasmineResult(); jasmineResult.setDetails(this.buildReport(executor,format)); FileUtils.writeStringToFile(junitXmlReport, this.buildJunitXmlReport(executor,debug), "UTF-8"); return jasmineResult; } catch (Exception e) { throw new RuntimeException(e); } finally { try { driver.quit(); } catch (Exception e) { <START> System.err.println("There was an exception quitting WebDriver - " + e.getMessage()); <END> } } }</code><technical_language>logger instead of System.err.println. Also, include entire exception: java log.error("There exception quitting WebDriver.", e);</technical_language>

Target:
public JasmineResult execute(URL runnerUrl, File junitXmlReport, WebDriver driver, int timeout, boolean debug, Log log, String format) { try { if (!(driver instanceof JavascriptExecutor)) { throw new RuntimeException("The provided web driver can't execute JavaScript: " + driver.getClass()); } JavascriptExecutor executor = (JavascriptExecutor) driver; driver.get(runnerUrl.toString()); this.waitForRunnerToFinish(driver, timeout, debug, log); this.checkForConsoleErrors(driver, log); JasmineResult jasmineResult = new JasmineResult(); jasmineResult.setDetails(this.buildReport(executor,format)); FileUtils.writeStringToFile(junitXmlReport, this.buildJunitXmlReport(executor,debug), "UTF-8"); return jasmineResult; } catch (Exception e) { throw new RuntimeException(e); } finally { try { driver.quit(); } catch (Exception e) { log.error("There was an exception quitting WebDriver.", e); } } }
Source:
<code>public PreSharedKeyIdentity(String virtualHost, String identity) { if (identity == null) { throw new NullPointerException("Identity must not be null"); } else { this.identity = identity; this.virtualHost = virtualHost; final int prime = 31; int result = 1; result = prime * result + ((identity == null) ? 0 : identity.hashCode()); result = prime * result + ((virtualHost == null) ? 0 : virtualHost.hashCode()); this.hash = result; StringBuilder b = new StringBuilder(); if (virtualHost != null) { b.append(virtualHost).append(":"); } b.append(identity); <START> this.name = b.toString(); <END> } }</code><technical_language>hash of name provide enough efficiency</technical_language>

Target:
public PreSharedKeyIdentity(String virtualHost, String identity) { if (identity == null) { throw new NullPointerException("Identity must not be null"); } else { StringBuilder b = new StringBuilder(); if (virtualHost == null) { this.virtualHost = null; } else if (StringUtil.isValidHostName(virtualHost)) { this.virtualHost = virtualHost.toLowerCase(); b.append(this.virtualHost); } else { throw new IllegalArgumentException("virtual host is not a valid hostname"); } this.identity = identity; b.append(":").append(identity); this.name = b.toString(); } }
Source:
<code>public static boolean hasBlockWaterTicket(World world, BlockPos pos) { if (world.isRemote) { throw new IllegalArgumentException("Water region is only determined server-side"); } Set<SimpleTicket<AxisAlignedBB>> tickets = wateredAABBs.get(world.provider.getDimension()); if (tickets == null) { return false; } Vec3d posAsVec3d = new Vec3d(pos); <START> return tickets.stream().anyMatch(ticket -> ticket.getTarget().contains(posAsVec3d)); <END> }</code><technical_language>if change this a tiny bit, ticket.getTarget().contains(posAsVec3d) => ticket.contains(posAsVec3d) add public boolean contains(Vec3d posAsVec3d) {return getTarget().contains(posAsVec3d)} ticket, open for modders want do (use energy/water etc)</technical_language>

Target:
public static boolean hasBlockWaterTicket(World world, BlockPos pos) { ChunkTicketManager<Vec3d> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world); if (ticketManager != null) { Vec3d posAsVec3d = new Vec3d(pos); for (SimpleTicket<Vec3d> ticket : ticketManager.getTickets()) { if (ticket.matches(posAsVec3d)) return true; } } return false; }
Source:
<code>public Iterator<ChangesQueryTestCase[]> getChangesQueryTestCases() { return Iterables.transform(Arrays.asList( queryParameter( new TestQueryRequest().withQuery("is:open") <START> ).expectUrl("/changes/?q=is%3Aopen"), <END> queryParameter( new TestQueryRequest().withQuery("is:open is:watched") ).expectUrl("/changes/?q=is%3Aopen+is%3Awatched"), queryParameter( new TestQueryRequest().withLimit(10) ).expectUrl("/changes/?n=10"), queryParameter( new TestQueryRequest().withQuery("is:open").withLimit(10) ).expectUrl("/changes/?q=is%3Aopen&n=10"), queryParameter( new TestQueryRequest().withOption(ListChangesOption.LABELS) ).expectUrl("/changes/?o=LABELS"), queryParameter( new TestQueryRequest().withStart(50) ).expectUrl("/changes/?S=50"), queryParameter( new TestQueryRequest().withSortkey("003460ab0001ae15") ).expectUrl("/changes/?N=003460ab0001ae15"), queryParameter( new TestQueryRequest().withQuery("is:open") .withLimit(10) .withOption(ListChangesOption.CURRENT_FILES) .withStart(30) ).expectUrl("/changes/?q=is%3Aopen&n=10&S=30&o=CURRENT_FILES") ), WRAP_IN_ARRAY_FUNCTION).iterator(); }</code><technical_language>I yet, I assume encoding colon works fine server</technical_language>

Target:
public Iterator<ChangesQueryTestCase[]> getChangesQueryTestCases() { return Iterables.transform(Arrays.asList( queryParameter( new TestQueryRequest().withQuery("is:open") ).expectUrl("/changes/?q=is:open"), queryParameter( new TestQueryRequest().withQuery("is:open+is:watched") ).expectUrl("/changes/?q=is:open+is:watched"), queryParameter( new TestQueryRequest().withLimit(10) ).expectUrl("/changes/?n=10"), queryParameter( new TestQueryRequest().withQuery("is:open").withLimit(10) ).expectUrl("/changes/?q=is:open&n=10"), queryParameter( new TestQueryRequest().withOption(ListChangesOption.LABELS) ).expectUrl("/changes/?o=LABELS"), queryParameter( new TestQueryRequest().withStart(50) ).expectUrl("/changes/?S=50"), queryParameter( new TestQueryRequest().withSortkey("003460ab0001ae15") ).expectUrl("/changes/?N=003460ab0001ae15"), queryParameter( new TestQueryRequest().withQuery("is:open") .withLimit(10) .withOption(ListChangesOption.CURRENT_FILES) .withStart(30) ).expectUrl("/changes/?q=is:open&n=10&S=30&o=CURRENT_FILES"), queryParameter( new TestQueryRequest().withQuery("is:merged is:watched").encode() ).expectUrl("/changes/?q=is%3Amerged+is%3Awatched") ), WRAP_IN_ARRAY_FUNCTION).iterator(); }
Source:
<code>public static void clearUserData(@NonNull Context context) { <START> ArrayList<String> exceptionsList = new ArrayList<>(); <END> Collections.addAll(exceptionsList, PrefManager.Pref.getAllPreferenceFileNames()); exceptionsList.add(DbStructure.NAME); PackageManager packageManager = context.getPackageManager(); try { PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); File dataDir = new File(packageInfo.applicationInfo.dataDir); File[] filesList = dataDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, exceptionsList); } } } catch (PackageManager.NameNotFoundException e) { logger.error(e); } File externalAppDir = FileUtil.getExternalAppDir(context); File[] filesList = externalAppDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, Collections.singletonList(AppConstants.Directories.VIDEOS)); } } PrefManager.nukeSharedPreferences(Collections.singletonList(PrefManager.Pref.APP_INFO)); }</code><technical_language>This final</technical_language>

Target:
public static void clearUserData(@NonNull Context context) { final ArrayList<String> exceptionsList = new ArrayList<>(); Collections.addAll(exceptionsList, PrefManager.Pref.getAllPreferenceFileNames()); exceptionsList.add(DbStructure.NAME); PackageManager packageManager = context.getPackageManager(); try { PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); File dataDir = new File(packageInfo.applicationInfo.dataDir); File[] filesList = dataDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, exceptionsList); } } } catch (PackageManager.NameNotFoundException e) { logger.error(e); } File externalAppDir = FileUtil.getExternalAppDir(context); File[] filesList = externalAppDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, Collections.singletonList(AppConstants.Directories.VIDEOS)); } } PrefManager.nukeSharedPreferences(Collections.singletonList(PrefManager.Pref.APP_INFO)); }
Source:
<code>public void run(String[] args) throws IOException { CmdLineParser parser = new CmdLineParser(this); <START> try { <END> parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(VERSION); System.err.println(e.getMessage()); System.err.println("java Fastq_liftOver [options...] arguments..."); parser.printUsage(System.err); System.err.println(); return; } if (printVersion) { System.out.println(VERSION); return; } long tStart = System.currentTimeMillis(); MapBlocks mapBlocks = new MapBlocks(mapFile); if (fastqType.equals("dwgsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); doLiftOverDwgsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("art")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); log.info("alnFiles " + alnFiles.get(0).getName() + " " + alnFiles.get(1).getName()); log.info("outFiles " + outFiles.get(0).getName() + " " + outFiles.get(1).getName()); doLiftOverArtFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("pbsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " "); log.info("mafFiles " + mafFiles.get(0).getName() + " "); log.info("refFiles " + refFiles.get(0).getName() + " "); log.info("outFiles " + outFiles.get(0).getName() + " "); doLiftOverPbsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress)); } log.info("Conversion took " + (System.currentTimeMillis() - tStart) / 1e3 + " seconds."); }</code><technical_language>Is wrap argument parsing VarSimTool a method</technical_language>

Target:
public void run(String[] args) throws IOException { if (!parseArguments(args)) { return; } long tStart = System.currentTimeMillis(); MapBlocks mapBlocks = new MapBlocks(mapFile); if (fastqType.equals("dwgsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); doLiftOverDwgsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("art")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); log.info("alnFiles " + alnFiles.get(0).getName() + " " + alnFiles.get(1).getName()); log.info("outFiles " + outFiles.get(0).getName() + " " + outFiles.get(1).getName()); doLiftOverArtFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("pbsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " "); log.info("mafFiles " + mafFiles.get(0).getName() + " "); log.info("refFiles " + refFiles.get(0).getName() + " "); log.info("outFiles " + outFiles.get(0).getName() + " "); doLiftOverPbsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress)); } log.info("Conversion took " + (System.currentTimeMillis() - tStart) / 1e3 + " seconds."); }
Source:
<code>private void discoverHostName_SelectedItemChanged() { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { <START> vds.setVdsName(dhost.getName() + "." + dhg.getDomainName()); END> vds.setHostName(dhost.getIp()); } updateModelFromVds(vds, null, false, null); }</code><technical_language>name mac.domain? Is changable</technical_language>

Target:
private void discoverHostName_SelectedItemChanged() { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName()); vds.setHostName(dhost.getName() + "." + dhg.getDomainName()); } updateModelFromVds(vds, null, false, null); }
Source:
<code>public void variables() { setRootRule(PythonGrammar.ATOM); Name name = (Name) parse("foo", treeMaker::expression); assertThat(name.isVariable()).isTrue(); setRootRule(PythonGrammar.ATTRIBUTE_REF); QualifiedExpression qualifiedExpressionTree = (QualifiedExpression) parse("a.b", treeMaker::expression); assertThat(qualifiedExpressionTree.name().isVariable()).isFalse(); setRootRule(PythonGrammar.FUNCDEF); FunctionDef functionDefTree = parse("def func(x): pass", treeMaker::funcDefStatement); assertThat(functionDefTree.name().isVariable()).isFalse(); setRootRule(PythonGrammar.FILE_INPUT); FileInput fileInput = parse("func(x = 2)", treeMaker::fileInput); CallExpression callExpression = (CallExpression) ((ExpressionStatement) fileInput.statements().statements().get(0)).expressions().get(0); <START> assertThat(((RegularArgument) callExpression.arguments().get(0)).keywordArgument().isVariable()).isFalse(); <END> }</code><technical_language>I test isVariable a strange semantic. I I prefer a test symbol usages</technical_language>

Target:
public void variables() { setRootRule(PythonGrammar.ATOM); Name name = (Name) parse("foo", treeMaker::expression); assertThat(name.isVariable()).isTrue(); setRootRule(PythonGrammar.ATTRIBUTE_REF); QualifiedExpression qualifiedExpressionTree = (QualifiedExpression) parse("a.b", treeMaker::expression); assertThat(qualifiedExpressionTree.name().isVariable()).isFalse(); setRootRule(PythonGrammar.FUNCDEF); FunctionDef functionDefTree = parse("def func(x): pass", treeMaker::funcDefStatement); assertThat(functionDefTree.name().isVariable()).isFalse(); }
Source:
<code><START> public static CDIProvider getCDIProvider() { <END> if (configuredProvider != null) { return configuredProvider; } else { if (discoveredProviders == null) { synchronized (lock) { if (discoveredProviders == null) { findAllProviders(); } } } configuredProvider = discoveredProviders.stream() .filter(c -> c.getCDI() != null) .findAny().orElseThrow(() -> new IllegalStateException("Unable to access CDI")); return configuredProvider; } }</code><technical_language>This method public point</technical_language>

Target:
private static CDIProvider getCDIProvider() { if (configuredProvider != null) { return configuredProvider; } else { if (discoveredProviders == null) { synchronized (lock) { if (discoveredProviders == null) { findAllProviders(); } } } configuredProvider = discoveredProviders.stream() .filter(c -> c.getCDI() != null) .findAny().orElseThrow(() -> new IllegalStateException("Unable to access CDI")); return configuredProvider; } }
Source:
<code>public static void removeIncludedGroups(AccountGroup.UUID group, Set<AccountGroupIncludeByUuid.Key> ids, final AsyncCallback<VoidResult> cb) { if (ids.size() == 1) { AccountGroupIncludeByUuid.Key g = ids.iterator().next(); <START> groups(group).id(g.getIncludeUUID().toString()).delete(cb); <END> } else { IncludedGroupInput in = IncludedGroupInput.create(); for (AccountGroupIncludeByUuid.Key g : ids) { in.add_group(g.getIncludeUUID().toString()); } group(group).view("groups.delete").post(in, cb); } }</code><technical_language>get() toString()</technical_language>

Target:
public static void removeIncludedGroups(AccountGroup.UUID group, Set<AccountGroupIncludeByUuid.Key> ids, final AsyncCallback<VoidResult> cb) { if (ids.size() == 1) { AccountGroupIncludeByUuid.Key g = ids.iterator().next(); groups(group).id(g.getIncludeUUID().get()).delete(cb); } else { IncludedGroupInput in = IncludedGroupInput.create(); for (AccountGroupIncludeByUuid.Key g : ids) { in.add_group(g.getIncludeUUID().get()); } group(group).view("groups.delete").post(in, cb); } }
Source:
<code>protected void queueRequest(final ITmfDataRequest request) { <START> if (fExecutor == null || fExecutor.isShutdown()) { <END> request.cancel(); return; } TmfEventThread thread = new TmfEventThread(this, request); if (TmfCoreTracer.isRequestTraced()) { TmfCoreTracer.traceRequest(request, "QUEUED"); } fExecutor.execute(thread); }</code><technical_language>replaced executorIsShutdown</technical_language>

Target:
protected void queueRequest(final ITmfDataRequest request) { if (fExecutor.isShutdown()) { request.cancel(); return; } TmfEventThread thread = new TmfEventThread(this, request); if (TmfCoreTracer.isRequestTraced()) { TmfCoreTracer.traceRequest(request, "QUEUED"); } fExecutor.execute(thread); }
Source:
<code>public void canRemoveRelease() throws Exception { final Releases releases = RtReleasesITCase.releases(); <START> final Release release = releases.create("v.011"); <END> MatcherAssert.assertThat( releases.iterate(), Matchers.hasItem(release) ); releases.remove(release.number()); MatcherAssert.assertThat( releases.iterate(), Matchers.not(Matchers.hasItem(release)) ); }</code><technical_language>if a release this name exists there? test fail</technical_language>

Target:
public void canRemoveRelease() throws Exception { final Releases releases = RtReleasesITCase.releases(); final Release release = releases.create( RandomStringUtils.randomAlphabetic(Tv.TEN) ); MatcherAssert.assertThat( releases.iterate(), Matchers.hasItem(release) ); releases.remove(release.number()); MatcherAssert.assertThat( releases.iterate(), Matchers.not(Matchers.hasItem(release)) ); }
Source:
<code>public double getDemandedEnergy() { if( this.isOutput() ) { return 0; } try { for( PartP2PIC2Power t : this.getOutputs() ) { if( t.OutputEnergyA <= 0.0001 || t.OutputEnergyB <= 0.0001 ) { return 2048; } } } <START> catch( GridAccessException e ) <END> { return 0; } return 0; }</code><technical_language>![MAJOR](<LINK_1> log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public double getDemandedEnergy() { if( this.isOutput() ) { return 0; } try { for( PartP2PIC2Power t : this.getOutputs() ) { if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 ) { return 2048; } } } catch( GridAccessException e ) { return 0; } return 0; }
Source:
<code>public ComponentBuilder append(String text, FormatRetention retention) { parts.add( current ); <START> <END> TextComponent component = new TextComponent( current ); component.setText( text ); current = component; retain( retention ); return this; }</code><technical_language>is this line related " Add API append BaseComponent arrays ComponentBuilder"</technical_language>

Target:
public ComponentBuilder append(String text, FormatRetention retention) { parts.add( current ); current = new TextComponent( (TextComponent) current ); ((TextComponent) current).setText( text ); retain( retention ); return this; }
Source:
<code>public boolean push(Collection<Event> events) { HttpPost post = new HttpPost(eventGateUri); try { <START> post.setEntity(new StringEntity(objectMapper.writeValueAsString(events), ContentType.APPLICATION_JSON)); <END> try (CloseableHttpResponse response = httpClient.execute(post)) { if (response.getStatusLine().getStatusCode() >= 400) { log.error("Cannot send events to eventgate endpoint: {}: {}", eventGateUri, response.getStatusLine()); return false; } } return true; } catch (IOException e) { log.error("Cannot send events to eventgate endpoint: {}", eventGateUri, e); return false; } }</code><technical_language>stream request instead of this intermediate String</technical_language>

Target:
public int push(Collection<Event> events) { HttpPost post = new HttpPost(eventGateUri); try { post.setEntity(httpEntity(events)); try (CloseableHttpResponse response = httpClient.execute(post)) { if (response.getStatusLine().getStatusCode() >= 400) { log.error("Cannot send events to eventgate endpoint: {}: {}", eventGateUri, response.getStatusLine()); return 0; } } return events.size(); } catch (IOException e) { log.error("Cannot send events to eventgate endpoint: {}", eventGateUri, e); return 0; } }
Source:
<code>public void init() { switch (this.getAttackStrength()) { case LOW: maxRequestCount = 4; break; case MEDIUM: maxRequestCount = 8; break; case HIGH: maxRequestCount = 12; break; case INSANE: maxRequestCount = 28; break; <START> default: <END> break; } }</code><technical_language>Set MEDIUM</technical_language>

Target:
public void init() { switch (this.getAttackStrength()) { case LOW: maxRequestCount = 4; break; case MEDIUM: maxRequestCount = 8; break; case HIGH: maxRequestCount = 12; break; case INSANE: maxRequestCount = 28; break; default: maxRequestCount = 8; break; } }
Source:
<code>protected void testAddStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.ADD, 2); assertAddedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } <START> <END> assertEqualsB4Left(right); }</code><technical_language>assertEqualsB4Left method name ? call this test A4 model, method name is appropriate. Change method name, this test in abstract file test, sould divide in tests. Please do change other tests present problem</technical_language>

Target:
protected void testAddStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.ADD, 2); assertAddedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsM1(right); assertEqualsM1(left); }
Source:
<code>public boolean architectureMatches(String productArch) { if (productArch != null) { Set<String> supportedArches = <START> org.candlepin.util.Util.asSet(productArch.toUpperCase().trim().split("\\s*,\\s*")); <END> if (supportedArches.contains("X86")) { supportedArches.add("I386"); supportedArches.add("I586"); supportedArches.add("I686"); } if (!supportedArches.contains("ALL") && (!this.hasFact(Consumer.Facts.ARCH) || this.getFact(Consumer.Facts.ARCH).isEmpty() || !supportedArches.contains(this.getFact(Consumer.Facts.ARCH).toUpperCase()))) { return false; } } return true; }</code><technical_language>This need fully qualified if this lives</technical_language>

Target:
public boolean architectureMatches(String productArch) { if (productArch != null) { Set<String> supportedArches = Util.asSet(productArch.toUpperCase().trim().split("\\s*,\\s*")); if (supportedArches.contains("X86")) { supportedArches.add("I386"); supportedArches.add("I586"); supportedArches.add("I686"); } if (!supportedArches.contains("ALL") && (!this.hasFact(Consumer.Facts.ARCH) || this.getFact(Consumer.Facts.ARCH).isEmpty() || !supportedArches.contains(this.getFact(Consumer.Facts.ARCH).toUpperCase()))) { return false; } } return true; }
Source:
<code>private void maybeAddNewline(Node n) { Node previousNode = n.getPrevious(); <START> boolean hasComment = nodeComments.hasComment(n) || nodeComments.hasComment(n.getParent()); <END> if (isEmptyAndHasComment(previousNode) || (n.getParent() != null && isEmptyAndHasComment(n.getParent().getPrevious()))) { hasComment = true; } if (!hasComment && TOKENS_TO_ADD_NEWLINES_BEFORE.contains(n.getToken())) { add("\n"); } }</code><technical_language>getParent() check is enough? I.e., ASTs check grandparent higher</technical_language>

Target:
private void maybeAddNewline(Node n) { boolean hasComment = nodeComments.hasComment(n) || nodeComments.hasComment(n.getParent()) || isPreviousEmptyAndHasComment(n) || (n.getParent() != null && isPreviousEmptyAndHasComment(n.getParent())); if (!hasComment && TOKENS_TO_ADD_NEWLINES_BEFORE.contains(n.getToken())) { add("\n"); } }
Source:
<code>public Receive createReceive() { return receiveBuilder() .match(Tick.class, message -> { _periodicMetrics.recordCounter("job-executor-actor-ticks", 1); if (!_cachedJob.isPresent()) { <START> LOGGER.info() <END> .setMessage("uninitialized JobExecutorActor is trying to tick") .log(); return; } final CachedJob<T> cachedJob = _cachedJob.get(); final Optional<Instant> nextRun = cachedJob.getSchedule().nextRun(cachedJob.getLastRun()); if (!nextRun.isPresent()) { LOGGER.info() .setMessage("job has no more scheduled runs") .addData("cachedJob", cachedJob) .log(); stopForever(); return; } if (_clock.instant().isBefore(nextRun.get())) { scheduleExtraTickIfNecessary(nextRun.get()); } else { if (_executionMutex.tryAcquire()) { cachedJob.execute(getSelf(), nextRun.get()) .whenComplete((result, error) -> _executionMutex.release()); } } }) .match(Reload.class, message -> { final String eTag = message.getETag(); final CachedJob<T> cachedJob; try { cachedJob = initializeOrEnsureRefMatch(unsafeJobRefCast(message.getJobRef())); if (eTag == null) { cachedJob.reload(); } else { cachedJob.reloadIfOutdated(eTag); } } catch (final NoSuchElementException error) { LOGGER.warn() .setMessage("job no longer exists in repository; stopping actor") .addData("jobRef", message.getJobRef()) .log(); stopForever(); } }) .build(); }</code><technical_language>This happen right? conversely, wait schedule timer initialization? (the isPresent check is required point error)</technical_language>

Target:
public Receive createReceive() { return receiveBuilder() .match(Tick.class, this::tick) .match(Reload.class, message -> { @SuppressWarnings("unchecked") final Reload<T> typedMessage = (Reload<T>) message; this.reload(typedMessage); }) .match(JobCompleted.class, message -> { @SuppressWarnings("unchecked") final JobCompleted<T> typedMessage = (JobCompleted<T>) message; this.jobCompleted(typedMessage); }) .build(); }
Source:
<code>public boolean equals(Object obj) { <START> if (this == obj) <END> return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TestClass other = (TestClass) obj; if (fClass == null) return other.fClass == null; else return fClass.equals(other.fClass); }</code><technical_language>JUnit style is braces for "if" "do" "while" statements</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TestClass other = (TestClass) obj; return fClass == other.fClass; }
Source:
<code>public void beginSpan(SpanType type, Attributes attributes) { <START> if (delegate.isXhtmlStrict()) { <END> assertOpenImplicitBlock(); } SpanStrategy strategy = pushSpanStrategy(type, attributes); strategy.beginSpan(delegate, type, attributes); }</code><technical_language>move if (delegate.isXhtmlStrict()) assertOpenImplicitBlock</technical_language>

Target:
public void beginSpan(SpanType type, Attributes attributes) { assertOpenBlock(); SpanStrategy strategy = pushSpanStrategy(type, attributes); strategy.beginSpan(delegate, type, attributes); }
Source:
<code>public Transceiver readCategories(final ArticleIdentity id) throws IOException { return new Transceiver() { @Override protected Calendar getLastModifiedDate() { <START> return null; <END> } @Override protected Object getData() throws IOException { Article article = findArticleById(id); return article.getCategories(); } }; }</code><technical_language>I article object's lastModified return here. want query for in getData; able avoid this extending EntityTransceiver instead of Transceiver</technical_language>

Target:
public Transceiver readCategories(final ArticleIdentity id) throws IOException { return new EntityTransceiver<Article>() { @Override protected Article fetchEntity() { return findArticleById(id); } @Override protected Object getView(Article entity) { return entity.getCategories(); } }; }
Source:
<code>static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(CertificateServiceVersion.values()).filter( CertificateClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> { argumentsList.add(Arguments.of(httpClient, serviceVersion)); System.out.println("-----------------------------------------------------------"); <START> System.out.println(httpClient); System.out.println(serviceVersion); <END> System.out.println("-----------------------------------------------------------"); }); }); return argumentsList.stream(); }</code><technical_language>suggestion System.out.printf("HttpClient is %s; Service Version is %s", httpClient, serviceVersion);</technical_language>

Target:
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(CertificateServiceVersion.values()).filter( CertificateClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> { argumentsList.add(Arguments.of(httpClient, serviceVersion)); }); }); return argumentsList.stream(); }
Source:
<code>protected void resetView(ITmfTrace viewTrace) { super.resetView(viewTrace); <START> ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> dataProvider = DataProviderManager <END> .getInstance().getDataProvider(viewTrace, getProviderId(), ITimeGraphDataProvider.class); if (dataProvider != null) { fEntries.row(dataProvider).clear(); } }</code><technical_language>Is a chance this create a data provider required? data provider trace child traces, view trace? need pattern traceClosed implementation. need do calling super.resetView() entry list cleared</technical_language>

Target:
protected void resetView(ITmfTrace viewTrace) { List<@NonNull TimeGraphEntry> entryList = getEntryList(viewTrace); super.resetView(viewTrace); if (entryList != null) { synchronized (fEntries) { for (TimeGraphEntry entry : entryList) { if (entry instanceof TraceEntry) { fEntries.row(((TraceEntry) entry).getProvider()).clear(); } } } } }
Source:
<code>public void setClassId() { ClassIds.assignClassId(getElement(), ClassIds.LEFT_RIGHT_TOGGLE_BTN + " _ " + left_.getInnerText() + "_" + right_.getInnerText()); <START> ClassIds.assignClassId(left_, ClassIds.LEFT_TOGGLE_BTN + "_" + left_.getInnerText()); <END> ClassIds.assignClassId(right_, ClassIds.RIGHT_TOGGLE_BTN + "_" + right_.getInnerText()); }</code><technical_language>other question, this potentially result in class ids spaces in them</technical_language>

Target:
public void setClassId() { String leftId = ClassIds.idSafeString(left_.getInnerText()); String rightId = ClassIds.idSafeString(right_.getInnerText()); ClassIds.assignClassId(getElement(), ClassIds.LEFT_RIGHT_TOGGLE_BTN + "_" + leftId + "_" + rightId); ClassIds.assignClassId(left_, ClassIds.LEFT_TOGGLE_BTN + "_" + leftId); ClassIds.assignClassId(right_, ClassIds.RIGHT_TOGGLE_BTN + "_" + rightId); }
Source:
<code><START> public Boolean getUnconfirmedAllowed(String product) { <END> ProductEntry entry = products.get(product); if (entry != null) { return entry.getUnconfirmedAllowed(); } else { return false; } }</code><technical_language>This return a boolean boolean</technical_language>

Target:
public boolean getUnconfirmedAllowed(String product) { ProductEntry entry = products.get(product); if (entry != null && entry.getUnconfirmedAllowed() != null) { return entry.getUnconfirmedAllowed().booleanValue(); } else { return false; } }
Source:
<code>public Window merge(Window that) { final List<Expression> partitionBy; if (that.getPartitions().isEmpty()) { partitionBy = this.getPartitions(); } else { if (!this.getPartitions().isEmpty()) { throw new IllegalArgumentException( "Cannot override PARTITION BY clause of window " + this.windowRef); } partitionBy = that.getPartitions(); } final List<SortItem> orderBy; if (that.getOrderBy().isEmpty()) { orderBy = this.getOrderBy(); } else { if (!this.getOrderBy().isEmpty()) { throw new IllegalArgumentException( "Cannot override ORDER BY clause of window " + this.windowRef); } orderBy = that.getOrderBy(); } if (that.getWindowFrame().isPresent()) { throw new IllegalArgumentException( "Cannot copy window " + this.windowRef() + " because it has a frame clause"); } <START> return new Window(null, partitionBy, orderBy, this.getWindowFrame()); <END> }</code><technical_language>is windowRef property preserved</technical_language>

Target:
public Window merge(Window that) { if (this.empty()) { return that; } final List<Expression> partitionBy; if (!this.partitions.isEmpty()) { throw new IllegalArgumentException( "Cannot override PARTITION BY clause of window " + this.windowRef); } else { partitionBy = that.getPartitions(); } final List<SortItem> orderBy; if (that.getOrderBy().isEmpty()) { orderBy = this.getOrderBy(); } else { if (!this.getOrderBy().isEmpty()) { throw new IllegalArgumentException( "Cannot override ORDER BY clause of window " + this.windowRef); } orderBy = that.getOrderBy(); } if (that.getWindowFrame().isPresent()) { throw new IllegalArgumentException( "Cannot copy window " + this.windowRef() + " because it has a frame clause"); } return new Window(that.windowRef, partitionBy, orderBy, this.getWindowFrame()); }
Source:
<code>public ResponseEntity<?> commitCursors(@PathVariable("subscriptionId") final String subscriptionId, @RequestBody final List<Cursor> cursors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.HIGH_LEVEL_API)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } try { final boolean allCommitted = cursorsCommitService.commitCursors(subscriptionId, cursors); return allCommitted ? ResponseEntity.ok().build() : ResponseEntity.noContent().build(); } catch (final NakadiException e) { return Responses.create(e.asProblem(), request); } catch (InvalidCursorException e) { <START> return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, e.getMessage()), request); <END> } }</code><technical_language>removed static imports</technical_language>

Target:
public ResponseEntity<?> commitCursors(@PathVariable("subscriptionId") final String subscriptionId, @RequestBody final List<Cursor> cursors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final boolean allCommitted = cursorsService.commitCursors(subscriptionId, cursors); return allCommitted ? ok().build() : noContent().build(); } catch (final NakadiException e) { return create(e.asProblem(), request); } catch (InvalidCursorException e) { return create(Problem.valueOf(UNPROCESSABLE_ENTITY, e.getMessage()), request); } }
Source:
<code><START> public static String humanReadable(long bytes) { <END> if (bytes > GB) { return String.format("%.03f GB", ((float) bytes) / GB); } else if (bytes > MB) { return String.format("%.03f MB", ((float) bytes) / MB); } else if (bytes > KB) { return String.format("%.03f kB", ((float) bytes) / KB); } else { return String.format("%d B", bytes); } }</code><technical_language>method snippet instead of copying logic (there is a typo %.02f B in case %d B below)? java public static String humanReadable(long bytes) { float fbytes = (float) bytes; return humanReadable(fbytes); }</technical_language>

Target:
public static String humanReadable(long bytes) { if (bytes > TB) { return String.format("%.03f TB", ((float) bytes) / TB); } else if (bytes > GB) { return String.format("%.03f GB", ((float) bytes) / GB); } else if (bytes > MB) { return String.format("%.03f MB", ((float) bytes) / MB); } else if (bytes > KB) { return String.format("%.03f kB", ((float) bytes) / KB); } else { return String.format("%d B", bytes); } }
Source:
<code><START> private void deleteRoutingDataPath() throws Exception { <END> TestHelper.verify(() -> { ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH); if (ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .exists(MetadataStoreRoutingConstants.ROUTING_DATA_PATH)) { return false; } return true; }, TestHelper.WAIT_DURATION); }</code><technical_language>do Assert.assertTrue return of verify()</technical_language>

Target:
private void deleteRoutingDataPath() throws Exception { Assert.assertTrue(TestHelper.verify(() -> { ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH); if (ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .exists(MetadataStoreRoutingConstants.ROUTING_DATA_PATH)) { return false; } return true; }, TestHelper.WAIT_DURATION), "Routing data path should be deleted after the tests."); }
Source:
<code>public void testFilterPublic() { filter.inClazz = DummyPublicPOJO.class; filter.setCondition("({$}.val == 100)"); <START> filter.activate(null); <END> logger.debug("start round 0"); filter.beginWindow(0); pdata.val = 100; filter.input.process(pdata); Assert.assertEquals("true tuples", 1, filter.trueTuples); Assert.assertEquals("false tuples", 0, filter.falseTuples); filter.endWindow(); logger.debug("end round 0"); logger.debug("start round 1"); filter.beginWindow(1); pdata.val = 1000; filter.input.process(pdata); Assert.assertEquals("true tuples", 0, filter.trueTuples); Assert.assertEquals("false tuples", 1, filter.falseTuples); filter.endWindow(); logger.debug("end round 1"); filter.deactivate(); }</code><technical_language>Please call setup tear of operator</technical_language>

Target:
public void testFilterPublic() { prepareFilterOperator(DummyPublicPOJO.class, "({$}.val == 100)"); filter.beginWindow(0); pdata.val = 100; filter.input.put(pdata); Assert.assertEquals("true condition true tuples", 1, trueSink.getCount()); Assert.assertEquals("true condition false tuples", 0, falseSink.getCount()); Assert.assertEquals("true condition error tuples", 0, errorSink.getCount()); filter.endWindow(); clearSinks(); filter.beginWindow(1); pdata.val = 1000; filter.input.put(pdata); Assert.assertEquals("false condition true tuples", 0, trueSink.getCount()); Assert.assertEquals("false condition false tuples", 1, falseSink.getCount()); Assert.assertEquals("false condition error tuples", 0, errorSink.getCount()); filter.endWindow(); clearFilterOperator(); }
Source:
<code>public void alteringSomeParametersDuringClone() throws Exception { destRepo = new File(ResourcesPlugin.getWorkspace() .getRoot().getLocation().toFile(), "test2"); importWizard.openWizard(); RepoPropertiesPage repoProperties = importWizard.openRepoPropertiesPage(); RepoRemoteBranchesPage remoteBranches = repoProperties .nextToRemoteBranches(r.getUri()); remoteBranches.deselectAllBranches(); remoteBranches .assertErrorMessage("At least one branch must be selected."); remoteBranches.assertNextIsDisabled(); remoteBranches.selectBranches(SampleTestRepository.FIX); remoteBranches.assertNextIsEnabled(); WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy(); workingCopy.setDirectory(destRepo.toString()); workingCopy.assertBranch(SampleTestRepository.FIX); workingCopy.setRemoteName("src"); workingCopy.waitForCreate(); Repository repository = new RepositoryBuilder().setGitDir( <START> new File(destRepo, Constants.DOT_GIT)).build(); <END> assertNotNull(repository.resolve("src/" + SampleTestRepository.FIX)); assertNull(repository.resolve("src/master")); assertEquals(repository.resolve("stable"), repository .resolve("src/stable")); assertNotNull(repository.resolve(Constants.R_TAGS + SampleTestRepository.v2_0_name).name()); assertTrue(repository.getAllRefs().size() >= 4); bot.button("Cancel").click(); }</code><technical_language>FileRepositoryBuilder.create</technical_language>

Target:
public void alteringSomeParametersDuringClone() throws Exception { destRepo = new File(ResourcesPlugin.getWorkspace() .getRoot().getLocation().toFile(), "test2"); importWizard.openWizard(); RepoPropertiesPage repoProperties = importWizard.openRepoPropertiesPage(); RepoRemoteBranchesPage remoteBranches = repoProperties .nextToRemoteBranches(r.getUri()); remoteBranches.deselectAllBranches(); remoteBranches .assertErrorMessage("At least one branch must be selected."); remoteBranches.assertNextIsDisabled(); remoteBranches.selectBranches(SampleTestRepository.FIX); remoteBranches.assertNextIsEnabled(); WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy(); workingCopy.setDirectory(destRepo.toString()); workingCopy.assertBranch(SampleTestRepository.FIX); workingCopy.setRemoteName("src"); workingCopy.waitForCreate(); Repository repository = FileRepositoryBuilder.create(new File(destRepo, Constants.DOT_GIT)); assertNotNull(repository.resolve("src/" + SampleTestRepository.FIX)); assertNull(repository.resolve("src/master")); assertEquals(repository.resolve("stable"), repository .resolve("src/stable")); assertNotNull(repository.resolve(Constants.R_TAGS + SampleTestRepository.v2_0_name).name()); assertTrue(repository.getAllRefs().size() >= 4); bot.button("Cancel").click(); }
Source:
<code><START> public void setSelectedDevices(List<StorageDevice> selectedDevices) { <END> getStorageDevices().setSelectedItems(selectedDevices); }</code><technical_language>this protected. I assume ListModel is</technical_language>

Target:
protected void setSelectedDevices(List<StorageDevice> selectedDevices) { getStorageDevices().setSelectedItems(selectedDevices); }
Source:
<code>public void processTraces(Traces traces, String projectId) { URL url; String urlString = String.format("%s/v1/projects/%s/traces", hostUrl, projectId); try { url = new URL(urlString); } catch (MalformedURLException ex) { logger.severe("Malformed URL: " + urlString); return; } String jsonRequest; try { jsonRequest = JsonFormat.printer().print(traces); } catch (InvalidProtocolBufferException ex) { logger.severe("Failed to format: " + traces.toString()); return; } try { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("X-HTTP-Method-Override", "PATCH"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Authorization", "Bearer " + oAuth2Credentials.getAccessToken().getTokenValue()); <START> byte[] responseBytes = ByteStreams.toByteArray(connection.getInputStream()); <END> int responseCode = connection.getResponseCode(); if (responseCode != 200) { logger.severe(String.format("Unsuccessful patchTraces (%s):\nResponse: %s", responseCode, new String(responseBytes))); } } catch (IOException ex) { logger.severe("Failed to send: " + traces.toString()); } }</code><technical_language>move this if statement avoid making this call status != 200</technical_language>

Target:
private void processTraces(Traces traces, String projectId) { URL url; String urlString = String.format("%s/v1/projects/%s/traces", hostUrl, projectId); try { url = new URL(urlString); } catch (MalformedURLException ex) { logger.severe("Malformed URL: " + urlString); return; } String jsonRequest; try { jsonRequest = JsonFormat.printer().print(traces); } catch (InvalidProtocolBufferException ex) { logger.severe("Failed to format: " + traces.toString()); return; } try { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("X-HTTP-Method-Override", "PATCH"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty( "Authorization", "Bearer " + oAuth2Credentials.getAccessToken().getTokenValue()); InputStream responseStream = connection.getInputStream(); int responseCode = connection.getResponseCode(); if (responseCode != 200) { byte[] responseBytes = ByteStreams.toByteArray(responseStream); logger.severe(String.format("Unsuccessful patchTraces (%s):\nResponse: %s", responseCode, new String(responseBytes))); } } catch (IOException ex) { logger.severe("Failed to send: " + traces.toString()); } }
Source:
<code>public MobFileCleanerChore(HMaster master) { super(master.getServerName() + "-MobFileCleanerChore", master, master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), TimeUnit.SECONDS); this.master = master; <START> try (Connection conn = ConnectionFactory.createConnection(master.getConfiguration())) { <END> this.connection = conn; } catch (IOException e) { LOG.warn("Failed to create connection", e); } cleaner = new ExpiredMobFileCleaner(connection); cleaner.setConf(master.getConfiguration()); checkObsoleteConfigurations(); }</code><technical_language>this call conn.close end of try block. master.getConnection() of shared connection making a new one</technical_language>

Target:
public MobFileCleanerChore(HMaster master) { super(master.getServerName() + "-MobFileCleanerChore", master, master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), TimeUnit.SECONDS); this.master = master; cleaner = new ExpiredMobFileCleaner(master.getConnection()); cleaner.setConf(master.getConfiguration()); checkObsoleteConfigurations(); }
Source:
<code>public boolean isAccountLinkingEnabled () { <START> return AccountLinkingStatus.ENABLED.equals(getStatus()) ? true : false; <END> }</code><technical_language>simplified AccountLinkingStatus.ENABLED.equals(getStatus())</technical_language>

Target:
public boolean isAccountLinkingEnabled () { return AccountLinkingStatus.ENABLED.equals(getStatus()); }