1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-16 12:12:06 +01:00

Fix security exception when running in an applet. SMACK-119

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3348 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-01-23 22:02:07 +00:00 committed by gato
parent 9b70d45644
commit 4964786ec9

View file

@ -26,16 +26,15 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter; import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URL; import java.net.URL;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -526,19 +525,40 @@ public class VCard extends IQ {
private void copyFieldsFrom(VCard result) { private void copyFieldsFrom(VCard result) {
if (result == null) result = new VCard(); if (result == null) result = new VCard();
Field[] fields = VCard.class.getDeclaredFields(); homeAddr = result.homeAddr;
for (int i = 0; i < fields.length; i++) { homePhones = result.homePhones;
Field field = fields[i];
if (field.getDeclaringClass() == VCard.class && workAddr = result.workAddr;
!Modifier.isFinal(field.getModifiers())) { workPhones = result.workPhones;
try {
field.setAccessible(true); firstName = result.firstName;
field.set(this, field.get(result)); lastName = result.lastName;
} middleName = result.middleName;
catch (IllegalAccessException e) {
throw new RuntimeException("This cannot happen:" + field, e); emailHome = result.emailHome;
} emailWork = result.emailWork;
organization = result.organization;
organizationUnit = result.organizationUnit;
otherSimpleFields = result.otherSimpleFields;
avatar = result.avatar;
setType(result.getType());
setError(result.getError());
setFrom(result.getFrom());
setTo(result.getTo());
setPacketID(result.getPacketID());
Iterator iterator = result.getExtensions();
while (iterator.hasNext()) {
addExtension((PacketExtension) iterator.next());
} }
iterator = result.getPropertyNames();
while(iterator.hasNext()) {
String key = (String) iterator.next();
setProperty(key, result.getProperty(key));
} }
} }