ObserverService.addObserver fails with 1.9.x

Dzenno <[email protected]> Mon, 3 Nov 2008 11:46:06 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.java
Organization http://groups.google.com
Message-ID <506ae1ae-c96e-40af-bf13-ad16e4c97fdf@r15g2000prh.googlegroups.com>
Hi,
Trying to call addObserver fails at runtime now. This used to work
with 1.8.1.3. I put in an Observer instance so that I can get HTTP
header info and other HTTPChannel details.

Here is a snippet of code showing how I add an observer (this works no
problems with 1.8.1.3):

WebProgressListener listener = new WebProgressListener();
		HTTPHeaderObserver httpObserver = new HTTPHeaderObserver();
		try {
			// Creates a latch with count 1
			latch = new CountDownLatch(1);
			listener.setLatch(latch);
			webProgress.addProgressListener(listener,
					nsIWebProgress.NOTIFY_STATE_DOCUMENT);

			observerService.addObserver(httpObserver, "http-on-modify-request",
					false);  // PROBLEM IS AT THIS LINE, NATIVE ERROR COMING OUT OF
GECKO
			observerService.addObserver(httpObserver,
					"http-on-examine-response", false);
.......
} catch (Throwable t) {
} finally {
      observerService.removeObserver("http-on-modify-request");
      observerService.removeObserver("http-on-examine-response");
}

Here is my HTTPHeaderObserver class declaration snippet:

public class HTTPHeaderObserver implements nsIObserver {
....
}

I tried testing with the addObserver call that used a true flag
specified instead of false but then when I try to cleanup the observer
at the bottom (in the finally block) I get a different problem at that
line of code saying that I can't remove it.

Any ideas?