mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-08 20:11:08 +01:00
's;^\s+$;;' on all source files
And add checkstyle test for lines containing only whitespace characters.
This commit is contained in:
parent
05c97c494b
commit
0fde39fa45
193 changed files with 1066 additions and 1062 deletions
|
|
@ -108,7 +108,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
protected static Collection<ConnectionCreationListener> getConnectionCreationListeners() {
|
||||
return XMPPConnectionRegistry.getConnectionCreationListeners();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A collection of ConnectionListeners which listen for connection closing
|
||||
* and reconnection events.
|
||||
|
|
@ -208,7 +208,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
*/
|
||||
protected final SynchronizationPoint<SmackException> saslFeatureReceived = new SynchronizationPoint<SmackException>(
|
||||
AbstractXMPPConnection.this);
|
||||
|
||||
|
||||
/**
|
||||
* The SASLAuthentication manager that is responsible for authenticating with the server.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public class PacketCollector {
|
|||
public StanzaFilter getStanzaFilter() {
|
||||
return packetFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Polls to see if a packet is currently available and returns it, or
|
||||
* immediately returns <tt>null</tt> if no packets are currently in the
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public final class SmackConfiguration {
|
|||
public static void setPacketCollectorSize(int collectorSize) {
|
||||
packetCollectorSize = collectorSize;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a SASL mechanism to the list to be used.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ public interface XMPPConnection {
|
|||
* @param packetFilter the packet filter to use.
|
||||
*/
|
||||
public void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);
|
||||
|
||||
|
||||
/**
|
||||
* Removes a packet interceptor.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class XMPPConnectionRegistry {
|
|||
ConnectionCreationListener connectionCreationListener) {
|
||||
connectionEstablishedListeners.add(connectionCreationListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a listener that was interested in connection creation events.
|
||||
*
|
||||
|
|
@ -49,7 +49,7 @@ public class XMPPConnectionRegistry {
|
|||
ConnectionCreationListener connectionCreationListener) {
|
||||
connectionEstablishedListeners.remove(connectionCreationListener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.jivesoftware.smack.packet.XMPPError;
|
|||
*/
|
||||
public abstract class XMPPException extends Exception {
|
||||
private static final long serialVersionUID = 6881651633890968625L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new XMPPException.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smack.util.Objects;
|
|||
*
|
||||
*/
|
||||
public class IQTypeFilter extends FlexibleStanzaTypeFilter<IQ> {
|
||||
|
||||
|
||||
public static final StanzaFilter GET = new IQTypeFilter(Type.get);
|
||||
public static final StanzaFilter SET = new IQTypeFilter(Type.set);
|
||||
public static final StanzaFilter RESULT = new IQTypeFilter(Type.result);
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
public String getSubject() {
|
||||
return getSubject(null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the subject corresponding to the language. If the language is null, the method result
|
||||
* will be the same as {@link #getSubject()}. Null will be returned if the language does not have
|
||||
|
|
@ -165,7 +165,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
Subject subject = getMessageSubject(language);
|
||||
return subject == null ? null : subject.subject;
|
||||
}
|
||||
|
||||
|
||||
private Subject getMessageSubject(String language) {
|
||||
language = determineLanguage(language);
|
||||
for (Subject subject : subjects) {
|
||||
|
|
@ -284,7 +284,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
Body body = getMessageBody(language);
|
||||
return body == null ? null : body.message;
|
||||
}
|
||||
|
||||
|
||||
private Body getMessageBody(String language) {
|
||||
language = determineLanguage(language);
|
||||
for (Body body : bodies) {
|
||||
|
|
@ -400,7 +400,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
}
|
||||
|
||||
private String determineLanguage(String language) {
|
||||
|
||||
|
||||
// empty string is passed by #setSubject() and #setBody() and is the same as null
|
||||
language = "".equals(language) ? null : language;
|
||||
|
||||
|
|
@ -414,7 +414,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
else {
|
||||
return language;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -537,7 +537,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
// simplified comparison because language and subject are always set
|
||||
return this.language.equals(other.language) && this.subject.equals(other.subject);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -599,7 +599,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
// simplified comparison because language and message are always set
|
||||
return this.language.equals(other.language) && this.message.equals(other.message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import java.util.logging.Logger;
|
|||
*/
|
||||
public class ExceptionLoggingCallback extends ParsingExceptionCallback {
|
||||
private static final Logger LOGGER = Logger.getLogger(ExceptionLoggingCallback.class.getName());
|
||||
|
||||
|
||||
@Override
|
||||
public void handleUnparsablePacket(UnparsablePacket unparsed) throws Exception {
|
||||
LOGGER.log(Level.SEVERE, "Smack message parsing exception: ", unparsed.getParsingException());
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ abstract class AbstractProviderInfo {
|
|||
private String element;
|
||||
private String ns;
|
||||
private Object provider;
|
||||
|
||||
|
||||
AbstractProviderInfo(String elementName, String namespace, Object iqOrExtProvider) {
|
||||
element = elementName;
|
||||
ns = namespace;
|
||||
provider = iqOrExtProvider;
|
||||
}
|
||||
|
||||
|
||||
public String getElementName() {
|
||||
return element;
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ abstract class AbstractProviderInfo {
|
|||
public String getNamespace() {
|
||||
return ns;
|
||||
}
|
||||
|
||||
|
||||
Object getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
*
|
||||
*/
|
||||
public final class IQProviderInfo extends AbstractProviderInfo {
|
||||
|
||||
|
||||
/**
|
||||
* Defines an IQ provider which implements the <code>IQProvider</code> interface.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public final class ProviderManager {
|
|||
addIQProvider(info.getElementName(), info.getNamespace(), info.getProvider());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (loader.getExtensionProviderInfo() != null) {
|
||||
for (ExtensionProviderInfo info : loader.getExtensionProviderInfo()) {
|
||||
addExtensionProvider(info.getElementName(), info.getNamespace(), info.getProvider());
|
||||
|
|
@ -142,7 +142,7 @@ public final class ProviderManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the IQ provider registered to the specified XML element name and namespace.
|
||||
* For example, if a provider was registered to the element name "query" and the
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class HTTPProxySocketFactory
|
|||
throws IOException
|
||||
{
|
||||
return httpProxifiedSocket(host.getHostAddress(), port);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Socket createSocket( InetAddress address, int port,
|
||||
|
|
@ -74,7 +74,7 @@ class HTTPProxySocketFactory
|
|||
{
|
||||
return httpProxifiedSocket(address.getHostAddress(), port);
|
||||
}
|
||||
|
||||
|
||||
private Socket httpProxifiedSocket(String host, int port)
|
||||
throws IOException
|
||||
{
|
||||
|
|
@ -96,11 +96,11 @@ class HTTPProxySocketFactory
|
|||
}
|
||||
socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: "
|
||||
+ hostport + proxyLine + "\r\n\r\n").getBytes("UTF-8"));
|
||||
|
||||
|
||||
InputStream in = socket.getInputStream();
|
||||
StringBuilder got = new StringBuilder(100);
|
||||
int nlchars = 0;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
char c = (char) in.read();
|
||||
|
|
@ -141,30 +141,30 @@ class HTTPProxySocketFactory
|
|||
}
|
||||
|
||||
String gotstr = got.toString();
|
||||
|
||||
|
||||
BufferedReader br = new BufferedReader(new StringReader(gotstr));
|
||||
String response = br.readLine();
|
||||
|
||||
|
||||
if (response == null)
|
||||
{
|
||||
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Empty proxy " +
|
||||
"response from " + proxyhost + ", cancelling");
|
||||
}
|
||||
|
||||
|
||||
Matcher m = RESPONSE_PATTERN.matcher(response);
|
||||
if (!m.matches())
|
||||
{
|
||||
throw new ProxyException(ProxyInfo.ProxyType.HTTP , "Unexpected " +
|
||||
"proxy response from " + proxyhost + ": " + response);
|
||||
}
|
||||
|
||||
|
||||
int code = Integer.parseInt(m.group(1));
|
||||
|
||||
|
||||
if (code != HttpURLConnection.HTTP_OK)
|
||||
{
|
||||
throw new ProxyException(ProxyInfo.ProxyType.HTTP);
|
||||
}
|
||||
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ public class ProxyException extends IOException {
|
|||
{
|
||||
super("Proxy Exception " + type.toString() + " : "+ex+", "+cause);
|
||||
}
|
||||
|
||||
|
||||
public ProxyException(ProxyInfo.ProxyType type, String ex)
|
||||
{
|
||||
super("Proxy Exception " + type.toString() + " : "+ex);
|
||||
}
|
||||
|
||||
|
||||
public ProxyException(ProxyInfo.ProxyType type)
|
||||
{
|
||||
super("Proxy Exception " + type.toString() + " : " + "Unknown Error");
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ public class ProxyInfo
|
|||
SOCKS4,
|
||||
SOCKS5
|
||||
}
|
||||
|
||||
|
||||
private String proxyAddress;
|
||||
private int proxyPort;
|
||||
private String proxyUsername;
|
||||
private String proxyPassword;
|
||||
private ProxyType proxyType;
|
||||
|
||||
|
||||
public ProxyInfo( ProxyType pType, String pHost, int pPort, String pUser,
|
||||
String pPass)
|
||||
{
|
||||
|
|
@ -50,60 +50,60 @@ public class ProxyInfo
|
|||
this.proxyUsername = pUser;
|
||||
this.proxyPassword = pPass;
|
||||
}
|
||||
|
||||
|
||||
public static ProxyInfo forHttpProxy(String pHost, int pPort, String pUser,
|
||||
String pPass)
|
||||
{
|
||||
return new ProxyInfo(ProxyType.HTTP, pHost, pPort, pUser, pPass);
|
||||
}
|
||||
|
||||
|
||||
public static ProxyInfo forSocks4Proxy(String pHost, int pPort, String pUser,
|
||||
String pPass)
|
||||
{
|
||||
return new ProxyInfo(ProxyType.SOCKS4, pHost, pPort, pUser, pPass);
|
||||
}
|
||||
|
||||
|
||||
public static ProxyInfo forSocks5Proxy(String pHost, int pPort, String pUser,
|
||||
String pPass)
|
||||
{
|
||||
return new ProxyInfo(ProxyType.SOCKS5, pHost, pPort, pUser, pPass);
|
||||
}
|
||||
|
||||
|
||||
public static ProxyInfo forNoProxy()
|
||||
{
|
||||
return new ProxyInfo(ProxyType.NONE, null, 0, null, null);
|
||||
}
|
||||
|
||||
|
||||
public static ProxyInfo forDefaultProxy()
|
||||
{
|
||||
return new ProxyInfo(ProxyType.NONE, null, 0, null, null);
|
||||
}
|
||||
|
||||
|
||||
public ProxyType getProxyType()
|
||||
{
|
||||
return proxyType;
|
||||
}
|
||||
|
||||
|
||||
public String getProxyAddress()
|
||||
{
|
||||
return proxyAddress;
|
||||
}
|
||||
|
||||
|
||||
public int getProxyPort()
|
||||
{
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
|
||||
public String getProxyUsername()
|
||||
{
|
||||
return proxyUsername;
|
||||
}
|
||||
|
||||
|
||||
public String getProxyPassword()
|
||||
{
|
||||
return proxyPassword;
|
||||
}
|
||||
|
||||
|
||||
public SocketFactory getSocketFactory()
|
||||
{
|
||||
if(proxyType == ProxyType.NONE)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class Socks4ProxySocketFactory
|
|||
extends SocketFactory
|
||||
{
|
||||
private ProxyInfo proxy;
|
||||
|
||||
|
||||
public Socks4ProxySocketFactory(ProxyInfo proxy)
|
||||
{
|
||||
this.proxy = proxy;
|
||||
|
|
@ -44,7 +44,7 @@ public class Socks4ProxySocketFactory
|
|||
throws IOException, UnknownHostException
|
||||
{
|
||||
return socks4ProxifiedSocket(host,port);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Socket createSocket(String host ,int port, InetAddress localHost,
|
||||
|
|
@ -65,9 +65,9 @@ public class Socks4ProxySocketFactory
|
|||
throws IOException
|
||||
{
|
||||
return socks4ProxifiedSocket(address.getHostAddress(),port);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
private Socket socks4ProxifiedSocket(String host, int port)
|
||||
throws IOException
|
||||
|
|
@ -85,7 +85,7 @@ public class Socks4ProxySocketFactory
|
|||
in=socket.getInputStream();
|
||||
out=socket.getOutputStream();
|
||||
socket.setTcpNoDelay(true);
|
||||
|
||||
|
||||
byte[] buf=new byte[1024];
|
||||
int index=0;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class Socks5ProxySocketFactory
|
|||
extends SocketFactory
|
||||
{
|
||||
private ProxyInfo proxy;
|
||||
|
||||
|
||||
public Socks5ProxySocketFactory(ProxyInfo proxy)
|
||||
{
|
||||
this.proxy = proxy;
|
||||
|
|
@ -49,28 +49,28 @@ public class Socks5ProxySocketFactory
|
|||
int localPort)
|
||||
throws IOException, UnknownHostException
|
||||
{
|
||||
|
||||
|
||||
return socks5ProxifiedSocket(host,port);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Socket createSocket(InetAddress host, int port)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
|
||||
return socks5ProxifiedSocket(host.getHostAddress(),port);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Socket createSocket( InetAddress address, int port,
|
||||
InetAddress localAddress, int localPort)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
|
||||
return socks5ProxifiedSocket(address.getHostAddress(),port);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Socket socks5ProxifiedSocket(String host, int port)
|
||||
throws IOException
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ public class Socks5ProxySocketFactory
|
|||
int proxy_port = proxy.getProxyPort();
|
||||
String user = proxy.getProxyUsername();
|
||||
String passwd = proxy.getProxyPassword();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
socket=new Socket(proxy_host, proxy_port);
|
||||
|
|
@ -241,7 +241,7 @@ public class Socks5ProxySocketFactory
|
|||
o DST.PORT desired destination port in network octet
|
||||
order
|
||||
*/
|
||||
|
||||
|
||||
index=0;
|
||||
buf[index++]=5;
|
||||
buf[index++]=1; // CONNECT
|
||||
|
|
@ -328,7 +328,7 @@ public class Socks5ProxySocketFactory
|
|||
default:
|
||||
}
|
||||
return socket;
|
||||
|
||||
|
||||
}
|
||||
catch(RuntimeException e)
|
||||
{
|
||||
|
|
@ -355,7 +355,7 @@ public class Socks5ProxySocketFactory
|
|||
throw new IOException(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void fill(InputStream in, byte[] buf, int len)
|
||||
throws IOException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class ObservableReader extends Reader {
|
|||
public ObservableReader(Reader wrappedReader) {
|
||||
this.wrappedReader = wrappedReader;
|
||||
}
|
||||
|
||||
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
int count = wrappedReader.read(cbuf, off, len);
|
||||
if (count > 0) {
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ public class PacketParserUtils {
|
|||
message.setType(Message.Type.fromString(typeString));
|
||||
}
|
||||
String language = getLanguageAttribute(parser);
|
||||
|
||||
|
||||
// determine message's default language
|
||||
String defaultLanguage = null;
|
||||
if (language != null && !"".equals(language.trim())) {
|
||||
|
|
@ -891,7 +891,7 @@ public class PacketParserUtils {
|
|||
XmlPullParser parser) throws Exception {
|
||||
return parseExtensionElement(elementName, namespace, parser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses an extension element.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ public interface ReaderListener {
|
|||
* @param str the read String
|
||||
*/
|
||||
public abstract void read(String str);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class StringUtils {
|
|||
throw new IllegalStateException("UTF-8 encoding not supported by platform", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pseudo-random number generator object for use with randomString().
|
||||
* The Random class is not considered to be cryptographically secure, so
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public XmlStringBuilder optElement(String name, Object object) {
|
||||
if (object != null) {
|
||||
element(name, object.toString());
|
||||
|
|
@ -272,7 +272,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
|||
optAttribute("xml:lang", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public XmlStringBuilder escape(String text) {
|
||||
assert text != null;
|
||||
sb.append(StringUtils.escapeForXML(text));
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ package org.jivesoftware.smack.util.dns;
|
|||
*
|
||||
*/
|
||||
public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
|
||||
|
||||
|
||||
private int weight;
|
||||
private int priority;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new SRVRecord
|
||||
*
|
||||
|
|
@ -52,11 +52,11 @@ public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
|
|||
this.weight = weight;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue