diff --git a/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java index 5b7913cf6..6530d00bd 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java +++ b/core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java @@ -16,7 +16,6 @@ */ package org.jivesoftware.smack.util; -import java.beans.PropertyDescriptor; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; @@ -832,14 +831,15 @@ public class PacketParserUtils { 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)) {