users@jaxb.java.net

Unable to catch JAXBException

From: Rahel Luethy <rahel.luethy_at_gmx.net>
Date: Tue, 13 May 2003 18:58:48 +0200

hey there

we're using JAXB in a project deployed with java webstart. recently, we
forgot to set the permissions correctly (JAXB didn't have permission to access
bgm.ser) which unveiled the problem that JAXB does not properly throw a
JAXBException upon "missing" bgm.ser, but instead itself prints the stack trace of
the exception to System.err. (which is not what we want --> a nice message to
the user as a consequence of the caught exception would be preferred ;-))

the error(?) can be reproduced by just deleting the file "bgm.ser" and
invoking a code snippet similar to this one:

try
{
  JAXBContext context = JAXBContext.newInstance("test.jaxb.demo");
  Unmarshaller unmarshaller = context.createUnmarshaller();
  unmarshaller.setValidating(true);
  unmarshaller.unmarshal(new InputSource("xml/demo.xml"));
}
catch (JAXBException jaxbe)
{
  //will never be reached when bgm.ser is missing
  System.err.println("Caught JAXBException: " + jaxbe.getMessage()); }

am i getting something wrong?

thanks in advance!
cu: rahel

--
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte l?cheln! Fotogalerie online mit GMX ohne eigene Homepage!