Hi

Is there any rationale behind GadgetException extending Excepiton and thus
not being able to encapsulate runtime exceptions like NullPointerException
(checked vs unchecked exception) ?
Would it make sense for it to do so ? I am running into some cases where
NullPointerException is throws all the way up to the stack and I was
wondering if i could just make GadgetException catch these.
For example, caja html parser sometimes throws NullPointerExceptions when
the dom is being parsed in GadgetHtmlParser, where i plan on adding the
lines in blue:
if (document == null) { try { document = parseDomImpl(source); } catch
(GadgetException e) { throw e; } catch (DOMException e) { // DOMException is
a RuntimeException document = errorDom(e); HtmlSerialization.attach(document,
serializerProvider.get(), source); return document; + } catch
(NullPointerException e) { + throw new
GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, + "Caught
exception in parseDomImpl", e); }

Thoughts ?

Thanks
Gagan

Reply via email to