Helmut, that seems to be not a good idea.
When i try your code on a field with substituted attachment names, after execution the http server gets ill:
Exception
java.io.NotSerializableException: lotus.domino.local.EmbeddedObject
lotus.domino.local.EmbeddedObject
This occurs after that on ALL xpages, regardless if they are involved or not. I have to do a restart of the http-task.
On a field with original attachment names, there is no problem.