Skip to content

Commit aad7674

Browse files
committed
Throw UOE for unsupported MultiPageSinkFactory.createSink(...) overloads
This prevent NPE which was previously experienced due to non-allowed null value being returned. This closes #1231
1 parent 6c97398 commit aad7674

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/java/org/apache/maven/plugins/site/render/ReportDocumentRenderer.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,21 @@ public Sink createSink(File outputDirectory, String outputName) {
146146
}
147147

148148
@Override
149-
public Sink createSink(File arg0, String arg1, String arg2) throws IOException {
150-
// Not used
151-
return null;
149+
public Sink createSink(File outputDir, String outputName, String encoding) throws IOException {
150+
throw new UnsupportedOperationException(
151+
"Only createSink(File, String) is supported by MultiPageSinkFactory. The encoding is always determined by the site rendering context.");
152152
}
153153

154154
@Override
155-
public Sink createSink(OutputStream arg0) throws IOException {
156-
// Not used
157-
return null;
155+
public Sink createSink(OutputStream out) throws IOException {
156+
throw new UnsupportedOperationException(
157+
"Only createSink(File, String) is supported by MultiPageSinkFactory. OutputStream based sinks are not supported.");
158158
}
159159

160160
@Override
161-
public Sink createSink(OutputStream arg0, String arg1) throws IOException {
162-
// Not used
163-
return null;
161+
public Sink createSink(OutputStream out, String encoding) throws IOException {
162+
throw new UnsupportedOperationException(
163+
"Only createSink(File, String) is supported by MultiPageSinkFactory. OutputStream based sinks are not supported.");
164164
}
165165

166166
public List<MultiPageSubSink> sinks() {

0 commit comments

Comments
 (0)