Revision: 6643 Author: br...@google.com Date: Wed Nov 4 08:40:20 2009 Log: 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. http://code.google.com/p/google-web-toolkit/source/detail?r=6643 Modified: /trunk/user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java ======================================= --- /trunk/user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java Tue Nov 3 14:14:13 2009 +++ /trunk/user/src/com/google/gwt/uibinder/parsers/DockLayoutPanelParser.java Wed Nov 4 08:40:20 2009 @@ -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 -~----------~----~----~----~------~----~------~--~---