Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!

Scott Corley

Greenhorn
+ Follow
since Nov 28, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Scott Corley

Is the XSL run on the server or the client?
Multipart support is also available from Jakarta http://jakarta.apache.org/commons/fileupload. Without the gotta buy the book license.
17 years ago
If you are using the latest JSP spec (2.4), and the tag on the page is defined using tagfiles, I believe that tagfile may use other tags from your taglib.
17 years ago
JSP
Not sure how it is accomplished because I haven't looked at the code but it sounds like the hot folder concept in AntFlow, http://antflow.onionnetworks.com/download.html.
17 years ago
Consider the code segment :

FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream("students-objects.txt", true); //always append
oos = new ObjectOutputStream(fos);
for(int i = 0; i < list.size(); i++ ) {
oos.writeObject(list.get(i);
}
oos.flush();
}
catch (IOException io) {
io.printStackTrace();
}
finally {
try {
if (oos != null) oos.close();
if (fos != null) fos.close();
}
catch (IOException e) {}
}

If I call the previous code segment more than once with a list of Serializable objects every thing seems fine until I try to read from the file. It reads the list of elements written first correctly, then fails throwing a StreamCorruptedException with the following stack trace :

java.io.StreamCorruptedException
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at ObjectStreamExample.readStudentInfo(ObjectStreamExample.java:40)
at ObjectStreamExample.main(ObjectStreamExample.java:72)

I am seeing this behavior in JDK 1.4 and 1.5. Is this a desired behavior? If so, does anyone know why? Is there a better workaround then rewriting the current contents each time you write?
17 years ago