From 13d4058170e801b9fdfa2212214a550b1f040cb3 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Wed, 15 Jan 2003 15:01:30 +0000 Subject: [PATCH] Code cleanup, more IQ parsing support. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1782 b35dd754-fafc-0310-a699-88a17e54d16e --- .../org/jivesoftware/smack/PacketReader.java | 154 +++++++++++------- 1 file changed, 93 insertions(+), 61 deletions(-) diff --git a/source/org/jivesoftware/smack/PacketReader.java b/source/org/jivesoftware/smack/PacketReader.java index e8caece17..be6c0862c 100644 --- a/source/org/jivesoftware/smack/PacketReader.java +++ b/source/org/jivesoftware/smack/PacketReader.java @@ -55,6 +55,7 @@ package org.jivesoftware.smack; import org.xmlpull.v1.*; import java.util.*; import org.jivesoftware.smack.packet.*; +import org.jivesoftware.smack.packet.Error; import org.jivesoftware.smack.filter.PacketFilter; /** @@ -156,6 +157,9 @@ public class PacketReader { done = true; } + /** + * Process listeners. + */ private void processListeners() { boolean processedPacket = false; while (true) { @@ -236,6 +240,9 @@ public class PacketReader { * @param packet the packet to process. */ private void processPacket(Packet packet) { + if (packet == null) { + return; + } // Loop through all collectors and notify the appropriate ones. synchronized (collectors) { // Loop through packet collectors backwards. @@ -258,36 +265,26 @@ public class PacketReader { * @throws Exception if an exception occurs while parsing the packet. */ private static Packet parseIQ(XmlPullParser parser) throws Exception { - String id = null; - String to = null; - String from = null; - IQ.Type type = null; - // Parse attributes of the opening iq tag. - for (int i=0; i