Skip to content

BaseEncoding.encodingStream().close() is non-idempotent #5284

@brettkail-wk

Description

@brettkail-wk

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===

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions