diff options
Diffstat (limited to 'src/com/isode')
-rw-r--r-- | src/com/isode/stroke/elements/DiscoInfo.java | 14 | ||||
-rw-r--r-- | src/com/isode/stroke/parser/tree/NullParserElement.java | 2 | ||||
-rw-r--r-- | src/com/isode/stroke/queries/IQRouter.java | 1 | ||||
-rw-r--r-- | src/com/isode/stroke/serializer/xml/XMLElement.java | 16 | ||||
-rw-r--r-- | src/com/isode/stroke/streamstack/XMPPLayer.java | 27 | ||||
-rw-r--r-- | src/com/isode/stroke/stringcodecs/Hexify.java | 2 |
6 files changed, 29 insertions, 33 deletions
diff --git a/src/com/isode/stroke/elements/DiscoInfo.java b/src/com/isode/stroke/elements/DiscoInfo.java index d7ff8e8..4ef1537 100644 --- a/src/com/isode/stroke/elements/DiscoInfo.java +++ b/src/com/isode/stroke/elements/DiscoInfo.java @@ -16,7 +16,11 @@ import java.util.List; * disco#info from XEP-0030. */ public class DiscoInfo extends Payload { - + private String node_ = ""; + private final List<Identity> identities_ = new ArrayList<Identity>(); + private final List<String> features_ = new ArrayList<String>(); + private final List<Form> extensions_ = new ArrayList<Form>(); + public static final String ChatStatesFeature = "http://jabber.org/protocol/chatstates"; public static final String SecurityLabelsFeature = "urn:xmpp:sec-label:0"; public static final String SecurityLabelsCatalogFeature = "urn:xmpp:sec-label:catalog:2"; @@ -148,9 +152,6 @@ public class DiscoInfo extends Payload { } - public DiscoInfo() { - } - /** * * @return Node, notnull. @@ -222,8 +223,5 @@ public class DiscoInfo extends Payload { public List<Form> getExtensions() { return new ArrayList(extensions_); } - private String node_ = ""; - private final List<Identity> identities_ = new ArrayList<Identity>(); - private final List<String> features_ = new ArrayList<String>(); - private final List<Form> extensions_ = new ArrayList<Form>(); + } diff --git a/src/com/isode/stroke/parser/tree/NullParserElement.java b/src/com/isode/stroke/parser/tree/NullParserElement.java index 83f8b6f..b5270c0 100644 --- a/src/com/isode/stroke/parser/tree/NullParserElement.java +++ b/src/com/isode/stroke/parser/tree/NullParserElement.java @@ -25,5 +25,5 @@ public class NullParserElement extends ParserElement{ /** * Empty/Null Parser element */ - public static NullParserElement element = new NullParserElement(); + public static final NullParserElement element = new NullParserElement(); } diff --git a/src/com/isode/stroke/queries/IQRouter.java b/src/com/isode/stroke/queries/IQRouter.java index 61c2221..bb4dafa 100644 --- a/src/com/isode/stroke/queries/IQRouter.java +++ b/src/com/isode/stroke/queries/IQRouter.java @@ -29,7 +29,6 @@ public class IQRouter { public IQRouter(IQChannel channel) { channel_ = channel; - final IQRouter thisObject = this; channel_.onIQReceived.connect(new Slot1<IQ>() { public void call(IQ p1) { diff --git a/src/com/isode/stroke/serializer/xml/XMLElement.java b/src/com/isode/stroke/serializer/xml/XMLElement.java index 9512c85..6a51d3f 100644 --- a/src/com/isode/stroke/serializer/xml/XMLElement.java +++ b/src/com/isode/stroke/serializer/xml/XMLElement.java @@ -37,22 +37,22 @@ public class XMLElement implements XMLNode { } public String serialize() { - String result = ""; - result += "<" + tag_; + StringBuilder result = new StringBuilder(); + result.append("<").append(tag_); for (String key : attributes_.keySet()) { - result += " " + key + "=\"" + attributes_.get(key) + "\""; + result.append(" ").append(key).append("=\"").append(attributes_.get(key)).append("\""); } if (childNodes_.size() > 0) { - result += ">"; + result.append(">"); for (XMLNode node : childNodes_) { - result += node.serialize(); + result.append(node.serialize()); } - result += "</" + tag_ + ">"; + result.append("</").append(tag_).append(">"); } else { - result += "/>"; + result.append("/>"); } - return result; + return result.toString(); } public void setAttribute(String attribute, String value) { diff --git a/src/com/isode/stroke/streamstack/XMPPLayer.java b/src/com/isode/stroke/streamstack/XMPPLayer.java index 8163998..34c25b5 100644 --- a/src/com/isode/stroke/streamstack/XMPPLayer.java +++ b/src/com/isode/stroke/streamstack/XMPPLayer.java @@ -29,7 +29,20 @@ import com.isode.stroke.signals.Signal1; * XML parsing being multi-threaded here. */ public class XMPPLayer implements HighLayer, XMPPParserClient { + public final Signal1<ProtocolHeader> onStreamStart = new Signal1<ProtocolHeader>(); + public final Signal1<Element> onElement = new Signal1<Element>(); + public final Signal1<ByteArray> onWriteData = new Signal1<ByteArray>(); + public final Signal1<ByteArray> onDataRead = new Signal1<ByteArray>(); + public final Signal onError = new Signal(); + private PayloadParserFactoryCollection payloadParserFactories_; + private XMPPParser xmppParser_; + private PayloadSerializerCollection payloadSerializers_; + private XMPPSerializer xmppSerializer_; + private boolean resetParserAfterParse_; + private boolean inParser_; + + public XMPPLayer( PayloadParserFactoryCollection payloadParserFactories, PayloadSerializerCollection payloadSerializers, @@ -80,12 +93,6 @@ public class XMPPLayer implements HighLayer, XMPPParserClient { writeDataToChildLayer(data); } - public final Signal1<ProtocolHeader> onStreamStart = new Signal1<ProtocolHeader>(); - public final Signal1<Element> onElement = new Signal1<Element>(); - public final Signal1<ByteArray> onWriteData = new Signal1<ByteArray>(); - public final Signal1<ByteArray> onDataRead = new Signal1<ByteArray>(); - public final Signal onError = new Signal(); - public void handleStreamStart(ProtocolHeader header) { onStreamStart.emit(header); } @@ -102,14 +109,6 @@ public class XMPPLayer implements HighLayer, XMPPParserClient { resetParserAfterParse_ = false; } - private PayloadParserFactoryCollection payloadParserFactories_; - private XMPPParser xmppParser_; - private PayloadSerializerCollection payloadSerializers_; - private XMPPSerializer xmppSerializer_; - private boolean resetParserAfterParse_; - private boolean inParser_; - private EventLoop eventLoop_; - /* Multiple-inheritance workarounds */ private StreamLayer fakeStreamLayer_ = new StreamLayer() { diff --git a/src/com/isode/stroke/stringcodecs/Hexify.java b/src/com/isode/stroke/stringcodecs/Hexify.java index 52facb4..d3d3882 100644 --- a/src/com/isode/stroke/stringcodecs/Hexify.java +++ b/src/com/isode/stroke/stringcodecs/Hexify.java @@ -13,7 +13,7 @@ import com.isode.stroke.base.ByteArray; public class Hexify { public static String hexify(byte datum) { - return String.format("%02x", new Byte(datum)); + return String.format("%02x", Byte.valueOf(datum)); } public static String hexify(ByteArray data) { |