Find ObjectOutputStreams appending to a file

Proprietary

Marks a new ObjectOutputStream(..) over a file opened for appending, with new FileOutputStream(file, true) or Files.newOutputStream(path, StandardOpenOption.APPEND), directly, through a BufferedOutputStream or through a local variable whose every value but null does so. Each ObjectOutputStream writes a stream header, so a file appended to twice holds two headers and an ObjectInputStream reading it fails with a StreamCorruptedException. Subclasses of ObjectOutputStream, which may skip the header when appending, are not marked, and neither is a stream created in a source file that also creates or calls a subclass overriding writeStreamHeader(), as it is likely written only to a new file. Test sources are not searched.

io.moderne.staticanalysis.FindObjectOutputStreamAppending
mod run . --recipe=io.moderne.staticanalysis.FindObjectOutputStreamAppending

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.