Story #956: Fix problems with Metacat 0.5 implementation
A newline is removed from Sci metadata on GET operation
We found a one byte discrepancy in GET operations on created objects. We verified that the file created on the filesystem contains a newline as the last character. When we GET the file, the newline is chopped somehow by Metacat
#6 Updated by Chad Berkley over 11 years ago
After thinking I had fixed this, I ran into it again. There seems to be a problem with FileOutputStream not writing the last byte of a String (or of an OutputStream) to disk when that last byte is a white space char. The only way I could find to fix this was to append a second newline onto the end of the written text if I found that it ended with one in the first place. I tried many different ways of writing this to disk, including FileWriter, FileOutputStream and IOUtils.copy and they all trimmed the trailing newline. Not sure what's going on there. The fix is a hack, but it works for now. If anyone has any ideas as to what's going on, let me know. The fix is in DocumentImpl.writeToFileSystem().