writetofile throwing null error

Hi,

I am trying to write a file using - ‘PSUtilities.file:writeToFile’ at some directory which has been specified in allowed write paths in PSUtilities config file. When I execute that service with filename , data and appendOverwriteFlag = failIfFileExists , it writes blank file at specified directory and throws error null if file does not exits where as throws correct error of ‘File already exists’ in other case.

Can someone help me with this , why its writing a 0kb file?

Thanks in advance.

appendOverwrite flag should be set to either “append” or “Overwrite”

The allowable values for appendOverwriteFlag are (case-sensitive)

append
overwrite
failIfFileExists

In reviewing the code, the obvious case where a NPE will be thrown is if userData is null. Verify that the userData variable you are passing to this service is not null.