1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49: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

@ -66,11 +66,12 @@ public class BookmarkManager {
BookmarkManager manager = bookmarkManagerMap.get(connection);
if (manager == null) {
manager = new BookmarkManager(connection);
bookmarkManagerMap.put(connection, manager);
}
return manager;
}
private PrivateDataManager privateDataManager;
private final PrivateDataManager privateDataManager;
private Bookmarks bookmarks;
private final Object bookmarkLock = new Object();
@ -80,9 +81,8 @@ public class BookmarkManager {
*
* @param connection the connection for persisting and retrieving bookmarks.
*/
private BookmarkManager(XMPPConnection connection) throws XMPPException, SmackException {
private BookmarkManager(XMPPConnection connection) {
privateDataManager = PrivateDataManager.getInstanceFor(connection);
bookmarkManagerMap.put(connection, this);
}
/**

View file

@ -142,7 +142,7 @@ public class ChatStateManager extends Manager {
return false;
}
private void fireNewChatState(Chat chat, ChatState state) {
private static void fireNewChatState(Chat chat, ChatState state) {
for (ChatMessageListener listener : chat.getListeners()) {
if (listener instanceof ChatStateListener) {
((ChatStateListener) listener).stateChanged(chat, state);

View file

@ -574,7 +574,7 @@ public class AdHocCommandManager extends Manager {
* @param condition the condition of the error.
* @throws NotConnectedException
*/
private IQ respondError(AdHocCommandData response,
private static IQ respondError(AdHocCommandData response,
XMPPError.Condition condition) {
return respondError(response, new XMPPError(condition));
}

View file

@ -31,6 +31,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
@ -193,10 +194,20 @@ public class IncomingFileTransfer extends FileTransfer {
try {
inputStream = streamNegotiatorTask.get(15, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
throw new SmackException("Interruption while executing", e);
}
catch (ExecutionException e) {
final Throwable cause = e.getCause();
if (cause instanceof XMPPErrorException) {
throw (XMPPErrorException) cause;
}
if (cause instanceof InterruptedException) {
throw (InterruptedException) cause;
}
if (cause instanceof NoResponseException) {
throw (NoResponseException) cause;
}
if (cause instanceof SmackException) {
throw (SmackException) cause;
}
throw new SmackException("Error in execution", e);
}
catch (TimeoutException e) {

View file

@ -87,9 +87,7 @@ public abstract class StreamNegotiator {
}
protected final IQ initiateIncomingStream(final XMPPConnection connection, StreamInitiation initiation)
// CHECKSTYLE:OFF
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// CHECKSTYLE:ON
throws NoResponseException, XMPPErrorException, NotConnectedException {
final StreamInitiation response = createInitiationAccept(initiation,
getNamespaces());

View file

@ -47,16 +47,6 @@ public class PubSub extends IQ
setType(type);
}
/**
* Returns the XML element name of the extension sub-packet root element.
*
* @return the XML element name of the stanza(/packet) extension.
*/
@SuppressWarnings("static-method")
public String getElementName() {
return ELEMENT;
}
@SuppressWarnings("unchecked")
public <PE extends ExtensionElement> PE getExtension(PubSubElementType elem)
{

View file

@ -19,7 +19,6 @@ package org.jivesoftware.smackx.xdatalayout.provider;
import java.io.IOException;
import java.util.List;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smackx.xdatalayout.packet.DataLayout;
import org.jivesoftware.smackx.xdatalayout.packet.DataLayout.DataFormLayoutElement;
import org.jivesoftware.smackx.xdatalayout.packet.DataLayout.Fieldref;
@ -37,8 +36,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class DataLayoutProvider {
public static DataLayout parse(XmlPullParser parser) throws XmlPullParserException, IOException,
SmackException {
public static DataLayout parse(XmlPullParser parser) throws XmlPullParserException, IOException {
DataLayout dataLayout = new DataLayout(parser.getAttributeValue("", "label"));
parseLayout(dataLayout.getPageLayout(), parser);
return dataLayout;