Posts

Showing posts from January, 2008

SAXParseException: -1:-1: Premature End Of File - Misleading error

Today I had to look at a piece of code a colleague had written, using my XPathAccessor class. She used it in a servlet which gets XML formatted requests. As those are generated by an external 3rd party tool we agreed on some XML schema definitions. Everything they send us needs to conform to its corresponding schema, each reply we send gets validated against a different set.In order to allow independent testing on either side, we provided a little test kit that allows testing our system without having to set up a servlet engine. Basically it just takes a file, reads it into a String and hands that to the handler.First it gets parsed without validation. This is necessary to find out which type of request we were send (the address is the same for all of them). After the root element is known, it will be read again, this time using the right schema to verify the request.Once that is done, some reply is put together and sent back to the client. So far, so good.When I looked at the code I …

Can't start server: Bind on TCP/IP port: No such file or directory (some progress)

Back in October last year I wrote about a peculiar MySQL error message: Can't start server: Bind on TCP/IP port: No such file or directoryThis error only seems to occur on Windows (Server 2003 in this case). While the first part is clear - a port could not be bound, because it was already occupied by another process - the second part does not make any sense.We got in contact about this with MySQL support recently, because we came across the problem again on a machine that had received the "treatment" described in the earlier article which did not seem to work. Turned out that server had not been rebooted ever since, so the registry change was never activated.However as a nice side-effect we now know (almost for sure) what that strange "No such file or directory" is all about: see MySQL Bug #33137. It has been categorized as a feature request - I doubt it will get any serious attention soon. So I will just summarize here to have it all in one place.Apparently wh…

Preload-mania killing aging machines

Over the holidays a friend of mine asked me to have a look at his machine, because it was extremely slow and barely responding at all anymore. When he tried to print a few documents it took more than 10 minutes for the first page to come out of the printer after the job had been started.First I suspected a hardware problem, but when I booted it up I quickly realized that this was a bad case of "freeware congestion" combined with "pre-load-mania". When I had last set up the machine I had just put F-Secure Anti-virus, the necessary hardware drivers, Word and Firefox on the machine.Hardware-wise a Celeron 2,4GHz with 512MB RAM is not exactly a high-end machine, but for web surfing, some emails and the occasional letter it should be very sufficient.Now, about a year and a half later the login screen was followed by a desktop building up icon-wise and a colorful ICQ login even before the anti-virus software's splash screen. After that the hard drive kept working fur…

Switch/Case and Autoboxing/Autounboxing

Because I have seen people trying this several times in the last couple weeks I decided I might just as well write a post about it: A seemingly common misconception of Java 5's auto(un)boxing.While it has been a while now since we moved to Java 5 only now are people slowly getting familiar with the new syntax features. Most of them learned Java beginning with 1.4 and have a history in the DBase or FoxPro world. So object oriented programming and Java as one implementation of it are understood, however maybe not as deeply as you would expect. Some are especially impressed by the ease of use autoboxing and -unboxing bring to the wrapper classes for primitives. I also find that feature quite useful, because objects falling out of the persistence framework have full-blown object types for boolean values or numbers. This makes it rather cumbersome to work with them. Autounboxing helps a lot there: if (theBusinessObject.isCompleted().booleanValue() && theBusinessObject.getNumbe…