Skip to content

Commit

Permalink
TS-41980 Handle nested jars for converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsofia Borbely committed Feb 25, 2025
1 parent 7e96a77 commit 84a5108
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void runJaCoCoReportGeneration() throws IOException, AgentOptionParseExce
try (Benchmark benchmark = new Benchmark("Generating the XML report")) {
generator.convert(new Dump(sessionInfo, executionDataStore), Paths.get(arguments.outputFile).toFile());
} catch (EmptyReportException e) {
logger.warn("Converted report was emtpy.", e);
logger.warn("Converted report was empty.", e);
}
}

Check warning on line 65 in agent/src/main/java/com/teamscale/jacoco/agent/convert/Converter.java

View check run for this annotation

cqse.teamscale.io / teamscale-test-gaps

agent/src/main/java/com/teamscale/jacoco/agent/convert/Converter.java#L43-L65

[Test Gap] Changed method `runJaCoCoReportGeneration` has not been tested. https://cqse.teamscale.io/metrics/code/teamscale-jacoco-agent/agent%2Fsrc%2Fmain%2Fjava%2Fcom%2Fteamscale%2Fjacoco%2Fagent%2Fconvert%2FConverter.java?t=ts%2F41980_closed_stream%3AHEAD&selection=char-1592-2678

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ open class FilteringAnalyzer(
*/
@Throws(IOException::class)
protected open fun analyzeJar(input: InputStream, location: String): Int {
ZipInputStream(BashFileSkippingInputStream(input)).use { zip ->
return generateSequence { zip.nextEntry(location) }
val zip = ZipInputStream(BashFileSkippingInputStream(input))
return generateSequence { zip.nextEntry(location) }
.map { entry -> analyzeAll(zip, "$location@${entry.name}") }
.sum()
}
}

Check warning on line 76 in report-generator/src/main/kotlin/com/teamscale/report/jacoco/FilteringAnalyzer.kt

View check run for this annotation

cqse.teamscale.io / teamscale-test-gaps

report-generator/src/main/kotlin/com/teamscale/report/jacoco/FilteringAnalyzer.kt#L71-L76

[Test Gap] Changed method `analyzeJar` has not been tested. https://cqse.teamscale.io/metrics/code/teamscale-jacoco-agent/report-generator%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fteamscale%2Freport%2Fjacoco%2FFilteringAnalyzer.kt?t=ts%2F41980_closed_stream%3AHEAD&selection=char-2693-2952

/** Copied from [org.jacoco.core.analysis.Analyzer.nextEntry]. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class BashFileSkippingInputStream(input: InputStream) : FilterInputStream(Buffer
`in`.mark(BUFFER_SIZE)
bytesRead = `in`.read(buffer, 0, BUFFER_SIZE)
}

throw IOException("ZIP header not found in the input stream.")
}

/**
Expand Down

0 comments on commit 84a5108

Please sign in to comment.