1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 04:22:05 +01:00

Merge pull request #253 from vanitasvitae/norEmpty

requireNotNullOrEmpty: Obey the rules of grammar
This commit is contained in:
Florian Schmaus 2018-07-28 12:57:49 +02:00 committed by GitHub
commit 48627bd0fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 82 additions and 52 deletions

View file

@ -497,7 +497,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException, public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException,
SmackException, IOException, InterruptedException { SmackException, IOException, InterruptedException {
if (!config.allowNullOrEmptyUsername) { if (!config.allowNullOrEmptyUsername) {
StringUtils.requireNotNullOrEmpty(username, "Username must not be null or empty"); StringUtils.requireNotNullNorEmpty(username, "Username must not be null nor empty");
} }
throwNotConnectedExceptionIfAppropriate("Did you call connect() before login()?"); throwNotConnectedExceptionIfAppropriate("Did you call connect() before login()?");
throwAlreadyLoggedInExceptionIfAppropriate(); throwAlreadyLoggedInExceptionIfAppropriate();

View file

@ -894,8 +894,8 @@ public abstract class ConnectionConfiguration {
* @return a reference to this builder. * @return a reference to this builder.
*/ */
public B addEnabledSaslMechanism(String saslMechanism) { public B addEnabledSaslMechanism(String saslMechanism) {
return addEnabledSaslMechanism(Arrays.asList(StringUtils.requireNotNullOrEmpty(saslMechanism, return addEnabledSaslMechanism(Arrays.asList(StringUtils.requireNotNullNorEmpty(saslMechanism,
"saslMechanism must not be null or empty"))); "saslMechanism must not be null nor empty")));
} }
/** /**

View file

@ -42,7 +42,7 @@ public class PacketExtensionFilter implements StanzaFilter {
* @param namespace the XML namespace of the stanza extension. * @param namespace the XML namespace of the stanza extension.
*/ */
public PacketExtensionFilter(String elementName, String namespace) { public PacketExtensionFilter(String elementName, String namespace) {
StringUtils.requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); StringUtils.requireNotNullNorEmpty(namespace, "namespace must not be null nor empty");
this.elementName = elementName; this.elementName = elementName;
this.namespace = namespace; this.namespace = namespace;

View file

@ -50,7 +50,7 @@ public class PacketIDFilter implements StanzaFilter {
*/ */
@Deprecated @Deprecated
public PacketIDFilter(String packetID) { public PacketIDFilter(String packetID) {
StringUtils.requireNotNullOrEmpty(packetID, "Packet ID must not be null or empty."); StringUtils.requireNotNullNorEmpty(packetID, "Packet ID must not be null nor empty.");
this.packetID = packetID; this.packetID = packetID;
} }

View file

@ -40,7 +40,7 @@ public class StanzaExtensionFilter implements StanzaFilter {
* @param namespace the XML namespace of the stanza extension. * @param namespace the XML namespace of the stanza extension.
*/ */
public StanzaExtensionFilter(String elementName, String namespace) { public StanzaExtensionFilter(String elementName, String namespace) {
StringUtils.requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); StringUtils.requireNotNullNorEmpty(namespace, "namespace must not be null nor empty");
this.elementName = elementName; this.elementName = elementName;
this.namespace = namespace; this.namespace = namespace;

View file

@ -44,7 +44,7 @@ public class StanzaIdFilter implements StanzaFilter {
* @param stanzaID the stanza ID to filter for. * @param stanzaID the stanza ID to filter for.
*/ */
public StanzaIdFilter(String stanzaID) { public StanzaIdFilter(String stanzaID) {
this.stanzaId = StringUtils.requireNotNullOrEmpty(stanzaID, "Stanza ID must not be null or empty."); this.stanzaId = StringUtils.requireNotNullNorEmpty(stanzaID, "Stanza ID must not be null nor empty.");
} }
@Override @Override

View file

@ -35,7 +35,7 @@ public class ThreadFilter extends FlexibleStanzaTypeFilter<Message> implements S
* @param thread the thread value to filter for. * @param thread the thread value to filter for.
*/ */
public ThreadFilter(String thread) { public ThreadFilter(String thread) {
StringUtils.requireNotNullOrEmpty(thread, "Thread must not be null or empty."); StringUtils.requireNotNullNorEmpty(thread, "Thread must not be null nor empty.");
this.thread = thread; this.thread = thread;
} }

View file

@ -27,7 +27,7 @@ public abstract class AbstractTextElement implements ExtensionElement {
private final String lang; private final String lang;
protected AbstractTextElement(String text, String lang) { protected AbstractTextElement(String text, String lang) {
this.text = StringUtils.requireNotNullOrEmpty(text, "Text must not be null or empty"); this.text = StringUtils.requireNotNullNorEmpty(text, "Text must not be null nor empty");
this.lang = lang; this.lang = lang;
} }

View file

@ -66,8 +66,8 @@ public final class StandardExtensionElement implements ExtensionElement {
private StandardExtensionElement(String name, String namespace, Map<String, String> attributes, String text, private StandardExtensionElement(String name, String namespace, Map<String, String> attributes, String text,
MultiMap<String, StandardExtensionElement> elements) { MultiMap<String, StandardExtensionElement> elements) {
this.name = StringUtils.requireNotNullOrEmpty(name, "Name must not be null or empty"); this.name = StringUtils.requireNotNullNorEmpty(name, "Name must not be null nor empty");
this.namespace = StringUtils.requireNotNullOrEmpty(namespace, "Namespace must not be null or empty"); this.namespace = StringUtils.requireNotNullNorEmpty(namespace, "Namespace must not be null nor empty");
if (attributes == null) { if (attributes == null) {
this.attributes = Collections.emptyMap(); this.attributes = Collections.emptyMap();
} }
@ -173,7 +173,7 @@ public final class StandardExtensionElement implements ExtensionElement {
} }
public Builder addAttribute(String name, String value) { public Builder addAttribute(String name, String value) {
StringUtils.requireNotNullOrEmpty(name, "Attribute name must be set"); StringUtils.requireNotNullNorEmpty(name, "Attribute name must be set");
Objects.requireNonNull(value, "Attribute value must be not null"); Objects.requireNonNull(value, "Attribute value must be not null");
if (attributes == null) { if (attributes == null) {
attributes = new LinkedHashMap<>(); attributes = new LinkedHashMap<>();

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smack.packet; package org.jivesoftware.smack.packet;
import static org.jivesoftware.smack.util.StringUtils.requireNotNullOrEmpty; import static org.jivesoftware.smack.util.StringUtils.requireNotNullNorEmpty;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -122,7 +122,7 @@ public abstract class Stanza implements TopLevelStreamElement {
*/ */
public void setStanzaId(String id) { public void setStanzaId(String id) {
if (id != null) { if (id != null) {
requireNotNullOrEmpty(id, "id must either be null or not the empty String"); requireNotNullNorEmpty(id, "id must either be null or not the empty String");
} }
this.id = id; this.id = id;
} }
@ -324,8 +324,8 @@ public abstract class Stanza implements TopLevelStreamElement {
* @since 4.1 * @since 4.1
*/ */
public List<ExtensionElement> getExtensions(String elementName, String namespace) { public List<ExtensionElement> getExtensions(String elementName, String namespace) {
requireNotNullOrEmpty(elementName, "elementName must not be null or empty"); requireNotNullNorEmpty(elementName, "elementName must not be null nor empty");
requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); requireNotNullNorEmpty(namespace, "namespace must not be null nor empty");
String key = XmppStringUtils.generateKey(elementName, namespace); String key = XmppStringUtils.generateKey(elementName, namespace);
return packetExtensions.getAll(key); return packetExtensions.getAll(key);
} }

View file

@ -39,8 +39,8 @@ public class SaslStreamElements {
public AuthMechanism(String mechanism, String authenticationText) { public AuthMechanism(String mechanism, String authenticationText) {
this.mechanism = Objects.requireNonNull(mechanism, "SASL mechanism shouldn't be null."); this.mechanism = Objects.requireNonNull(mechanism, "SASL mechanism shouldn't be null.");
this.authenticationText = StringUtils.requireNotNullOrEmpty(authenticationText, this.authenticationText = StringUtils.requireNotNullNorEmpty(authenticationText,
"SASL authenticationText must not be null or empty (RFC6120 6.4.2)"); "SASL authenticationText must not be null nor empty (RFC6120 6.4.2)");
} }
@Override @Override

View file

@ -31,7 +31,15 @@ public class Objects {
return requireNonNull(obj, null); return requireNonNull(obj, null);
} }
public static <T extends Collection<?>> T requireNonNullOrEmpty(T collection, String message) { /**
* Require a collection to be neither null, nor empty.
*
* @param collection collection
* @param message error message
* @param <T> Collection type
* @return collection
*/
public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message) {
if (requireNonNull(collection).isEmpty()) { if (requireNonNull(collection).isEmpty()) {
throw new IllegalArgumentException(message); throw new IllegalArgumentException(message);
} }

View file

@ -444,7 +444,29 @@ public class StringUtils {
return csOne.toString().compareTo(csTwo.toString()); return csOne.toString().compareTo(csTwo.toString());
} }
/**
* Require a {@link CharSequence} to be neither null, nor empty.
*
* @deprecated use {@link #requireNotNullNorEmpty(CharSequence, String)} instead.
* @param cs CharSequence
* @param message error message
* @param <CS> CharSequence type
* @return cs
*/
@Deprecated
public static <CS extends CharSequence> CS requireNotNullOrEmpty(CS cs, String message) { public static <CS extends CharSequence> CS requireNotNullOrEmpty(CS cs, String message) {
return requireNotNullNorEmpty(cs, message);
}
/**
* Require a {@link CharSequence} to be neither null, nor empty.
*
* @param cs CharSequence
* @param message error message
* @param <CS> CharSequence type
* @return cs
*/
public static <CS extends CharSequence> CS requireNotNullNorEmpty(CS cs, String message) {
if (isNullOrEmpty(cs)) { if (isNullOrEmpty(cs)) {
throw new IllegalArgumentException(message); throw new IllegalArgumentException(message);
} }

View file

@ -372,7 +372,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
private final String xmlFragment; private final String xmlFragment;
private XmlNsAttribute(String value) { private XmlNsAttribute(String value) {
this.value = StringUtils.requireNotNullOrEmpty(value, "Value must not be null"); this.value = StringUtils.requireNotNullNorEmpty(value, "Value must not be null");
this.xmlFragment = " xmlns='" + value + '\''; this.xmlFragment = " xmlns='" + value + '\'';
} }

View file

@ -48,7 +48,7 @@ public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
*/ */
public SRVRecord(DnsName fqdn, int port, int priority, int weight, List<InetAddress> inetAddresses) { public SRVRecord(DnsName fqdn, int port, int priority, int weight, List<InetAddress> inetAddresses) {
super(fqdn, port, inetAddresses); super(fqdn, port, inetAddresses);
StringUtils.requireNotNullOrEmpty(fqdn, "The FQDN must not be null"); StringUtils.requireNotNullNorEmpty(fqdn, "The FQDN must not be null");
if (weight < 0 || weight > 65535) if (weight < 0 || weight > 65535)
throw new IllegalArgumentException( throw new IllegalArgumentException(
"DNS SRV records weight must be a 16-bit unsigned integer (i.e. between 0-65535. Weight was: " "DNS SRV records weight must be a 16-bit unsigned integer (i.e. between 0-65535. Weight was: "

View file

@ -87,7 +87,7 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement {
} }
public ExplicitMessageEncryptionElement(String encryptionNamespace, String name) { public ExplicitMessageEncryptionElement(String encryptionNamespace, String name) {
this.encryptionNamespace = StringUtils.requireNotNullOrEmpty(encryptionNamespace, this.encryptionNamespace = StringUtils.requireNotNullNorEmpty(encryptionNamespace,
"encryptionNamespace must not be null"); "encryptionNamespace must not be null");
this.name = name; this.name = name;
} }

View file

@ -34,9 +34,9 @@ public class Tag implements NamedElement {
public Tag(String name, Type type, String value) { public Tag(String name, Type type, String value) {
// TODO According to XEP-0347 § 5.2 names are case insensitive. Uppercase them all? // TODO According to XEP-0347 § 5.2 names are case insensitive. Uppercase them all?
this.name = StringUtils.requireNotNullOrEmpty(name, "name must not be null or empty"); this.name = StringUtils.requireNotNullNorEmpty(name, "name must not be null nor empty");
this.type = Objects.requireNonNull(type); this.type = Objects.requireNonNull(type);
this.value = StringUtils.requireNotNullOrEmpty(value, "value must not be null or empty"); this.value = StringUtils.requireNotNullNorEmpty(value, "value must not be null nor empty");
if (this.name.length() > 32) { if (this.name.length() > 32) {
throw new IllegalArgumentException("Meta Tag names must not be longer then 32 characters (XEP-0347 § 5.2"); throw new IllegalArgumentException("Meta Tag names must not be longer then 32 characters (XEP-0347 § 5.2");
} }

View file

@ -37,7 +37,7 @@ public final class NodeInfo {
} }
public NodeInfo(String nodeId, String sourceId, String cacheType) { public NodeInfo(String nodeId, String sourceId, String cacheType) {
this.nodeId = StringUtils.requireNotNullOrEmpty(nodeId, "Node ID must not be null or empty"); this.nodeId = StringUtils.requireNotNullNorEmpty(nodeId, "Node ID must not be null nor empty");
this.sourceId = sourceId; this.sourceId = sourceId;
this.cacheType = cacheType; this.cacheType = cacheType;
} }

View file

@ -39,8 +39,8 @@ public class BoBHash {
* @param hashType * @param hashType
*/ */
public BoBHash(String hash, String hashType) { public BoBHash(String hash, String hashType) {
this.hash = StringUtils.requireNotNullOrEmpty(hash, "hash must not be null or empty"); this.hash = StringUtils.requireNotNullNorEmpty(hash, "hash must not be null nor empty");
this.hashType = StringUtils.requireNotNullOrEmpty(hashType, "hashType must not be null or empty"); this.hashType = StringUtils.requireNotNullNorEmpty(hashType, "hashType must not be null nor empty");
this.cid = this.hashType + '+' + this.hash + "@bob.xmpp.org"; this.cid = this.hashType + '+' + this.hash + "@bob.xmpp.org";
} }

View file

@ -288,7 +288,7 @@ public class Bytestream extends IQ {
*/ */
public StreamHost(final Jid JID, final String address, int port) { public StreamHost(final Jid JID, final String address, int port) {
this.JID = Objects.requireNonNull(JID, "StreamHost JID must not be null"); this.JID = Objects.requireNonNull(JID, "StreamHost JID must not be null");
this.addy = StringUtils.requireNotNullOrEmpty(address, "StreamHost address must not be null"); this.addy = StringUtils.requireNotNullNorEmpty(address, "StreamHost address must not be null");
this.port = port; this.port = port;
} }

View file

@ -318,8 +318,8 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
* @param lang the entity's lang. * @param lang the entity's lang.
*/ */
public Identity(String category, String type, String name, String lang) { public Identity(String category, String type, String name, String lang) {
this.category = StringUtils.requireNotNullOrEmpty(category, "category cannot be null"); this.category = StringUtils.requireNotNullNorEmpty(category, "category cannot be null");
this.type = StringUtils.requireNotNullOrEmpty(type, "type cannot be null"); this.type = StringUtils.requireNotNullNorEmpty(type, "type cannot be null");
this.key = XmppStringUtils.generateKey(category, type); this.key = XmppStringUtils.generateKey(category, type);
this.name = name; this.name = name;
this.lang = lang; this.lang = lang;
@ -500,7 +500,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
* @param variable the feature's variable. * @param variable the feature's variable.
*/ */
public Feature(String variable) { public Feature(String variable) {
this.variable = StringUtils.requireNotNullOrEmpty(variable, "variable cannot be null"); this.variable = StringUtils.requireNotNullNorEmpty(variable, "variable cannot be null");
} }
/** /**

View file

@ -68,8 +68,8 @@ public class Version extends IQ {
public Version(String name, String version, String os) { public Version(String name, String version, String os) {
super(ELEMENT, NAMESPACE); super(ELEMENT, NAMESPACE);
this.setType(IQ.Type.result); this.setType(IQ.Type.result);
this.name = StringUtils.requireNotNullOrEmpty(name, "name must not be null"); this.name = StringUtils.requireNotNullNorEmpty(name, "name must not be null");
this.version = StringUtils.requireNotNullOrEmpty(version, "version must not be null"); this.version = StringUtils.requireNotNullNorEmpty(version, "version must not be null");
this.os = os; this.os = os;
} }

View file

@ -68,7 +68,7 @@ public final class Jingle extends IQ {
private Jingle(String sessionId, JingleAction action, FullJid initiator, FullJid responder, JingleReason reason, private Jingle(String sessionId, JingleAction action, FullJid initiator, FullJid responder, JingleReason reason,
List<JingleContent> contents) { List<JingleContent> contents) {
super(ELEMENT, NAMESPACE); super(ELEMENT, NAMESPACE);
this.sessionId = StringUtils.requireNotNullOrEmpty(sessionId, "Jingle session ID must not be null"); this.sessionId = StringUtils.requireNotNullNorEmpty(sessionId, "Jingle session ID must not be null");
this.action = Objects.requireNonNull(action, "Jingle action must not be null"); this.action = Objects.requireNonNull(action, "Jingle action must not be null");
this.initiator = initiator; this.initiator = initiator;
this.responder = responder; this.responder = responder;
@ -190,7 +190,7 @@ public final class Jingle extends IQ {
} }
public Builder setSessionId(String sessionId) { public Builder setSessionId(String sessionId) {
StringUtils.requireNotNullOrEmpty(sessionId, "Session ID must not be null or empty"); StringUtils.requireNotNullNorEmpty(sessionId, "Session ID must not be null nor empty");
this.sid = sessionId; this.sid = sessionId;
return this; return this;
} }

View file

@ -75,7 +75,7 @@ public final class JingleContent implements NamedElement {
JingleContentDescription description, JingleContentTransport transport) { JingleContentDescription description, JingleContentTransport transport) {
this.creator = Objects.requireNonNull(creator, "Jingle content creator must not be null"); this.creator = Objects.requireNonNull(creator, "Jingle content creator must not be null");
this.disposition = disposition; this.disposition = disposition;
this.name = StringUtils.requireNotNullOrEmpty(name, "Jingle content name must not be null or empty"); this.name = StringUtils.requireNotNullNorEmpty(name, "Jingle content name must not be null nor empty");
this.senders = senders; this.senders = senders;
this.description = description; this.description = description;
this.transport = transport; this.transport = transport;

View file

@ -41,7 +41,7 @@ public class JingleS5BTransport extends JingleContentTransport {
protected JingleS5BTransport(List<JingleContentTransportCandidate> candidates, JingleContentTransportInfo info, String streamId, String dstAddr, Bytestream.Mode mode) { protected JingleS5BTransport(List<JingleContentTransportCandidate> candidates, JingleContentTransportInfo info, String streamId, String dstAddr, Bytestream.Mode mode) {
super(candidates, info); super(candidates, info);
StringUtils.requireNotNullOrEmpty(streamId, "sid MUST be neither null, nor empty."); StringUtils.requireNotNullNorEmpty(streamId, "sid MUST be neither null, nor empty.");
this.streamId = streamId; this.streamId = streamId;
this.dstAddr = dstAddr; this.dstAddr = dstAddr;
this.mode = mode; this.mode = mode;

View file

@ -55,7 +55,7 @@ public class MessageCorrectExtension implements ExtensionElement {
private final String idInitialMessage; private final String idInitialMessage;
public MessageCorrectExtension(String idInitialMessage) { public MessageCorrectExtension(String idInitialMessage) {
this.idInitialMessage = StringUtils.requireNotNullOrEmpty(idInitialMessage, "idInitialMessage must not be null"); this.idInitialMessage = StringUtils.requireNotNullNorEmpty(idInitialMessage, "idInitialMessage must not be null");
} }
public String getIdInitialMessage() { public String getIdInitialMessage() {

View file

@ -399,7 +399,7 @@ public final class PrivacyListManager extends Manager {
* @throws InterruptedException * @throws InterruptedException
*/ */
public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
listName = StringUtils.requireNotNullOrEmpty(listName, "List name must not be null"); listName = StringUtils.requireNotNullNorEmpty(listName, "List name must not be null");
return new PrivacyList(false, false, listName, getPrivacyListItems(listName)); return new PrivacyList(false, false, listName, getPrivacyListItems(listName));
} }

View file

@ -86,7 +86,7 @@ public class Affiliation implements ExtensionElement {
* @param namespace the affiliation's namespace. * @param namespace the affiliation's namespace.
*/ */
public Affiliation(String node, Type affiliation, AffiliationNamespace namespace) { public Affiliation(String node, Type affiliation, AffiliationNamespace namespace) {
this.node = StringUtils.requireNotNullOrEmpty(node, "node must not be null or empty"); this.node = StringUtils.requireNotNullNorEmpty(node, "node must not be null nor empty");
this.affiliation = affiliation; this.affiliation = affiliation;
this.jid = null; this.jid = null;
this.namespace = Objects.requireNonNull(namespace); this.namespace = Objects.requireNonNull(namespace);

View file

@ -57,8 +57,8 @@ public class SimplePayload implements ExtensionElement {
payload = xmlPayload; payload = xmlPayload;
elemName = StringUtils.requireNotNullOrEmpty(qname.getLocalPart(), "Could not determine element name from XML payload"); elemName = StringUtils.requireNotNullNorEmpty(qname.getLocalPart(), "Could not determine element name from XML payload");
ns = StringUtils.requireNotNullOrEmpty(qname.getNamespaceURI(), "Could not determine namespace from XML payload"); ns = StringUtils.requireNotNullNorEmpty(qname.getNamespaceURI(), "Could not determine namespace from XML payload");
} }
/** /**

View file

@ -156,7 +156,7 @@ public class FormField implements NamedElement {
* @param variable the variable name of the question. * @param variable the variable name of the question.
*/ */
public FormField(String variable) { public FormField(String variable) {
this.variable = StringUtils.requireNotNullOrEmpty(variable, "Variable must not be null or empty"); this.variable = StringUtils.requireNotNullNorEmpty(variable, "Variable must not be null nor empty");
} }
/** /**

View file

@ -218,19 +218,19 @@ public final class Configuration {
} }
public Builder setAdminAccountUsernameAndPassword(String adminAccountUsername, String adminAccountPassword) { public Builder setAdminAccountUsernameAndPassword(String adminAccountUsername, String adminAccountPassword) {
this.adminAccountUsername = StringUtils.requireNotNullOrEmpty(adminAccountUsername, "adminAccountUsername must not be null or empty"); this.adminAccountUsername = StringUtils.requireNotNullNorEmpty(adminAccountUsername, "adminAccountUsername must not be null nor empty");
this.adminAccountPassword = StringUtils.requireNotNullOrEmpty(adminAccountPassword, "adminAccountPassword must no be null or empty"); this.adminAccountPassword = StringUtils.requireNotNullNorEmpty(adminAccountPassword, "adminAccountPassword must no be null nor empty");
return this; return this;
} }
public Builder setUsernamesAndPassword(String accountOneUsername, String accountOnePassword, public Builder setUsernamesAndPassword(String accountOneUsername, String accountOnePassword,
String accountTwoUsername, String accountTwoPassword, String accountThreeUsername, String accountThreePassword) { String accountTwoUsername, String accountTwoPassword, String accountThreeUsername, String accountThreePassword) {
this.accountOneUsername = StringUtils.requireNotNullOrEmpty(accountOneUsername, "accountOneUsername must not be null or empty"); this.accountOneUsername = StringUtils.requireNotNullNorEmpty(accountOneUsername, "accountOneUsername must not be null nor empty");
this.accountOnePassword = StringUtils.requireNotNullOrEmpty(accountOnePassword, "accountOnePassword must not be null or empty"); this.accountOnePassword = StringUtils.requireNotNullNorEmpty(accountOnePassword, "accountOnePassword must not be null nor empty");
this.accountTwoUsername = StringUtils.requireNotNullOrEmpty(accountTwoUsername, "accountTwoUsername must not be null or empty"); this.accountTwoUsername = StringUtils.requireNotNullNorEmpty(accountTwoUsername, "accountTwoUsername must not be null nor empty");
this.accountTwoPassword = StringUtils.requireNotNullOrEmpty(accountTwoPassword, "accountTwoPasswordmust not be null or empty"); this.accountTwoPassword = StringUtils.requireNotNullNorEmpty(accountTwoPassword, "accountTwoPasswordmust not be null nor empty");
this.accountThreeUsername = StringUtils.requireNotNullOrEmpty(accountThreeUsername, "accountThreeUsername must not be null or empty"); this.accountThreeUsername = StringUtils.requireNotNullNorEmpty(accountThreeUsername, "accountThreeUsername must not be null nor empty");
this.accountThreePassword = StringUtils.requireNotNullOrEmpty(accountThreePassword, "accountThreePassword must not be null or empty"); this.accountThreePassword = StringUtils.requireNotNullNorEmpty(accountThreePassword, "accountThreePassword must not be null nor empty");
return this; return this;
} }

View file

@ -598,7 +598,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
failedAddresses.add(hostAddress); failedAddresses.add(hostAddress);
} else { } else {
socket = socketFactory.createSocket(); socket = socketFactory.createSocket();
StringUtils.requireNotNullOrEmpty(host, "Host of HostAddress " + hostAddress + " must not be null when using a Proxy"); StringUtils.requireNotNullNorEmpty(host, "Host of HostAddress " + hostAddress + " must not be null when using a Proxy");
final String hostAndPort = host + " at port " + port; final String hostAndPort = host + " at port " + port;
LOGGER.finer("Trying to establish TCP connection via Proxy to " + hostAndPort); LOGGER.finer("Trying to establish TCP connection via Proxy to " + hostAndPort);
try { try {