auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>ContainerElementConstraintMappingContext nestedContainerElement(int[] nestedIndexes) { if ( !( configuredType instanceof ParameterizedType ) && !( TypeHelper.isArray( configuredType ) ) ) { <START> throw LOG.getTypeIsNotAParameterizedNorArrayTypeException( configuredType ); <END> } ContainerElementConstraintMappingContextImpl nestedContext = new ContainerElementConstraintMappingContextImpl( typeContext, parent, ConstraintLocation.forTypeArgument( parentLocation, typeParameter, getContainerElementType() ), nestedIndexes[0] ); nestedContainerElementContexts.put( nestedIndexes[0], nestedContext ); if ( nestedIndexes.length > 1 ) { return nestedContext.nestedContainerElement( Arrays.copyOfRange( nestedIndexes, 1, nestedIndexes.length ) ); } else { return nestedContext; } }</code><technical_language>2 spaces -> 1 space parenthesis</technical_language>

Target:
ContainerElementConstraintMappingContext nestedContainerElement(int[] nestedIndexes) { if ( !( configuredType instanceof ParameterizedType ) && !( TypeHelper.isArray( configuredType ) ) ) { throw LOG.getTypeIsNotAParameterizedNorArrayTypeException( configuredType ); } ContainerElementConstraintMappingContextImpl nestedContext = new ContainerElementConstraintMappingContextImpl( typeContext, parentContainerElementTarget, ConstraintLocation.forTypeArgument( parentLocation, typeParameter, getContainerElementType() ), nestedIndexes[0] ); nestedContainerElementContexts.put( nestedIndexes[0], nestedContext ); if ( nestedIndexes.length > 1 ) { return nestedContext.nestedContainerElement( Arrays.copyOfRange( nestedIndexes, 1, nestedIndexes.length ) ); } else { return nestedContext; } }
Source:
<code>protected Quip doTargetableComplimentRequest(Map<String, String> messageMap, SsmlDocumentBuilder builder, QuipMetadata metadata) throws DerpwizardException { if(!messageMap.containsKey("target") || StringUtils.isEmpty(messageMap.get("target"))){ throw new DerpwizardException("<speak>I'm sorry, I didn't understand who you wanted me to compliment.</speak>", "I'm sorry, I didn't understand who you wanted me to compliment.", "Could not determine compliment recipient"); } String target = messageMap.get("target"); target = target.substring(0,1).toUpperCase()+target.substring(1); Queue<String> complimentsUsed = metadata.getComplimentsUsed(); Quip quip = getRandomTargetableQuip(QuipType.COMPLIMENT, complimentsUsed, target); String plaintext = quip.getText(); String ssml = quip.getSsml(); <START> if(quip.isTargetable()){ END> plaintext = quip.getTargetableText(); ssml = quip.getTargetableSsml(); } builder.setShortFormTextMessage("CompliBot compliment"); builder.setFullTextMessage(plaintext); builder.text(ssml); return quip; }</code><technical_language>do need reverify that</technical_language>

Target:
protected Quip doTargetableComplimentRequest(Map<String, String> messageMap, SsmlDocumentBuilder builder, QuipMetadata metadata) throws DerpwizardException { if(!messageMap.containsKey("target") || StringUtils.isEmpty(messageMap.get("target"))){ return doComplimentRequest(messageMap, builder, metadata); } String target = messageMap.get("target"); if(target.toLowerCase().equals("me")){ return doComplimentRequest(messageMap, builder, metadata); } target = target.substring(0,1).toUpperCase()+target.substring(1); Queue<String> complimentsUsed = metadata.getComplimentsUsed(); Quip quip = getRandomTargetableQuip(QuipType.COMPLIMENT, complimentsUsed, target); String plaintext = quip.getText(); String ssml = quip.getSsml(); if(quip.isTargetable()){ plaintext = quip.getTargetableText(); ssml = quip.getTargetableSsml(); } builder.setShortFormTextMessage("CompliBot compliment"); builder.setFullTextMessage(plaintext); builder.text(ssml); return quip; }
Source:
<code>protected void executeCommand() { try { glusterSyncJob.refreshSelfHealData(cluster); } catch (Exception e) { addCustomValue("ClusterName", cluster.getName()); <START> auditLog(this, AuditLogType.GLUSTER_VOLUME_HEAL_REFRESH_FAILED); <END> setSucceeded(false); } setSucceeded(true); }</code><technical_language>log error failed</technical_language>

Target:
protected void executeCommand() { try { glusterSyncJob.refreshSelfHealData(cluster); } catch (Exception e) { log.error("Error while refreshing Gluster self heal data of cluster '{}': {}", cluster.getName(), e.getMessage()); addCustomValue("ClusterName", cluster.getName()); auditLog(this, AuditLogType.GLUSTER_VOLUME_HEAL_REFRESH_FAILED); setSucceeded(false); } setSucceeded(true); }
Source:
<code>public static void output(Type elementType, ArrayAggregationState state, BlockBuilder out) { if (state.isEmpty()) { out.appendNull(); } else { BlockBuilder entryBuilder = out.beginBlockEntry(); state.forEach((block, position) -> { if (entryBuilder.getRetainedSizeInBytes() > MAX_ARRAY_SIZE) { <START> throw new PrestoException(EXCEEDED_MAX_ARRAY_SIZE, format("Array size (%s) exceeds the maximum array size (%s)", entryBuilder.getRetainedSizeInBytes(), MAX_ARRAY_SIZE)); <END> } elementType.appendTo(block, position, entryBuilder); }); out.closeEntry(); } }</code><technical_language>nit: I other places () values in output message. Remove brackets</technical_language>

Target:
public static void output(Type elementType, ArrayAggregationState state, BlockBuilder out) { if (state.isEmpty()) { out.appendNull(); } else { BlockBuilder entryBuilder = out.beginBlockEntry(); state.forEach((block, position) -> { elementType.appendTo(block, position, entryBuilder); if (entryBuilder.getRetainedSizeInBytes() > MAX_ENTRY_RETAINED_SIZE_IN_BYTES) { throw new PrestoException(CELL_TOO_LARGE, format( "Array size %s bytes exceeds the maximum supported array size %s", new DataSize(entryBuilder.getRetainedSizeInBytes(), BYTE).toString(), new DataSize(MAX_ENTRY_RETAINED_SIZE_IN_BYTES, BYTE).toString())); } }); out.closeEntry(); } }
Source:
<code>public ConfigBag putAll(Map flags) { for (Object eo: flags.entrySet()) { Map.Entry e = (Map.Entry)eo; boolean isNew = !config.containsKey(e.getKey()); <START> boolean isUsed = !isNew && unusedConfig.containsKey(e.getKey()); <END> config.put(e.getKey(), e.getValue()); if (isNew || !isUsed) unusedConfig.put(e.getKey(), e.getValue()); } return this; }</code><technical_language>Is this right? If previously key "a" do putAll(["a":"val]), isUsed false in unusedConfig. added unusedConfig below. If is intended behaviour rename variable isUsed else</technical_language>

Target:
public ConfigBag putAll(Map flags) { for (Object eo: flags.entrySet()) { Map.Entry e = (Map.Entry)eo; boolean isNew = !config.containsKey(e.getKey()); boolean isUsed = !isNew && !unusedConfig.containsKey(e.getKey()); config.put(e.getKey(), e.getValue()); if (!isUsed) unusedConfig.put(e.getKey(), e.getValue()); } return this; }
Source:
<code><START> private static double computeSphericalExcess(Polygon polygon, int start, int end) <END> { if (polygon.getPoint(end - 1).equals(polygon.getPoint(start))) { end = end - 1; } if (end - start < 3) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Polygon is not valid: a loop contains less then 3 vertices."); } Point point = new Point(); polygon.getPoint(end - 1, point); SphericalExcessCalculator calculator = new SphericalExcessCalculator(point); for (int i = start; i < end; i++) { polygon.getPoint(i, point); calculator.add(point); } return calculator.getSphericalExcess(); }</code><technical_language>Math.abs call unnecessary here</technical_language>

Target:
private static double computeSphericalExcess(Polygon polygon, int start, int end) { if (polygon.getPoint(end - 1).equals(polygon.getPoint(start))) { end = end - 1; } if (end - start < 3) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Polygon is not valid: a loop contains less then 3 vertices."); } Point point = new Point(); polygon.getPoint(end - 1, point); SphericalExcessCalculator calculator = new SphericalExcessCalculator(point); for (int i = start; i < end; i++) { polygon.getPoint(i, point); calculator.add(point); } return calculator.computeSphericalExcess(); }
Source:
<code>public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (applicationContext instanceof AbstractApplicationContext) { <START> ((AbstractApplicationContext) applicationContext).setId(this.containerMetadata.getId()); <END> } this.context = applicationContext; }</code><technical_language>This is of reasons I create a PR yet; answer is explore (possibly ApplicationContextInitializer creating ContainerMetadata earlier). Earlier (current master) a static method called publish container started event a context (static SingleNodeApplication call it), needs change. need a bean, a managed lifecycle</technical_language>

Target:
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.context = applicationContext; }
Source:
<code>private void matchIndexesToNode( NodeRecord record, CheckerEngine<NodeRecord, ConsistencyReport.NodeConsistencyReport> engine, RecordAccess records, Collection<PropertyRecord> propertyRecs ) { Set<Long> labels = NodeLabelReader.getListOfLabels( record, records, engine ); PrimitiveIntObjectMap<PropertyBlock> nodePropertyMap = null; for ( IndexRule indexRule : indexes.onlineRules() ) { int[] labelIds = indexRule.schema().getEntityTokenIds(); <START> if ( Arrays.stream( labelIds ).asLongStream().anyMatch( labels::contains ) ) <END> { if ( nodePropertyMap == null ) { nodePropertyMap = properties( propertyReader.propertyBlocks( propertyRecs ) ); } int[] indexPropertyIds = indexRule.schema().getPropertyIds(); if ( nodeHasSchemaProperties( nodePropertyMap, indexPropertyIds ) ) { Value[] values = getPropertyValues( nodePropertyMap, indexPropertyIds ); try ( IndexReader reader = indexes.accessorFor( indexRule ).newReader() ) { long nodeId = record.getId(); if ( indexRule.canSupportUniqueConstraint() ) { verifyNodeCorrectlyIndexedUniquely( nodeId, values, engine, indexRule, reader ); } else { long count = reader.countIndexedNodes( nodeId, values ); reportIncorrectIndexCount( values, engine, indexRule, count ); } } } } } }</code><technical_language>Instead of converting primitive int array long objects find matches please primitive arrays instead (update NodeLabelReader return primitives well)</technical_language>

Target:
private void matchIndexesToNode( NodeRecord record, CheckerEngine<NodeRecord, ConsistencyReport.NodeConsistencyReport> engine, RecordAccess records, Collection<PropertyRecord> propertyRecs ) { LongSet labels = NodeLabelReader.getListOfLabels( record, records, engine ); IntObjectMap<PropertyBlock> nodePropertyMap = null; for ( StoreIndexDescriptor indexRule : indexes.onlineRules() ) { int[] labelIds = indexRule.schema().getEntityTokenIds(); if ( Arrays.stream( labelIds ).asLongStream().anyMatch( labels::contains ) ) { if ( nodePropertyMap == null ) { nodePropertyMap = properties( propertyReader.propertyBlocks( propertyRecs ) ); } int[] indexPropertyIds = indexRule.schema().getPropertyIds(); if ( nodeHasSchemaProperties( nodePropertyMap, indexPropertyIds ) ) { Value[] values = getPropertyValues( nodePropertyMap, indexPropertyIds ); try ( IndexReader reader = indexes.accessorFor( indexRule ).newReader() ) { long nodeId = record.getId(); if ( indexRule.canSupportUniqueConstraint() ) { verifyNodeCorrectlyIndexedUniquely( nodeId, values, engine, indexRule, reader ); } else { long count = reader.countIndexedNodes( nodeId, values ); reportIncorrectIndexCount( values, engine, indexRule, count ); } } } } } }
Source:
<code>public void testTextMaxWidth(){ assertEquals(10, testLayerDefault.getTextMaxWidth().intValue()); assertEquals(16, testLayerDefault.getTextSize().intValue()); assertEquals(160, testLayerDefault.getTextMaxWidth().intValue() * testLayerDefault.getTextSize().intValue()); assertEquals(5, testLayer.getTextMaxWidth().intValue()); <START> assertEquals(20, testLayer.getTextSize().intValue()); <END> assertEquals(100, testLayer.getTextMaxWidth().intValue() * testLayer.getTextSize().intValue()); }</code><technical_language>This line a bit redundant, do a call testLayerDefault.transform() ensure correct shows in resulting FeatureTypeStyle</technical_language>

Target:
public void testTextMaxWidth(){ assertEquals(160, testLayerDefault.getTextMaxWidth().intValue() * testLayerDefault.getTextSize().intValue()); assertEquals(100, testLayer.getTextMaxWidth().intValue() * testLayer.getTextSize().intValue()); }
Source:
<code>public Utf8InputStreamReader(final InputStream input) { <START> super(input, Charset.forName(Utf8InputStreamReader.ENCODING)); <END> }</code><technical_language>@dalifreire StandardCharsets.UTF_8</technical_language>

Target:
public Utf8InputStreamReader(final InputStream input) { super(input, StandardCharsets.UTF_8); }
Source:
<code>public static int getFooterCount(Properties schema) { <START> return getIntegerValue(schema, "skip.footer.line.count", "0"); <END> }</code><technical_language>reject negative values somewhere</technical_language>

Target:
public static int getFooterCount(Properties schema) { return getPositiveIntegerValue(schema, "skip.footer.line.count", "0"); }
Source:
<code>public void testExecuteQueryNotSupported() { setup(ExpectedError.NOT_SUPPORTED); getQuery().executeQueryCommand(); Map<String, LldpInfo> returnValue = getQuery().getQueryReturnValue().getReturnValue(); <START> assertTrue(returnValue == null); <END> }</code><technical_language>Please assertEquals</technical_language>

Target:
public void testExecuteQueryNotSupported() { setup(ExpectedError.NOT_SUPPORTED); getQuery().executeQueryCommand(); Map<String, LldpInfo> returnValue = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(returnValue, null); }
Source:
<code>public void testCreateAndBulkLoadTable() throws SQLException { String tblName = QueryUtils.DFLT_SCHEMA + ".\"PersonTbl\""; execute(conn, "create table " + tblName + " (id int primary key, age int, firstName varchar(30), lastName varchar(30))"); int updatesCnt = stmt.executeUpdate( <START> "copy from '" + BULKLOAD_TWO_LINES_CSV_FILE + "' into " + tblName + <END> "(_key, age, firstName, lastName)" + " format csv"); assertEquals(2, updatesCnt); checkCacheContents(tblName, true, 2); }</code><technical_language>Changes unrelated. Please, revert</technical_language>

Target:
public void testCreateAndBulkLoadTable() throws SQLException { String tblName = QueryUtils.DFLT_SCHEMA + ".\"PersonTbl\""; execute(conn, "create table " + tblName + " (id int primary key, age int, firstName varchar(30), lastName varchar(30))"); try { int updatesCnt = stmt.executeUpdate( "copy from '" + BULKLOAD_TWO_LINES_CSV_FILE + "' into " + tblName + "(_key, age, firstName, lastName)" + " format csv"); assertEquals(2, updatesCnt); checkCacheContents(tblName, true, 2); } finally { execute(conn, "drop table " + tblName); } }
Source:
<code>private MetadataStrategy getMetadataStrategy(final RepositoryPath repositoryPath) { MavenRepositoryConfiguration repositoryConfiguration = (MavenRepositoryConfiguration) repositoryPath.getRepository().getRepositoryConfiguration(); if (repositoryConfiguration == null) { <START> return checksumMetadataStrategy; <END> } MetadataStrategyEnum configuredStrategy = MetadataStrategyEnum.ofStrategy(repositoryConfiguration.getMetadataStrategy()); if (MetadataStrategyEnum.REFRESH.equals(configuredStrategy)) { return refreshMetadataStrategy; } else { return checksumMetadataStrategy; } }</code><technical_language>complexity reduced: suggestion MavenRepositoryConfiguration repositoryConfiguration = (MavenRepositoryConfiguration) repositoryPath.getRepository().getRepositoryConfiguration(); String strategy = Optional.ofNullable(repositoryConfiguration) .map(MavenRepositoryConfiguration::getMetadataStrategy) .orElse(null); if (MetadataStrategyEnum.REFRESH.toString().equalsIgnoreCase(strategy)) { return refreshMetadataStrategy; } return checksumMetadataStrategy;</technical_language>

Target:
private MetadataExpirationStrategy getMetadataStrategy(final RepositoryPath repositoryPath) { MavenRepositoryConfiguration repositoryConfiguration = (MavenRepositoryConfiguration) repositoryPath.getRepository().getRepositoryConfiguration(); String strategy = Optional.ofNullable(repositoryConfiguration) .map(MavenRepositoryConfiguration::getMetadataExpirationStrategy) .orElse(null); if (MetadataExpirationStrategyType.REFRESH == MetadataExpirationStrategyType.ofStrategy(strategy)) { return refreshMetadataStrategy; } return checksumMetadataExpirationStrategy; }
Source:
<code>private List<StagingFileInfo> computeFileNamesForMissingBuckets( ConnectorSession session, Table table, HiveStorageFormat storageFormat, Path targetPath, String filePrefix, int bucketCount, PartitionUpdate partitionUpdate) { if (partitionUpdate.getStagingFileInfos().size() == bucketCount) { return ImmutableList.of(); } HdfsContext hdfsContext = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); JobConf conf = toJobConf(hdfsEnvironment.getConfiguration(hdfsContext, targetPath)); String fileExtension = HiveWriterFactory.getFileExtension(conf, fromHiveStorageFormat(storageFormat)); Set<String> targetFileNames = ImmutableSet.copyOf( partitionUpdate.getStagingFileInfos().stream() .map(StagingFileInfo::getTargetFileName) .collect(toImmutableSet())); ImmutableList.Builder<StagingFileInfo> missingFileNamesBuilder = ImmutableList.builder(); for (int i = 0; i < bucketCount; i++) { String targetFileName = HiveWriterFactory.computeBucketedFileName(filePrefix, i) + fileExtension; if (!targetFileNames.contains(targetFileName)) { missingFileNamesBuilder.add(new StagingFileInfo(targetFileName, targetFileName)); } } List<StagingFileInfo> missingStagingFileInfos = missingFileNamesBuilder.build(); verify(targetFileNames.size() + missingStagingFileInfos.size() == bucketCount); return missingStagingFileInfos; <START> } <END></code><technical_language>purpose of this (instead of returning a List<String> ? :) -- get called createEmptyFile anyway, List<String></technical_language>

Target:
private List<String> computeFileNamesForMissingBuckets( ConnectorSession session, Table table, HiveStorageFormat storageFormat, Path targetPath, String filePrefix, int bucketCount, PartitionUpdate partitionUpdate) { if (partitionUpdate.getFileWriteInfos().size() == bucketCount) { return ImmutableList.of(); } HdfsContext hdfsContext = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); JobConf conf = toJobConf(hdfsEnvironment.getConfiguration(hdfsContext, targetPath)); String fileExtension = HiveWriterFactory.getFileExtension(conf, fromHiveStorageFormat(storageFormat)); Set<String> targetFileNames = ImmutableSet.copyOf(getTargetFileNames(partitionUpdate.getFileWriteInfos())); ImmutableList.Builder<String> missingFileNamesBuilder = ImmutableList.builder(); for (int i = 0; i < bucketCount; i++) { String targetFileName = HiveWriterFactory.computeBucketedFileName(filePrefix, i) + fileExtension; if (!targetFileNames.contains(targetFileName)) { missingFileNamesBuilder.add(targetFileName); } } List<String> missingFileNames = missingFileNamesBuilder.build(); verify(targetFileNames.size() + missingFileNames.size() == bucketCount); return missingFileNames; }
Source:
<code><START> private String applyRestrictions(@NonNull String string, int maxChars) { <END> if (string.length() > maxChars) { return string.substring(0, maxChars); } string = string.replaceAll("[:\\-\\s]", "_").replaceAll("__", "_"); return string; }</code><technical_language>This restriction applies event name parameter name. Parameter values string, long, double</technical_language>

Target:
private String applyRestrictions(@NonNull String string, int maxChars) { string = truncateString(string, maxChars); string = string.replaceAll("[:\\-\\s]+", "_"); return string; }
Source:
<code>public void setContent(String contents) { <START> this.nameplateContent = Strings.nullToEmpty(contents); <END> }</code><technical_language>Again, nullToEmpty</technical_language>

Target:
public void setContent(String contents) { this.nameplateContent = contents; }
Source:
<code>public File source() { if (expression != null) { <START> return null; <END> } else { return new File(parameters.get(0)); } }</code><technical_language>this is right? Please double check</technical_language>

Target:
public Source source() { if (expression != null) { return Sources.fromCommandLine("-e"); } else { return Sources.fromFile(parameters.get(0)); } }
Source:
<code>public static UnweightedDoubleReservoirSample deserialize(SliceInput input) { int count = input.readInt(); int maxSamples = input.readInt(); double[] samples = new double[maxSamples]; <START> input.readBytes( <END> Slices.wrappedDoubleArray(samples), Math.min(count, samples.length) * SizeOf.SIZE_OF_DOUBLE); return new UnweightedDoubleReservoirSample(count, samples); }</code><technical_language>put parameters line: input.readBytes(Slices.wrappedDoubleArray(samples), Math.min(count, samples.length) * SizeOf.SIZE_OF_DOUBLE);</technical_language>

Target:
public static UnweightedDoubleReservoirSample deserialize(SliceInput input) { int seenCount = input.readInt(); int maxSamples = input.readInt(); double[] samples = new double[maxSamples]; input.readBytes(Slices.wrappedDoubleArray(samples), Math.min(seenCount, samples.length) * SizeOf.SIZE_OF_DOUBLE); return new UnweightedDoubleReservoirSample(seenCount, samples); }
Source:
<code>public void testfindbyRegionAndOtherBeaconFilters() { <START> Region startRange = new Region("9", new Long(10099), new Long(10099)); <END> Region endRange = new Region("9", new Long(10099), new Long(10099)); List<VariantRepositoryFilter> filters = new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, Arrays.asList("PRJEB5829")); List<VariantMongo> variantMongoList = service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters); assertEquals(true, variantMongoList.size() > 0); assertEquals("9", variantMongoList.get(0).getChromosome()); assertEquals("A", variantMongoList.get(0).getReference()); assertEquals("T", variantMongoList.get(0).getAlternate()); assertEquals(VariantType.SNV, variantMongoList.get(0).getType()); filters= new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, null); assertEquals(true,service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size()> 0); filters= new FilterBuilder().getBeaconFilters("A", "T", null, null); assertEquals(true,service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size()> 0); filters= new FilterBuilder().getBeaconFilters("A", null, VariantType.SNV, null); assertEquals(true,service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size()> 0); endRange = new Region("9", new Long(10098), new Long(10098)); assertEquals(false, service.findbyRegionAndOtherBeaconFilters(startRange, endRange, filters).size() > 0); }</code><technical_language>suggestion Region startRange = new Region("9", 10099L, 10099L);</technical_language>

Target:
public void testfindbyRegionAndOtherBeaconFilters() { Region startRange = new Region("9", 10099L, 10099L); Region endRange = new Region("9", 10099L, 10099L); Pageable pageable = new PageRequest(0, 1000); List<VariantRepositoryFilter> filters = new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, Collections.singletonList("PRJEB5829")); List<VariantMongo> variantMongoList = service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable); assertTrue(variantMongoList.size() > 0); assertEquals("9", variantMongoList.get(0).getChromosome()); assertEquals("A", variantMongoList.get(0).getReference()); assertEquals("T", variantMongoList.get(0).getAlternate()); assertEquals(VariantType.SNV, variantMongoList.get(0).getType()); filters = new FilterBuilder().getBeaconFilters("A", "T", VariantType.SNV, null); assertTrue(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); filters = new FilterBuilder().getBeaconFilters("A", "T", null, null); assertTrue(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); filters = new FilterBuilder().getBeaconFilters("A", null, VariantType.SNV, null); assertTrue(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); endRange = new Region("9", 10098L, 10098L); assertFalse(service.findByRegionAndOtherBeaconFilters(startRange, endRange, filters, pageable).size() > 0); }
Source:
<code>public void testGenerateReportToPdfFile_WithDataSource() throws Exception { String reportFileName = infoForDataSourceReport.getReportFileName(); String reportDirectoty = infoForDataSourceReport.getReportsDirectory(); String reportTemplateClassPath = infoForDataSourceReport.getReportTemplateClassPath(); String reportTemplateName = infoForDataSourceReport.getReportTemplateName(); ResourceBundle resourceBundle = infoForDataSourceReport.getResourceBundle(); String subReportTemplateClassPath = infoForDataSourceReport.getSubReportTemplateClassPath(); Map<String, String> subReports = infoForDataSourceReport.getSubReports(); Map<String, Object> reportData = new HashMap<String, Object>(); reportData.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR, subReportTemplateClassPath); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_TEMPLATE_NAME, subReports); try { String template = reportTemplateClassPath + reportTemplateName; String fullReportFileName = reportDirectoty + reportFileName; Collection<Account> accountDataSource = this.getAccounts(); reportGenerationService.generateReportToPdfFile(reportData, accountDataSource, template, fullReportFileName); } catch (Exception e) { <START> e.printStackTrace(); <END> fail("fail to generate PDF file." + e); } }</code><technical_language>want logging (and below) instead of printing stacktrace, right</technical_language>

Target:
public void testGenerateReportToPdfFile_WithDataSource() throws Exception { String reportFileName = infoForDataSourceReport.getReportFileName(); String reportDirectoty = infoForDataSourceReport.getReportsDirectory(); String reportTemplateClassPath = infoForDataSourceReport.getReportTemplateClassPath(); String reportTemplateName = infoForDataSourceReport.getReportTemplateName(); ResourceBundle resourceBundle = infoForDataSourceReport.getResourceBundle(); String subReportTemplateClassPath = infoForDataSourceReport.getSubReportTemplateClassPath(); Map<String, String> subReports = infoForDataSourceReport.getSubReports(); Map<String, Object> reportData = new HashMap<String, Object>(); reportData.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_DIR, subReportTemplateClassPath); reportData.put(ReportGeneration.PARAMETER_NAME_SUBREPORT_TEMPLATE_NAME, subReports); try { String template = reportTemplateClassPath + reportTemplateName; String fullReportFileName = reportDirectoty + reportFileName; Collection<Account> accountDataSource = this.getAccounts(); reportGenerationService.generateReportToPdfFile(reportData, accountDataSource, template, fullReportFileName); } catch (Exception e) { LOG.error("fail to generate PDF file", e); fail("fail to generate PDF file." + e); } }
Source:
<code>public void onMessage(String data) { <START> <END> try { @SuppressWarnings("unchecked") Map<String, Object> dataMap = objectMapper.readValue(data, Map.class); String event = (String) dataMap.get("event"); if ((event != null) && (event.equals("KEEP_ALIVE"))) { return; } event = (String) dataMap.get("type"); if (event != null) { if (event.equals("authenticated")) { log.info("WebSocket connection authenticated as (in {})", dataMap.get("userId"), dataMap.get("orgId")); } else { String channelName = (String) dataMap.get("channel"); if (channelName != null) { TransportChannel channel = channels.get(channelName); if ((channel != null) && (!channel.isClosed())) { StreamMessage message = new StreamMessage(event, null, data); channel.offer(message); } else { log.debug("ignoring message. channel not found {}", channelName); } } } } else { log.debug("ignoring message. {}", dataMap); } } catch (IOException ex) { log.error("failed to process messages", ex); } }</code><technical_language>rm</technical_language>

Target:
public void onMessage(String data) { try { @SuppressWarnings("unchecked") Map<String, Object> dataMap = objectMapper.readValue(data, Map.class); String event = (String) dataMap.get("event"); if ("KEEP_ALIVE".equals(event)) { return; } String type = (String) dataMap.get("type"); if (type == null) { log.debug("type missing so ignoring message. {}", dataMap); return; } if (type.equals("authenticated")) { log.info("WebSocket connection authenticated as (in {})", dataMap.get("userId"), dataMap.get("orgId")); } else { String channelName = (String) dataMap.get("channel"); if (channelName != null) { TransportChannel channel = channels.get(channelName); if ((channel != null) && (!channel.isClosed())) { StreamMessage message = new StreamMessage(type, null, data); channel.offer(message); } else { log.debug("ignoring message. channel not found {}", channelName); } } } } catch (IOException ex) { log.error("failed to process messages", ex); } }
Source:
<code>public AnviltopData.RowMutation.Builder adapt(Delete operation) { AnviltopData.RowMutation.Builder result = AnviltopData.RowMutation.newBuilder(); result.setRowKey(ByteString.copyFrom(operation.getRow())); if (operation.getFamilyCellMap().isEmpty()) { throwIfUnsupportedDeleteRow(operation); AnviltopData.RowMutation.Mod.Builder modBuilder = result.addModsBuilder(); modBuilder.setDeleteRow(true); } else { for (Map.Entry<byte[], List<Cell>> entry : operation.getFamilyCellMap().entrySet()) { ByteString familyByteString = ByteString.copyFrom(entry.getKey()); for (Cell cell : entry.getValue()) { if (isColumnDelete(cell)) { <START> if (isPointDelete(cell)) { <END> throwIfUnsupportedPointDelete(cell); } addDeleteCellRange(result, familyByteString, cell); } else if (isDeleteFamily(cell)) { throwIfUnsupportedDeleteFamily(cell); addDeleteFamilyMods(result, familyByteString); } else if (isDeleteFamilyVersion(cell)) { throwOnUnsupportedDeleteFamilyVersion(cell); } else { throwOnUnsupportedCellType(cell); } } } } return result; }</code><technical_language>Again, confused a point delete a column delete</technical_language>

Target:
public AnviltopData.RowMutation.Builder adapt(Delete operation) { AnviltopData.RowMutation.Builder result = AnviltopData.RowMutation.newBuilder(); result.setRowKey(ByteString.copyFrom(operation.getRow())); if (operation.getFamilyCellMap().isEmpty()) { throwIfUnsupportedDeleteRow(operation); AnviltopData.RowMutation.Mod.Builder modBuilder = result.addModsBuilder(); modBuilder.setDeleteRow(true); } else { for (Map.Entry<byte[], List<Cell>> entry : operation.getFamilyCellMap().entrySet()) { ByteString familyByteString = ByteString.copyFrom(entry.getKey()); for (Cell cell : entry.getValue()) { if (isColumnDelete(cell) || isPointDelete(cell)) { if (isPointDelete(cell)) { throwIfUnsupportedPointDelete(cell); } addDeleteCellRange(result, familyByteString, cell); } else if (isFamilyDelete(cell)) { throwIfUnsupportedDeleteFamily(cell); addDeleteFamilyMods(result, familyByteString); } else if (isFamilyVersionDelete(cell)) { throwOnUnsupportedDeleteFamilyVersion(cell); } else { throwOnUnsupportedCellType(cell); } } } } return result; }
Source:
<code>public void returnsNonZeroreturnsCode() throws Exception { final Shell shell = Mockito.mock(Shell.class); Mockito.doReturn(1).when(shell).exec( Mockito.anyString(), Mockito.any(InputStream.class), Mockito.any(TeeOutputStream.class), Mockito.any(TeeOutputStream.class) ); final Terminal terminal = new Terminal(shell); try { terminal.exec("", ""); <START> Assert.fail("should throw IOException"); <END> } catch (IOException ex) { Assert.assertTrue(true); } }</code><technical_language>Instead of this custom code, @Test expected attribute</technical_language>

Target:
public void returnsNonZeroreturnsCode() throws Exception { final Shell shell = Mockito.mock(Shell.class); Mockito.doReturn(1).when(shell).exec( Mockito.anyString(), Mockito.any(InputStream.class), Mockito.any(OutputStream.class), Mockito.any(OutputStream.class) ); final Terminal terminal = new Terminal(shell); terminal.exec("", ""); }
Source:
<code><START> public void switchOnOff(State state, ObjectInstance space) { <END> boolean isOn = SpaceFactory.getOnOff(space); SpaceFactory.setOnOff(space, !isOn); if (!isOn) { for (String name : SpaceFactory.getContents(space)) { ObjectInstance container = state.getObject(name); if (!ContainerFactory.isEmptyContainer(container)) { if (SpaceFactory.isBaking(space) && ContainerFactory.isBakingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { IngredientFactory.bakeIngredient(state.getObject(ing)); } } else if (SpaceFactory.isHeating(space) && ContainerFactory.isHeatingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { if (!IngredientFactory.isMeltedAtRoomTemperature(state.getObject(ing))) { IngredientFactory.meltIngredient(state.getObject(ing)); } } } } } } }</code><technical_language>Again, public</technical_language>

Target:
private void switchOnOff(State state, ObjectInstance space) { boolean isOn = SpaceFactory.getOnOff(space); SpaceFactory.setOnOff(space, !isOn); if (!isOn) { for (String name : SpaceFactory.getContents(space)) { ObjectInstance container = state.getObject(name); if (!ContainerFactory.isEmptyContainer(container)) { if (SpaceFactory.isBaking(space) && ContainerFactory.isBakingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { IngredientFactory.bakeIngredient(state.getObject(ing)); } } else if (SpaceFactory.isHeating(space) && ContainerFactory.isHeatingContainer(container)) { for (String ing : ContainerFactory.getContentNames(container)) { if (!IngredientFactory.isMeltedAtRoomTemperature(state.getObject(ing))) { IngredientFactory.meltIngredient(state.getObject(ing)); } } } } } } }
Source:
<code>public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String rgbKey = getPath(presentationProvider, stateItem, <START> ITimeEventStyleStrings.fillStyle()); <END> String heightKey = getPath(presentationProvider, stateItem, ITimeEventStyleStrings.heightFactor()); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(rgbKey); if (defaultString.isEmpty()) { store.setDefault(rgbKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(rgbKey); if (store.getDefaultInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeightFactor = isLink(stateItem) ? TimeGraphControl.DEFAULT_LINK_WIDTH : TimeGraphControl.DEFAULT_STATE_WIDTH; defaultHeightFactor = (float) styleMap.getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeightFactor); store.setDefault(heightKey, defaultHeightFactor); } float width = store.getFloat(heightKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), width); } }</code><technical_language>fillColor()</technical_language>

Target:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String fillColorKey = getPreferenceName(presentationProvider, stateItem, ITimeEventStyleStrings.fillColor()); String heightFactorKey = getPreferenceName(presentationProvider, stateItem, ITimeEventStyleStrings.heightFactor()); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(fillColorKey); if (defaultString.isEmpty()) { store.setDefault(fillColorKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(fillColorKey); if (store.getDefaultInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeightFactor = isLink(stateItem) ? TimeGraphControl.DEFAULT_LINK_WIDTH : TimeGraphControl.DEFAULT_STATE_WIDTH; defaultHeightFactor = (float) styleMap.getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeightFactor); store.setDefault(heightFactorKey, defaultHeightFactor); } float heightFactor = store.getFloat(heightFactorKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), heightFactor); } }
Source:
<code>public DatacenterBrokerHeuristicExample() { Log.setLevel(Level.WARN); System.out.println("Starting " + getClass().getSimpleName()); <START> boolean useBestFitBroker = true; <END> seed = 0; random0 = new UniformDistr(0, 1, seed); simulation0 = new CloudSim(); final Datacenter datacenter0 = createDatacenter(simulation0); broker0 = createBroker(); vmList0 = createVms(random0); cloudletList0 = createCloudlets(random0); broker0.submitVmList(vmList0); broker0.submitCloudletList(cloudletList0); simulation0.start(); random1 = new UniformDistr(0, 1, seed); simulation1 = new CloudSim(); final Datacenter datacenter1 = createDatacenter(simulation1); if (useBestFitBroker) { broker1 = new DatacenterBrokerBestFit(simulation1); } else { broker1 = new DatacenterBrokerSimple(simulation1); broker1.setVmMapper(this::bestFitCloudletToVmMapper); } vmList1 = createVms(random1); cloudletList1 = createCloudlets(random1); broker1.submitVmList(vmList1); broker1.submitCloudletList(cloudletList1); simulation1.start(); final List<Cloudlet> finishedCloudlets0 = broker0.getCloudletFinishedList(); new CloudletsTableBuilder(finishedCloudlets0).build(); final List<Cloudlet> finishedCloudlets1 = broker1.getCloudletFinishedList(); finishedCloudlets1.sort(Comparator.comparingLong(Cloudlet::getId)); new CloudletsTableBuilder(finishedCloudlets1).build(); print(broker0); }</code><technical_language>Mutability is another source of bugs. CloudSim core extensively final variables. I time update examples, reviewing some of them, I set variables final. suggestion final boolean useBestFitBroker = true;</technical_language>

Target:
public DatacenterBrokerHeuristicExample() { Log.setLevel(Level.WARN); System.out.println("Starting " + getClass().getSimpleName()); this.vmList = new ArrayList<>(); this.cloudletList = new ArrayList<>(); simulation = new CloudSim(); final Datacenter datacenter0 = createDatacenter(); DatacenterBrokerHeuristic broker0 = createBroker(); createAndSubmitVms(broker0); createAndSubmitCloudlets(broker0); simulation.start(); final List<Cloudlet> finishedCloudlets = broker0.getCloudletFinishedList(); new CloudletsTableBuilder(finishedCloudlets).build(); print(broker0); }
Source:
<code>static Object getAvroRecord (StreamlineEvent streamlineEvent, Schema schema) { <START> if (streamlineEvent.keySet().size() == 1 && streamlineEvent.containsKey(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD)) { <END> return streamlineEvent.get(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD); } GenericRecord result; result = new GenericData.Record(schema); for (Map.Entry<String, Object> entry: streamlineEvent.entrySet()) { result.put(entry.getKey(), getAvroValue(entry.getValue(), schema.getField(entry.getKey()).schema())); } return result; }</code><technical_language>check handle invalid schema scenario also. if (streamlineEvent.containsKey(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD)) { if((streamlineEvent.keySet().size() > 1 ) { throw new RuntimeException("Invalid schema, primitive schema field."); // error message if } return streamlineEvent.get(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD); }</technical_language>

Target:
static Object getAvroRecord (StreamlineEvent streamlineEvent, Schema schema) { if (streamlineEvent.containsKey(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD)) { if (streamlineEvent.keySet().size() > 1) { throw new RuntimeException("Invalid schema, primitive schema can contain only one field."); } return streamlineEvent.get(StreamlineEvent.PRIMITIVE_PAYLOAD_FIELD); } GenericRecord result; result = new GenericData.Record(schema); for (Map.Entry<String, Object> entry: streamlineEvent.entrySet()) { result.put(entry.getKey(), getAvroValue(entry.getValue(), schema.getField(entry.getKey()).schema())); } return result; }
Source:
<code>public void initialize() throws ParserConfigurationException, SAXException { saxParser = SAXParserFactory.newInstance().newSAXParser(); <START> handler = new DatabaseProjectXmlHandler(projectsReceiver = new ProjectsReceiver()); <END> }</code><technical_language>This syntax (assignment method call) is confusing</technical_language>

Target:
public void initialize() throws ParserConfigurationException, SAXException { saxParser = SAXParserFactory.newInstance().newSAXParser(); projectsReceiver = new ProjectsReceiver(); handler = new DatabaseProjectXmlHandler(projectsReceiver); }
Source:
<code>private static void makeWritable(@Nonnull Path path) throws IOException { if (!Functions.isWindows()) { try { PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class); Set<PosixFilePermission> newPermissions = ((PosixFileAttributes)attrs).permissions(); newPermissions.add(PosixFilePermission.OWNER_WRITE); <START> Files.setPosixFilePermissions(path, newPermissions); <END> } catch (NoSuchFileException e) { return; } catch (UnsupportedOperationException e) { } } path.toFile().setWritable(true); }</code><technical_language>Do want return skip older File.setWritable call</technical_language>

Target:
private static void makeWritable(@Nonnull Path path) throws IOException { if (!Functions.isWindows()) { try { PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class); Set<PosixFilePermission> newPermissions = ((PosixFileAttributes)attrs).permissions(); newPermissions.add(PosixFilePermission.OWNER_WRITE); Files.setPosixFilePermissions(path, newPermissions); return; } catch (NoSuchFileException e) { return; } catch (UnsupportedOperationException e) { } } path.toFile().setWritable(true); }
Source:
<code>private Vector3i computeAABB(TreeGenerator treeGen, long seed) { Vector3i pos = new Vector3i(ChunkConstants.SIZE_X / 2, 0, ChunkConstants.SIZE_Z / 2); Vector3i min = new Vector3i(pos); <START> Vector3i max = new Vector3i(pos); <END> Rect2i chunks = Rect2i.createFromMinAndMax(-1, -1, 1, 1); for (Vector2i chunkPos : chunks) { Chunk chunk = new ChunkImpl(chunkPos.getX(), 0, chunkPos.getY()) { @Override public Block setBlock(int x, int y, int z, Block block) { Vector3i world = chunkToWorldPosition(x, y, z); minimize(min, world); maximize(max, world); return null; } }; Random random = new MersenneRandom(seed); BlockManager blockManager = CoreRegistry.get(BlockManager.class); Vector3i relPos = chunk.chunkToWorldPosition(0, 0, 0).sub(pos).invert(); treeGen.generate(blockManager, chunk, random, relPos.x, relPos.y, relPos.z); } Vector3i ext = new Vector3i(max).sub(min); return ext; }</code><technical_language>final in class</technical_language>

Target:
private Vector3i computeAABB(TreeGenerator treeGen, long seed) { Vector3i pos = new Vector3i(ChunkConstants.SIZE_X / 2, 0, ChunkConstants.SIZE_Z / 2); final Vector3i min = new Vector3i(pos); final Vector3i max = new Vector3i(pos); Rect2i chunks = Rect2i.createFromMinAndMax(-1, -1, 1, 1); for (Vector2i chunkPos : chunks) { Chunk chunk = new ChunkImpl(chunkPos.getX(), 0, chunkPos.getY()) { @Override public Block setBlock(int x, int y, int z, Block block) { Vector3i world = chunkToWorldPosition(x, y, z); minimize(min, world); maximize(max, world); return null; } }; Random random = new MersenneRandom(seed); BlockManager blockManager = CoreRegistry.get(BlockManager.class); Vector3i relPos = chunk.chunkToWorldPosition(0, 0, 0).sub(pos).invert(); treeGen.generate(blockManager, chunk, random, relPos.x, relPos.y, relPos.z); } Vector3i ext = new Vector3i(max).sub(min); return ext; }
Source:
<code>private static int getFirstGeneratedLineNumber(final String sourceFileName, final String smap) { try { final BufferedReader br = new BufferedReader( new StringReader(smap)); expectLine(br, "SMAP"); expectLine(br, sourceFileName); expectLine(br, "Kotlin"); expectLine(br, "*S Kotlin"); expectLine(br, "*F"); final BitSet sourceFileIds = new BitSet(); String line; while (!"*L".equals(line = br.readLine())) { br.readLine(); final Matcher m = FILE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final String fileName = m.group(2); if (fileName.equals(sourceFileName)) { sourceFileIds.set(Integer.parseInt(m.group(1))); } } if (sourceFileIds.isEmpty()) { <START> throw new IllegalStateException("Unexpected SMAP"); <END> } int min = Integer.MAX_VALUE; while (!"*E".equals(line = br.readLine())) { final Matcher m = LINE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final int inputStartLine = Integer.parseInt(m.group(1)); final int lineFileID = Integer .parseInt(m.group(2).substring(1)); final int outputStartLine = Integer.parseInt(m.group(4)); if (sourceFileIds.get(lineFileID) && inputStartLine == outputStartLine) { continue; } min = Math.min(outputStartLine, min); } return min; } catch (final IOException e) { throw new AssertionError(e); } }</code><technical_language>line tne stack trace. more helpful if give a specific error message? users google for a specific error message</technical_language>

Target:
private static int getFirstGeneratedLineNumber(final String sourceFileName, final String smap) { try { final BufferedReader br = new BufferedReader( new StringReader(smap)); expectLine(br, "SMAP"); expectLine(br, sourceFileName); expectLine(br, "Kotlin"); expectLine(br, "*S Kotlin"); expectLine(br, "*F"); final BitSet sourceFileIds = new BitSet(); String line; while (!"*L".equals(line = br.readLine())) { br.readLine(); final Matcher m = FILE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final String fileName = m.group(2); if (fileName.equals(sourceFileName)) { sourceFileIds.set(Integer.parseInt(m.group(1))); } } if (sourceFileIds.isEmpty()) { throw new IllegalStateException("Unexpected SMAP FileSection"); } int min = Integer.MAX_VALUE; while (!"*E".equals(line = br.readLine())) { final Matcher m = LINE_INFO_PATTERN.matcher(line); if (!m.matches()) { throw new IllegalStateException( "Unexpected SMAP line: " + line); } final int inputStartLine = Integer.parseInt(m.group(1)); final int lineFileID = Integer .parseInt(m.group(2).substring(1)); final int outputStartLine = Integer.parseInt(m.group(4)); if (sourceFileIds.get(lineFileID) && inputStartLine == outputStartLine) { continue; } min = Math.min(outputStartLine, min); } return min; } catch (final IOException e) { throw new AssertionError(e); } }
Source:
<code>public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { try { String uri = message.getRequestHeader().getURI().toString(); String contentType = message.getResponseHeader() .getHeader(HttpHeader.CONTENT_TYPE) .toLowerCase(Locale.ROOT); <START> String responseBodyStart = StringUtils.left(message.getResponseBody().toString(), 250) .toLowerCase(Locale.ROOT); <END> if (uri.endsWith(".graphql") || uri.endsWith(".graphqls") || contentType.startsWith("application/graphql")) { schema = message.getResponseBody().toString(); LOG.debug("Found GraphQL schema at: " + uri); } if (responseBodyStart.contains("__schema") || responseBodyStart.contains("graphql")) { LOG.debug("Found GraphQl endpoint at: " + uri); return true; } return false; } catch (Exception e) { LOG.debug("Could not parse " + message.getRequestHeader().getURI()); return false; } }</code><technical_language>delayed</technical_language>

Target:
public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { String uri = message.getRequestHeader().getURI().toString(); switch (MessageValidator.validate(message)) { case VALID_ENDPOINT: LOG.debug("Found GraphQl endpoint at: " + uri); return true; case VALID_SCHEMA: LOG.debug("Found GraphQL schema at: " + uri); break; } return false; }