elharo opened a new issue, #92:
URL: https://github.com/apache/maven-reporting-api/issues/92
## Severity: High
### Summary
The `getOutputPath()` and `getOutputName()` default methods in `MavenReport`
delegate to each other. Because **both** are `default`, an implementation is
allowed to override **neither**. Such an implementation compiles cleanly but
recurses infinitely the first time the output path is queried and crashes with
`StackOverflowError`.
### Location
`src/main/java/org/apache/maven/reporting/MavenReport.java:91-93` and
`:100-102`
```java
default String getOutputPath() {
return getOutputName();
}
@Deprecated
default String getOutputName() {
return getOutputPath();
}
```
### Impact
The output path is queried during every report render. An implementation
that overrides neither method (legal now that both are `default`) throws
`StackOverflowError` on first access. Historically `getOutputName()` was
abstract and mandatory, so implementations ported to the new API that omit both
methods now crash at runtime instead of failing to compile.
### Steps to reproduce
1. Implement `MavenReport` without overriding either `getOutputPath()` or
`getOutputName()`.
2. Call `getOutputPath()` (or `getOutputName()`).
3. Observe `StackOverflowError`.
### Suggested fix
Make at least one of the methods non-default/abstract, or replace the
default delegation with a fail-fast fallback, e.g.:
```java
@Deprecated
default String getOutputName() {
throw new UnsupportedOperationException("Implement getOutputPath()
instead");
}
```
### Test gap
`MavenReportTest` only covers implementations that override the method; it
never exercises an implementation that overrides neither, which is the case
that overflows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]