Issue #17036: Variable os is never used
3.6.0
bug for bug:


@Override
public void write(XmlWriterRequest<PluginDescriptor> request) throws XmlWriterException {
nonNull(request, "request");
PluginDescriptor content = nonNull(request.getContent(), "content");
Path path = request.getPath();
OutputStream outputStream = request.getOutputStream();
Writer writer = request.getWriter();
if (writer == null && outputStream == null && path == null) {
throw new IllegalArgumentException("writer, outputStream or path must be non null");
}
try {
if (writer != null) {
new PluginDescriptorStaxWriter().write(writer, content);
} else if (outputStream != null) {
new PluginDescriptorStaxWriter().write(outputStream, content);
} else {
try (OutputStream os = Files.newOutputStream(path)) { // UnusedLocalVariable: Unused local variable 'os'.
new PluginDescriptorStaxWriter().write(outputStream, content);
}
}
} catch (Exception e) {
throw new XmlWriterException("Unable to write plugin: " + getMessage(e), getLocation(e), e);
}
}
javac
@Override
public void write(XmlWriterRequest<PluginDescriptor> request) throws XmlWriterException {
nonNull(request, "request");
PluginDescriptor content = nonNull(request.getContent(), "content");
Path path = request.getPath();
OutputStream outputStream = request.getOutputStream();
Writer writer = request.getWriter();
if (writer == null && outputStream == null && path == null) {
throw new IllegalArgumentException("writer, outputStream or path must be non null");
}
try {
if (writer != null) {
new PluginDescriptorStaxWriter().write(writer, content);
} else if (outputStream != null) {
new PluginDescriptorStaxWriter().write(outputStream, content);
} else {
try (OutputStream os = Files.newOutputStream(path)) {
new PluginDescriptorStaxWriter().write(outputStream, content);
}
}
} catch (Exception e) {
throw new XmlWriterException("Unable to write plugin: " + getMessage(e), getLocation(e), e);
}
}
[ERROR] src/main/java/org/apache/maven/impl/DefaultPluginXmlFactory.java:[96,35] (coding) UnusedLocalVariable: Unused local variable 'os'.
Issue #17036: Variable
osis never usedstreaminDefaultPluginXmlFactory#writeapache/maven#23033.6.0
bug for bug:


javac