auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Instant[] bisectAndCoerce(String value) throws InvalidAttributeValueException { <START> if (value.length() % 2 != 1) { END> throw new InvalidAttributeValueException(value); } int mid = (value.length()-1)/2; String from = value.substring(0, mid); String to = value.substring(mid+1); try { return new Instant[] { coercerFunction.apply(from), coercerFunction.apply(to) }; } catch (DateTimeParseException e) { throw new InvalidAttributeValueException(value); } }</code><technical_language>This format, combined length is odd</technical_language>

Target:
protected Instant[] bisectAndCoerce(String value) throws InvalidAttributeValueException { if (value.length() != 41 && value.charAt(20) == RANGE_SEPARATOR_CHAR) { throw new InvalidAttributeValueException(value); } String from = value.substring(0, 20); String to = value.substring(21); try { return new Instant[] { coercerFunction.apply(from), coercerFunction.apply(to) }; } catch (DateTimeParseException e) { throw new InvalidAttributeValueException(value); } }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.MethodSymbol overriddenSymbol = methodTree.symbol().overriddenSymbol(); if (overriddenSymbol == null || overriddenSymbol.isUnknown()) { return; } <START> MethodTree overridenMethodTree = overriddenSymbol.declaration(); <END> if (null != overridenMethodTree && isSynchronized(overridenMethodTree) && !isSynchronized(methodTree)) { reportIssue(methodTree.simpleName(), "Make this method \"synchronized\" to match the parent class implementation."); } }</code><technical_language>this work. in immense majority of cases, declaration of parent method in file, access modifier</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.MethodSymbol methodSymbol = methodTree.symbol(); Symbol.MethodSymbol overriddenSymbol = methodSymbol.overriddenSymbol(); if (overriddenSymbol == null || overriddenSymbol.isUnknown()) { return; } if (isSynchronized(overriddenSymbol) && !isSynchronized(methodSymbol)) { List<JavaFileScannerContext.Location> secondaries = Collections.emptyList(); MethodTree overridenMethodTree = overriddenSymbol.declaration(); if (overridenMethodTree != null) { secondaries = Collections.singletonList(new JavaFileScannerContext.Location("", overridenMethodTree.simpleName())); } reportIssue(methodTree.simpleName(), MESSAGE, secondaries, null); } }
Source:
<code>public boolean equals(final Object o) { assert o != null; if (o == this) { return true; } if (!(o instanceof Variable)) { return false; } Variable var = (Variable) o; if (var.source == source) { assert name.equals(var.name) : "Defined in the same place, but names not equal?"; return true; } <START> if (var.name == "self" && name == "self") { <END> return true; } assert source == null || !source.equals(var.source) : "Why are there multiple objects for this source section? might need to fix comparison above"; return false; }</code><technical_language>So, source information for nodes correct? try fix those, instead of adding hack (which is correct/reliable Java codacy bot indicates). issues nodes constructed manually in places, is happening other variables</technical_language>

Target:
public boolean equals(final Object o) { assert o != null; if (o == this) { return true; } if (!(o instanceof Variable)) { return false; } Variable var = (Variable) o; if (var.source == source) { assert name.equals(var.name) : "Defined in the same place, but names not equal?"; return true; } assert source == null || !source.equals(var.source) : "Why are there multiple objects for this source section? might need to fix comparison above"; return false; }
Source:
<code>static Properties getRouterProperties(String routerDatacenter) { Properties properties = new Properties(); properties.setProperty("router.hostname", "localhost"); properties.setProperty("router.datacenter.name", routerDatacenter); properties.setProperty("router.connection.checkout.timeout.ms", "5000"); <START> properties.setProperty("router.request.timeout.ms", "20000"); <END> properties.setProperty("router.max.put.chunk.size.bytes", Integer.toString(CHUNK_SIZE)); properties.setProperty("router.put.success.target", "1"); properties.setProperty("coordinator.hostname", "localhost"); properties.setProperty("coordinator.datacenter.name", routerDatacenter); return properties; }</code><technical_language>need override this? require 20 seconds</technical_language>

Target:
static Properties getRouterProperties(String routerDatacenter) { Properties properties = new Properties(); properties.setProperty("router.hostname", "localhost"); properties.setProperty("router.datacenter.name", routerDatacenter); properties.setProperty("router.connection.checkout.timeout.ms", "5000"); properties.setProperty("router.request.timeout.ms", "10000"); properties.setProperty("router.max.put.chunk.size.bytes", Integer.toString(CHUNK_SIZE)); properties.setProperty("router.put.success.target", "1"); properties.setProperty("coordinator.hostname", "localhost"); properties.setProperty("coordinator.datacenter.name", routerDatacenter); return properties; }
Source:
<code>public void aliasGeneratorFindsByAlias() { <START> ResultDescription desc = new ResultDescription() { <END> @Override public ResultDescription appendText(String format, Object... args) { return null; } @Override public ResultDescription startStage(String stageName) { return null; } @Override public ResultDescription finishStage() { return null; } }; ScoredCandidates scoredCandidates = aliasGenerator.generate(aliasIdentified2, desc); for (Object scoredCandidate : scoredCandidates.candidates().keySet()) { Object content = scoredCandidates.candidates().get(scoredCandidate); if (content instanceof Content) { assertEquals(content, aliasIdentified1); } else { fail(); } } }</code><technical_language>Is worth defineing this a separate NullResultDescription class other tests</technical_language>

Target:
public void aliasGeneratorFindsByAlias() { ScoredCandidates scoredCandidates = aliasGenerator.generate(aliasIdentified2, desc); for (Object scoredCandidate : scoredCandidates.candidates().keySet()) { Object content = scoredCandidates.candidates().get(scoredCandidate); assertTrue(content instanceof Content); assertEquals(content, aliasIdentified1); } }
Source:
<code>public KieServerImpl(KieServerStateRepository stateRepository) { this.repository = stateRepository; String modeParam = System.getProperty(KieServerConstants.KIE_SERVER_MODE, KieServerMode.DEVELOPMENT.toString()); try { mode = KieServerMode.valueOf(modeParam.toUpperCase()); logger.info("Starting server in '" + mode.name() + "' mode."); } catch (Exception ex) { mode = KieServerMode.DEVELOPMENT; <START> logger.warn("Unable to parse value of " + KieServerConstants.KIE_SERVER_MODE + " = " + modeParam + "; supported values are 'REGULAR' or 'PRODUCTION'. Falling back to 'DEVELOPMENT' mode."); <END> } }</code><technical_language>@pefernan message be: logger.warn("Unable parse of " + KieServerConstants.KIE_SERVER_MODE + " = " + modeParam + "; supported values 'DEVELOPMENT' 'PRODUCTION'. Falling 'DEVELOPMENT' mode.");</technical_language>

Target:
public KieServerImpl(KieServerStateRepository stateRepository) { this.repository = stateRepository; String modeParam = System.getProperty(KieServerConstants.KIE_SERVER_MODE, KieServerMode.DEVELOPMENT.toString()); try { mode = KieServerMode.valueOf(modeParam.toUpperCase()); logger.info("Starting server in '" + mode.name() + "' mode."); } catch (Exception ex) { mode = KieServerMode.DEVELOPMENT; logger.warn("Unable to parse value of " + KieServerConstants.KIE_SERVER_MODE + " = " + modeParam + "; supported values are 'DEVELOPMENT' or 'PRODUCTION'. Falling back to 'DEVELOPMENT' mode."); } }
Source:
<code>public Image loadImage(String fileName) { File fin = new File(fileName); if (!fin.exists()) { System.out.println(String.format("Trying to load image for a non-existent file! Path: %s", fileName)); return null; } Image result = Toolkit.getDefaultToolkit().getImage(fileName); if (result == null) { return null; } final boolean isAnimated = waitUntilLoaded(result); <START> if ((result.getWidth(null) == -1) || (result.getHeight(null) == -1)) { <END> return null; } return isAnimated ? result : ImageUtil.createAcceleratedImage(result); }</code><technical_language>recommend < 0</technical_language>

Target:
public Image loadImage(String fileName) { File fin = new File(fileName); if (!fin.exists()) { System.out.println(String.format("Trying to load image for a non-existent file! Path: %s", fileName)); return null; } Image result = Toolkit.getDefaultToolkit().getImage(fileName); if (result == null) { return null; } final boolean isAnimated = waitUntilLoaded(result); if ((result.getWidth(null) < 0) || (result.getHeight(null) < 0)) { return null; } return isAnimated ? result : ImageUtil.createAcceleratedImage(result); }
Source:
<code>public DataFetcherResult getRecords(int maxRecords) { if (!isInitialized) { throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization."); } if (nextIterator != null) { try { GetRecordsResult getRecordsResult = kinesisProxy.get(nextIterator, maxRecords); <START> LOG.info("Successfully fetched records from Kinesis for shard " + shardId + ": " + getRecordsResult); <END> return new AdvancingResult(getRecordsResult); } catch (ResourceNotFoundException e) { LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId); return TERMINAL_RESULT; } } else { LOG.info("Cannot fetch records from Kinesis for shard " + shardId + ": nextIterator is null."); return TERMINAL_RESULT; } }</code><technical_language>Logging response INFO level for existing applications. log INFO nextIterator is null, is interesting case</technical_language>

Target:
public DataFetcherResult getRecords(int maxRecords) { if (!isInitialized) { throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization."); } if (nextIterator != null) { try { return new AdvancingResult(kinesisProxy.get(nextIterator, maxRecords)); } catch (ResourceNotFoundException e) { LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId); return TERMINAL_RESULT; } } else { LOG.info("Skipping fetching records from Kinesis for shard " + shardId + ": nextIterator is null."); return TERMINAL_RESULT; } }
Source:
<code>public void readValueAndWriteValueShouldBeSymmetric() throws IOException { final TypeSerializerRegistry registry = TypeSerializerRegistry.build() .addCustomType(SamplePerson.class, new SamplePersonSerializer()).create(); final GraphBinaryReader reader = new GraphBinaryReader(registry); final GraphBinaryWriter writer = new GraphBinaryWriter(registry); final SamplePerson person = new SamplePerson("Matias", Date.from(LocalDateTime.of(2005, 8, 5, 1, 0).toInstant(ZoneOffset.UTC))); for (boolean nullable: new boolean[] { true, false }) { final Buffer buffer = bufferFactory.create(allocator.buffer()); writer.writeValue(person, buffer, nullable); final SamplePerson actual = reader.readValue(buffer, SamplePerson.class, nullable); <START> Assert.assertTrue(new ReflectionEquals(person).matches(actual)); <END> buffer.release(); } }</code><technical_language>nit: tend prefer statically import assertion method avoid assertTrue() provides a terrible failure message, typically prefer: assertThat(new ReflectionEquals(person).matches(actual), is(true))</technical_language>

Target:
public void readValueAndWriteValueShouldBeSymmetric() throws IOException { final TypeSerializerRegistry registry = TypeSerializerRegistry.build() .addCustomType(SamplePerson.class, new SamplePersonSerializer()).create(); final GraphBinaryReader reader = new GraphBinaryReader(registry); final GraphBinaryWriter writer = new GraphBinaryWriter(registry); final SamplePerson person = new SamplePerson("Matias", Date.from(LocalDateTime.of(2005, 8, 5, 1, 0).toInstant(ZoneOffset.UTC))); for (boolean nullable: new boolean[] { true, false }) { final Buffer buffer = bufferFactory.create(allocator.buffer()); writer.writeValue(person, buffer, nullable); final SamplePerson actual = reader.readValue(buffer, SamplePerson.class, nullable); assertThat(actual, new ReflectionEquals(person)); buffer.release(); } }
Source:
<code>public void updateUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) <START> .build(); <END> MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setId(metadataField.getID()); metadataFieldRest.setElement(ELEMENT_UPDATED); metadataFieldRest.setQualifier(QUALIFIER_UPDATED); metadataFieldRest.setScopeNote(SCOPE_NOTE_UPDATED); getClient() .perform(put("/api/core/metadatafields/" + metadataField.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataFieldMatcher.matchMetadataFieldByKeys( metadataSchema.getName(), ELEMENT, QUALIFIER) )); }</code><technical_language>turn auth system creating test data</technical_language>

Target:
public void updateUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setId(metadataField.getID()); metadataFieldRest.setElement(ELEMENT_UPDATED); metadataFieldRest.setQualifier(QUALIFIER_UPDATED); metadataFieldRest.setScopeNote(SCOPE_NOTE_UPDATED); getClient() .perform(put("/api/core/metadatafields/" + metadataField.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataFieldMatcher.matchMetadataFieldByKeys( metadataSchema.getName(), ELEMENT, QUALIFIER) )); }
Source:
<code><START> public void convert() throws IOException { <END> Result sourceDataset = documentEntity(EXT_IDENTIFIERS); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals(EXT_ID_TYPE_DOI_UPPERCASED.toLowerCase(), metadata.getReferenceType()); assertEquals(EXT_IDENTIFIERS.get(EXT_ID_TYPE_DOI_UPPERCASED), metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(2, metadata.getTitles().size()); assertEquals(TITLE, metadata.getTitles().get(0)); assertEquals(OTHER_TITLE, metadata.getTitles().get(1)); assertEquals(ABSTRACT, metadata.getDescription()); assertEquals(PUBLISHER, metadata.getPublisher()); assertEquals(YEAR, metadata.getPublicationYear()); assertEquals(1, metadata.getFormats().size()); assertEquals(FORMAT, metadata.getFormats().iterator().next()); assertEquals(RESOURCE_TYPE_CLASSID, metadata.getResourceTypeValue()); assertEquals(2, metadata.getAlternateIdentifiers().size()); assertEquals(EXT_IDENTIFIERS, metadata.getAlternateIdentifiers()); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void convert() { Result sourceDataset = documentEntity(EXT_IDENTIFIERS); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals(EXT_ID_TYPE_DOI_UPPERCASED.toLowerCase(), metadata.getReferenceType()); assertEquals(EXT_IDENTIFIERS.get(EXT_ID_TYPE_DOI_UPPERCASED), metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(2, metadata.getTitles().size()); assertEquals(TITLE, metadata.getTitles().get(0)); assertEquals(OTHER_TITLE, metadata.getTitles().get(1)); assertEquals(ABSTRACT, metadata.getDescription()); assertEquals(PUBLISHER, metadata.getPublisher()); assertEquals(YEAR, metadata.getPublicationYear()); assertEquals(1, metadata.getFormats().size()); assertEquals(FORMAT, metadata.getFormats().iterator().next()); assertEquals(RESOURCE_TYPE_CLASSID, metadata.getResourceTypeValue()); assertEquals(2, metadata.getAlternateIdentifiers().size()); assertEquals(EXT_IDENTIFIERS, metadata.getAlternateIdentifiers()); }
Source:
<code>public static <G, K, V> Map<G, Map<? extends K, ? extends V>> groupBy( <START> Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<G> closure) { <END> final Map<G, List<Map.Entry<? extends K, ? extends V>>> initial = groupEntriesBy(self, closure); final Map<G, Map<? extends K, ? extends V>> answer = new LinkedHashMap<G, Map<? extends K, ? extends V>>(); for (Map.Entry<G, List<Map.Entry<? extends K, ? extends V>>> outer : initial.entrySet()) { G key = outer.getKey(); List<Map.Entry<? extends K, ? extends V>> entries = outer.getValue(); Map<K, V> target = createSimilarMap(self); putAll(target, entries); answer.put(key, target); } return answer; }</code><technical_language>wildcards parameter instead? return types, nested wildcards confuse :smile: closure parameter benefit ? extends G</technical_language>

Target:
public static <G, K, V> Map<G, Map<K, V>> groupBy(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<G> closure) { final Map<G, List<Map.Entry<K, V>>> initial = groupEntriesBy(self, closure); final Map<G, Map<K, V>> answer = new LinkedHashMap<G, Map<K, V>>(); for (Map.Entry<G, List<Map.Entry<K, V>>> outer : initial.entrySet()) { G key = outer.getKey(); List<Map.Entry<K, V>> entries = outer.getValue(); Map<K, V> target = createSimilarMap(self); for (Map.Entry<K, V> entry : entries) { target.put(entry.getKey(), entry.getValue()); } answer.put(key, target); } return answer; }
Source:
<code>public String openBrowser(String url, String... args) { String browserName = robot.getParamsValue(args, 0, "firefox"); String alias = robot.getParamsValue(args, 1, "None"); String remoteUrl = robot.getParamsValue(args, 2, "None"); String desiredCapabilities = robot.getParamsValue(args, 3, "None"); String browserOptions = robot.getParamsValue(args, 4, "None"); String webDriverManager = robot.getParamsValue(args, 5, "None"); <START> if (!webDriverManager.equals("None")) { <END> webDriverManagerSetup(browserName); } try { logging.info("browserName: " + browserName); WebDriver webDriver = createWebDriver(browserName, desiredCapabilities, remoteUrl, browserOptions); webDriver.get(url); String sessionId = webDriverCache.register(webDriver, alias); logging.debug(String.format("Opened browser with session id %s", sessionId)); return sessionId; } catch (Throwable t) { if (remoteUrl != null && !remoteUrl.equalsIgnoreCase("FALSE") && !remoteUrl.equalsIgnoreCase("NONE")) { logging.warn(String.format("Opening browser '%s' to base url '%s' through remote server at '%s' failed", browserName, url, remoteUrl)); } else { logging.warn(String.format("Opening browser '%s' to base url '%s' failed", browserName, url)); } throw new SeleniumLibraryFatalException(t); } }</code><technical_language>cleaner, if Robot -class boolean a default, Boolean usage of String in this case</technical_language>

Target:
public String openBrowser(String url, String... args) { String browserName = robot.getParamsValue(args, 0, "firefox"); String alias = robot.getParamsValue(args, 1, "None"); String remoteUrl = robot.getParamsValue(args, 2, "None"); String desiredCapabilities = robot.getParamsValue(args, 3, "None"); String browserOptions = robot.getParamsValue(args, 4, "None"); boolean isWebDriverManager = robot.getParamsValue(args, 5, false); if (isWebDriverManager) { webDriverManagerSetup(browserName); } try { logging.info("browserName: " + browserName); WebDriver webDriver = createWebDriver(browserName, desiredCapabilities, remoteUrl, browserOptions); webDriver.get(url); String sessionId = webDriverCache.register(webDriver, alias); logging.debug(String.format("Opened browser with session id %s", sessionId)); return sessionId; } catch (Throwable t) { if (remoteUrl != null && !remoteUrl.equalsIgnoreCase("FALSE") && !remoteUrl.equalsIgnoreCase("NONE")) { logging.warn(String.format("Opening browser '%s' to base url '%s' through remote server at '%s' failed", browserName, url, remoteUrl)); } else { logging.warn(String.format("Opening browser '%s' to base url '%s' failed", browserName, url)); } throw new SeleniumLibraryFatalException(t); } }
Source:
<code>private boolean checkAll(HttpServletRequest request, String cache, Nameable entity, Predicate<IAuthorizationPlugin> predicate) { if (stack == null) { return true; } Statistics stats = RuntimeEnvironment.getInstance().getStatistics(); Boolean val; Map<String, Boolean> m = (Map<String, Boolean>) request.getAttribute(cache); if (m == null) { m = new TreeMap<>(); } else if ((val = m.get(entity.getName())) != null) { stats.addRequest(request, "authorization_cache_hits"); return val; } stats.addRequest(request, "authorization_cache_misses"); long time = System.currentTimeMillis(); <START> boolean overallDecision = performCheck(entity, predicate); <END> stats.addRequestTime(request, "authorization", System.currentTimeMillis() - time); stats.addRequestTime(request, "authorization_of_" + entity.getName(), System.currentTimeMillis() - time); m.put(entity.getName(), overallDecision); request.setAttribute(cache, m); return overallDecision; }</code><technical_language>add overallDecision stats too. good detect brute-forcing attacks</technical_language>

Target:
private boolean checkAll(HttpServletRequest request, String cache, Nameable entity, Predicate<IAuthorizationPlugin> predicate) { if (stack == null) { return true; } Statistics stats = RuntimeEnvironment.getInstance().getStatistics(); Boolean val; Map<String, Boolean> m = (Map<String, Boolean>) request.getAttribute(cache); if (m == null) { m = new TreeMap<>(); } else if ((val = m.get(entity.getName())) != null) { stats.addRequest(request, "authorization_cache_hits"); return val; } stats.addRequest(request, "authorization_cache_misses"); long time = System.currentTimeMillis(); boolean overallDecision = performCheck(entity, predicate); time = System.currentTimeMillis() - time; stats.addRequestTime(request, "authorization", time); stats.addRequestTime(request, String.format("authorization_%s", overallDecision ? "positive" : "negative"), time); stats.addRequestTime(request, String.format("authorization_%s_of_%s", overallDecision ? "positive" : "negative", entity.getName()), time); stats.addRequestTime(request, String.format("authorization_of_%s", entity.getName()), time); m.put(entity.getName(), overallDecision); request.setAttribute(cache, m); return overallDecision; }
Source:
<code>public void setPortletDefinitionRegistry(final IPortletDefinitionRegistry portletDefinitionRegistry) { <START> Validate.notNull(portletDefinitionRegistry, "Pportlet definition registry must not be null."); <END> this.portletDefinitionRegistry = portletDefinitionRegistry; }</code><technical_language>Pportlet Portlet</technical_language>

Target:
public void setPortletDefinitionRegistry(final IPortletDefinitionRegistry portletDefinitionRegistry) { Validate.notNull(portletDefinitionRegistry, "Portlet definition registry must not be null."); this.portletDefinitionRegistry = portletDefinitionRegistry; }
Source:
<code>protected void validateFileDescriptions() { int fileUploadSize = 0; if (null != this.getFileUpload()) { fileUploadSize = this.getFileUpload().size(); } <START> for (int i = 0; i < fileUploadSize; i++) { <END> if (null != fileDescriptions) { if (!(fileDescriptions.get(i).length() > 0)) { this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } if (fileDescriptions.get(i).length() > 250) { this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrTooLong")); } } else { this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } } }</code><technical_language>Log error cases</technical_language>

Target:
protected void validateFileDescriptions() { int fileUploadSize = 0; if (null != this.getFileUpload()) { fileUploadSize = this.getFileUpload().size(); } for (int i = 0; i < fileUploadSize; i++) { if (null != fileDescriptions) { if (!(fileDescriptions.get(i).length() > 0)) { logger.debug("Description empty for the field ", DESCR_FIELD + i); this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } if (fileDescriptions.get(i).length() > 250) { logger.debug("Description too long for the field ", DESCR_FIELD + i); this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrTooLong")); } } else { logger.debug("Description empty for the field ", DESCR_FIELD + i); this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } } }
Source:
<code>@Test public void testTranslate3() { checkWholeExpFails("translate('aabbcc', 'ab', '+-')", "No match found for function signature TRANSLATE3\\(<CHARACTER>, <CHARACTER>, <CHARACTER>\\)"); tester = tester.withOperatorTable( ChainedSqlOperatorTable.of(SqlDialectOperatorTableFactory .instance() <START> .getOperatorTable(SqlDialect.Dialect.ORACLE), <END> SqlStdOperatorTable.instance())); checkExpType("translate('aabbcc', 'ab', '+-')", "VARCHAR(6) NOT NULL"); checkWholeExpFails("translate('abc', 'ab')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); checkWholeExpFails("translate('abc', 'ab', 123)", "(?s)Cannot apply 'TRANSLATE3' to arguments of type 'TRANSLATE3\\(<CHAR\\(3\\)>, <CHAR\\(2\\)>, <INTEGER>\\)'\\. .*"); checkWholeExpFails("translate('abc', 'ab', '+-', 'four')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); }</code><technical_language>Please break line "of(" clear ".instance()" applies to</technical_language>

Target:
@Test public void testTranslate3() { checkWholeExpFails("translate('aabbcc', 'ab', '+-')", "No match found for function signature TRANSLATE3\\(<CHARACTER>, <CHARACTER>, <CHARACTER>\\)"); tester = tester.withOperatorTable( ChainedSqlOperatorTable .of(SqlDialectOperatorTableFactory .instance() .getOperatorTable(SqlFlavor.Flavor.ORACLE), SqlStdOperatorTable.instance())); checkExpType("translate('aabbcc', 'ab', '+-')", "VARCHAR(6) NOT NULL"); checkWholeExpFails("translate('abc', 'ab')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); checkWholeExpFails("translate('abc', 'ab', 123)", "(?s)Cannot apply 'TRANSLATE3' to arguments of type 'TRANSLATE3\\(<CHAR\\(3\\)>, <CHAR\\(2\\)>, <INTEGER>\\)'\\. .*"); checkWholeExpFails("translate('abc', 'ab', '+-', 'four')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); }
Source:
<code>public void setExpressionStatement(ExpressionStatement expr) { if (!(expr instanceof ReferenceLookup || expr instanceof FunctionInvocation || expr instanceof ClosureReference || (expr instanceof BinaryOperation <START> && ((BinaryOperation) expr).getType().equals(OperatorType.ANON_CALL)))) { <END> throw new IllegalArgumentException("Decorator expression must be a reference or an invocation, got a " + expr.getClass().getSimpleName()); } this.expressionStatement = expr; makeParentOf(expr); }</code><technical_language>flip OperatorsType.ANON_CALL.equals(...) ensure null safety, in case</technical_language>

Target:
public void setExpressionStatement(ExpressionStatement expr) { if (!isValidDecoratorExpressoin(expr)) { throw new IllegalArgumentException("Decorator expression must be a reference or an invocation, got a " + expr.getClass().getSimpleName()); } this.expressionStatement = expr; makeParentOf(expr); }
Source:
<code>public static Test setUpTest(Test test) { <START> return new Java17ProjectTestSetup(test); <END> }</code><technical_language>I this is of failures setting a Java17 project called TestSetup17project that</technical_language>

Target:
public static Test setUpTest(Test test) { return new Java1d5ProjectTestSetup(test); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } final Address address = (Address) o; <START> return this.type == address.type && this.socketAddr.equals(address.socketAddr); <END> }</code><technical_language>this.type == address.type, do need it</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } final Address address = (Address) o; return port == address.port && inetAddress.equals(address.inetAddress); }
Source:
<code>private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); <START> DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US); <END> DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { logger.error(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } try { return Instant.from(dtf_windows.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); }</code><technical_language>Locale.ROOT instead in locale</technical_language>

Target:
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX"); DateTimeFormatter dtfWindows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX"); try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { logger.error(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } try { return Instant.from(dtfWindows.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); }
Source:
<code>public void add(final RevCommit c) { sinceLastIndex++; if (++inQueue > REBUILD_INDEX_COUNT && sinceLastIndex > REBUILD_INDEX_COUNT) { sinceLastIndex = 0; buildIndex(); } Entry q = head; final long when = c.commitTime; if (!index.isEmpty()) { Entry prev = null; for (Entry i : index) { if (when > i.commit.commitTime) { <START> if (prev != null) { <END> q = prev; } break; } prev = i; } } final Entry n = newEntry(c); if (q == null || when > q.commit.commitTime) { n.next = q; head = n; } else { Entry p = q.next; while (p != null && p.commit.commitTime > when) { q = p; p = q.next; } n.next = q.next; q.next = n; } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public void add(final RevCommit c) { sinceLastIndex++; if (++inQueue > REBUILD_INDEX_COUNT && sinceLastIndex > REBUILD_INDEX_COUNT) { sinceLastIndex = 0; buildIndex(); } Entry q = head; final long when = c.commitTime; if (!index.isEmpty()) { Entry prev = null; for (Entry i : index) { if (when > i.commit.commitTime) { if (prev != null) q = prev; break; } prev = i; } } final Entry n = newEntry(c); if (q == null || when > q.commit.commitTime) { n.next = q; head = n; } else { Entry p = q.next; while (p != null && p.commit.commitTime > when) { q = p; p = q.next; } n.next = q.next; q.next = n; } }
Source:
<code>public void populateTemplates() { if (state_ != STATE_EMPTY) return; progressPanel_.showProgress(250); server_.getRmdTemplates( new ServerRequestCallback<JsArray<RmdDocumentTemplate>>() { @Override public void onResponseReceived(JsArray<RmdDocumentTemplate> templates) { JsArrayUtil.fillList(templates, templates_); templates_.sort((RmdDocumentTemplate a, RmdDocumentTemplate b) -> { <START> return (a.getPackage() + a.getName()).compareTo( <END> (b.getPackage() + b.getName())); }); for (RmdDocumentTemplate template: templates_) { String preferredTemplate = RStudioGinjector.INSTANCE.getUserPrefs() .rmdPreferredTemplatePath().getValue(); listTemplates_.addItem(new RmdDiscoveredTemplateItem(template), template.getPath() != preferredTemplate); } state_ = STATE_POPULATED; completeDiscovery(); } @Override public void onError(ServerError error) { RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage( "R Markdown Templates Not Found", "An error occurred while looking for R Markdown templates. " + error.getMessage()); } }); state_ = STATE_POPULATING; }</code><technical_language>In theory this sort in unexpected if package name is a substring of other; e.g. foo + bar fo + obaz "fo" < "foo", "foobar" < "foobaz". chances of this happening in this context ultimately dealing user input I worth comparing component separately</technical_language>

Target:
public void populateTemplates() { if (state_ != STATE_EMPTY) return; progressPanel_.showProgress(250); server_.getRmdTemplates( new ServerRequestCallback<JsArray<RmdDocumentTemplate>>() { @Override public void onResponseReceived(JsArray<RmdDocumentTemplate> templates) { JsArrayUtil.fillList(templates, templates_); templates_.sort((RmdDocumentTemplate a, RmdDocumentTemplate b) -> { int result = a.getPackage().compareTo(b.getPackage()); if (result == 0) { return a.getName().compareTo(b.getName()); } return result; }); for (RmdDocumentTemplate template: templates_) { String preferredTemplate = RStudioGinjector.INSTANCE.getUserPrefs() .rmdPreferredTemplatePath().getValue(); listTemplates_.addItem(new RmdDiscoveredTemplateItem(template), template.getPath() != preferredTemplate); } state_ = STATE_POPULATED; completeDiscovery(); } @Override public void onError(ServerError error) { RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage( "R Markdown Templates Not Found", "An error occurred while looking for R Markdown templates. " + error.getMessage()); } }); state_ = STATE_POPULATING; }
Source:
<code>public Optional<char[]> getValue(final String variableKey) { <START> char[] fromCache = getFromCache(variableKey, <END> () -> loadValueFromStore(variableKey)); return Arrays.equals(fromCache, CACHE_404) ? Optional.empty() : Optional.ofNullable(decrypt(fromCache)); }</code><technical_language>need .toLowerCase()?, I thought keys saved lowercase in keystore</technical_language>

Target:
public Optional<char[]> getValue(final String variableKey) { final char[] fromCache = getFromCache(variableKey, () -> loadValueFromStore(variableKey)); return Arrays.equals(fromCache, CACHE_404) ? Optional.empty() : Optional.ofNullable(decrypt(fromCache)); }
Source:
<code>public static void assertErrorMessage(final WhoisResources whoisResources, final int number, final String severity, final String text, final String... argument) { ErrorMessage errorMsg = whoisResources.getErrorMessages().get(number); <START> assertEquals(text, errorMsg.getText()); <END> assertThat(errorMsg.getSeverity(), is(severity)); if (argument.length > 0) { assertThat(errorMsg.getArgs(), hasSize(argument.length)); for (int i = 0; i < argument.length; i++) { assertThat(errorMsg.getArgs().get(i).getValue(), is(argument[i])); } } }</code><technical_language>assertThat(errorMsg.getText(), is(text); for consistency</technical_language>

Target:
public static void assertErrorMessage(final WhoisResources whoisResources, final int number, final String severity, final String text, final String... argument) { ErrorMessage errorMsg = whoisResources.getErrorMessages().get(number); assertThat(errorMsg.getText(), is(text)); assertThat(errorMsg.getSeverity(), is(severity)); if (argument.length > 0) { assertThat(errorMsg.getArgs(), hasSize(argument.length)); for (int i = 0; i < argument.length; i++) { assertThat(errorMsg.getArgs().get(i).getValue(), is(argument[i])); } } }
Source:
<code>private void spongeImpl$onBlockFallenUpon( final Block block, final net.minecraft.world.World world, final BlockPos pos, final Entity entity, final float fallDistance) { if (world.isRemote) { block.onFallenUpon(world, pos, entity, fallDistance); return; } final BlockState state = world.getBlockState(pos); <START> if (!SpongeCommonEventFactory.handleCollideBlockEvent(block, world, pos, state, entity, Direction.UP)) { <END> block.onFallenUpon(world, pos, entity, fallDistance); this.lastCollidedBlockPos = pos; } }</code><technical_language>Do need pass in block anymore</technical_language>

Target:
private void impl$onBlockFallenUpon( final Block block, final net.minecraft.world.World world, final BlockPos pos, final Entity entity, final float fallDistance) { if (world.isRemote) { block.onFallenUpon(world, pos, entity, fallDistance); return; } final BlockState state = world.getBlockState(pos); if (!SpongeCommonEventFactory.handleCollideBlockEvent(block, world, pos, state, entity, Direction.UP)) { block.onFallenUpon(world, pos, entity, fallDistance); this.impl$lastCollidedBlockPos = pos; } }
Source:
<code><START> public <T> Iterable<T> findVariableOfType(Class<T> type) <END> { for (Map<String, Iterable<? extends WindupVertexFrame>> topOfStack : deque) { for (Iterable<? extends WindupVertexFrame> frames : topOfStack.values()) { List<T> result = new ArrayList<>(); for (WindupVertexFrame frame : frames) { if (!type.isAssignableFrom(frame.getClass())) { break; } result.add((T) frame); } if(!result.isEmpty()) return result; } } return null; }</code><technical_language>This technically break usage of this method. (Calling a class is a Frame). Is wanted do</technical_language>

Target:
public <T extends WindupVertexFrame> Iterable<T> findVariableOfType(Class<T> type) { for (Map<String, Iterable<? extends WindupVertexFrame>> topOfStack : deque) { for (Iterable<? extends WindupVertexFrame> frames : topOfStack.values()) { boolean empty = true; for (WindupVertexFrame frame : frames) { if (!type.isAssignableFrom(frame.getClass())) { break; } else { empty =false; } } if(!empty) return (Iterable<T>)frames; } } return null; }
Source:
<code>private Playlist getPlaylist() { try { return playlistServiceServiceLocator.getService().getPlaylist(); } catch (ServiceNotBoundException e) { <START> e.printStackTrace(); END> return null; } }</code><technical_language>Put actual log message</technical_language>

Target:
private Playlist getPlaylist() { Playlist playlist = null; try { playlist = playlistServiceServiceLocator.getService().getPlaylist(); } catch (ServiceNotBoundException e) { Log.wtf(TAG, e); } return playlist; }
Source:
<code><START> public String getWorldpayChallengeJwt() { <END> return worldpayChallengeJwt; }</code><technical_language>I Optional for getters response classes helps highlight response follow pattern happy as-is. Interested in opinion though</technical_language>

Target:
public Optional<String> getWorldpayChallengeJwt() { return Optional.ofNullable(worldpayChallengeJwt); }
Source:
<code>private void unlock() { Comparator<Entry<String, ReentrantLock>> reversed = (o1, o2) -> o2.getKey().compareTo(o1.getKey()); Set<Entry<String, ReentrantLock>> reversedEntrySet = idSync.entrySet() .stream() .sorted(reversed) .collect(Collectors.toSet()); String[] beanDefinitionNames = getBeanDefinitionNames(); for (Entry<String, ReentrantLock> entry : reversedEntrySet) { String id = entry.getKey(); if (!Arrays.stream(beanDefinitionNames).anyMatch(n -> n.equals(id))) { continue; } ReentrantLock lock = entry.getValue(); <START> if (lock.isLocked()) <END> { lock.unlock(); logger.info(String.format("Test resource [%s] unlocked.", id)); } } }</code><technical_language>@ptirador this needed</technical_language>

Target:
private void unlock() { Comparator<Entry<String, ReentrantLock>> reversed = (o1, o2) -> o2.getKey().compareTo(o1.getKey()); Set<Entry<String, ReentrantLock>> reversedEntrySet = idSync.entrySet() .stream() .sorted(reversed) .collect(Collectors.toSet()); String[] beanDefinitionNames = getBeanDefinitionNames(); for (Entry<String, ReentrantLock> entry : reversedEntrySet) { String id = entry.getKey(); if (!Arrays.stream(beanDefinitionNames).anyMatch(n -> n.equals(id))) { continue; } ReentrantLock lock = entry.getValue(); lock.unlock(); logger.info(String.format("Test resource [%s] unlocked.", id)); } }
Source:
<code>@Override public boolean canSeeSky(BlockPos pos) { Cube cube = getCube(pos.getX(), pos.getY(), pos.getZ()); if (cube == null) <START> return true; <END> IColumn IColumn = cube.getColumn(); int height = IColumn.getHeightValue(blockToLocal(pos.getX()), blockToLocal(pos.getZ())); return height <= pos.getY(); }</code><technical_language>true. Instead separate array for columns get column bu x/z coords</technical_language>

Target:
@Override public boolean canSeeSky(BlockPos pos) { int blockX = pos.getX(); int blockY = pos.getY(); int blockZ = pos.getZ(); int cubeX = Coords.blockToCube(blockX); int cubeZ = Coords.blockToCube(blockZ); if (cubeX < originX || cubeZ < originZ) return false; cubeX -= originX; cubeZ -= originZ; if (cubeX >= dx || cubeZ >= dz) return false; IColumn column = columns[cubeX][cubeZ]; if (column == null) return false; int height = column.getHeightValue(blockToLocal(blockX), blockToLocal(blockZ)); return height <= blockY; }
Source:
<code>public static List<DateTime> getDatesOnEitherSide(DateTime startDate, DateTime endDate, FEED_TYPE feedType) { int counter = 0, skip = 0; List<DateTime> dates = new ArrayList<DateTime>(); while (!startDate.isAfter(endDate) && counter < 1000) { if (counter == 1 && skip == 0) { <START> skip = 1; <END> } switch (feedType) { case MINUTELY: startDate = startDate.plusMinutes(skip); dates.add(startDate); break; case HOURLY: startDate = startDate.plusHours(skip); dates.add(startDate); break; case DAILY: startDate = startDate.plusDays(skip); dates.add(startDate); break; case MONTHLY: startDate = startDate.plusMonths(skip); dates.add(startDate); break; case YEARLY: startDate = startDate.plusYears(skip); dates.add(startDate); break; default: Assert.fail("Unexpected feedType = " + feedType); } ++counter; } return dates; }</code><technical_language>i reading this right. Skip is 0 1? this a param method? minutes/years/etc want side? java doc for this method good especially understand do</technical_language>

Target:
public static List<DateTime> getDatesOnEitherSide(DateTime startDate, DateTime endDate, FEED_TYPE feedType) { final List<DateTime> dates = new ArrayList<DateTime>(); if(!startDate.isAfter(endDate)) { dates.add(startDate); } for (int counter = 0; !startDate.isAfter(endDate) && counter < 1000; ++counter) { switch (feedType) { case MINUTELY: startDate = startDate.plusMinutes(1); dates.add(startDate); break; case HOURLY: startDate = startDate.plusHours(1); dates.add(startDate); break; case DAILY: startDate = startDate.plusDays(1); dates.add(startDate); break; case MONTHLY: startDate = startDate.plusMonths(1); dates.add(startDate); break; case YEARLY: startDate = startDate.plusYears(1); dates.add(startDate); break; default: Assert.fail("Unexpected feedType = " + feedType); } } return dates; }
Source:
<code>protected boolean shouldGenerate() { <START> return frontDeps != null && connectClientTsApiFolder != null; <END> }</code><technical_language>this field connectClientTsApiFolder a null? created in CTOR a final</technical_language>

Target:
protected boolean shouldGenerate() { return frontDeps != null; }
Source:
<code>protected Set<String> getAllWorkspaceNames( Set<String> alreadyKnownNames ) { Set<String> cacheNames = null; if (cacheContainer instanceof EmbeddedCacheManager) { cacheNames = new HashSet<String>(((EmbeddedCacheManager)cacheContainer).getCacheNames()); } else if (cacheContainer instanceof RemoteCacheManager) { <START> cacheNames = alreadyKnownNames; <END> } else { cacheNames = alreadyKnownNames; } if (cacheNames.equals(alreadyKnownNames)) { return cacheNames; } final UUID rootNodeUuid = getRootNodeUuid(); Set<String> nonWorkspaceCacheNames = new HashSet<String>(); for (String cacheName : cacheNames) { if (alreadyKnownNames.contains(cacheName)) continue; BasicCache<UUID, InfinispanNode> cache = cacheContainer.getCache(cacheName); if (!cache.containsKey(rootNodeUuid)) { nonWorkspaceCacheNames.add(cacheName); } } if (!nonWorkspaceCacheNames.isEmpty()) cacheNames.removeAll(nonWorkspaceCacheNames); return cacheNames; }</code><technical_language>RemoteCacheManager a "get caches" method, I merge 2 "else" branches</technical_language>

Target:
protected Set<String> getAllWorkspaceNames( Set<String> alreadyKnownNames ) { Set<String> cacheNames = null; if (cacheContainer instanceof EmbeddedCacheManager) { cacheNames = new HashSet<String>(((EmbeddedCacheManager)cacheContainer).getCacheNames()); } else { cacheNames = alreadyKnownNames; } if (cacheNames.equals(alreadyKnownNames)) { return cacheNames; } final UUID rootNodeUuid = getRootNodeUuid(); Set<String> nonWorkspaceCacheNames = new HashSet<String>(); for (String cacheName : cacheNames) { if (alreadyKnownNames.contains(cacheName)) continue; BasicCache<UUID, InfinispanNode> cache = cacheContainer.getCache(cacheName); if (!cache.containsKey(rootNodeUuid)) { nonWorkspaceCacheNames.add(cacheName); } } if (!nonWorkspaceCacheNames.isEmpty()) cacheNames.removeAll(nonWorkspaceCacheNames); return cacheNames; }
Source:
<code><START> public static TextFlow highlight(String text, String filter ) { <END> int filterIndex = text.toLowerCase().indexOf(filter.toLowerCase()); Text textBefore = new Text(text.substring(0, filterIndex)); Text textAfter = new Text(text.substring(filterIndex + filter.length())); Text textFilter = new Text(text.substring(filterIndex, filterIndex + filter.length())); textFilter.setFill(Color.ORANGE); textFilter.setFont(Font.font("Helvetica", FontWeight.BOLD, 12)); return new TextFlow(textBefore, textFilter, textAfter); }</code><technical_language>This highlight method scale a algorithm for matching inputs. works algorithm is a simple contains check, highlighted span is filter. a static class a good idea</technical_language>

Target:
public static TextFlow highlight(String text, String filter) { int filterIndex = text.toLowerCase(Locale.getDefault()).indexOf(filter.toLowerCase(Locale.getDefault())); Text textBefore = new Text(text.substring(0, filterIndex)); Text textAfter = new Text(text.substring(filterIndex + filter.length())); Text textFilter = new Text(text.substring(filterIndex, filterIndex + filter.length())); textFilter.setFill(Color.ORANGE); return new TextFlow(textBefore, textFilter, textAfter); }
Source:
<code>private String formatPlanNodeStatsAndCost(PlanNode node) { PlanNodeStatsEstimate stats = estimatedStatsAndCosts.getStats().getOrDefault(node.getId(), PlanNodeStatsEstimate.unknown()); PlanNodeCostEstimate cost = estimatedStatsAndCosts.getCosts().getOrDefault(node.getId(), PlanNodeCostEstimate.unknown()); <START> return String.format("{rows: %s (%s), cpu: %s, memory: %s, network: %s}", <END> formatAsLong(stats.getOutputRowCount()), formatEstimateAsDataSize(stats.getOutputSizeInBytes(node.getOutputSymbols(), types)), formatDouble(cost.getCpuCost()), formatDouble(cost.getMemoryCost()), formatDouble(cost.getNetworkCost())); }</code><technical_language>static import</technical_language>

Target:
private String formatPlanNodeStatsAndCost(PlanNode node) { PlanNodeStatsEstimate stats = estimatedStatsAndCosts.getStats().getOrDefault(node.getId(), PlanNodeStatsEstimate.unknown()); PlanNodeCostEstimate cost = estimatedStatsAndCosts.getCosts().getOrDefault(node.getId(), PlanNodeCostEstimate.unknown()); return format("{rows: %s (%s), cpu: %s, memory: %s, network: %s}", formatAsLong(stats.getOutputRowCount()), formatEstimateAsDataSize(stats.getOutputSizeInBytes(node.getOutputSymbols(), types)), formatDouble(cost.getCpuCost()), formatDouble(cost.getMemoryCost()), formatDouble(cost.getNetworkCost())); }