Gotcha: JUnit tests fail on Eclipse with a mysterious Xerces error

I had a strange problem occurring with some JUnit tests

java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredElementImpl.getTextContent()Ljava/lang/String;
at com.whirlycott.cache.CacheManager.configure(Unknown Source)
at com.whirlycott.cache.CacheManager.(Unknown Source)
at com.whirlycott.cache.CacheManager.(Unknown Source)

Turns out that if you have Commons Configuration specified in your Maven POM, you’ll get this error. You need to specify this in pom.xml:

</dependency> <strong style="display:none"><a href="">augmentation implants breast gummy bear</a></strong>

… and specify xercesImpl 2.6.2 as a dependency. Things will work again.

MSIE hangs when trying to load .jpg images

Bea recently started getting complaints from her blog readers that they couldn’t see the images on her site. I thought that it was strange that neither of us would have noticed this, but sure enough, they were right. The problem was infuriatingly difficult to debug, so I figured that I would post my fix here. But I was lucky: I wasted an entire weekend on this exact problem about 3 years ago, so I had a sense of what I was looking for after I remembered the details.

The symptom is this: MSIE on Windows stops loading graphics. Everything else loads fine, but the graphics just refused to load. You can sniff packets, look at HTTP headers and everything will be normal. But broken at the same time.
Basically, certain applications on the Mac platform (like Photoshop) put large quantities of XML into the header of .jpg images. The XML looks like this:

<plist version="1.0">

Whenever MSIE encounters one of these large XML chunks in a jpg, all images from then on will not load until the browser is restarted. So it’s like a tripwire: once you set it off, everything breaks.

The fix? Well, I used a few lines of perl and some netpbm utilities. Make a file with all of the offending images and feed it to this script:

#!/usr/bin/perl -w
use strict;
open (F, "/tmp/bad-images.txt");
while () {
my $file = $_;
print $file, "n";
$file =~ s/(/(/g;
$file =~ s/)/)/g;
$file =~ s/ / /g;
my $command = "cp $file /tmp/ &#038;&#038; anytopnm $file | pnmtojpeg > $file.2 &#038;&#038; mv $file.2 $file";

If you’re going to have any luck with this, you’ll probably be running on some kind of Unix server with netpbm installed.

There’s some more info on this article.

StyleFeeder in the Boston Globe

StyleFeeder is featured on the front page of the Boston Globe’s business section today. If you’re not a lover of dead trees, maybe you prefer the online version? My favorite part is in the little sidebar section entitled “Room to grow” where it shows the funding amounts of some other companies doing similar-ish things to StyleFeeder:

Launched in June
Funding: $40 from founder Philip Jacob

Is that a real number? Actually, yes. I spent $10 on the domain name via my OpenSRS account, a few bucks for the graphic of the woman shopper in the header and some other stock photos that I didn’t use, and perhaps another thing or two that I don’t even remember. StyleFeeder initially was hosted on one of my own servers which cost me $0 more than I normally pay. Obviously, the real cost was my time, but the cash expenses were tiny.

StyleFeeder Party 7:00PM Thursday, July 6th

If you’re in Harvard Square tomorrow night, drop by the Top 10 Sources offices 66 Church Street at 7pm for a bit of fun, food and… StyleFeeder 🙂 Post a comment or drop me an email if you are planning on joining us so we can make sure that there’s enough to eat. Everyone’s welcome!