Image

XMLDecoder problem

I have the following code in my servlet:

<br /> InputStream inp = rs.getBinaryStream("cells");<br /> <br /> try{<br />// BufferedReader reader = new BufferedReader(new InputStreamReader(inp));<br />// while (reader.ready()) System.err.println(reader.readLine());<br /> XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(inp));<br /><br /> CellBean[][] cells = (CellBean[][]) decoder.readObject();<br /> grid.setCells(cells); <br /> decoder.close();<br /> }<br /> catch(Exception ex){<br /> // do smth<br /> }<br />

First time i call servlet, decoder.readObject() returns null. Next calls successfully return an array of CellBeans. When i tried to uncomment the lines with reader, it returned me xml for my array, so I'm sure the problem is in XMLDecoder. What the hell is going on with it?