BaseEncoding.encodingStream().close() is non-idempotent
Author: brettkail-wkCreated Oct 16, 2020Updated Aug 30, 2026
Labelstype=defectpackage=ioP3
Closeable.close says:
If the stream is already closed then invoking this method has no effect.
Code:
StringWriter w = new StringWriter();
OutputStream out = BaseEncoding.base64().encodingStream(w);
out.write(0);
out.close();
System.out.println(w);
out.close();
System.out.println(w);
Output:
AA==
AA==A===
Source: google/guava