Revision: 4168
Author: [email protected]
Date: Thu Jul 8 15:50:35 2010
Log: Handle DOMImplementationRegistry returning null.
http://codereview.appspot.com/1763041
DOMImplementationRegistry.getDOMImplementation is documented to return null
if no implementation is available; handle that case with an explicit error
rather than continuing until NullPointerException.
Also standardize formatting of the related nearby code.
[email protected]
http://code.google.com/p/google-caja/source/detail?r=4168
Modified:
/trunk/src/com/google/caja/parser/html/DomParser.java
=======================================
--- /trunk/src/com/google/caja/parser/html/DomParser.java Wed Jun 9
16:29:50 2010
+++ /trunk/src/com/google/caja/parser/html/DomParser.java Thu Jul 8
15:50:35 2010
@@ -160,13 +160,18 @@
.getDOMImplementation(features);
} catch (ClassNotFoundException ex) {
throw new SomethingWidgyHappenedError(
- "Missing DOM implementation. Is Xerces on the classpath?",
ex);
+ "Missing DOM implementation. Is Xerces on the classpath?",
ex);
} catch (IllegalAccessException ex) {
- throw new SomethingWidgyHappenedError(
- "Missing DOM implementation. Is Xerces on the classpath?",
ex);
+ throw new SomethingWidgyHappenedError(
+ "Missing DOM implementation. Is Xerces on the classpath?",
ex);
} catch (InstantiationException ex) {
- throw new SomethingWidgyHappenedError(
- "Missing DOM implementation. Is Xerces on the classpath?",
ex);
+ throw new SomethingWidgyHappenedError(
+ "Missing DOM implementation. Is Xerces on the classpath?",
ex);
+ }
+ if (domImpl == null) {
+ throw new SomethingWidgyHappenedError(
+ "Missing DOM implementation. Is Xerces on the classpath? " +
+ "(DOMImplementationRegistry.getDOMImplementation returned
null.)");
}
}