]> source.dussan.org Git - vaadin-framework.git/commitdiff
Additional fix for #695 - Serialization support: Fixed NPE in MethodProperty
authorArtur Signell <artur.signell@itmill.com>
Fri, 17 Apr 2009 11:08:52 +0000 (11:08 +0000)
committerArtur Signell <artur.signell@itmill.com>
Fri, 17 Apr 2009 11:08:52 +0000 (11:08 +0000)
svn changeset:7457/svn branch:6.0

src/com/itmill/toolkit/data/util/MethodProperty.java

index 9d74175b2cfdd9c0da26881e19d74f05f0ee5733..e8f220be791352d3d347d23de961192e623c72ec 100644 (file)
@@ -98,10 +98,20 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
         out.writeObject(instance);
         out.writeObject(setArgs);
         out.writeObject(getArgs);
-        out.writeObject(setMethod.getName());
-        out.writeObject(setMethod.getParameterTypes());
-        out.writeObject(getMethod.getName());
-        out.writeObject(getMethod.getParameterTypes());
+        if (setMethod != null) {
+            out.writeObject(setMethod.getName());
+            out.writeObject(setMethod.getParameterTypes());
+        } else {
+            out.writeObject("");
+            out.writeObject("");
+        }
+        if (getMethod != null) {
+            out.writeObject(getMethod.getName());
+            out.writeObject(getMethod.getParameterTypes());
+        } else {
+            out.writeObject("");
+            out.writeObject("");
+        }
     };
 
     /* Special serialization to handle method references */
@@ -114,10 +124,18 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
             getArgs = (Object[]) in.readObject();
             String name = (String) in.readObject();
             Class<?>[] paramTypes = (Class<?>[]) in.readObject();
-            setMethod = instance.getClass().getMethod(name, paramTypes);
+            if (name != null && !name.equals("")) {
+                setMethod = instance.getClass().getMethod(name, paramTypes);
+            } else {
+                setMethod = null;
+            }
             name = (String) in.readObject();
             paramTypes = (Class<?>[]) in.readObject();
-            getMethod = instance.getClass().getMethod(name, paramTypes);
+            if (name != null && !name.equals("")) {
+                getMethod = instance.getClass().getMethod(name, paramTypes);
+            } else {
+                getMethod = null;
+            }
         } catch (SecurityException e) {
             System.err.println("Internal deserialization error");
             e.printStackTrace();