Project

General

Profile

« Previous | Next » 

Revision 7a1fcbeb

Added by Leszek Koltunski over 4 years ago

fix a bug: in certain places when we use reflection, it needs to be getDeclaredMethod and not getMethod because the methods are not public!

View differences:

src/main/java/org/distorted/library/effect/Effect.java
40 40
  private final int mRegionDim;
41 41
  private final int mCenterDim;
42 42

  
43
  ArrayList<EffectListener> mListeners =null;
44
  int mNumListeners=0;  // ==mListeners.length(), but we only create mListeners if the first one gets added
43
  private ArrayList<EffectListener> mListeners =null;
44
  private int mNumListeners=0;  // ==mListeners.length(), but we only create mListeners if the first one gets added
45 45

  
46 46
  private static long mNextID = 0;
47 47

  
......
172 172
 */
173 173
  public static void enableEffects(EffectType type)
174 174
    {
175
    Method method=null;
175
    Method method;
176 176

  
177 177
    for(EffectName name: EffectName.values())
178 178
      {
......
182 182

  
183 183
        try
184 184
          {
185
          method = cls.getMethod("enable");
185
          method = cls.getMethod("enable");  // getMethod and NOT getDeclaredMethod because enable()
186
                                             // is public
186 187
          }
187 188
        catch(NoSuchMethodException ex)
188 189
          {
189 190
          android.util.Log.e("Effect", "exception getting method: "+ex.getMessage());
191
          method = null;
190 192
          }
191 193

  
192 194
        try
193 195
          {
194
          method.invoke(null);
196
          if( method!=null ) method.invoke(null);
195 197
          }
196 198
        catch(Exception ex)
197 199
          {

Also available in: Unified diff