思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c
以下内容为反编译后的 JivePropertiesExtension.java 源代码,内容仅作参考
package org.jivesoftware.smackx.jiveproperties.packet;
import com.heytap.msp.push.mode.MessageStat;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smack.util.stringencoder.Base64;
public class JivePropertiesExtension implements ExtensionElement {
public static final String ELEMENT = "properties";
public static final Logger LOGGER = Logger.getLogger(JivePropertiesExtension.class.getName());
public static final String NAMESPACE = "http://www.jivesoftware.com/xmlns/xmpp/properties";
public final Map<String, Object> properties;
public JivePropertiesExtension() {
this.properties = new HashMap();
}
public static JivePropertiesExtension from(Message message) {
return (JivePropertiesExtension) message.getExtension(ELEMENT, NAMESPACE);
}
public synchronized void deleteProperty(String str) {
if (this.properties == null) {
return;
}
this.properties.remove(str);
}
@Override
public String getElementName() {
return ELEMENT;
}
@Override
public String getNamespace() {
return NAMESPACE;
}
public synchronized Map<String, Object> getProperties() {
if (this.properties == null) {
return Collections.emptyMap();
}
return Collections.unmodifiableMap(new HashMap(this.properties));
}
public synchronized Object getProperty(String str) {
if (this.properties == null) {
return null;
}
return this.properties.get(str);
}
public synchronized Collection<String> getPropertyNames() {
if (this.properties == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(new HashSet(this.properties.keySet()));
}
public synchronized void setProperty(String str, Object obj) {
if (obj instanceof Serializable) {
this.properties.put(str, obj);
} else {
throw new IllegalArgumentException("Value must be serializable");
}
}
@Override
public CharSequence toXML(String str) {
ObjectOutputStream objectOutputStream;
String str2;
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder((ExtensionElement) this);
xmlStringBuilder.rightAngleBracket();
for (String str3 : getPropertyNames()) {
Object property = getProperty(str3);
xmlStringBuilder.openElement(MessageStat.PROPERTY);
xmlStringBuilder.element("name", str3);
xmlStringBuilder.halfOpenElement("value");
String str4 = "java-object";
if (property instanceof Integer) {
str2 = Integer.toString(((Integer) property).intValue());
str4 = "integer";
} else if (property instanceof Long) {
str2 = Long.toString(((Long) property).longValue());
str4 = "long";
} else if (property instanceof Float) {
str2 = Float.toString(((Float) property).floatValue());
str4 = "float";
} else if (property instanceof Double) {
str2 = Double.toString(((Double) property).doubleValue());
str4 = "double";
} else if (property instanceof Boolean) {
str2 = Boolean.toString(((Boolean) property).booleanValue());
str4 = "boolean";
} else if (property instanceof String) {
str2 = (String) property;
str4 = o.h;
} else {
ByteArrayOutputStream byteArrayOutputStream = null;
try {
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
try {
objectOutputStream = new ObjectOutputStream(byteArrayOutputStream2);
try {
objectOutputStream.writeObject(property);
Base64.encodeToString(byteArrayOutputStream2.toByteArray());
try {
objectOutputStream.close();
} catch (Exception unused) {
}
byteArrayOutputStream2.close();
} catch (Exception e) {
e = e;
byteArrayOutputStream = byteArrayOutputStream2;
try {
LOGGER.log(Level.SEVERE, "Error encoding java object", (Throwable) e);
str2 = "Serializing error: " + e.getMessage();
if (objectOutputStream != null) {
try {
objectOutputStream.close();
} catch (Exception unused2) {
}
}
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (Exception unused3) {
}
}
xmlStringBuilder.attribute("type", str4);
xmlStringBuilder.rightAngleBracket();
xmlStringBuilder.escape(str2);
xmlStringBuilder.closeElement("value");
xmlStringBuilder.closeElement(MessageStat.PROPERTY);
} catch (Throwable th) {
th = th;
if (objectOutputStream != null) {
try {
objectOutputStream.close();
} catch (Exception unused4) {
}
}
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (Exception unused5) {
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
byteArrayOutputStream = byteArrayOutputStream2;
if (objectOutputStream != null) {
}
if (byteArrayOutputStream != null) {
}
throw th;
}
} catch (Exception e2) {
e = e2;
objectOutputStream = null;
} catch (Throwable th3) {
th = th3;
objectOutputStream = null;
}
} catch (Exception e3) {
e = e3;
objectOutputStream = null;
} catch (Throwable th4) {
th = th4;
objectOutputStream = null;
}
}
xmlStringBuilder.attribute("type", str4);
xmlStringBuilder.rightAngleBracket();
xmlStringBuilder.escape(str2);
xmlStringBuilder.closeElement("value");
xmlStringBuilder.closeElement(MessageStat.PROPERTY);
}
xmlStringBuilder.closeElement(this);
return xmlStringBuilder;
}
public JivePropertiesExtension(Map<String, Object> map) {
this.properties = map;
}
}