mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 22:02:06 +01:00
errorprone: Enable MethodCanBeStatic
This commit is contained in:
parent
870d1a7238
commit
34f1c2b79e
15 changed files with 38 additions and 37 deletions
|
@ -203,7 +203,11 @@ allprojects {
|
||||||
'-Werror',
|
'-Werror',
|
||||||
]
|
]
|
||||||
options.errorprone {
|
options.errorprone {
|
||||||
error("UnusedVariable", "UnusedMethod")
|
error(
|
||||||
|
"UnusedVariable",
|
||||||
|
"UnusedMethod",
|
||||||
|
"MethodCanBeStatic",
|
||||||
|
)
|
||||||
errorproneArgs = [
|
errorproneArgs = [
|
||||||
// Disable errorprone checks
|
// Disable errorprone checks
|
||||||
'-Xep:TypeParameterUnusedInFormals:OFF',
|
'-Xep:TypeParameterUnusedInFormals:OFF',
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class MUCLightBlockingIQ extends IQ {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseBlocking(IQChildElementXmlStringBuilder xml, HashMap<Jid, Boolean> map, boolean isRoom) {
|
private static void parseBlocking(IQChildElementXmlStringBuilder xml, HashMap<Jid, Boolean> map, boolean isRoom) {
|
||||||
Iterator<Map.Entry<Jid, Boolean>> it = map.entrySet().iterator();
|
Iterator<Map.Entry<Jid, Boolean>> it = map.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Jid, Boolean> pair = it.next();
|
Map.Entry<Jid, Boolean> pair = it.next();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class MediaElementProvider extends FormFieldChildElementProvider<MediaEle
|
||||||
return mediaElementBuilder.build();
|
return mediaElementBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MediaElement.Uri parseUri(XmlPullParser parser)
|
private static MediaElement.Uri parseUri(XmlPullParser parser)
|
||||||
throws SmackUriSyntaxParsingException, XmlPullParserException, IOException {
|
throws SmackUriSyntaxParsingException, XmlPullParserException, IOException {
|
||||||
String type = parser.getAttributeValue("type");
|
String type = parser.getAttributeValue("type");
|
||||||
URI uri = ParserUtils.getUriFromNextText(parser);
|
URI uri = ParserUtils.getUriFromNextText(parser);
|
||||||
|
|
|
@ -607,7 +607,7 @@ public final class JingleSession extends JingleNegotiator implements MediaReceiv
|
||||||
* @param connection TODO javadoc me please
|
* @param connection TODO javadoc me please
|
||||||
* The connection to clean up
|
* The connection to clean up
|
||||||
*/
|
*/
|
||||||
private void unregisterInstanceFor(XMPPConnection connection) {
|
private static void unregisterInstanceFor(XMPPConnection connection) {
|
||||||
synchronized (sessions) {
|
synchronized (sessions) {
|
||||||
sessions.remove(connection);
|
sessions.remove(connection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class JingleSessionStateActive extends JingleSessionState {
|
||||||
/**
|
/**
|
||||||
* Receive and process the <session-terminate> action.
|
* Receive and process the <session-terminate> action.
|
||||||
*/
|
*/
|
||||||
private IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {
|
private static IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {
|
||||||
|
|
||||||
// According to XEP-166 the only thing we can do is ack.
|
// According to XEP-166 the only thing we can do is ack.
|
||||||
IQ response = session.createAck(jingle);
|
IQ response = session.createAck(jingle);
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class JingleSessionStatePending extends JingleSessionState {
|
||||||
/**
|
/**
|
||||||
* Receive and process the <session-accept> action.
|
* Receive and process the <session-accept> action.
|
||||||
*/
|
*/
|
||||||
private IQ receiveContentAcceptAction(Jingle inJingle) {
|
private static IQ receiveContentAcceptAction(Jingle inJingle) {
|
||||||
|
|
||||||
// According to XEP-167 the only thing we can do is ack.
|
// According to XEP-167 the only thing we can do is ack.
|
||||||
// setSessionState(JingleSessionStateEnum.ACTIVE);
|
// setSessionState(JingleSessionStateEnum.ACTIVE);
|
||||||
|
@ -116,7 +116,7 @@ public class JingleSessionStatePending extends JingleSessionState {
|
||||||
/**
|
/**
|
||||||
* Receive and process the <session-accept> action.
|
* Receive and process the <session-accept> action.
|
||||||
*/
|
*/
|
||||||
private IQ receiveSessionAcceptAction(JingleSession session, Jingle inJingle) {
|
private static IQ receiveSessionAcceptAction(JingleSession session, Jingle inJingle) {
|
||||||
|
|
||||||
// According to XEP-166 the only thing we can do is ack.
|
// According to XEP-166 the only thing we can do is ack.
|
||||||
session.setSessionState(JingleSessionStateActive.getInstance());
|
session.setSessionState(JingleSessionStateActive.getInstance());
|
||||||
|
@ -126,7 +126,7 @@ public class JingleSessionStatePending extends JingleSessionState {
|
||||||
/**
|
/**
|
||||||
* Receive and process the <session-terminate> action.
|
* Receive and process the <session-terminate> action.
|
||||||
*/
|
*/
|
||||||
private IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {
|
private static IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {
|
||||||
|
|
||||||
// According to XEP-166 the only thing we can do is ack.
|
// According to XEP-166 the only thing we can do is ack.
|
||||||
IQ response = session.createAck(jingle);
|
IQ response = session.createAck(jingle);
|
||||||
|
|
|
@ -101,8 +101,8 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
||||||
* @throws SmackException if Smack detected an exceptional situation.
|
* @throws SmackException if Smack detected an exceptional situation.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
|
private static IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle)
|
||||||
private IQ receiveSessionInitiateAction(JingleSession session, Jingle inJingle) throws SmackException, InterruptedException {
|
throws SmackException, InterruptedException {
|
||||||
|
|
||||||
IQ response;
|
IQ response;
|
||||||
boolean shouldAck = true;
|
boolean shouldAck = true;
|
||||||
|
@ -208,7 +208,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
||||||
/**
|
/**
|
||||||
* Receive and process the <session-terminate> action.
|
* Receive and process the <session-terminate> action.
|
||||||
*/
|
*/
|
||||||
private IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {
|
private static IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {
|
||||||
|
|
||||||
// According to XEP-166 the only thing we can do is ack.
|
// According to XEP-166 the only thing we can do is ack.
|
||||||
IQ response = session.createAck(jingle);
|
IQ response = session.createAck(jingle);
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class MediaNegotiator extends JingleNegotiator {
|
||||||
/**
|
/**
|
||||||
* Process the ACK of our list of codecs (our offer).
|
* Process the ACK of our list of codecs (our offer).
|
||||||
*/
|
*/
|
||||||
private Jingle receiveResult(IQ iq) throws XMPPException {
|
private static Jingle receiveResult(IQ iq) throws XMPPException {
|
||||||
Jingle response = null;
|
Jingle response = null;
|
||||||
|
|
||||||
// if (!remoteAudioPts.isEmpty()) {
|
// if (!remoteAudioPts.isEmpty()) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class JMFInit extends Frame implements Runnable {
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
||||||
message("Failed to commit to JMFRegistry!");
|
LOGGER.fine("Failed to commit to JMFRegistry!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread detectThread = new Thread(this);
|
Thread detectThread = new Thread(this);
|
||||||
|
@ -89,28 +89,28 @@ public class JMFInit extends Frame implements Runnable {
|
||||||
if (args != null && args.length > 0) {
|
if (args != null && args.length > 0) {
|
||||||
tempDir = args[0];
|
tempDir = args[0];
|
||||||
|
|
||||||
message("Setting cache directory to " + tempDir);
|
LOGGER.fine("Setting cache directory to " + tempDir);
|
||||||
try {
|
try {
|
||||||
Registry.set("secure.cacheDir", tempDir);
|
Registry.set("secure.cacheDir", tempDir);
|
||||||
Registry.commit();
|
Registry.commit();
|
||||||
|
|
||||||
message("Updated registry");
|
LOGGER.fine("Updated registry");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
message("Couldn't update registry!");
|
LOGGER.fine("Couldn't update registry!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("LiteralClassName")
|
@SuppressWarnings("LiteralClassName")
|
||||||
private void detectCaptureDevices() {
|
private static void detectCaptureDevices() {
|
||||||
// check if JavaSound capture is available
|
// check if JavaSound capture is available
|
||||||
message("Looking for Audio capturer");
|
LOGGER.fine("Looking for Audio capturer");
|
||||||
Class<?> dsauto;
|
Class<?> dsauto;
|
||||||
try {
|
try {
|
||||||
dsauto = Class.forName("DirectSoundAuto");
|
dsauto = Class.forName("DirectSoundAuto");
|
||||||
dsauto.getConstructor().newInstance();
|
dsauto.getConstructor().newInstance();
|
||||||
message("Finished detecting DirectSound capturer");
|
LOGGER.fine("Finished detecting DirectSound capturer");
|
||||||
}
|
}
|
||||||
catch (ThreadDeath td) {
|
catch (ThreadDeath td) {
|
||||||
throw td;
|
throw td;
|
||||||
|
@ -123,13 +123,13 @@ public class JMFInit extends Frame implements Runnable {
|
||||||
try {
|
try {
|
||||||
jsauto = Class.forName("JavaSoundAuto");
|
jsauto = Class.forName("JavaSoundAuto");
|
||||||
jsauto.getConstructor().newInstance();
|
jsauto.getConstructor().newInstance();
|
||||||
message("Finished detecting javasound capturer");
|
LOGGER.fine("Finished detecting javasound capturer");
|
||||||
}
|
}
|
||||||
catch (ThreadDeath td) {
|
catch (ThreadDeath td) {
|
||||||
throw td;
|
throw td;
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
message("JavaSound capturer detection failed!");
|
LOGGER.fine("JavaSound capturer detection failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -182,7 +182,7 @@ public class JMFInit extends Frame implements Runnable {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void detectDirectAudio() {
|
private static void detectDirectAudio() {
|
||||||
Class<?> cls;
|
Class<?> cls;
|
||||||
int plType = PlugInManager.RENDERER;
|
int plType = PlugInManager.RENDERER;
|
||||||
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
|
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
|
||||||
|
@ -229,7 +229,7 @@ public class JMFInit extends Frame implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void detectS8DirectAudio() {
|
private static void detectS8DirectAudio() {
|
||||||
Class<?> cls;
|
Class<?> cls;
|
||||||
int plType = PlugInManager.RENDERER;
|
int plType = PlugInManager.RENDERER;
|
||||||
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
|
String dar = "com.sun.media.renderer.audio.DirectAudioRenderer";
|
||||||
|
@ -273,10 +273,6 @@ public class JMFInit extends Frame implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void message(String mesg) {
|
|
||||||
LOGGER.fine(mesg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void start(boolean visible) {
|
public static void start(boolean visible) {
|
||||||
new JMFInit(null, visible);
|
new JMFInit(null, visible);
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,7 +318,7 @@ public class AudioChannel {
|
||||||
* @return the best stanza size
|
* @return the best stanza size
|
||||||
* @throws IllegalArgumentException if an illegal argument was given.
|
* @throws IllegalArgumentException if an illegal argument was given.
|
||||||
*/
|
*/
|
||||||
private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
|
private static int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
|
||||||
String encoding = codecFormat.getEncoding();
|
String encoding = codecFormat.getEncoding();
|
||||||
if (encoding.equalsIgnoreCase(AudioFormat.GSM) ||
|
if (encoding.equalsIgnoreCase(AudioFormat.GSM) ||
|
||||||
encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) {
|
encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) {
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class STUNResolver extends TransportResolver {
|
||||||
*
|
*
|
||||||
* @return the best STUN server that can be used.
|
* @return the best STUN server that can be used.
|
||||||
*/
|
*/
|
||||||
private STUNService bestSTUNServer(ArrayList<STUNService> listServers) {
|
private static STUNService bestSTUNServer(ArrayList<STUNService> listServers) {
|
||||||
if (listServers.isEmpty()) {
|
if (listServers.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -115,8 +115,8 @@ public class AgentChatHistory extends IQ {
|
||||||
return agentChatHistory;
|
return agentChatHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AgentChatSession parseChatSetting(XmlPullParser parser) throws XmlPullParserException, IOException {
|
private static AgentChatSession parseChatSetting(XmlPullParser parser)
|
||||||
|
throws XmlPullParserException, IOException {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
Date date = null;
|
Date date = null;
|
||||||
long duration = 0;
|
long duration = 0;
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class AgentStatusRequest extends IQ {
|
||||||
return statusRequest;
|
return statusRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Item parseAgent(XmlPullParser parser) throws XmlPullParserException, IOException {
|
private static Item parseAgent(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||||
|
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
EntityBareJid jid = ParserUtils.getBareJidAttribute(parser);
|
EntityBareJid jid = ParserUtils.getBareJidAttribute(parser);
|
||||||
|
|
|
@ -154,8 +154,8 @@ public class OccupantsInfo extends IQ {
|
||||||
return occupantsInfo;
|
return occupantsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OccupantInfo parseOccupantInfo(XmlPullParser parser) throws XmlPullParserException, IOException, SmackTextParseException {
|
private static OccupantInfo parseOccupantInfo(XmlPullParser parser)
|
||||||
|
throws XmlPullParserException, IOException, SmackTextParseException {
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
String jid = null;
|
String jid = null;
|
||||||
String nickname = null;
|
String nickname = null;
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class TranscriptsProvider extends IQProvider<Transcripts> {
|
||||||
return new Transcripts(userID, summaries);
|
return new Transcripts(userID, summaries);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Transcripts.TranscriptSummary parseSummary(XmlPullParser parser) throws IOException,
|
private static Transcripts.TranscriptSummary parseSummary(XmlPullParser parser)
|
||||||
XmlPullParserException {
|
throws IOException, XmlPullParserException {
|
||||||
String sessionID = parser.getAttributeValue("", "sessionID");
|
String sessionID = parser.getAttributeValue("", "sessionID");
|
||||||
Date joinTime = null;
|
Date joinTime = null;
|
||||||
Date leftTime = null;
|
Date leftTime = null;
|
||||||
|
@ -108,7 +108,8 @@ public class TranscriptsProvider extends IQProvider<Transcripts> {
|
||||||
return new Transcripts.TranscriptSummary(sessionID, joinTime, leftTime, agents);
|
return new Transcripts.TranscriptSummary(sessionID, joinTime, leftTime, agents);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Transcripts.AgentDetail> parseAgents(XmlPullParser parser) throws IOException, XmlPullParserException {
|
private static List<Transcripts.AgentDetail> parseAgents(XmlPullParser parser)
|
||||||
|
throws IOException, XmlPullParserException {
|
||||||
List<Transcripts.AgentDetail> agents = new ArrayList<>();
|
List<Transcripts.AgentDetail> agents = new ArrayList<>();
|
||||||
String agentJID = null;
|
String agentJID = null;
|
||||||
Date joinTime = null;
|
Date joinTime = null;
|
||||||
|
|
Loading…
Reference in a new issue