1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +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; 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) public ProxyException(ProxyInfo.ProxyType type, String ex)
{ {
super("Proxy Exception " + type.toString() + " : "+ex); super("Proxy Exception " + type.toString() + " : "+ex);

View file

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

View file

@ -37,7 +37,7 @@ public class AMPExtensionTest {
private InputStream INCORRECT_RECEIVING_STANZA_STREAM; private InputStream INCORRECT_RECEIVING_STANZA_STREAM;
@Before @Before
public void setUp() throws IOException { public void setUp() {
CORRECT_SENDING_STANZA_STREAM = getClass().getResourceAsStream("correct_stanza_test.xml"); CORRECT_SENDING_STANZA_STREAM = getClass().getResourceAsStream("correct_stanza_test.xml");
INCORRECT_RECEIVING_STANZA_STREAM = getClass().getResourceAsStream("incorrect_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()]; byte[] data = new byte[stream.available()];
stream.read(data); stream.read(data);
stream.close(); stream.close();

View file

@ -214,7 +214,7 @@ public class Socks5ClientForInitiatorTest {
socks5Proxy.start(); socks5Proxy.start();
StreamHost streamHost = new StreamHost(proxyJID, StreamHost streamHost = new StreamHost(proxyJID,
socks5Proxy.getAddress(), socks5Proxy.getPort()); Socks5TestProxy.getAddress(), socks5Proxy.getPort());
// create digest to get the socket opened by target // create digest to get the socket opened by target
String digest = Socks5Utils.createDigest(sessionID, initiatorJID, targetJID); String digest = Socks5Utils.createDigest(sessionID, initiatorJID, targetJID);
@ -267,7 +267,7 @@ public class Socks5ClientForInitiatorTest {
socks5Proxy.start(); socks5Proxy.start();
StreamHost streamHost = new StreamHost(proxyJID, StreamHost streamHost = new StreamHost(proxyJID,
socks5Proxy.getAddress(), socks5Proxy.getPort()); Socks5TestProxy.getAddress(), socks5Proxy.getPort());
// create digest to get the socket opened by target // create digest to get the socket opened by target
String digest = Socks5Utils.createDigest(sessionID, initiatorJID, targetJID); 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 * @return the host address of the local SOCKS5 proxy server
*/ */
public String getAddress() { public static String getAddress() {
try { try {
return InetAddress.getLocalHost().getHostAddress(); 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.jivesoftware.smackx.xdata.packet.DataForm;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.jxmpp.stringprep.XmppStringprepException;
/** /**
* Configure form test. * Configure form test.
@ -78,7 +77,7 @@ public class ConfigureFormTest
} }
@Test (expected=SmackException.class) @Test (expected=SmackException.class)
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException, XmppStringprepException public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
{ {
ThreadedDummyConnection con = new ThreadedDummyConnection(); ThreadedDummyConnection con = new ThreadedDummyConnection();
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE); 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 * @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()) { for (XMPPInputOutputStream handler : SmackConfiguration.getCompresionHandlers()) {
String method = handler.getCompressionMethod(); String method = handler.getCompressionMethod();
if (compression.getMethods().contains(method)) if (compression.getMethods().contains(method))