The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

Something happened in Java 8 Update 91 that broke existing JSP code. That seems pretty clear. Here is a sample of similar questions and bug reports: Unable to compile JSP file with JDK1.8.0_92 Spring MVC – Unable to compile class for JSP Unable to access CloudPlatform Client https://bugs.openjdk.java.net/browse/JDK-8155588 (closed as “not an issue”) https://bugs.openjdk.java.net/browse/JDK-8155223 (closed … Read more

Java FileInputStream ObjectInputStream reaches end of file EOF

readObject() doesn’t return null at EOF. You could catch the EOFException and interpret it as EOF, but this would fail to detect distinguish a normal EOF from a file that has been truncated. A better approach would be to use some meta-data. That is, rather than asking the ObjectInput how many objects are in the … Read more

Appending to an ObjectOutputStream

As the API says, the ObjectOutputStream constructor writes the serialization stream header to the underlying stream. And this header is expected to be only once, in the beginning of the file. So calling new ObjectOutputStream(fos); multiple times on the FileOutputStream that refers to the same file will write the header multiple times and corrupt the … Read more

tech