yugalatea / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

NullPointerException in Gadget UserPreferencesGenerator #211

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
gwt-gadgets-1.0.1

Detailed description:
In UserPreferencesGenerator if the user defined subclass doesn't define a
method returning an expected class or interface (eg. int, void, etc..),
offcourse this is a user mistake, the generator throws a
NullPointerException instead of a proper message.

The patch fix this problem.

Original issue reported on code.google.com by daniele.galdi@gmail.com on 14 Nov 2008 at 11:32

Attachments:

GoogleCodeExporter commented 9 years ago
I can see the problem in the code, but I can't actually reproduce it by 
creating a
preference method that returns 'int'.

Original comment by galgwt.reviews@gmail.com on 14 Nov 2008 at 12:39

GoogleCodeExporter commented 9 years ago
I had this problem when for my mistake I created an interface like this.

interface MyGadgetPreferences extends UserPreferences {

   StringPreference method1();

   // The wrong method
   void setPrefId();
}

Yes offcourse this class was wrong, but the UserPreferencesConverter didn't 
says to
me a correct message. The message was a NPE...that for me is wrong.

Original comment by daniele.galdi@gmail.com on 14 Nov 2008 at 1:28

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 11 Dec 2008 at 9:23

GoogleCodeExporter commented 9 years ago
public interface HelloPreferences extends UserPreferences {

  @PreferenceAttributes(display_name = "Barley", //
      default_value = "Hops", //
      options = Options.REQUIRED)
  StringPreference goodBrew();

  @PreferenceAttributes(display_name = "Bob", //
      default_value = "Doug", //
      options = Options.REQUIRED)
  void strangeBrew();

}

gives me the error:

Compiling module com.google.gwt.gadgets.sample.hellogadgets.HelloGadgets
Computing all possible rebind results for
'com.google.gwt.gadgets.sample.hellogadgets.client.HelloGadgets'
   Rebinding com.google.gwt.gadgets.sample.hellogadgets.client.HelloGadgets
      Invoking <generate-with class='com.google.gwt.gadgets.rebind.GadgetGenerator'/>
         Building gadget manifest
            Generating userpref element for method public abstract void strangeBrew()
               [ERROR] void is not assignable to
com.google.gwt.gadgets.client.UserPreferences.Preference
[ERROR] Build failed

which looks reasonable.  I'm using gwt-gadgets 1.0.1(plus a few unreleased 
patches) +
gwt 1.5.3

I'll go on and add protection around preference type anyway.

Original comment by galgwt.reviews@gmail.com on 8 Jan 2009 at 5:04

GoogleCodeExporter commented 9 years ago
 http://galgwt-reviews.appspot.com/2403

Original comment by galgwt.reviews@gmail.com on 8 Jan 2009 at 6:08

GoogleCodeExporter commented 9 years ago
Committed as r1163.

Original comment by galgwt.reviews@gmail.com on 9 Jan 2009 at 6:26

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 9 Jan 2009 at 6:26

GoogleCodeExporter commented 9 years ago
Released in gwt-gadgets-1.0.2

Original comment by galgwt.reviews@gmail.com on 21 Feb 2009 at 1:29

GoogleCodeExporter commented 9 years ago
Updating account names

Original comment by zundel@google.com on 21 Dec 2009 at 2:00