Sometimes life as a software developer is almost too painful for me to bear. It’s ok to debug a piece of code for hours or to rack one’s brains over a problem instead of getting a good night’s rest; that’s part of the deal. What I can’t stand is solving a problem after hours and realizing that I had been barking up the wrong tree all the time.
While working on my first Sun SPOT project (blog posts on that are ahead) with Eclipse, the ANT editor all of a sudden reported an error on an XML build file: “content is not allowed in prolog”. While I was vaguely familiar with the meaning of it I could not see what was wrong with the XML file. For hours I searched the Internet, played around with my Eclipse preferences, and studied the first few lines of my build file. I loaded the file into the XML editor to confirm that it was valid indeed. I also loaded it into XmlSpy to double check. I did the right thing but missed to draw the right conclusions. As an XML document the file was ok, but as an ANT file it obviously wasn’t.
It was only after too many hours that I started stripping down the file, removing everything that wasn’t absolutely necessary. The error disappeared. So, I started removing individual lines to find the hot spot. When I stumbled upon an ANT <import> tag it finally dawned on me: the error was absolutely correct, but it simply referred to a different file. It was the imported file that couldn’t be parsed.
Yes, lesson learned. Indeed. I’ll never make that mistake again.