Reviewers: Ray Ryan,


Please review this at http://gwt-code-reviews.appspot.com/88809

Affected files:
   user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java


Index: user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java
===================================================================
--- user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (revision  
6521)
+++ user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (working  
copy)
@@ -272,8 +272,17 @@
      this.messages = new MessagesWriter(BINDER_URI, logger, templatePath,
          baseClass.getPackage().getName(), this.implClassName);

-    JClassType uiBinderType = baseClass.getImplementedInterfaces()[0];
+    JClassType[] uiBinderTypes = baseClass.getImplementedInterfaces();
+    if (uiBinderTypes.length == 0) {
+      die("No implemented interfaces present on type %s",  
baseClass.getName());
+    }
+    JClassType uiBinderType = uiBinderTypes[0];
+
      JClassType[] typeArgs = uiBinderType.isParameterized().getTypeArgs();
+    if (typeArgs.length < 2) {
+      die("Root and owner type parameters are required for type %s",
+          uiBinderType.getName());
+    }
      uiRootType = typeArgs[0];
      uiOwnerType = typeArgs[1];

@@ -786,7 +795,11 @@
    private BundleAttributeParser createBundleParser(JClassType bundleClass,
        XMLAttribute attribute) throws UnableToCompleteException {

-    final String templateResourceName = attribute.getName().split(":")[0];
+    final String[] templateResourceNames = attribute.getName().split(":");
+    if (templateResourceNames.length == 0) {
+      die("No template resource");
+    }
+    final String templateResourceName = templateResourceNames[0];
      warn("The %1$s mechanism is deprecated. Instead, declare the  
following "
          + "%2$s:with element as a child of your %2$s:UiBinder element: "
          + "<%2$s:with field='%3$s' type='%4$s.%5$s' />", BUNDLE_URI_SCHEME,



--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to