This is my weekly contribution to the "Stupid Developer of the Week" award. I spent the last hour or so trying to diagnose why my ANT script couldn't write to my file system. Apparently there is some Windows 7 bug where folders are marked Read Only and you can't clear it. So despite my ANT script's ability to make a folder I kept getting "Access is denied" errors when it tried to write into the folder. Here is the code I used.

<?xml version="1.0"?> <project name="test" default="getstuff" basedir=".">

<property name="url" value="http://www.raymondcamden.com" /> <property name="temp.dir" value="c:/temphttpdump/" />

<target name="getstuff"> <echo message="About to get ${url} and copy to ${temp.dir}" /> <mkdir dir="${temp.dir}" /> <attrib file="${temp.dir}" readonly="false" system="false" verbose="on" /> <get src="${url}" dest="${temp.dir}" httpusecaches="false" verbose="on" /> </target>

</project>

Spot the issue yet? My get task is being told to save the result of my http get operation to a folder. But I didn't tell it the file to use! And because of this, the task assumed I wanted a file named temphttpdump since people often name files without extensions. To fix it I simply added a file name:

<get src="${url}" dest="${temp.dir}/result.html" httpusecaches="false" verbose="on" />

In my own defense, "Access is denied" as a message has a much different meaning to most folks. Why couldn't it have said "File exists and I can't overwrite" instead? I would have recognized it was trying to save it as a file and saved an hour of my life.