aboutsummaryrefslogtreecommitdiff
path: root/asmack-master/patch/22-remove-beans.Property-deps.patch
blob: 8653716d9340caad3a1630ebaba57eca4af0e1e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- ../../src-unpatched/trunk/org/jivesoftware/smack/util/PacketParserUtils.java	2009-12-06 19:45:45.000000000 +0100
+++ org/jivesoftware/smack/util/PacketParserUtils.java	2009-12-06 19:48:13.000000000 +0100
@@ -25,7 +25,6 @@
 import org.jivesoftware.smack.provider.ProviderManager;
 import org.xmlpull.v1.XmlPullParser;
 
-import java.beans.PropertyDescriptor;
 import java.io.ByteArrayInputStream;
 import java.io.ObjectInputStream;
 import java.util.ArrayList;
@@ -828,14 +827,14 @@
             if (eventType == XmlPullParser.START_TAG) {
                 String name = parser.getName();
                 String stringValue = parser.nextText();
-                PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
-                // Load the class type of the property.
-                Class<?> propertyType = descriptor.getPropertyType();
+                Class propertyType = object.getClass().getMethod(
+                    "get" + Character.toUpperCase(name.charAt(0)) + name.substring(1)).getReturnType();
                 // Get the value of the property by converting it from a
                 // String to the correct object type.
                 Object value = decode(propertyType, stringValue);
                 // Set the value of the bean.
-                descriptor.getWriteMethod().invoke(object, value);
+                object.getClass().getMethod("set" + Character.toUpperCase(name.charAt(0)) + name.substring(1), propertyType)
+                .invoke(object, value);
             }
             else if (eventType == XmlPullParser.END_TAG) {
                 if (parser.getName().equals(elementName)) {