Reviewers: jgw, Description: Forgetting a namespace prefix on a child elem of DockLayoutPanel causes an NPE, for example:
<g:DockLayoutPanel unit="PCT"> <west><g:HTMLPanel>foo</g:HTMLPanel></west> <east></east> </g:DockLayoutPanel> Unfortunately, even after the patch the error message is confusing. It says: "In <g:DockLayoutPanel unit='PCT'>, child must be one of {north, south, east, west, center}" The problem is that when you look at the XML, it seems like you've done exactly what's being asked for. The error message ought to someone account for the NS mismatch in how it explains the error. Please review this at http://gwt-code-reviews.appspot.com/91813 Affected files: user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java Index: user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java =================================================================== --- user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java (revision 6630) +++ user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java (working copy) @@ -98,8 +98,22 @@ } private boolean isValidChildElement(XMLElement parent, XMLElement child) { - return child.getNamespaceUri().equals(parent.getNamespaceUri()) - && DOCK_NAMES.containsKey(child.getLocalName()); + String childNsUri = child.getNamespaceUri(); + String parentNsUri = parent.getNamespaceUri(); + if (childNsUri == null && parentNsUri != null) { + return false; + } + if (childNsUri != null && parentNsUri == null) { + return false; + } + if (!childNsUri.equals(parentNsUri)) { + return false; + } + if (!DOCK_NAMES.containsKey(child.getLocalName())) { + return false; + } + // Made it through the gauntlet. + return true; } private boolean requiresSize(XMLElement elem) { --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---