Skip to content

Commit 3e0392e

Browse files
committed
Merge pull request #104 from surevine/issue-103
Fixes issue 103
2 parents 62ccbc5 + 174f3d4 commit 3e0392e

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/main/java/org/buddycloud/channelserver/channel/node/configuration/field/Factory.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ public Field create(String type, String value)
1313
if ((null == type) || (null == value)) {
1414
throw new ConfigurationFieldException();
1515
}
16-
if (type.equals("pubsub#owner") && (false == this.allowOwner)) {
16+
if (type.equals(Owner.FIELD_NAME) && (false == this.allowOwner)) {
1717
throw new ConfigurationFieldException();
18+
} else if (type.equals(Owner.FIELD_NAME)) {
19+
Owner field = new Owner();
20+
field.setValue(value);
21+
return field;
1822
} else if (type.equals(ChannelTitle.FIELD_NAME)) {
1923
ChannelTitle field = new ChannelTitle();
2024
field.setValue(value);

src/main/java/org/buddycloud/channelserver/channel/node/configuration/field/Owner.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.buddycloud.channelserver.channel.node.configuration.field;
22

3+
import org.xmpp.packet.JID;
4+
35
public class Owner extends Field
46
{
57
public static final String FIELD_NAME = "pubsub#owner";
@@ -12,6 +14,12 @@ public Owner()
1214

1315
public boolean isValid()
1416
{
15-
return true;
17+
try {
18+
JID owner = new JID(getValue());
19+
owner.toBareJID();
20+
return true;
21+
} catch (IllegalArgumentException e) {
22+
return false;
23+
}
1624
}
1725
}

0 commit comments

Comments
 (0)