I have an application that sends an object over MQ. If for some reason this object isn't sent, I need to have it written to a local file after it's been encrypted. When I don't encrypt the object and wrap an ObjectOutputStream around a FileOutputStream, it works great. If I try to wrap an ObjectOutputStream around a CipherOutputStream which wraps a FileOutputStream, the FileOutputStream is created, the CipherOutputStream is created, and then it just fails. No exceptions are thrown, no error messages of any kind, it just fails to create the ObjectOutputStream wrapping the CipherOutputStream. I've searched Sun's bug database and done a Google search, but can't find any mention of this problem. If it makes a difference, I'm limited to 1.4.2_11, upgrading is not an option at this time.
It prints the fileoutputstream message, prints the outputstream message, does not print the null message, and does not print the objectoutputstream message. The catch block not only displays an error, it sends an email also, neither of which is occurring.
posted 13 years ago
Found the problem. Turns out the Cipher used to initialize the CipherOutputStream was null due to a local variable masking the class variable holding the Cipher. I hate debugging code I didn't write.
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop