I have a bundle where I try to add a site to the trusted list of Java 1.7 update 51, through the use of an "Edit Text File" action.

In this action, I take the file "${UserProfile}\AppData\LocalLow\Sun\Java\Deployme nt\security\exception.sites", and search it for the desired site address (http://acesso.serpro.gov.br). If this string isn't found, I add it to the very start of the file.
If the file doesn't exists, I create it, using this site as the initial content of the file.

The problem is that after creating/editing the file, some garbage is being added, in a way that the result file doesn't get properly processed by java. And there's no way I can manage to make my string to get added to the very start of the file, it always is added just after the garbage.

Does anyone have seen this type of behaviour?