1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

Lint fixes: Remove dead code, etc.

- make method static when possible
- remove never thrown Exception declarations
- other fixes
This commit is contained in:
Florian Schmaus 2015-03-24 18:33:47 +01:00
parent 83b84c5bd3
commit c6594aec2f
18 changed files with 48 additions and 65 deletions

View file

@ -360,7 +360,7 @@ public class ChatManager extends Manager{
return Collections.unmodifiableSet(chatManagerListeners);
}
private void deliverMessage(Chat chat, Message message) {
private static void deliverMessage(Chat chat, Message message) {
// Here we will run any interceptors
chat.deliver(message);
}

View file

@ -177,7 +177,7 @@ public class DirectoryRosterStore implements RosterStore {
return setRosterVersion(version);
}
private Item readEntry(File file) {
private static Item readEntry(File file) {
String s = FileUtils.readFile(file);
if (s == null) {
return null;

View file

@ -322,7 +322,7 @@ public class ChatConnectionTest {
assertNull(listener.getNewChat());
}
private Message createChatPacket(final String threadId, final boolean isFullJid) {
private static Message createChatPacket(final String threadId, final boolean isFullJid) {
Message chatMsg = new Message(JidTestUtil.BARE_JID_1, Message.Type.chat);
chatMsg.setBody("the body message - " + System.currentTimeMillis());
Jid jid;

View file

@ -21,7 +21,6 @@ import static org.junit.Assert.assertNotNull;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.junit.Before;
import org.junit.Test;
@ -37,7 +36,7 @@ public class RosterOfflineTest {
Roster roster;
@Before
public void setup() throws XMPPException, SmackException {
public void setup() {
this.connection = new DummyConnection();
assertFalse(connection.isConnected());

View file

@ -32,7 +32,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.im.InitSmackIm;
import org.jivesoftware.smack.packet.ErrorIQ;
import org.jivesoftware.smack.packet.IQ;
@ -511,8 +510,7 @@ public class RosterTest extends InitSmackIm {
* @param connection the dummy connection of which the provided roster belongs to.
* @param roster the roster (or buddy list) which should be initialized.
*/
public static void removeAllRosterEntries(DummyConnection connection, Roster roster)
throws InterruptedException, XMPPException {
public static void removeAllRosterEntries(DummyConnection connection, Roster roster) {
for(RosterEntry entry : roster.getEntries()) {
// prepare the roster push packet
final RosterPacket rosterPush= new RosterPacket();
@ -539,7 +537,7 @@ public class RosterTest extends InitSmackIm {
* @throws SmackException
* @throws XmppStringprepException
*/
private void initRoster() throws InterruptedException, XMPPException, SmackException, XmppStringprepException {
private void initRoster() throws InterruptedException, SmackException, XmppStringprepException {
roster.reload();
while (true) {
final Stanza sentPacket = connection.getSentPacket();

View file

@ -135,7 +135,7 @@ public class RosterVersioningTest {
* @throws XmppStringprepException
*/
@Test(timeout = 5000)
public void testOtherVersionStored() throws InterruptedException, XMPPException, SmackException, XmppStringprepException {
public void testOtherVersionStored() throws XMPPException, SmackException, XmppStringprepException {
Item vaglafItem = vaglafItem();
// We expect that the roster request is the only packet sent. This is not part of the specification,
@ -226,7 +226,7 @@ public class RosterVersioningTest {
}
}
private Item vaglafItem() throws XmppStringprepException {
private static Item vaglafItem() throws XmppStringprepException {
Item item = new Item(JidCreate.from("vaglaf@example.com"), "vaglaf the only");
item.setItemType(ItemType.both);
item.addGroupName("all");
@ -235,7 +235,7 @@ public class RosterVersioningTest {
return item;
}
private void populateStore(RosterStore store) throws IOException {
private static void populateStore(RosterStore store) throws IOException {
store.addEntry(new RosterPacket.Item(JidCreate.from("geoff@example.com"), "geoff hurley"), "");
RosterPacket.Item item = new RosterPacket.Item(JidCreate.from("joe@example.com"), "joe stevens");
@ -249,7 +249,7 @@ public class RosterVersioningTest {
store.addEntry(item, "v96");
}
private void answerWithEmptyRosterResult() throws InterruptedException {
private void answerWithEmptyRosterResult() {
// We expect that the roster request is the only packet sent. This is not part of the specification,
// but a shortcut in the test implementation.
Stanza sentPacket = connection.getSentPacket();