auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void processComplex(RelOptRuleCall call, Project project, TableScan scan) { HazelcastTable originalTable = OptUtils.getHazelcastTable(scan); ProjectFieldVisitor projectFieldVisitor = new ProjectFieldVisitor(originalTable.getProjects()); for (RexNode projectExp : project.getProjects()) { projectExp.accept(projectFieldVisitor); } List<Integer> newScanProjects = projectFieldVisitor.createNewScanProjects(); if (newScanProjects.isEmpty()) { <START> return; <END> } if (newScanProjects.size() == originalTable.getProjects().size()) { return; } LogicalTableScan newScan = OptUtils.createLogicalScanWithNewTable( scan, originalTable.withProject(newScanProjects) ); ProjectConverter projectConverter = projectFieldVisitor.createProjectConverter(); List<RexNode> newProjects = new ArrayList<>(); for (RexNode projectExp : project.getProjects()) { RexNode newProjectExp = projectExp.accept(projectConverter); newProjects.add(newProjectExp); } LogicalProject newProject = LogicalProject.create( newScan, project.getHints(), newProjects, project.getRowType() ); call.transformTo(newProject); }</code><technical_language>set projects=[] for scan? able handle zero fields..</technical_language>

Target:
private void processComplex(RelOptRuleCall call, Project project, TableScan scan) { HazelcastTable originalTable = OptUtils.getHazelcastTable(scan); ProjectFieldVisitor projectFieldVisitor = new ProjectFieldVisitor(originalTable.getProjects()); for (RexNode projectExp : project.getProjects()) { projectExp.accept(projectFieldVisitor); } List<Integer> newScanProjects = projectFieldVisitor.createNewScanProjects(); if (newScanProjects.size() == originalTable.getProjects().size()) { return; } LogicalTableScan newScan = OptUtils.createLogicalScanWithNewTable( scan, originalTable.withProject(newScanProjects) ); ProjectConverter projectConverter = projectFieldVisitor.createProjectConverter(); List<RexNode> newProjects = new ArrayList<>(); for (RexNode projectExp : project.getProjects()) { RexNode newProjectExp = projectExp.accept(projectConverter); newProjects.add(newProjectExp); } LogicalProject newProject = LogicalProject.create( newScan, project.getHints(), newProjects, project.getRowType() ); call.transformTo(newProject); }
Source:
<code>static <R extends IRecipe<?>> List<R> filterRecipes(Collection<IRecipe<?>> recipes, Class<R> recipeClass, IRecipeType<R> recipeType) { return recipes.stream() .filter(iRecipe -> iRecipe.getType()==recipeType) .map(recipeClass::cast) <START> .collect(Collectors.toCollection(ArrayList::new)); <END> }</code><technical_language>Collectors.toList()</technical_language>

Target:
static <R extends IRecipe<?>> Map<ResourceLocation, R> filterRecipes(Collection<IRecipe<?>> recipes, Class<R> recipeClass, IRecipeType<R> recipeType) { return recipes.stream() .filter(iRecipe -> iRecipe.getType()==recipeType) .map(recipeClass::cast) .collect(Collectors.toMap(recipe -> recipe.getId(), recipe -> recipe)); }
Source:
<code>public final void removeBundles(Bundle... bundles) { for (Bundle bundle : bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } <START> if (bundles != null && bundles != this.bundles) { <END> for (Bundle bundle : this.bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } } }</code><technical_language>Whats benefit of check if bundles working is bundles base class has? append parse loop</technical_language>

Target:
public final void removeBundles(Bundle... bundles) { for (Bundle bundle : bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } if (bundles != this.bundles) { for (Bundle bundle : this.bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } } }
Source:
<code>public CurrencyAmount presentValue(FixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { CurrencyAmount pvProduct = presentValueProduct(trade, provider); CurrencyAmount pvPayment = presentValuePayment(trade, provider); <START> return pvProduct.plus(pvPayment); <END> }</code><technical_language>trade "quantity" missing</technical_language>

Target:
public CurrencyAmount presentValue(FixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { LocalDate settlementDate = trade.getTradeInfo().getSettlementDate().get(); CurrencyAmount pvProduct = productPricer.presentValue(trade.getProduct(), provider, settlementDate); return presentValueFromProductPresentValue(trade, provider, pvProduct); }
Source:
<code>public Map<String, String> getUAMap(String uaString) { result.clear(); UserAgent browser = null; Device device = null; OS os = null; if (uaString == null) uaString = ""; try { Client c = cachingParser.parse(uaString); if (c != null) { browser = c.userAgent; device = c.device; os = c.os; } } catch (Exception e) { LOG.error(e.getMessage(), e); } if (browser != null) { result.put("browser_family", replaceNA(browser.family)); result.put("browser_major", replaceNA(browser.major)); } else { result.put("browser_family", NA); result.put("browser_major", NA); } if (device != null) { result.put("device_family", replaceNA(device.family)); } else { result.put("device_family", NA); } if (os != null) { result.put("os_family", replaceNA(os.family)); result.put("os_major", replaceNA(os.major)); result.put("os_minor", replaceNA(os.minor)); } else { result.put("os_family", NA); result.put("os_major", NA); result.put("os_minor", NA); } <START> <END> if (uaString.startsWith("WikipediaApp")) { int delimiterIndex = uaString.indexOf(' ', 13); result.put("wmf_app_version", uaString.substring(13, delimiterIndex)); } else { result.put("wmf_app_version", NA); } return result; }</code><technical_language>more future proof do: String wikipediaApp = "WikipediaApp"; ...startsWith(wikipediaApp) int delimiterIndex = uaString.indexOf(' ', wikipediaApp.length()) ... uaString.substring(wikipediaApp.length() delimiterIndex) ... hardcoding literal 13 in there</technical_language>

Target:
public Map<String, String> getUAMap(String uaString) { result.clear(); UserAgent browser = null; Device device = null; OS os = null; if (uaString == null) uaString = ""; try { Client c = cachingParser.parse(uaString); if (c != null) { browser = c.userAgent; device = c.device; os = c.os; } } catch (Exception e) { LOG.error(e.getMessage(), e); } if (browser != null) { result.put("browser_family", replaceNA(browser.family)); result.put("browser_major", replaceNA(browser.major)); } else { result.put("browser_family", NA); result.put("browser_major", NA); } if (device != null) { result.put("device_family", replaceNA(device.family)); } else { result.put("device_family", NA); } if (os != null) { result.put("os_family", replaceNA(os.family)); result.put("os_major", replaceNA(os.major)); result.put("os_minor", replaceNA(os.minor)); } else { result.put("os_family", NA); result.put("os_major", NA); result.put("os_minor", NA); } String wmfAppStart = "WikipediaApp/"; if (uaString.startsWith(wmfAppStart)) { int from = wmfAppStart.length(); int to = uaString.indexOf(' ', from); result.put("wmf_app_version", uaString.substring(from, to)); } else { result.put("wmf_app_version", NA); } return result; }
Source:
<code>private List<ComputedStatistics> getComputedStatistics() { ImmutableList.Builder<ComputedStatistics> statistics = ImmutableList.builder(); while (!statisticsAggregation.isFinished()) { <START> Page page = statisticsAggregation.getOutput(); <END> if (page == null) { continue; } for (int position = 0; position < page.getPositionCount(); position++) { statistics.add(getComputedStatistics(page, position)); } } return statistics.build(); }</code><technical_language>verify(statisticsAggregation.isBlocked().isDone()); fail fast voidly looping in case wrong</technical_language>

Target:
private List<ComputedStatistics> getComputedStatistics() { ImmutableList.Builder<ComputedStatistics> statistics = ImmutableList.builder(); while (!statisticsAggregationOperator.isFinished()) { verify(statisticsAggregationOperator.isBlocked().isDone()); Page page = statisticsAggregationOperator.getOutput(); if (page == null) { continue; } for (int position = 0; position < page.getPositionCount(); position++) { statistics.add(getComputedStatistics(page, position)); } } return statistics.build(); }
Source:
<code>public static Serializer getXmlSerializer() { if (xmlSerializer == null) { <START> xmlSerializer = Framework.getService(SerializerService.class).getSerializer("xml"); <END> } return xmlSerializer; }</code><technical_language>store result of Framework.getService in a field. Do lookup time (same issue in other classes too)</technical_language>

Target:
public static Serializer getXmlSerializer() { return SerializerService.getXMLSerializerHelper(); }
Source:
<code>private void createNewTargetState(boolean resolve, URL[] urls, IProgressMonitor monitor) { fState = stateObjectFactory.createState(resolve); if (resolve) { fState.getResolver().setSelectionPolicy(new Comparator<BaseDescription>() { @Override public int compare(BaseDescription bd1, BaseDescription bd2) { <START> Version v1 = bd1.getVersion(); Version v2 = bd2.getVersion(); if (v1.getMajor() == v2.getMajor() && v1.getMinor() == v2.getMinor() && v1.getMicro() == v2.getMicro()) { boolean q1 = "qualifier".equals(v1.getQualifier()); boolean q2 = "qualifier".equals(v2.getQualifier()); if (q1 && q2) { return 0; } else if (q1 && !q2) { return -1; } else if (q2 && !q1) { return 1; } } return v2.compareTo(v1); <END> } }); } monitor.beginTask(PDECoreMessages.PDEState_CreatingTargetModelState, urls.length); for (int i = 0; i < urls.length; i++) { File file = new File(urls[i].getFile()); try { if (monitor.isCanceled()) return; monitor.subTask(file.getName()); addBundle(file, -1); } catch (CoreException e) { PDECore.log(e); } finally { monitor.worked(1); } } }</code><technical_language>In case of a tie I return similar VersionHashMap.compare does: return bd1.getBundleId() <= bd2.getBundleId() ? -1 : 1; This code assumes bundle IDs same. If do duplicate bundle IDs (which allowed) this mess sort algorithm</technical_language>

Target:
private void createNewTargetState(boolean resolve, URL[] urls, IProgressMonitor monitor) { fState = stateObjectFactory.createState(resolve); if (resolve) { fState.getResolver().setSelectionPolicy(new Comparator<BaseDescription>() { @Override public int compare(BaseDescription bd1, BaseDescription bd2) { Version v1 = bd1.getVersion(); Version v2 = bd2.getVersion(); int versionCompare = versionCompare(v1, v2); if (versionCompare != 0) return versionCompare; BundleDescription s1 = bd1.getSupplier(); BundleDescription s2 = bd2.getSupplier(); String n1 = s1.getName(); String n2 = s2.getName(); if (n1 != null && n1.equals(n2)) { return versionCompare(s1.getVersion(), s2.getVersion()); } long id1 = s1.getBundleId(); long id2 = s2.getBundleId(); return (id1 < id2) ? -1 : ((id1 == id2) ? 0 : 1); } private int versionCompare(Version v1, Version v2) { if (v1.getMajor() == v2.getMajor() && v1.getMinor() == v2.getMinor() && v1.getMicro() == v2.getMicro()) { boolean q1 = "qualifier".equals(v1.getQualifier()); boolean q2 = "qualifier".equals(v2.getQualifier()); if (q1 && q2) { return 0; } else if (q1 && !q2) { return -1; } else if (q2 && !q1) { return 1; } } int versionCompare = -(v1.compareTo(v2)); return versionCompare; } }); } monitor.beginTask(PDECoreMessages.PDEState_CreatingTargetModelState, urls.length); for (int i = 0; i < urls.length; i++) { File file = new File(urls[i].getFile()); try { if (monitor.isCanceled()) return; monitor.subTask(file.getName()); addBundle(file, -1); } catch (CoreException e) { PDECore.log(e); } finally { monitor.worked(1); } } }
Source:
<code>public static GitRepository makeGitRepository() { final GitRepository repository = new GitRepository("guvnorng-playground", new Space("space")); final HashMap<String, Branch> branches = new HashMap<>(); <START> branches.put("master", <END> new Branch("master", mock(Path.class))); repository.setBranches(branches); return repository; }</code><technical_language>Perfect case for Collections.singletonMap(k,v) ;)</technical_language>

Target:
public static GitRepository makeGitRepository() { final GitRepository repository = new GitRepository("guvnorng-playground", new Space("space")); final Map<String, Branch> branches = Collections.singletonMap("master", new Branch("master", mock(Path.class))); repository.setBranches(branches); return repository; }
Source:
<code>public void testChunkResponse() throws IOException { HttpURLConnection urlConn = request("/test/v1/chunk", HttpMethod.POST); try { writeContent(urlConn, "Testing message"); String response = getContent(urlConn); <START> System.out.println(response); <END> } finally { urlConn.disconnect(); } }</code><technical_language>actually, is this test testing</technical_language>

Target:
public void testChunkResponse() throws IOException { HttpURLConnection urlConn = request("/test/v1/chunk", HttpMethod.POST); try { writeContent(urlConn, "Testing message"); String response = getContent(urlConn); Assert.assertEquals("Testing message", response); } finally { urlConn.disconnect(); } }
Source:
<code>public void deprecatesDefaultImage() throws IOException { final Talk talk = this.talk(); final XML xml = talk.read(); if (!"yegor256/rultor".equals( xml.xpath("/wire/github-repo/text()").get(0) )) { for (final String path : xml.xpath("/p/entry[@key='merge']/entry[@key='script']") <START> ) { <END> if ("yegor256/rultor".equals(path)) { final String dir = talk.read() .xpath("/talk/daemon/dir/text()").get(0); MatcherAssert.assertThat( dir, StringStartsWith.startsWith( "#### Deprecation Notice ####" ) ); } } } }</code><technical_language>@xupyprmv I formatting is a bit broken, reformat code IDEA</technical_language>

Target:
public void deprecatesDefaultImage() throws IOException { final String rultor = "yegor256/rultor"; final Talk talk = this.talk(); final XML xml = talk.read(); final String dir = xml.xpath("/talk/daemon/dir/text()").get(0); final List<String> repos = xml.xpath("/wire/github-repo/text()"); final String notice = "#### Deprecation Notice ####"; final Matcher<String> matcher; if ((repos.isEmpty() || !rultor.equals(repos.get(0))) && xml.xpath( "/p/entry[@key='merge']/entry[@key='script']" ).contains(rultor) ) { matcher = StringStartsWith.startsWith(notice); } else { matcher = Matchers.not(StringStartsWith.startsWith(notice)); } MatcherAssert.assertThat(dir, matcher); }
Source:
<code>protected Map<String, String> buildEnvFromProperties() { Map<String, String> env = new HashMap<String, String>(); Properties sparkProperties = new Properties(); String sparkMaster = getSparkMaster(properties); for (String key : properties.stringPropertyNames()) { if (RemoteInterpreterUtils.isEnvString(key)) { env.put(key, properties.getProperty(key)); } if (isSparkConf(key, properties.getProperty(key))) { sparkProperties.setProperty(key, toShellFormat(properties.getProperty(key))); } } setupPropertiesForPySpark(sparkProperties); setupPropertiesForSparkR(sparkProperties, properties.getProperty("SPARK_HOME")); if (isYarnMode() && getDeployMode().equals("cluster")) { <START> env.put("SPARK_YARN_CLUSTER", "true"); <END> } StringBuilder sparkConfBuilder = new StringBuilder(); if (sparkMaster != null) { sparkConfBuilder.append(" --master " + sparkMaster); } if (isYarnMode() && getDeployMode().equals("cluster")) { sparkConfBuilder.append(" --files " + zConf.getConfDir() + "/log4j_yarn_cluster.properties"); } for (String name : sparkProperties.stringPropertyNames()) { sparkConfBuilder.append(" --conf " + name + "=" + sparkProperties.getProperty(name)); } env.put("ZEPPELIN_SPARK_CONF", sparkConfBuilder.toString()); if (!env.containsKey("HADOOP_CONF_DIR") && System.getenv("HADOOP_CONF_DIR") != null) { env.put("HADOOP_CONF_DIR", System.getenv("HADOOP_CONF_DIR")); } LOGGER.debug("buildEnvFromProperties: " + env); return env; }</code><technical_language>thinking more this, I avoid Zeppelin specific env a SPARK_ prefix, avoid potential conflict</technical_language>

Target:
protected Map<String, String> buildEnvFromProperties() { Map<String, String> env = new HashMap<String, String>(); Properties sparkProperties = new Properties(); String sparkMaster = getSparkMaster(properties); for (String key : properties.stringPropertyNames()) { if (RemoteInterpreterUtils.isEnvString(key)) { env.put(key, properties.getProperty(key)); } if (isSparkConf(key, properties.getProperty(key))) { sparkProperties.setProperty(key, toShellFormat(properties.getProperty(key))); } } setupPropertiesForPySpark(sparkProperties); setupPropertiesForSparkR(sparkProperties); if (isYarnMode() && getDeployMode().equals("cluster")) { env.put("ZEPPELIN_SPARK_YARN_CLUSTER", "true"); } StringBuilder sparkConfBuilder = new StringBuilder(); if (sparkMaster != null) { sparkConfBuilder.append(" --master " + sparkMaster); } if (isYarnMode() && getDeployMode().equals("cluster")) { sparkConfBuilder.append(" --files " + zConf.getConfDir() + "/log4j_yarn_cluster.properties"); } for (String name : sparkProperties.stringPropertyNames()) { sparkConfBuilder.append(" --conf " + name + "=" + sparkProperties.getProperty(name)); } env.put("ZEPPELIN_SPARK_CONF", sparkConfBuilder.toString()); for (String envName : new String[]{"SPARK_HOME", "SPARK_CONF_DIR", "HADOOP_CONF_DIR"}) { String envValue = getEnv(envName); if (envValue != null) { env.put(envName, envValue); } } LOGGER.debug("buildEnvFromProperties: " + env); return env; }
Source:
<code>private boolean isViolatingEmptyLineBetweenFieldsPolicy(DetailAST detailAST) { return detailAST.getType() != TokenTypes.RCURLY && !(allowNoEmptyLineBetweenFields <START> && TokenUtil.isOfType(detailAST, TokenTypes.COMMA, TokenTypes.VARIABLE_DEF)); <END> }</code><technical_language>negatiion close Expression ? is easier read code negation is close possible. If give good name .. move expression in parentheses in special method. I need vote this maintainers</technical_language>

Target:
private boolean isViolatingEmptyLineBetweenFieldsPolicy(DetailAST detailAST) { return detailAST.getType() != TokenTypes.RCURLY && (!allowNoEmptyLineBetweenFields || !TokenUtil.isOfType(detailAST, TokenTypes.COMMA, TokenTypes.VARIABLE_DEF)); }
Source:
<code>public static String generateScenarioStepRegexp(String scenarioId, String stepId) { <START> return "^.*" + USER_SCENARIO_ID + scenarioId + US_STEP_ID + "\\d+_" + stepId + "_" + US_METRIC_ID + ".*$"; <END> }</code><technical_language>"^.*" + USER_SCENARIO_ID + scenarioId + US_STEP_ID + "\\d+_" + stepId + ".\*$" enought</technical_language>

Target:
public static String generateScenarioStepRegexp(String scenarioId, String stepId) { return String.format(SCENARIO_STEP_REGEXP_TEMPLATE, scenarioId, stepId); }
Source:
<code>private boolean setDocumentContent(IDocument document, IEditorInput input) throws CoreException { Reader reader = null; try { if (input instanceof FileStoreEditorInput){ reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); } else if (input instanceof IPathEditorInput){ reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); } else { return false; } } catch (FileNotFoundException e) { return true; <START> } catch (MalformedURLException e) { <END> e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); } try { setDocumentContent(document, reader); return true; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", IStatus.OK, "error reading file", e)); } }</code><technical_language>Exception handling realy inconsistent. In case return false, another true nothing. printing stacktrace. Please unify handling</technical_language>

Target:
private boolean setDocumentContent(IDocument document, IEditorInput input) throws CoreException { Reader reader = null; try { if (input instanceof FileStoreEditorInput){ reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); } else if (input instanceof IPathEditorInput){ reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); } else { return false; } } catch (FileNotFoundException e) { return true; } catch (MalformedURLException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", "Incorrect URL", e)); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", "Error reading file", e)); } try { setDocumentContent(document, reader); return true; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", IStatus.OK, "error reading file", e)); } }
Source:
<code>private byte[] getEncryptionKey() { byte[] key; if (loginNeeded) { initUKRForLogin(); if (ukrForLogin == null) { return null; } key = ByteEncrypter.wrapByteArrayWithString(ukrForLogin.getEncryptedKey(), password); } else { <START> CaseUtils.purgeCases(); <END> key = CommCareApplication._().getSession().getLoggedInUser().getWrappedKey(); } this.publishProgress(PROGRESS_CLEANED); return key; }</code><technical_language>I this is place for this call now. need this happen perform a sync request for sure, if refactored this modularly in this process, I call this getEncryptionKey() returned a key of this method</technical_language>

Target:
private byte[] getEncryptionKey() { byte[] key; if (loginNeeded) { initUKRForLogin(); if (ukrForLogin == null) { return null; } key = ukrForLogin.getEncryptedKey(); } else { key = CommCareApplication._().getSession().getLoggedInUser().getWrappedKey(); } this.publishProgress(PROGRESS_CLEANED); return key; }
Source:
<code>public static Object convertFromJsonValue(JsonValue value) { if (value == null) { return null; } else if (value.isNumber()) { try { <START> return value.asLong(); <END> } catch (NumberFormatException e) { return value.asDouble(); } } else if (value.isBoolean()) { return value.asBoolean(); } else if (value.isNull()) { return null; } else if (value.isString()) { return value.asString(); } throw new HazelcastSerializationException("Unknown Json type: " + value); }</code><technical_language>Minor: in other number check, WDYT checking for decimal point</technical_language>

Target:
public static Object convertFromJsonValue(JsonValue value) { if (value == null) { return null; } else if (value.isNumber()) { if (value.toString().contains(".")) { return value.asDouble(); } else { return value.asLong(); } } else if (value.isBoolean()) { return value.asBoolean(); } else if (value.isNull()) { return null; } else if (value.isString()) { return value.asString(); } throw new HazelcastSerializationException("Unknown Json type: " + value); }
Source:
<code>public void start() { life.start(); <START> Values.setNanoPrecision( configuration.get( GraphDatabaseSettings.default_temporal_nanosecond_precision ) ); <END> }</code><technical_language>more database running in a JVM, configurations</technical_language>

Target:
public void start() { life.start(); int nanoPrecisionConfig = configuration.get( GraphDatabaseSettings.temporal_nanosecond_precision ); if ( nanoPrecisionConfig != Values.getNanoPrecision() && Values.nanoPrecisionConfigAltered ) { throw new IllegalArgumentException( "dbms.temporal.nanosecond_precision can only be set once" ); } Values.setNanoPrecision( nanoPrecisionConfig ); Values.nanoPrecisionConfigAltered = true; }
Source:
<code>void testUnitTypeComparator() { assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(nullType, noneType1)); assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(noneType1, nullType)); assertThrows(IllegalStateException.class, () -> unitTypeComparator.compare(nullType, nullType)); <START> assertEquals(0, unitTypeComparator.compare(infrastructure, infrastructure)); <END> assertEquals(0, unitTypeComparator.compare(antiAircraft, antiAircraft)); assertEquals(0, unitTypeComparator.compare(air, air)); assertEquals(0, unitTypeComparator.compare(sea, sea)); assertEquals(0, unitTypeComparator.compare(attacker, attacker)); assertEquals(0, unitTypeComparator.compare(noneType1, noneType1)); assertEquals(1, unitTypeComparator.compare(infrastructure, antiAircraft)); assertEquals(1, unitTypeComparator.compare(antiAircraft, air)); assertEquals(1, unitTypeComparator.compare(air, sea)); assertEquals(1, unitTypeComparator.compare(sea, attacker)); assertEquals(1, unitTypeComparator.compare(attacker, noneType1)); assertEquals(1, unitTypeComparator.compare(noneType1, noneType2)); assertEquals(-1, unitTypeComparator.compare(antiAircraft, infrastructure)); assertEquals(-1, unitTypeComparator.compare(air, antiAircraft)); assertEquals(-1, unitTypeComparator.compare(sea, air)); assertEquals(-1, unitTypeComparator.compare(attacker, sea)); assertEquals(-1, unitTypeComparator.compare(noneType1, attacker)); assertEquals(-1, unitTypeComparator.compare(noneType2, noneType1)); }</code><technical_language>objection stick hamcrest style assertions, ie: 'assertThat'</technical_language>

Target:
void testUnitTypeComparator() { assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(nullType, noneType1)); assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(noneType1, nullType)); assertThrows(IllegalStateException.class, () -> unitTypeComparator.compare(nullType, nullType)); assertThat(unitTypeComparator.compare(infrastructure, infrastructure), is(0)); assertThat(unitTypeComparator.compare(antiAircraft, antiAircraft), is(0)); assertThat(unitTypeComparator.compare(air, air), is(0)); assertThat(unitTypeComparator.compare(sea, sea), is(0)); assertThat(unitTypeComparator.compare(attacker, attacker), is(0)); assertThat(unitTypeComparator.compare(noneType1, noneType1), is(0)); assertThat(unitTypeComparator.compare(infrastructure, antiAircraft), is(1)); assertThat(unitTypeComparator.compare(antiAircraft, air), is(1)); assertThat(unitTypeComparator.compare(air, sea), is(1)); assertThat(unitTypeComparator.compare(sea, attacker), is(1)); assertThat(unitTypeComparator.compare(attacker, noneType1), is(1)); assertThat(unitTypeComparator.compare(noneType1, noneType2), is(1)); assertThat(unitTypeComparator.compare(antiAircraft, infrastructure), is(-1)); assertThat(unitTypeComparator.compare(air, antiAircraft), is(-1)); assertThat(unitTypeComparator.compare(sea, air), is(-1)); assertThat(unitTypeComparator.compare(attacker, sea), is(-1)); assertThat(unitTypeComparator.compare(noneType1, attacker), is(-1)); assertThat(unitTypeComparator.compare(noneType2, noneType1), is(-1)); }
Source:
<code>public Stock(String symbol, String name, double price) { <START> super(); <END> this.symbol = symbol; this.name = name; this.price = price; }</code><technical_language>super() is necessary</technical_language>

Target:
public Stock(String symbol, String name, double price) { this.symbol = symbol; this.name = name; this.price = price; }
Source:
<code>public BackupMessagesLoader(BrokerMessageProducer brokerMessageProducer, HermesMetrics hermesMetrics, BrokerListeners brokerListeners, TopicsCache topicsCache, Trackers trackers, ConfigFactory config) { this.brokerMessageProducer = brokerMessageProducer; this.hermesMetrics = hermesMetrics; this.brokerListeners = brokerListeners; this.topicsCache = topicsCache; this.trackers = trackers; this.secondsToWaitForTopicsCache = config.getIntProperty(MESSAGES_LOADING_WAIT_FOR_TOPICS_CACHE); this.messageMaxAgeHours = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_AGE_HOURS); this.resentSleep = config.getIntProperty(KAFKA_PRODUCER_ACK_TIMEOUT) + secondsToWaitForTopicsCache * 1000; <START> this.maxResent = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_RESENT); <END> }</code><technical_language>maxResendRetries maybe, etc. :></technical_language>

Target:
public BackupMessagesLoader(BrokerMessageProducer brokerMessageProducer, HermesMetrics hermesMetrics, BrokerListeners brokerListeners, TopicsCache topicsCache, Trackers trackers, ConfigFactory config) { this.brokerMessageProducer = brokerMessageProducer; this.hermesMetrics = hermesMetrics; this.brokerListeners = brokerListeners; this.topicsCache = topicsCache; this.trackers = trackers; this.secondsToWaitForTopicsCache = config.getIntProperty(MESSAGES_LOADING_WAIT_FOR_TOPICS_CACHE); this.messageMaxAgeHours = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_AGE_HOURS); this.resendSleep = config.getIntProperty(KAFKA_PRODUCER_ACK_TIMEOUT) + secondsToWaitForTopicsCache * 1000; this.maxResendRetries = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_RESEND_RETRIES); }
Source:
<code>private void createFSTIndexForColumn(ColumnMetadata columnMetadata) throws IOException { String column = columnMetadata.getColumnName(); boolean hasDictionary = columnMetadata.hasDictionary(); if (!hasDictionary) { return; } if (_segmentWriter.hasIndexFor(column, ColumnIndexType.FST_INDEX)) { <START> LOGGER.info("Found text index for column: {}, in segment: {}", column, _segmentName); <END> return; } LOGGER.info( "Creating new FST index for column: in segment: {}, hasDictionary: {}, cardinality: {}", column, _segmentName, hasDictionary, columnMetadata.getCardinality()); File segmentDirectory = SegmentDirectoryPaths.segmentDirectoryFor( _indexDir, _segmentVersion); LuceneFSTIndexCreator luceneFSTIndexCreator = new LuceneFSTIndexCreator( segmentDirectory, column, columnMetadata.getCardinality(), null); try (BaseImmutableDictionary dictionary = getDictionaryReader(columnMetadata);) { for (int dictId = 0; dictId < dictionary.length(); dictId++) { luceneFSTIndexCreator.addSortedDictIds( dictionary.getStringValue(dictId), dictId); } } luceneFSTIndexCreator.seal(); }</code><technical_language>please fix log</technical_language>

Target:
private void createFSTIndexForColumn(ColumnMetadata columnMetadata) throws IOException { String column = columnMetadata.getColumnName(); File inProgress = new File(_indexDir, column + ".fst.inprogress"); File fstIndexFile = new File(_indexDir, column + FST_INDEX_FILE_EXTENSION); if (!inProgress.exists()) { if (_segmentWriter.hasIndexFor(column, ColumnIndexType.FST_INDEX)) { LOGGER.info("Found fst index for column: {}, in segment: {}", column, _segmentName); return; } FileUtils.touch(inProgress); } else { FileUtils.deleteQuietly(fstIndexFile); } LOGGER.info("Creating new FST index for column: in segment: {}, cardinality: {}", column, _segmentName, columnMetadata.getCardinality()); LuceneFSTIndexCreator luceneFSTIndexCreator = new LuceneFSTIndexCreator(_indexDir, column, null); try (BaseImmutableDictionary dictionary = getDictionaryReader(columnMetadata);) { for (int dictId = 0; dictId < dictionary.length(); dictId++) { luceneFSTIndexCreator.add(dictionary.getStringValue(dictId)); } } luceneFSTIndexCreator.seal(); if (_segmentVersion == SegmentVersion.v3) { LoaderUtils.writeIndexToV3Format(_segmentWriter, column, fstIndexFile, ColumnIndexType.FST_INDEX); } FileUtils.deleteQuietly(inProgress); LOGGER.info("Created FST index for segment: {}, column: {}", _segmentName, column); }
Source:
<code>protected void onLoad() { super.onLoad(); Util.ACCOUNT_SVC.myAccount(new ScreenLoadCallback<Account>(this) { public void preDisplay(final Account result) { display(result.getGeneralPreferences()); <START> AccountApi.self().view("preferences").get(new AsyncCallback<Preferences>() { <END> @Override public void onSuccess(Preferences prefs) { displayMyMenus(prefs.my()); } @Override public void onFailure(Throwable caught) { } }); } }); }</code><technical_language>Load this a CallbackGroup time myAccount. Add ScreenLoadCallback 2nd callback display screen callbacks finished successfully</technical_language>

Target:
protected void onLoad() { super.onLoad(); AccountApi.self().view("preferences") .get(new ScreenLoadCallback<Preferences>(this) { @Override public void preDisplay(Preferences prefs) { display(prefs); } }); }
Source:
<code>public void removeInterviewByAppointmentId(String interviewId) throws InterviewNotFoundException, HttpRequestException, QuestionsBlockNotFound, WrongCriteriaException { List<Interview> interviewsList = new ArrayList<Interview>(); { Interview interview1 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment1.getAppointmentId()); Interview interview2 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment2.getAppointmentId()); interviewsList.add(interview1); interviewsList.add(interview2); } <START> while(true){ <END> for (int i = 0; i < interviewsList.size(); i++){ if (interviewsList.get(i).getAppointmentId().equals(interviewId)){ interviewsList.remove(i); return; } } throw new InterviewNotFoundException("Wrong ID, interview not found"); } }</code><technical_language>why</technical_language>

Target:
public void removeInterviewByAppointmentId(String interviewId) throws HttpRequestException, InterviewNotFoundException { List<Interview> interviewsList = new ArrayList<Interview>(); { Interview interview1 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment1.getAppointmentId()); Interview interview2 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment2.getAppointmentId()); interviewsList.add(interview1); interviewsList.add(interview2); } for (int i = 0; i < interviewsList.size(); i++){ if (interviewsList.get(i).getAppointmentId().equals(interviewId)){ interviewsList.remove(i); return; } } throw new InterviewNotFoundException("Wrong ID, interview not found"); }
Source:
<code>protected void handleHTTPError(final HttpResponseException e) { if (e.getStatusCode() == HttpStatus.SC_FORBIDDEN) { <START> String message = "Network Error."; <END> try { JSONObject obj = new JSONObject(e.getMessage()); message = obj.getString("msg"); } catch (JSONException e1) { ZLog.logException(e1); } final String finalMessage = message; ((LoginActivity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, finalMessage, Toast.LENGTH_LONG) .show(); } }); } else { super.handleHTTPError(e); } }</code><technical_language>user visible text belongs in R.strings</technical_language>

Target:
protected void handleHTTPError(final HttpResponseException e) { if (e.getStatusCode() == HttpStatus.SC_FORBIDDEN) { String message = context.getString(R.string.network_error); try { JSONObject obj = new JSONObject(e.getMessage()); message = obj.getString("msg"); } catch (JSONException e1) { ZLog.logException(e1); } final String finalMessage = message; ((LoginActivity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, finalMessage, Toast.LENGTH_LONG) .show(); } }); } else { super.handleHTTPError(e); } }
Source:
<code>public ConfigEntry(String name, String value, ConfigSource source, boolean isSensitive, boolean isReadOnly, <START> List<ConfigSynonym> synonyms) { <END> Objects.requireNonNull(name, "name should not be null"); this.name = name; this.value = value; this.source = source; this.isSensitive = isSensitive; this.isReadOnly = isReadOnly; this.synonyms = synonyms; }</code><technical_language>This is a public API, change here. If need a ConfigEntry synonyms for test, create a static method in ConfigTest it. change confined test code</technical_language>

Target:
ConfigEntry(String name, String value, ConfigSource source, boolean isSensitive, boolean isReadOnly, List<ConfigSynonym> synonyms) { Objects.requireNonNull(name, "name should not be null"); this.name = name; this.value = value; this.source = source; this.isSensitive = isSensitive; this.isReadOnly = isReadOnly; this.synonyms = synonyms; }
Source:
<code>public void run() { <START> if (getStateSystemBuilder() == null) { <END> System.err.println("Cannot run event manager without assigning a target state system first!"); return; } ITmfEvent event; try { event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } currentEvent = event; if (fEventType.isInstance(event) && event.getType() != null) { eventHandle(event); } event = fEventsQueue.take(); } closeStateSystem(); } catch (InterruptedException e) { System.out.println("Event handler interrupted!"); e.printStackTrace(); } }</code><technical_language>field directly? In fact, checking fSSAssigned instead clearer</technical_language>

Target:
public void run() { if (!fStateSystemAssigned) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } ITmfEvent event; try { event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } currentEvent = event; if (fEventType.isInstance(event) && event.getType() != null) { eventHandle(event); } event = fEventsQueue.take(); } closeStateSystem(); } catch (InterruptedException e) { System.out.println("Event handler interrupted!"); e.printStackTrace(); } }
Source:
<code><START> public SetScheduleDeviceRequest(final String organisationIdentification, final String deviceIdentification, <END> final String correlationUid, final ScheduleMessageDataContainerDto scheduleMessageDataContainer, final RelayTypeDto relayType, final String domain, final String domainVersion, final String messageType, final int messagePriority, final String ipAddress, final int retryCount, final boolean isScheduled) { super(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, messagePriority, ipAddress, retryCount, isScheduled); this.scheduleMessageDataContainer = scheduleMessageDataContainer; this.relayType = relayType; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Constructor 12 parameters, is greater 6 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public SetScheduleDeviceRequest(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final ScheduleMessageDataContainerDto scheduleMessageDataContainer, final RelayTypeDto relayType, final String domain, final String domainVersion, final String messageType, final int messagePriority, final String ipAddress, final int retryCount, final boolean isScheduled) { super(DeviceRequest.newBuilder().organisationIdentification(organisationIdentification) .deviceIdentification(deviceIdentification).correlationUid(correlationUid).domain(domain) .domainVersion(domainVersion).messageType(messageType).messagePriority(messagePriority) .ipAddress(ipAddress).retryCount(retryCount).isScheduled(isScheduled)); this.scheduleMessageDataContainer = scheduleMessageDataContainer; this.relayType = relayType; }
Source:
<code>List<VdsNetworkInterface> filterNicsWithUnmanagedNetworks( List<VdsNetworkInterface> existingInterfaces, Set<String> removedUnmanagedNetworks){ List<VdsNetworkInterface> nicsWithUnmanagedNetworks = new ArrayList<VdsNetworkInterface>(); for(VdsNetworkInterface nic : existingInterfaces){ <START> if(nic.getNetworkImplementationDetails()!=null && !nic.getNetworkImplementationDetails().isManaged()) <END> if (!removedUnmanagedNetworks.contains(nic.getNetworkName())) nicsWithUnmanagedNetworks.add(nic); } return nicsWithUnmanagedNetworks; }</code><technical_language>if do this in this way. I refactorings in NetworkImplementationDetails code I guarantee validity. I implementation details 'managed' field false created anywhere. guess, this field is wrong. If so, alternative ~ UnmanagedNetworksHelper. In abandoned patch peek if necessary in class named 'UnmanagedNetworks' usages of this class, easy enough</technical_language>

Target:
List<VdsNetworkInterface> filterNicsWithUnmanagedNetworks( List<VdsNetworkInterface> existingInterfaces, Set<String> removedUnmanagedNetworks){ List<VdsNetworkInterface> nicsWithUnmanagedNetworks = new ArrayList<>(); for(VdsNetworkInterface nic : existingInterfaces){ if(nic.getNetworkImplementationDetails()!=null && !nic.getNetworkImplementationDetails().isManaged()) if (!removedUnmanagedNetworks.contains(nic.getNetworkName())) nicsWithUnmanagedNetworks.add(nic); } return nicsWithUnmanagedNetworks; }
Source:
<code>public ValidationResult canStopOrCommitRemoveBrick(GlusterVolumeEntity volumeEntity, List<GlusterBrickEntity> paramBricks) { GlusterAsyncTask asyncTask = volumeEntity.getAsyncTask(); <START> if (asyncTask != null && asyncTask.getType() == GlusterTaskType.REMOVE_BRICK) { <END> if (paramBricks.isEmpty()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } List<GlusterBrickEntity> bricksForTask = getGlusterBrickDao().getGlusterVolumeBricksByTaskId(asyncTask.getTaskId()); if (paramBricks.size() != bricksForTask.size()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } int counter = 0; for (GlusterBrickEntity paramBrick : paramBricks) { for (GlusterBrickEntity brick : bricksForTask) { if (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) && paramBrick.getServerId() == brick.getServerId()) { break; } counter++; if (counter == bricksForTask.size()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } } } } return ValidationResult.VALID; }</code><technical_language>if (asyncTask == null || asyncTask.getType != GlusterTaskType.REMOVE_BRICK) { return new ValidationResult( ... } avoid nesting of if statements this</technical_language>

Target:
public ValidationResult canStopOrCommitRemoveBrick(GlusterVolumeEntity volumeEntity, List<GlusterBrickEntity> paramBricks) { GlusterAsyncTask asyncTask = volumeEntity.getAsyncTask(); if (asyncTask == null || asyncTask.getType() != GlusterTaskType.REMOVE_BRICK) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID_TASK_TYPE); } if (paramBricks.isEmpty()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } List<GlusterBrickEntity> bricksForTask = getGlusterBrickDao().getGlusterVolumeBricksByTaskId(asyncTask.getTaskId()); if (paramBricks.size() != bricksForTask.size() || !areBricksInTheList(paramBricks, bricksForTask)) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } return ValidationResult.VALID; }
Source:
<code>public Completable toCompletable() { <START> return new Completable(OnSubscribeCompletable.create(this)); <END> }</code><technical_language>Completable.fromObservable()</technical_language>

Target:
public Completable toCompletable() { return Completable.fromObservable(this); }
Source:
<code>private void createButtons() { ButtonType submitButtonType = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(submitButtonType, ButtonType.CANCEL); submitButton = (Button) getDialogPane().lookupButton(submitButtonType); setResultConverter(submit -> { if (submit == submitButtonType) { return nameField.getText(); } <START> return null; <END> }); }</code><technical_language>null translate empty Optional result</technical_language>

Target:
private void createButtons() { ButtonType submitButtonType = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(submitButtonType, ButtonType.CANCEL); submitButton = (Button) getDialogPane().lookupButton(submitButtonType); submitButton.setId("boardsavebutton"); setResultConverter(submit -> { if (submit == submitButtonType) { return nameField.getText(); } return null; }); }
Source:
<code>public Message copy(final long newID) { try { LargeServerMessage newMessage = storageManager.createLargeMessage(newID, this); ensureFileExists(false); SequentialFile cloneFile = file.cloneFile(); try { byte[] bufferBytes = new byte[100 * 1024]; ByteBuffer buffer = ByteBuffer.wrap(bufferBytes); if (!cloneFile.isOpen()) { cloneFile.open(); } cloneFile.position(0); for (;;) { buffer.clear(); int bytesRead = cloneFile.read(buffer); byte[] bufferToWrite; if (bytesRead <= 0) { break; } else if (bytesRead == bufferBytes.length && !this.storageManager.isReplicated()) { bufferToWrite = bufferBytes; } else { bufferToWrite = new byte[bytesRead]; System.arraycopy(bufferBytes, 0, bufferToWrite, 0, bytesRead); } newMessage.addBytes(bufferToWrite); if (bytesRead < bufferBytes.length) { break; } } } finally { cloneFile.close(); } return newMessage; <START> <END> } catch (Exception e) { ActiveMQServerLogger.LOGGER.lareMessageErrorCopying(e, this); return null; } }</code><technical_language>Do need close underlying file of new large message copy</technical_language>

Target:
public Message copy(final long newID) { try { LargeServerMessage newMessage = storageManager.createLargeMessage(newID, this); ensureFileExists(false); SequentialFile cloneFile = file.cloneFile(); try { byte[] bufferBytes = new byte[100 * 1024]; ByteBuffer buffer = ByteBuffer.wrap(bufferBytes); if (!cloneFile.isOpen()) { cloneFile.open(); } cloneFile.position(0); for (;;) { buffer.clear(); int bytesRead = cloneFile.read(buffer); byte[] bufferToWrite; if (bytesRead <= 0) { break; } else if (bytesRead == bufferBytes.length && !this.storageManager.isReplicated()) { bufferToWrite = bufferBytes; } else { bufferToWrite = new byte[bytesRead]; System.arraycopy(bufferBytes, 0, bufferToWrite, 0, bytesRead); } newMessage.addBytes(bufferToWrite); if (bytesRead < bufferBytes.length) { break; } } } finally { if (!file.isOpen()) { newMessage.getFile().close(); } cloneFile.close(); } return newMessage; } catch (Exception e) { ActiveMQServerLogger.LOGGER.lareMessageErrorCopying(e, this); return null; } }
Source:
<code>public static void sendError(int status, String message) { <START> if ((status < 100) || (status > 999)) { <END> throw new IllegalArgumentException("HTTP status code must be between 100 and 999."); } if ((message == null) || message.isEmpty()) { throw new IllegalArgumentException("Error message cannot be null or empty."); } throw new HttpErrorException(status, message); }</code><technical_language>change this range? HTTP status codes upto 600 - <LINK_0></technical_language>

Target:
public static void sendError(int status, String message) { if ((status < 100) || (status > 599)) { throw new IllegalArgumentException("HTTP status code must be between 100 and 599."); } if ((message == null) || message.isEmpty()) { throw new IllegalArgumentException("Error message cannot be null or empty."); } throw new HttpErrorException(status, message); }
Source:
<code>public void setNode(Node selectedNode) { if ((selectedNode == null) || (!isSupported(selectedNode))) { resetComponent(); return; } AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class); if (file == null) { resetComponent(); return; } dataSource = file; resetComponent(); if(dataSource.getType() == TSK_DB_FILES_TYPE_ENUM.LOCAL && dataSource.getLocalAbsPath().endsWith(".html")) { loadWebEngineFileURL(dataSource.getLocalAbsPath()); } else { try { long size = file.getSize(); byte[] dataBytes = new byte[(int)size]; dataSource.read(dataBytes, 0, (int)size); String HTML = new String(dataBytes); loadWebEngineContent(HTML); } catch (TskCoreException ex) { <START> Exceptions.printStackTrace(ex); <END> } } }</code><technical_language>logger</technical_language>

Target:
public void setNode(Node selectedNode) { if ((selectedNode == null) || (!isSupported(selectedNode))) { resetComponent(); return; } AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class); if (file == null) { resetComponent(); return; } dataSource = file; resetComponent(); if(dataSource.getType() == TSK_DB_FILES_TYPE_ENUM.LOCAL && hasValidPathExtension(dataSource.getLocalAbsPath())) { loadWebEngineFileURL(dataSource.getLocalAbsPath()); } else { try { long size = file.getSize(); byte[] dataBytes = new byte[(int)size]; dataSource.read(dataBytes, 0, (int)size); String HTML = new String(dataBytes); loadWebEngineContent(HTML); } catch (TskCoreException ex) { logger.log(Level.WARNING, "An error occurred while reading data from a " + "file in the HTML content viewer.", ex); } } }
Source:
<code>@Override public ClassName withoutAnnotations() { ClassName resultEnclosingClassName = enclosingClassName != null ? enclosingClassName.withoutAnnotations() : null; return isAnnotated() ? new ClassName(packageName, resultEnclosingClassName, simpleName) <START> : this; <END> }</code><technical_language>this ternary exist. TypeName.get(Map.class).annotatedWith(..).nestedClass("Entry").withoutAnnotations() produce</technical_language>

Target:
@Override public ClassName withoutAnnotations() { if (!isAnnotated()) return this; ClassName resultEnclosingClassName = enclosingClassName != null ? enclosingClassName.withoutAnnotations() : null; return new ClassName(packageName, resultEnclosingClassName, simpleName); }