Commit 9f4bc5ad authored by guus's avatar guus

OF-607: prevent the resource-intensive JID constructor from being used when...

OF-607: prevent the resource-intensive JID constructor from being used when serializing cluster objects.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13425 b35dd754-fafc-0310-a699-88a17e54d16e
parent 31fefac2
...@@ -53,10 +53,10 @@ public class NotifyComponentRegistered implements ClusterTask { ...@@ -53,10 +53,10 @@ public class NotifyComponentRegistered implements ClusterTask {
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, componentJID.toString()); ExternalizableUtil.getInstance().writeSerializable(out, componentJID);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
componentJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); componentJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
} }
...@@ -55,10 +55,10 @@ public class NotifyComponentUnregistered implements ClusterTask { ...@@ -55,10 +55,10 @@ public class NotifyComponentUnregistered implements ClusterTask {
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, componentJID.toString()); ExternalizableUtil.getInstance().writeSerializable(out, componentJID);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
componentJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); componentJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
} }
...@@ -96,13 +96,13 @@ public class DirectedPresence implements Externalizable { ...@@ -96,13 +96,13 @@ public class DirectedPresence implements Externalizable {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeByteArray(out, nodeID); ExternalizableUtil.getInstance().writeByteArray(out, nodeID);
ExternalizableUtil.getInstance().writeSafeUTF(out, handler.toString()); ExternalizableUtil.getInstance().writeSerializable(out, handler);
ExternalizableUtil.getInstance().writeStrings(out, receivers); ExternalizableUtil.getInstance().writeStrings(out, receivers);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
nodeID = ExternalizableUtil.getInstance().readByteArray(in); nodeID = ExternalizableUtil.getInstance().readByteArray(in);
handler = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); handler = (JID) ExternalizableUtil.getInstance().readSerializable(in);
ExternalizableUtil.getInstance().readStrings(in, receivers); ExternalizableUtil.getInstance().readStrings(in, receivers);
} }
} }
...@@ -77,14 +77,14 @@ public class AddMember extends MUCRoomTask { ...@@ -77,14 +77,14 @@ public class AddMember extends MUCRoomTask {
@Override @Override
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, bareJID.toFullJID()); ExternalizableUtil.getInstance().writeSerializable(out, bareJID);
ExternalizableUtil.getInstance().writeSafeUTF(out, nickname); ExternalizableUtil.getInstance().writeSafeUTF(out, nickname);
} }
@Override @Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
bareJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); bareJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
nickname = ExternalizableUtil.getInstance().readSafeUTF(in); nickname = ExternalizableUtil.getInstance().readSafeUTF(in);
} }
} }
...@@ -80,7 +80,7 @@ public class DestroyRoomRequest extends MUCRoomTask { ...@@ -80,7 +80,7 @@ public class DestroyRoomRequest extends MUCRoomTask {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeBoolean(out, alternateJID != null); ExternalizableUtil.getInstance().writeBoolean(out, alternateJID != null);
if (alternateJID != null) { if (alternateJID != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, alternateJID.toFullJID()); ExternalizableUtil.getInstance().writeSerializable(out, alternateJID);
} }
ExternalizableUtil.getInstance().writeBoolean(out, reason != null); ExternalizableUtil.getInstance().writeBoolean(out, reason != null);
if (reason != null) { if (reason != null) {
...@@ -92,7 +92,7 @@ public class DestroyRoomRequest extends MUCRoomTask { ...@@ -92,7 +92,7 @@ public class DestroyRoomRequest extends MUCRoomTask {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
alternateJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); alternateJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
reason = ExternalizableUtil.getInstance().readSafeUTF(in); reason = ExternalizableUtil.getInstance().readSafeUTF(in);
......
...@@ -279,14 +279,14 @@ public class PrivacyList implements Cacheable, Externalizable { ...@@ -279,14 +279,14 @@ public class PrivacyList implements Cacheable, Externalizable {
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, userJID.toString()); ExternalizableUtil.getInstance().writeSerializable(out, userJID);
ExternalizableUtil.getInstance().writeSafeUTF(out, name); ExternalizableUtil.getInstance().writeSafeUTF(out, name);
ExternalizableUtil.getInstance().writeBoolean(out, isDefault); ExternalizableUtil.getInstance().writeBoolean(out, isDefault);
ExternalizableUtil.getInstance().writeSafeUTF(out, asElement().asXML()); ExternalizableUtil.getInstance().writeSafeUTF(out, asElement().asXML());
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
userJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); userJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
name = ExternalizableUtil.getInstance().readSafeUTF(in); name = ExternalizableUtil.getInstance().readSafeUTF(in);
isDefault = ExternalizableUtil.getInstance().readBoolean(in); isDefault = ExternalizableUtil.getInstance().readBoolean(in);
String xml = ExternalizableUtil.getInstance().readSafeUTF(in); String xml = ExternalizableUtil.getInstance().readSafeUTF(in);
......
...@@ -57,7 +57,7 @@ public class AffiliationTask extends NodeTask ...@@ -57,7 +57,7 @@ public class AffiliationTask extends NodeTask
public void writeExternal(ObjectOutput out) throws IOException public void writeExternal(ObjectOutput out) throws IOException
{ {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, jid.toString()); ExternalizableUtil.getInstance().writeSerializable(out, jid);
ExternalizableUtil.getInstance().writeSerializable(out, affiliation); ExternalizableUtil.getInstance().writeSerializable(out, affiliation);
} }
...@@ -65,7 +65,7 @@ public class AffiliationTask extends NodeTask ...@@ -65,7 +65,7 @@ public class AffiliationTask extends NodeTask
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{ {
super.readExternal(in); super.readExternal(in);
jid = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); jid = (JID) ExternalizableUtil.getInstance().readSerializable(in);
affiliation = (NodeAffiliate.Affiliation) ExternalizableUtil.getInstance().readSerializable(in); affiliation = (NodeAffiliate.Affiliation) ExternalizableUtil.getInstance().readSerializable(in);
} }
......
...@@ -64,8 +64,8 @@ public abstract class SubscriptionTask extends NodeTask ...@@ -64,8 +64,8 @@ public abstract class SubscriptionTask extends NodeTask
{ {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, subId); ExternalizableUtil.getInstance().writeSafeUTF(out, subId);
ExternalizableUtil.getInstance().writeSafeUTF(out, owner.toString()); ExternalizableUtil.getInstance().writeSerializable(out, owner);
ExternalizableUtil.getInstance().writeSafeUTF(out, subJid.toString()); ExternalizableUtil.getInstance().writeSerializable(out, subJid);
ExternalizableUtil.getInstance().writeSerializable(out, state); ExternalizableUtil.getInstance().writeSerializable(out, state);
} }
...@@ -74,8 +74,8 @@ public abstract class SubscriptionTask extends NodeTask ...@@ -74,8 +74,8 @@ public abstract class SubscriptionTask extends NodeTask
{ {
super.readExternal(in); super.readExternal(in);
subId = ExternalizableUtil.getInstance().readSafeUTF(in); subId = ExternalizableUtil.getInstance().readSafeUTF(in);
owner = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); owner = (JID) ExternalizableUtil.getInstance().readSerializable(in);
subJid = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); subJid = (JID) ExternalizableUtil.getInstance().readSerializable(in);
state = (State) ExternalizableUtil.getInstance().readSerializable(in); state = (State) ExternalizableUtil.getInstance().readSerializable(in);
} }
......
...@@ -538,7 +538,7 @@ public class RosterItem implements Cacheable, Externalizable { ...@@ -538,7 +538,7 @@ public class RosterItem implements Cacheable, Externalizable {
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, jid.toString()); ExternalizableUtil.getInstance().writeSerializable(out, jid);
ExternalizableUtil.getInstance().writeBoolean(out, nickname != null); ExternalizableUtil.getInstance().writeBoolean(out, nickname != null);
if (nickname != null) { if (nickname != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, nickname); ExternalizableUtil.getInstance().writeSafeUTF(out, nickname);
...@@ -553,7 +553,7 @@ public class RosterItem implements Cacheable, Externalizable { ...@@ -553,7 +553,7 @@ public class RosterItem implements Cacheable, Externalizable {
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
jid = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); jid = (JID) ExternalizableUtil.getInstance().readSerializable(in);
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
nickname = ExternalizableUtil.getInstance().readSafeUTF(in); nickname = ExternalizableUtil.getInstance().readSafeUTF(in);
} }
......
...@@ -94,12 +94,12 @@ public class ClientSessionTask extends RemoteSessionTask { ...@@ -94,12 +94,12 @@ public class ClientSessionTask extends RemoteSessionTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
public String toString() { public String toString() {
......
...@@ -80,12 +80,12 @@ public class ComponentSessionTask extends RemoteSessionTask { ...@@ -80,12 +80,12 @@ public class ComponentSessionTask extends RemoteSessionTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
public String toString() { public String toString() {
......
...@@ -85,7 +85,7 @@ public class DeliverRawTextTask implements ClusterTask { ...@@ -85,7 +85,7 @@ public class DeliverRawTextTask implements ClusterTask {
ExternalizableUtil.getInstance().writeInt(out, sessionType.ordinal()); ExternalizableUtil.getInstance().writeInt(out, sessionType.ordinal());
ExternalizableUtil.getInstance().writeBoolean(out, address != null); ExternalizableUtil.getInstance().writeBoolean(out, address != null);
if (address != null) { if (address != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
ExternalizableUtil.getInstance().writeBoolean(out, streamID != null); ExternalizableUtil.getInstance().writeBoolean(out, streamID != null);
if (streamID != null) { if (streamID != null) {
...@@ -97,7 +97,7 @@ public class DeliverRawTextTask implements ClusterTask { ...@@ -97,7 +97,7 @@ public class DeliverRawTextTask implements ClusterTask {
text = ExternalizableUtil.getInstance().readSafeUTF(in); text = ExternalizableUtil.getInstance().readSafeUTF(in);
sessionType = SessionType.values()[ExternalizableUtil.getInstance().readInt(in)]; sessionType = SessionType.values()[ExternalizableUtil.getInstance().readInt(in)];
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
streamID = ExternalizableUtil.getInstance().readSafeUTF(in); streamID = ExternalizableUtil.getInstance().readSafeUTF(in);
......
...@@ -65,12 +65,12 @@ public class OutgoingServerSessionTask extends RemoteSessionTask { ...@@ -65,12 +65,12 @@ public class OutgoingServerSessionTask extends RemoteSessionTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
public String toString() { public String toString() {
......
...@@ -85,7 +85,7 @@ public class ProcessPacketTask implements ClusterTask { ...@@ -85,7 +85,7 @@ public class ProcessPacketTask implements ClusterTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeBoolean(out, address != null); ExternalizableUtil.getInstance().writeBoolean(out, address != null);
if (address != null) { if (address != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
ExternalizableUtil.getInstance().writeBoolean(out, streamID != null); ExternalizableUtil.getInstance().writeBoolean(out, streamID != null);
if (streamID != null) { if (streamID != null) {
...@@ -104,7 +104,7 @@ public class ProcessPacketTask implements ClusterTask { ...@@ -104,7 +104,7 @@ public class ProcessPacketTask implements ClusterTask {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
streamID = ExternalizableUtil.getInstance().readSafeUTF(in); streamID = ExternalizableUtil.getInstance().readSafeUTF(in);
......
...@@ -256,12 +256,12 @@ public class RemoteComponentSession extends RemoteSession implements ComponentSe ...@@ -256,12 +256,12 @@ public class RemoteComponentSession extends RemoteSession implements ComponentSe
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, componentJID.toString()); ExternalizableUtil.getInstance().writeSerializable(out, componentJID);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
componentJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); componentJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
} }
} }
...@@ -106,12 +106,12 @@ public class ClientSessionTask extends RemoteSessionTask { ...@@ -106,12 +106,12 @@ public class ClientSessionTask extends RemoteSessionTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
public String toString() { public String toString() {
......
...@@ -80,12 +80,12 @@ public class ComponentSessionTask extends RemoteSessionTask { ...@@ -80,12 +80,12 @@ public class ComponentSessionTask extends RemoteSessionTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
public String toString() { public String toString() {
......
...@@ -85,7 +85,7 @@ public class DeliverRawTextTask implements ClusterTask { ...@@ -85,7 +85,7 @@ public class DeliverRawTextTask implements ClusterTask {
ExternalizableUtil.getInstance().writeInt(out, sessionType.ordinal()); ExternalizableUtil.getInstance().writeInt(out, sessionType.ordinal());
ExternalizableUtil.getInstance().writeBoolean(out, address != null); ExternalizableUtil.getInstance().writeBoolean(out, address != null);
if (address != null) { if (address != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
ExternalizableUtil.getInstance().writeBoolean(out, streamID != null); ExternalizableUtil.getInstance().writeBoolean(out, streamID != null);
if (streamID != null) { if (streamID != null) {
...@@ -97,7 +97,7 @@ public class DeliverRawTextTask implements ClusterTask { ...@@ -97,7 +97,7 @@ public class DeliverRawTextTask implements ClusterTask {
text = ExternalizableUtil.getInstance().readSafeUTF(in); text = ExternalizableUtil.getInstance().readSafeUTF(in);
sessionType = SessionType.values()[ExternalizableUtil.getInstance().readInt(in)]; sessionType = SessionType.values()[ExternalizableUtil.getInstance().readInt(in)];
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
streamID = ExternalizableUtil.getInstance().readSafeUTF(in); streamID = ExternalizableUtil.getInstance().readSafeUTF(in);
......
...@@ -65,12 +65,12 @@ public class OutgoingServerSessionTask extends RemoteSessionTask { ...@@ -65,12 +65,12 @@ public class OutgoingServerSessionTask extends RemoteSessionTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
public String toString() { public String toString() {
......
...@@ -85,7 +85,7 @@ public class ProcessPacketTask implements ClusterTask { ...@@ -85,7 +85,7 @@ public class ProcessPacketTask implements ClusterTask {
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeBoolean(out, address != null); ExternalizableUtil.getInstance().writeBoolean(out, address != null);
if (address != null) { if (address != null) {
ExternalizableUtil.getInstance().writeSafeUTF(out, address.toString()); ExternalizableUtil.getInstance().writeSerializable(out, address);
} }
ExternalizableUtil.getInstance().writeBoolean(out, streamID != null); ExternalizableUtil.getInstance().writeBoolean(out, streamID != null);
if (streamID != null) { if (streamID != null) {
...@@ -104,7 +104,7 @@ public class ProcessPacketTask implements ClusterTask { ...@@ -104,7 +104,7 @@ public class ProcessPacketTask implements ClusterTask {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
address = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); address = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
if (ExternalizableUtil.getInstance().readBoolean(in)) { if (ExternalizableUtil.getInstance().readBoolean(in)) {
streamID = ExternalizableUtil.getInstance().readSafeUTF(in); streamID = ExternalizableUtil.getInstance().readSafeUTF(in);
......
...@@ -256,12 +256,12 @@ public class RemoteComponentSession extends RemoteSession implements ComponentSe ...@@ -256,12 +256,12 @@ public class RemoteComponentSession extends RemoteSession implements ComponentSe
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, componentJID.toString()); ExternalizableUtil.getInstance().writeSerializable(out, componentJID);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
componentJID = new JID(ExternalizableUtil.getInstance().readSafeUTF(in)); componentJID = (JID) ExternalizableUtil.getInstance().readSerializable(in);
} }
} }
} }
...@@ -42,14 +42,14 @@ import org.xmpp.packet.Presence; ...@@ -42,14 +42,14 @@ import org.xmpp.packet.Presence;
*/ */
public class RemotePacketExecution implements ClusterTask { public class RemotePacketExecution implements ClusterTask {
private JID receipient; private JID recipient;
private Packet packet; private Packet packet;
public RemotePacketExecution() { public RemotePacketExecution() {
} }
public RemotePacketExecution(JID receipient, Packet packet) { public RemotePacketExecution(JID recipient, Packet packet) {
this.receipient = receipient; this.recipient = recipient;
this.packet = packet; this.packet = packet;
} }
...@@ -60,11 +60,11 @@ public class RemotePacketExecution implements ClusterTask { ...@@ -60,11 +60,11 @@ public class RemotePacketExecution implements ClusterTask {
public void run() { public void run() {
// Route packet to entity hosted by this node. If delivery fails then the routing table // Route packet to entity hosted by this node. If delivery fails then the routing table
// will inform the proper router of the failure and the router will handle the error reply logic // will inform the proper router of the failure and the router will handle the error reply logic
XMPPServer.getInstance().getRoutingTable().routePacket(receipient, packet, false); XMPPServer.getInstance().getRoutingTable().routePacket(recipient, packet, false);
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, receipient.toString()); ExternalizableUtil.getInstance().writeSerializable(out, recipient);
if (packet instanceof IQ) { if (packet instanceof IQ) {
ExternalizableUtil.getInstance().writeInt(out, 1); ExternalizableUtil.getInstance().writeInt(out, 1);
} }
...@@ -78,11 +78,7 @@ public class RemotePacketExecution implements ClusterTask { ...@@ -78,11 +78,7 @@ public class RemotePacketExecution implements ClusterTask {
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
String jid = ExternalizableUtil.getInstance().readSafeUTF(in); recipient = (JID) ExternalizableUtil.getInstance().readSerializable(in);
// Optimization that was avoiding the need to reparse and validate JIDs but cannot be done due
// to a change in the JID API. We need to bring this constructor back
//receipient = new JID(jid, true);
receipient = new JID(jid);
int packetType = ExternalizableUtil.getInstance().readInt(in); int packetType = ExternalizableUtil.getInstance().readInt(in);
Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in); Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
...@@ -100,6 +96,6 @@ public class RemotePacketExecution implements ClusterTask { ...@@ -100,6 +96,6 @@ public class RemotePacketExecution implements ClusterTask {
} }
public String toString() { public String toString() {
return super.toString() + " receipient: " + receipient + "packet: " + packet; return super.toString() + " recipient: " + recipient + "packet: " + packet;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment