Commit 9fe68387 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed error while binding new component domains. JM-624

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3700 b35dd754-fafc-0310-a699-88a17e54d16e
parent 88a4202d
...@@ -80,7 +80,8 @@ public class InternalComponentManager implements ComponentManager, RoutableChann ...@@ -80,7 +80,8 @@ public class InternalComponentManager implements ComponentManager, RoutableChann
// Check that the requested subdoman is not taken by another component // Check that the requested subdoman is not taken by another component
Component existingComponent = components.get(subdomain); Component existingComponent = components.get(subdomain);
if (existingComponent != null && existingComponent != component) { if (existingComponent != null && existingComponent != component) {
throw new ComponentException("Domain already taken by another component"); throw new ComponentException(
"Domain already taken by another component: " + existingComponent);
} }
// Register that the domain is now taken by the component // Register that the domain is now taken by the component
components.put(subdomain, component); components.put(subdomain, component);
...@@ -317,6 +318,10 @@ public class InternalComponentManager implements ComponentManager, RoutableChann ...@@ -317,6 +318,10 @@ public class InternalComponentManager implements ComponentManager, RoutableChann
if ("http://jabber.org/protocol/disco#info".equals(namespace)) { if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
// Add a disco item to the server for the component that supports disco // Add a disco item to the server for the component that supports disco
Element identity = childElement.element("identity"); Element identity = childElement.element("identity");
if (identity == null) {
// Do nothing since there are no identities in the disco#info packet
return;
}
try { try {
XMPPServer.getInstance().getIQDiscoItemsHandler().addComponentItem(packet.getFrom() XMPPServer.getInstance().getIQDiscoItemsHandler().addComponentItem(packet.getFrom()
.toBareJID(), .toBareJID(),
......
...@@ -74,7 +74,13 @@ public class ComponentSocketReader extends SocketReader { ...@@ -74,7 +74,13 @@ public class ComponentSocketReader extends SocketReader {
} }
else { else {
try { try {
InternalComponentManager.getInstance().addComponent(extraDomain, component); // Get the requested subdomain
String subdomain = extraDomain;
int index = extraDomain.indexOf(serverName);
if (index > -1) {
subdomain = extraDomain.substring(0, index -1);
}
InternalComponentManager.getInstance().addComponent(subdomain, component);
// Send confirmation that the new domain has been registered // Send confirmation that the new domain has been registered
connection.deliverRawText("<bind/>"); connection.deliverRawText("<bind/>");
} }
......
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