Cleanup of IQ parsing.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2008 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-08-04 21:58:31 +00:00 committed by mtucker
parent a63fb745c0
commit 8ed06a4f06
1 changed files with 7 additions and 10 deletions

View File

@ -347,7 +347,6 @@ class PacketReader {
String from = parser.getAttributeValue("", "from");
IQ.Type type = IQ.Type.fromString(parser.getAttributeValue("", "type"));
XMPPError error = null;
Map properties = null;
boolean done = false;
while (!done) {
@ -391,21 +390,19 @@ class PacketReader {
}
// Set basic values on the iq packet.
if (iqPacket == null) {
iqPacket = new IQ();
// If an IQ packet wasn't created above, create an empty IQ packet.
iqPacket = new IQ() {
public String getChildElementXML() {
return null;
}
};
}
iqPacket.setPacketID(id);
iqPacket.setTo(to);
iqPacket.setFrom(from);
iqPacket.setType(type);
iqPacket.setError(error);
// Set packet properties.
if (properties != null) {
for (Iterator i=properties.keySet().iterator(); i.hasNext(); ) {
String name = (String)i.next();
iqPacket.setProperty(name, properties.get(name));
}
}
// Return the packet.
return iqPacket;
}