Our application connects to a Lotus Domino server and works on its databases. Once we saw a corrupt database in one of our client’s server which could not be opened with the Lotus Notes client. Unfortunately the client’s staff have deleted it before we could ask a copy but we would like to test the error handling of the application with this kind of corrupt databases too.
We have also tried to modify some random bytes in a good database with a hex editor to make it corrupt without success. We’re looking for a way to create a corrupt database or a freely downloadable one.
IBM has not documented the detailed internal structure of the NSF file, so there’s really no good guide to simulating corrupted databases.
If you modify all the bytes to zero, however, that will surely give you a very corrupt database. It won’t be particularly useful to test your application’s behavior, and this most likely won’t be the same type of corruption that you saw on your client’s sever.
There are many ways an NSF could be corrupted. Some are automatically fixed by the server. Some will prevent the database from being opened. Some will allow you to open the database but prevent reads or updates from occurring. Some may cause data returned by API calls to be lost or mangled. Some will crash the Notes API core DLLs. I don’t really think it’s possible to test your code’s behavior for all possible types of corruption. Not in a reasonable number of test cases, anyhow. (I.e., I’m guessing about 1,000 cases of randomly zeroing out one of the individual non-zero bytes in a minimal-sized NSF would have a good probability of inflicting most of the different kinds of damage that are possible.)