1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Code cleanup: Fix some warnings

This commit is contained in:
Florian Schmaus 2015-09-23 23:21:37 +02:00
parent 9c772add93
commit 9c694a0a75
7 changed files with 10 additions and 21 deletions

View file

@ -29,11 +29,6 @@ public class ProxyException extends IOException {
*/
private static final long serialVersionUID = 1L;
public ProxyException(ProxyInfo.ProxyType type, String ex, Throwable cause)
{
super("Proxy Exception " + type.toString() + " : "+ex+", "+cause);
}
public ProxyException(ProxyInfo.ProxyType type, String ex)
{
super("Proxy Exception " + type.toString() + " : "+ex);

View file

@ -305,17 +305,12 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
catch(Exception eee)
{
}
String message="ProxySOCKS5: "+e.toString();
if(e instanceof Throwable)
{
throw new ProxyException(ProxyInfo.ProxyType.SOCKS5,message,
(Throwable)e);
}
throw new IOException(message);
// TODO convert to IOException(e) when minimum Android API level is 9 or higher
throw new IOException(e.getLocalizedMessage());
}
}
private void fill(InputStream in, byte[] buf, int len)
private static void fill(InputStream in, byte[] buf, int len)
throws IOException
{
int s=0;

View file

@ -37,7 +37,7 @@ public class AMPExtensionTest {
private InputStream INCORRECT_RECEIVING_STANZA_STREAM;
@Before
public void setUp() throws IOException {
public void setUp() {
CORRECT_SENDING_STANZA_STREAM = getClass().getResourceAsStream("correct_stanza_test.xml");
INCORRECT_RECEIVING_STANZA_STREAM = getClass().getResourceAsStream("incorrect_stanza_test.xml");
}
@ -97,7 +97,7 @@ public class AMPExtensionTest {
}
private String toString(InputStream stream) throws IOException {
private static String toString(InputStream stream) throws IOException {
byte[] data = new byte[stream.available()];
stream.read(data);
stream.close();

View file

@ -214,7 +214,7 @@ public class Socks5ClientForInitiatorTest {
socks5Proxy.start();
StreamHost streamHost = new StreamHost(proxyJID,
socks5Proxy.getAddress(), socks5Proxy.getPort());
Socks5TestProxy.getAddress(), socks5Proxy.getPort());
// create digest to get the socket opened by target
String digest = Socks5Utils.createDigest(sessionID, initiatorJID, targetJID);
@ -267,7 +267,7 @@ public class Socks5ClientForInitiatorTest {
socks5Proxy.start();
StreamHost streamHost = new StreamHost(proxyJID,
socks5Proxy.getAddress(), socks5Proxy.getPort());
Socks5TestProxy.getAddress(), socks5Proxy.getPort());
// create digest to get the socket opened by target
String digest = Socks5Utils.createDigest(sessionID, initiatorJID, targetJID);

View file

@ -146,7 +146,7 @@ public final class Socks5TestProxy {
*
* @return the host address of the local SOCKS5 proxy server
*/
public String getAddress() {
public static String getAddress() {
try {
return InetAddress.getLocalHost().getHostAddress();
}

View file

@ -33,7 +33,6 @@ import org.jivesoftware.smackx.pubsub.packet.PubSub;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.junit.Assert;
import org.junit.Test;
import org.jxmpp.stringprep.XmppStringprepException;
/**
* Configure form test.
@ -78,7 +77,7 @@ public class ConfigureFormTest
}
@Test (expected=SmackException.class)
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException, XmppStringprepException
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
{
ThreadedDummyConnection con = new ThreadedDummyConnection();
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);

View file

@ -746,7 +746,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* @return a instance of XMPPInputOutputStream or null if no suitable instance was found
*
*/
private XMPPInputOutputStream maybeGetCompressionHandler(Compress.Feature compression) {
private static XMPPInputOutputStream maybeGetCompressionHandler(Compress.Feature compression) {
for (XMPPInputOutputStream handler : SmackConfiguration.getCompresionHandlers()) {
String method = handler.getCompressionMethod();
if (compression.getMethods().contains(method))