[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

File writing error in Cluster.saveShadow



Hi!

There is an error in org.ozoneDB.core.wizardStore.Cluster.saveShadow().

The code is:

         int c = 0;
            do {
                c = in.read( chunk );
                out.write( chunk, 0, c );
            } while (c == chunkSize);

If the input file has a length that is dividable by 1024,
c will be -1 when the last chunk has been read; out.write will
then throw an IOException.
Solution:

         int c = 0;
            do {
                c = in.read( chunk );
		if (c > 0)
	                out.write( chunk, 0, c );
            } while (c == chunkSize);

Michael Keuchen