For your problem, it would help to know what the code is, when it getting called, and exactly where you're calling it from.
@George: thanks for the quick response!
My JS code contains a readFileIntoStream which I learnt is also to be run under privileged context. (still learning the ropes here.. ). I have been trying to incorporate the JS code directly into the PDF to get around this privileged context.. but I am unable to find a non-privileged equivalent for readFileIntoStream..
I hope I am clear..
From my PDF, I'm reading an external XML file that I pick up from a server share location. Based on the XML data, I am also reading another PDF, populating it with data from the XML and displaying the same to the user.. Hope this helps.