1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Xlint all the things

and fix all warnings.
This commit is contained in:
Florian Schmaus 2015-03-23 09:27:15 +01:00
parent 7c5428ab0e
commit f546d28ad8
50 changed files with 142 additions and 122 deletions

View file

@ -111,11 +111,14 @@ allprojects {
} }
} }
compileJava { tasks.withType(JavaCompile) {
// Some systems may not have set their platform default // Some systems may not have set their platform default
// converter to 'utf8', but we use unicode in our source // converter to 'utf8', but we use unicode in our source
// files. Therefore ensure that javac uses unicode // files. Therefore ensure that javac uses unicode
options.encoding = "utf8" options.encoding = "utf8"
options.compilerArgs = [
'-Xlint:all',
]
} }
jacoco { jacoco {

View file

@ -484,8 +484,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return streamId; return streamId;
} }
// TODO remove this suppression once "disable legacy session" code has been removed from Smack
@SuppressWarnings("deprecation")
protected void bindResourceAndEstablishSession(String resource) throws XMPPErrorException, protected void bindResourceAndEstablishSession(String resource) throws XMPPErrorException,
IOException, SmackException, InterruptedException { IOException, SmackException, InterruptedException {
@ -517,7 +515,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE); Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE);
// Only bind the session if it's announced as stream feature by the server, is not optional and not disabled // Only bind the session if it's announced as stream feature by the server, is not optional and not disabled
// For more information see http://tools.ietf.org/html/draft-cridland-xmpp-session-01 // For more information see http://tools.ietf.org/html/draft-cridland-xmpp-session-01
if (sessionFeature != null && !sessionFeature.isOptional() && !getConfiguration().isLegacySessionDisabled()) { // TODO remove this suppression once "disable legacy session" code has been removed from Smack
@SuppressWarnings("deprecation")
boolean legacySessionDisabled = getConfiguration().isLegacySessionDisabled();
if (sessionFeature != null && !sessionFeature.isOptional() && !legacySessionDisabled) {
Session session = new Session(); Session session = new Session();
packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(session), session); packetCollector = createPacketCollectorAndSend(new StanzaIdFilter(session), session);
packetCollector.nextResultOrThrow(); packetCollector.nextResultOrThrow();
@ -1083,6 +1084,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// desired behavior. // desired behavior.
return; return;
} }
break;
default: default:
break; break;
} }

View file

@ -577,6 +577,7 @@ public class PacketParserUtils {
} }
break; break;
} }
break;
case XmlPullParser.END_TAG: case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) { if (parser.getDepth() == initialDepth) {
break outerloop; break outerloop;

View file

@ -75,7 +75,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
Message message = (Message) PacketParserUtils Message message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
@ -95,7 +95,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(otherLanguage, message.getBody()); assertEquals(otherLanguage, message.getBody());
assertTrue(message.getBodyLanguages().isEmpty()); assertTrue(message.getBodyLanguages().isEmpty());
@ -113,7 +113,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
assertTrue(message.getBodyLanguages().isEmpty()); assertTrue(message.getBodyLanguages().isEmpty());
@ -132,7 +132,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
assertTrue(message.getBodyLanguages().isEmpty()); assertTrue(message.getBodyLanguages().isEmpty());
@ -153,7 +153,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertNull(message.getBody()); assertNull(message.getBody());
assertFalse(message.getBodyLanguages().isEmpty()); assertFalse(message.getBodyLanguages().isEmpty());
@ -174,7 +174,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertNull(message.getBody()); assertNull(message.getBody());
assertFalse(message.getBodyLanguages().isEmpty()); assertFalse(message.getBodyLanguages().isEmpty());
@ -195,7 +195,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertNull(message.getBody()); assertNull(message.getBody());
assertFalse(message.getBodyLanguages().isEmpty()); assertFalse(message.getBodyLanguages().isEmpty());
@ -224,7 +224,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
Message message = (Message) PacketParserUtils Message message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
@ -244,7 +244,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(otherLanguage, message.getSubject()); assertEquals(otherLanguage, message.getSubject());
assertTrue(message.getSubjectLanguages().isEmpty()); assertTrue(message.getSubjectLanguages().isEmpty());
@ -262,7 +262,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
assertTrue(message.getSubjectLanguages().isEmpty()); assertTrue(message.getSubjectLanguages().isEmpty());
@ -281,7 +281,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
assertTrue(message.getSubjectLanguages().isEmpty()); assertTrue(message.getSubjectLanguages().isEmpty());
@ -302,7 +302,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertNull(message.getSubject()); assertNull(message.getSubject());
assertFalse(message.getSubjectLanguages().isEmpty()); assertFalse(message.getSubjectLanguages().isEmpty());
@ -323,7 +323,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertNull(message.getSubject()); assertNull(message.getSubject());
assertFalse(message.getSubjectLanguages().isEmpty()); assertFalse(message.getSubjectLanguages().isEmpty());
@ -344,7 +344,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control)); message = PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
assertNull(message.getSubject()); assertNull(message.getSubject());
assertFalse(message.getSubjectLanguages().isEmpty()); assertFalse(message.getSubjectLanguages().isEmpty());
@ -378,7 +378,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
@ -403,7 +403,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage + "2") .t(defaultLanguage + "2")
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
@ -427,7 +427,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(otherLanguage, message.getBody()); assertEquals(otherLanguage, message.getBody());
@ -451,7 +451,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage + "2") .t(defaultLanguage + "2")
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
@ -474,7 +474,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
@ -497,7 +497,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getBody()); assertEquals(defaultLanguage, message.getBody());
@ -531,7 +531,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
@ -556,7 +556,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage + "2") .t(defaultLanguage + "2")
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
@ -580,7 +580,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage) .t(defaultLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(otherLanguage, message.getSubject()); assertEquals(otherLanguage, message.getSubject());
@ -604,7 +604,7 @@ public class PacketParserUtilsTest {
.t(defaultLanguage + "2") .t(defaultLanguage + "2")
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
@ -627,7 +627,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
@ -650,7 +650,7 @@ public class PacketParserUtilsTest {
.t(otherLanguage) .t(otherLanguage)
.asString(outputProperties); .asString(outputProperties);
message = (Message) PacketParserUtils message = PacketParserUtils
.parseMessage(PacketParserUtils.getParserFor(control)); .parseMessage(PacketParserUtils.getParserFor(control));
assertEquals(defaultLanguage, message.getSubject()); assertEquals(defaultLanguage, message.getSubject());
@ -682,7 +682,7 @@ public class PacketParserUtilsTest {
.t("Bad Message Body") .t("Bad Message Body")
.asString(outputProperties); .asString(outputProperties);
Message message = (Message) PacketParserUtils.parseMessage(TestUtils.getMessageParser(control)); Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control));
fail("Should throw exception. Instead got message: " + message.toXML().toString()); fail("Should throw exception. Instead got message: " + message.toXML().toString());
} }
@ -854,7 +854,7 @@ public class PacketParserUtilsTest {
XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML()); XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML());
} }
private String determineNonDefaultLanguage() { private static String determineNonDefaultLanguage() {
String otherLanguage = "jp"; String otherLanguage = "jp";
Locale[] availableLocales = Locale.getAvailableLocales(); Locale[] availableLocales = Locale.getAvailableLocales();
for (int i = 0; i < availableLocales.length; i++) { for (int i = 0; i < availableLocales.length; i++) {

View file

@ -54,7 +54,7 @@ public class CarbonTest extends ExperimentalInitializerTest {
.asString(outputProperties); .asString(outputProperties);
parser = PacketParserUtils.getParserFor(control); parser = PacketParserUtils.getParserFor(control);
cc = (CarbonExtension) new CarbonManagerProvider().parse(parser); cc = new CarbonManagerProvider().parse(parser);
fwd = cc.getForwarded(); fwd = cc.getForwarded();
// meta // meta
@ -85,7 +85,7 @@ public class CarbonTest extends ExperimentalInitializerTest {
.asString(outputProperties); .asString(outputProperties);
parser = PacketParserUtils.getParserFor(control); parser = PacketParserUtils.getParserFor(control);
cc = (CarbonExtension) new CarbonManagerProvider().parse(parser); cc = new CarbonManagerProvider().parse(parser);
assertEquals(CarbonExtension.Direction.received, cc.getDirection()); assertEquals(CarbonExtension.Direction.received, cc.getDirection());

View file

@ -68,7 +68,7 @@ public class MultipleRecipientInfo {
// TODO should return BareJid // TODO should return BareJid
public Jid getReplyRoom() { public Jid getReplyRoom() {
List<MultipleAddresses.Address> replyRoom = extension.getAddressesOfType(MultipleAddresses.Type.replyroom); List<MultipleAddresses.Address> replyRoom = extension.getAddressesOfType(MultipleAddresses.Type.replyroom);
return replyRoom.isEmpty() ? null : ((MultipleAddresses.Address) replyRoom.get(0)).getJid(); return replyRoom.isEmpty() ? null : replyRoom.get(0).getJid();
} }
/** /**
@ -92,6 +92,6 @@ public class MultipleRecipientInfo {
*/ */
public MultipleAddresses.Address getReplyAddress() { public MultipleAddresses.Address getReplyAddress() {
List<MultipleAddresses.Address> replyTo = extension.getAddressesOfType(MultipleAddresses.Type.replyto); List<MultipleAddresses.Address> replyTo = extension.getAddressesOfType(MultipleAddresses.Type.replyto);
return replyTo.isEmpty() ? null : (MultipleAddresses.Address) replyTo.get(0); return replyTo.isEmpty() ? null : replyTo.get(0);
} }
} }

View file

@ -98,7 +98,7 @@ public class AMPExtensionProvider extends ExtensionElementProvider<AMPExtension>
return ampExtension; return ampExtension;
} }
private AMPExtension.Condition createCondition(String name, String value) { private static AMPExtension.Condition createCondition(String name, String value) {
if (name == null || value == null) { if (name == null || value == null) {
LOGGER.severe("Can't create rule condition from null name and/or value"); LOGGER.severe("Can't create rule condition from null name and/or value");
return null; return null;

View file

@ -63,7 +63,7 @@ public class BookmarkManager {
public synchronized static BookmarkManager getBookmarkManager(XMPPConnection connection) public synchronized static BookmarkManager getBookmarkManager(XMPPConnection connection)
throws XMPPException, SmackException throws XMPPException, SmackException
{ {
BookmarkManager manager = (BookmarkManager) bookmarkManagerMap.get(connection); BookmarkManager manager = bookmarkManagerMap.get(connection);
if (manager == null) { if (manager == null) {
manager = new BookmarkManager(connection); manager = new BookmarkManager(connection);
} }

View file

@ -482,7 +482,7 @@ public class InBandBytestreamManager implements BytestreamManager {
* *
* @return a new unique session ID * @return a new unique session ID
*/ */
private String getNextSessionID() { private static String getNextSessionID() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append(SESSION_ID_PREFIX); buffer.append(SESSION_ID_PREFIX);
buffer.append(Math.abs(randomGenerator.nextLong())); buffer.append(Math.abs(randomGenerator.nextLong()));

View file

@ -295,7 +295,7 @@ public class InBandBytestreamSession implements BytestreamSession {
} }
// return byte and increment buffer pointer // return byte and increment buffer pointer
return ((int) buffer[bufferPointer++]) & 0xff; return buffer[bufferPointer++] & 0xff;
} }
public synchronized int read(byte[] b, int off, int len) throws IOException { public synchronized int read(byte[] b, int off, int len) throws IOException {

View file

@ -626,7 +626,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* @param proxy the proxy to query * @param proxy the proxy to query
* @return IQ packet to query a SOCKS5 proxy its network settings * @return IQ packet to query a SOCKS5 proxy its network settings
*/ */
private Bytestream createStreamHostRequest(Jid proxy) { private static Bytestream createStreamHostRequest(Jid proxy) {
Bytestream request = new Bytestream(); Bytestream request = new Bytestream();
request.setType(IQ.Type.get); request.setType(IQ.Type.get);
request.setTo(proxy); request.setTo(proxy);
@ -681,7 +681,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* @param streamHosts a list of SOCKS5 proxies the target should connect to * @param streamHosts a list of SOCKS5 proxies the target should connect to
* @return a SOCKS5 Bytestream initialization request packet * @return a SOCKS5 Bytestream initialization request packet
*/ */
private Bytestream createBytestreamInitiation(String sessionID, Jid targetJID, private static Bytestream createBytestreamInitiation(String sessionID, Jid targetJID,
List<StreamHost> streamHosts) { List<StreamHost> streamHosts) {
Bytestream initiation = new Bytestream(sessionID); Bytestream initiation = new Bytestream(sessionID);
@ -738,7 +738,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
* *
* @return a new unique session ID * @return a new unique session ID
*/ */
private String getNextSessionID() { private static String getNextSessionID() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append(SESSION_ID_PREFIX); buffer.append(SESSION_ID_PREFIX);
buffer.append(Math.abs(randomGenerator.nextLong())); buffer.append(Math.abs(randomGenerator.nextLong()));

View file

@ -309,7 +309,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
* *
* @param address the address the connection failure counter should be increased * @param address the address the connection failure counter should be increased
*/ */
private void incrementConnectionFailures(String address) { private static void incrementConnectionFailures(String address) {
Integer count = ADDRESS_BLACKLIST.get(address); Integer count = ADDRESS_BLACKLIST.get(address);
ADDRESS_BLACKLIST.put(address, count == null ? 1 : count + 1); ADDRESS_BLACKLIST.put(address, count == null ? 1 : count + 1);
} }
@ -320,7 +320,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
* @param address the address * @param address the address
* @return number of connection failures * @return number of connection failures
*/ */
private int getConnectionFailures(String address) { private static int getConnectionFailures(String address) {
Integer count = ADDRESS_BLACKLIST.get(address); Integer count = ADDRESS_BLACKLIST.get(address);
return count != null ? count : 0; return count != null ? count : 0;
} }

View file

@ -392,7 +392,7 @@ public class EntityCapsManager extends Manager {
return entityCapsEnabled; return entityCapsEnabled;
} }
public void setEntityNode(String entityNode) throws NotConnectedException { public void setEntityNode(String entityNode) {
this.entityNode = entityNode; this.entityNode = entityNode;
updateLocalEntityCaps(); updateLocalEntityCaps();
} }
@ -403,7 +403,7 @@ public class EntityCapsManager extends Manager {
* @param user * @param user
* the user (Full JID) * the user (Full JID)
*/ */
public void removeUserCapsNode(String user) { public static void removeUserCapsNode(String user) {
JID_TO_NODEVER_CACHE.remove(user); JID_TO_NODEVER_CACHE.remove(user);
} }

View file

@ -620,7 +620,7 @@ public class AdHocCommandManager extends Manager {
AdHocCommandInfo commandInfo = commands.get(commandNode); AdHocCommandInfo commandInfo = commands.get(commandNode);
LocalCommand command; LocalCommand command;
try { try {
command = (LocalCommand) commandInfo.getCommandInstance(); command = commandInfo.getCommandInstance();
command.setSessionID(sessionID); command.setSessionID(sessionID);
command.setName(commandInfo.getName()); command.setName(commandInfo.getName());
command.setNode(commandInfo.getNode()); command.setNode(commandInfo.getNode());

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smackx.commands.AdHocCommand;
import org.jivesoftware.smackx.commands.AdHocCommand.Action; import org.jivesoftware.smackx.commands.AdHocCommand.Action;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.AdHocCommandNote; import org.jivesoftware.smackx.commands.AdHocCommandNote;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.jivesoftware.smackx.xdata.provider.DataFormProvider; import org.jivesoftware.smackx.xdata.provider.DataFormProvider;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -93,7 +92,7 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
adHocCommandData.addAction(AdHocCommand.Action.prev); adHocCommandData.addAction(AdHocCommand.Action.prev);
} }
else if (elementName.equals("x") && namespace.equals("jabber:x:data")) { else if (elementName.equals("x") && namespace.equals("jabber:x:data")) {
adHocCommandData.setForm((DataForm) dataFormProvider.parse(parser)); adHocCommandData.setForm(dataFormProvider.parse(parser));
} }
else if (parser.getName().equals("note")) { else if (parser.getName().equals("note")) {
AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf( AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(

View file

@ -126,7 +126,7 @@ public class FileTransferManager extends Manager {
} }
return new OutgoingFileTransfer(connection().getUser(), userID, return new OutgoingFileTransfer(connection().getUser(), userID,
fileTransferNegotiator.getNextStreamID(), FileTransferNegotiator.getNextStreamID(),
fileTransferNegotiator); fileTransferNegotiator);
} }

View file

@ -214,7 +214,7 @@ public class FileTransferNegotiator extends Manager {
return selectedStreamNegotiator; return selectedStreamNegotiator;
} }
private FormField getStreamMethodField(DataForm form) { private static FormField getStreamMethodField(DataForm form) {
for (FormField field : form.getFields()) { for (FormField field : form.getFields()) {
if (field.getVariable().equals(STREAM_DATA_FIELD_NAME)) { if (field.getVariable().equals(STREAM_DATA_FIELD_NAME)) {
return field; return field;
@ -260,7 +260,7 @@ public class FileTransferNegotiator extends Manager {
* *
* @return Returns a new, unique, stream ID to identify a file transfer. * @return Returns a new, unique, stream ID to identify a file transfer.
*/ */
public String getNextStreamID() { public static String getNextStreamID() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append(STREAM_INIT_PREFIX); buffer.append(STREAM_INIT_PREFIX);
buffer.append(Math.abs(randomGenerator.nextLong())); buffer.append(Math.abs(randomGenerator.nextLong()));
@ -368,7 +368,7 @@ public class FileTransferNegotiator extends Manager {
} }
} }
private DataForm createDefaultInitiationForm() { private static DataForm createDefaultInitiationForm() {
DataForm form = new DataForm(DataForm.Type.form); DataForm form = new DataForm(DataForm.Type.form);
FormField field = new FormField(STREAM_DATA_FIELD_NAME); FormField field = new FormField(STREAM_DATA_FIELD_NAME);
field.setType(FormField.Type.list_single); field.setType(FormField.Type.list_single);

View file

@ -64,6 +64,7 @@ public class ForwardedProvider extends ExtensionElementProvider<Forwarded> {
default: default:
LOGGER.warning("Unsupported forwarded packet type: " + name); LOGGER.warning("Unsupported forwarded packet type: " + name);
} }
break;
case XmlPullParser.END_TAG: case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) { if (parser.getDepth() == initialDepth) {
break outerloop; break outerloop;

View file

@ -146,6 +146,7 @@ public class LastActivityManager extends Manager {
// We assume that only a switch to available and chat indicates user activity // We assume that only a switch to available and chat indicates user activity
// since other mode changes could be also a result of some sort of automatism // since other mode changes could be also a result of some sort of automatism
resetIdleTime(); resetIdleTime();
break;
default: default:
break; break;
} }

View file

@ -99,7 +99,7 @@ public class PrivateDataManager extends Manager {
*/ */
public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) { public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) {
String key = getProviderKey(elementName, namespace); String key = getProviderKey(elementName, namespace);
return (PrivateDataProvider)privateDataProviders.get(key); return privateDataProviders.get(key);
} }
/** /**

View file

@ -115,7 +115,7 @@ public class DefaultPrivateData implements PrivateData {
if (map == null) { if (map == null) {
return null; return null;
} }
return (String)map.get(name); return map.get(name);
} }
/** /**

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2014 Florian Schmaus * Copyright 2003-2007 Jive Software, 2014-2015 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smackx.muc.packet; package org.jivesoftware.smackx.muc.packet;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.NamedElement; import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.muc.MUCAffiliation; import org.jivesoftware.smackx.muc.MUCAffiliation;
import org.jivesoftware.smackx.muc.MUCRole; import org.jivesoftware.smackx.muc.MUCRole;
@ -30,7 +30,7 @@ import org.jxmpp.jid.parts.Resourcepart;
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class MUCItem implements NamedElement { public class MUCItem implements NamedElement {
public static final String ELEMENT = IQ.ITEM; public static final String ELEMENT = Stanza.ITEM;
private final MUCAffiliation affiliation; private final MUCAffiliation affiliation;
private final MUCRole role; private final MUCRole role;
@ -156,7 +156,7 @@ public class MUCItem implements NamedElement {
if (getActor() != null) { if (getActor() != null) {
xml.halfOpenElement("actor").attribute("jid", getActor()).closeEmptyElement(); xml.halfOpenElement("actor").attribute("jid", getActor()).closeEmptyElement();
} }
xml.closeElement(IQ.ITEM); xml.closeElement(Stanza.ITEM);
return xml; return xml;
} }

View file

@ -51,6 +51,7 @@ public class MUCParserUtils {
reason = parser.nextText(); reason = parser.nextText();
break; break;
} }
break;
case XmlPullParser.END_TAG: case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) { if (parser.getDepth() == initialDepth) {
break outerloop; break outerloop;

View file

@ -225,7 +225,7 @@ public class OfflineMessageRequest extends IQ {
return request; return request;
} }
private Item parseItem(XmlPullParser parser) private static Item parseItem(XmlPullParser parser)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
boolean done = false; boolean done = false;
Item item = new Item(parser.getAttributeValue("", "node")); Item item = new Item(parser.getAttributeValue("", "node"));

View file

@ -82,7 +82,7 @@ public class Affiliation implements ExtensionElement
return builder.toString(); return builder.toString();
} }
private void appendAttribute(StringBuilder builder, String att, String value) private static void appendAttribute(StringBuilder builder, String att, String value)
{ {
builder.append(" "); builder.append(" ");
builder.append(att); builder.append(att);

View file

@ -707,7 +707,7 @@ public class ConfigureForm extends Form
} }
} }
private List<String> getListSingle(String value) private static List<String> getListSingle(String value)
{ {
List<String> list = new ArrayList<String>(1); List<String> list = new ArrayList<String>(1);
list.add(value); list.add(value);

View file

@ -553,7 +553,7 @@ abstract public class Node
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
// CHECKSTYLE:ON // CHECKSTYLE:ON
ItemsExtension itemsElem = (ItemsExtension)event.getEvent(); ItemsExtension itemsElem = (ItemsExtension)event.getEvent();
ItemPublishEvent eventItems = new ItemPublishEvent(itemsElem.getNode(), (List<Item>)itemsElem.getItems(), getSubscriptionIds(packet), DelayInformationManager.getDelayTimestamp(packet)); ItemPublishEvent eventItems = new ItemPublishEvent(itemsElem.getNode(), itemsElem.getItems(), getSubscriptionIds(packet), DelayInformationManager.getDelayTimestamp(packet));
listener.handlePublishedItems(eventItems); listener.handlePublishedItems(eventItems);
} }
} }

View file

@ -170,7 +170,6 @@ final public class PubSubManager
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @throws InterruptedException
*/ */
@SuppressWarnings("unchecked")
public <T extends Node> T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException public <T extends Node> T getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
{ {
Node node = nodeMap.get(id); Node node = nodeMap.get(id);
@ -203,7 +202,9 @@ final public class PubSubManager
node.setTo(to); node.setTo(to);
nodeMap.put(id, node); nodeMap.put(id, node);
} }
return (T) node; @SuppressWarnings("unchecked")
T res = (T) node;
return res;
} }
/** /**

View file

@ -151,7 +151,7 @@ public class Subscription extends NodeExtension
return builder.toString(); return builder.toString();
} }
private void appendAttribute(StringBuilder builder, String att, String value) private static void appendAttribute(StringBuilder builder, String att, String value)
{ {
builder.append(" "); builder.append(" ");
builder.append(att); builder.append(att);

View file

@ -52,6 +52,7 @@ public class PubSub extends IQ
* *
* @return the XML element name of the packet extension. * @return the XML element name of the packet extension.
*/ */
@SuppressWarnings("static-method")
public String getElementName() { public String getElementName() {
return ELEMENT; return ELEMENT;
} }

View file

@ -254,10 +254,12 @@ public class VCardProvider extends IQProvider<VCard> {
default: default:
break; break;
} }
break;
case XmlPullParser.END_TAG: case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) { if (parser.getDepth() == initialDepth) {
break outerloop; break outerloop;
} }
break;
default: default:
break; break;
} }

View file

@ -91,7 +91,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
return dataForm; return dataForm;
} }
private FormField parseField(XmlPullParser parser) throws XmlPullParserException, IOException { private static FormField parseField(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
final String var = parser.getAttributeValue("", "var"); final String var = parser.getAttributeValue("", "var");
final FormField.Type type = FormField.Type.fromString(parser.getAttributeValue("", "type")); final FormField.Type type = FormField.Type.fromString(parser.getAttributeValue("", "type"));
@ -131,6 +131,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
} }
break; break;
} }
break;
case XmlPullParser.END_TAG: case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) { if (parser.getDepth() == initialDepth) {
break outerloop; break outerloop;
@ -141,7 +142,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
return formField; return formField;
} }
private DataForm.Item parseItem(XmlPullParser parser) throws XmlPullParserException, IOException { private static DataForm.Item parseItem(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
List<FormField> fields = new ArrayList<FormField>(); List<FormField> fields = new ArrayList<FormField>();
outerloop: while (true) { outerloop: while (true) {
@ -165,7 +166,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
return new DataForm.Item(fields); return new DataForm.Item(fields);
} }
private DataForm.ReportedData parseReported(XmlPullParser parser) throws XmlPullParserException, IOException { private static DataForm.ReportedData parseReported(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
List<FormField> fields = new ArrayList<FormField>(); List<FormField> fields = new ArrayList<FormField>();
outerloop: while (true) { outerloop: while (true) {
@ -189,7 +190,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
return new DataForm.ReportedData(fields); return new DataForm.ReportedData(fields);
} }
private FormField.Option parseOption(XmlPullParser parser) throws XmlPullParserException, IOException { private static FormField.Option parseOption(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
FormField.Option option = null; FormField.Option option = null;
String label = parser.getAttributeValue("", "label"); String label = parser.getAttributeValue("", "label");

View file

@ -69,7 +69,7 @@ public class DelayInformationTest extends InitExtensions {
.asString(outputProperties); .asString(outputProperties);
parser = PacketParserUtils.getParserFor(control); parser = PacketParserUtils.getParserFor(control);
delayInfo = (DelayInformation) p.parse(parser); delayInfo = p.parse(parser);
assertEquals("capulet.com", delayInfo.getFrom()); assertEquals("capulet.com", delayInfo.getFrom());
assertEquals(date, delayInfo.getStamp()); assertEquals(date, delayInfo.getStamp());
@ -85,7 +85,7 @@ public class DelayInformationTest extends InitExtensions {
.asString(outputProperties); .asString(outputProperties);
parser = PacketParserUtils.getParserFor(control); parser = PacketParserUtils.getParserFor(control);
delayInfo = (DelayInformation) p.parse(parser); delayInfo = p.parse(parser);
assertEquals("capulet.com", delayInfo.getFrom()); assertEquals("capulet.com", delayInfo.getFrom());
assertEquals(date, delayInfo.getStamp()); assertEquals(date, delayInfo.getStamp());
@ -109,7 +109,7 @@ public class DelayInformationTest extends InitExtensions {
.a("stamp", "2002-09-10T23:08:25.12Z") .a("stamp", "2002-09-10T23:08:25.12Z")
.asString(outputProperties); .asString(outputProperties);
delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); delayInfo = p.parse(PacketParserUtils.getParserFor(control));
GregorianCalendar cal = (GregorianCalendar) calendar.clone(); GregorianCalendar cal = (GregorianCalendar) calendar.clone();
cal.add(Calendar.MILLISECOND, 120); cal.add(Calendar.MILLISECOND, 120);
@ -122,7 +122,7 @@ public class DelayInformationTest extends InitExtensions {
.a("stamp", "2002-09-10T23:08:25Z") .a("stamp", "2002-09-10T23:08:25Z")
.asString(outputProperties); .asString(outputProperties);
delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); delayInfo = p.parse(PacketParserUtils.getParserFor(control));
assertEquals(calendar.getTime(), delayInfo.getStamp()); assertEquals(calendar.getTime(), delayInfo.getStamp());
@ -133,7 +133,7 @@ public class DelayInformationTest extends InitExtensions {
.a("stamp", "2002-9-10T23:08:25Z") .a("stamp", "2002-9-10T23:08:25Z")
.asString(outputProperties); .asString(outputProperties);
delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); delayInfo = p.parse(PacketParserUtils.getParserFor(control));
assertEquals(calendar.getTime(), delayInfo.getStamp()); assertEquals(calendar.getTime(), delayInfo.getStamp());
} }
@ -152,7 +152,7 @@ public class DelayInformationTest extends InitExtensions {
.a("stamp", "20020910T23:08:25") .a("stamp", "20020910T23:08:25")
.asString(outputProperties); .asString(outputProperties);
delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); delayInfo = p.parse(PacketParserUtils.getParserFor(control));
assertEquals(calendar.getTime(), delayInfo.getStamp()); assertEquals(calendar.getTime(), delayInfo.getStamp());
@ -172,7 +172,7 @@ public class DelayInformationTest extends InitExtensions {
.a("stamp", dateFormat.format(dateInPast.getTime())) .a("stamp", dateFormat.format(dateInPast.getTime()))
.asString(outputProperties); .asString(outputProperties);
delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); delayInfo = p.parse(PacketParserUtils.getParserFor(control));
assertEquals(dateInPast.getTime(), delayInfo.getStamp()); assertEquals(dateInPast.getTime(), delayInfo.getStamp());
@ -183,7 +183,7 @@ public class DelayInformationTest extends InitExtensions {
.a("stamp", "200868T09:16:20") .a("stamp", "200868T09:16:20")
.asString(outputProperties); .asString(outputProperties);
delayInfo = (DelayInformation) p.parse(PacketParserUtils.getParserFor(control)); delayInfo = p.parse(PacketParserUtils.getParserFor(control));
Date controlDate = XmppDateTime.parseDate("2008-06-08T09:16:20.0Z"); Date controlDate = XmppDateTime.parseDate("2008-06-08T09:16:20.0Z");
assertEquals(controlDate, delayInfo.getStamp()); assertEquals(controlDate, delayInfo.getStamp());
@ -209,6 +209,6 @@ public class DelayInformationTest extends InitExtensions {
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
DelayInformation delay = DelayInformationManager.getXep203DelayInformation(presence); DelayInformation delay = DelayInformationManager.getXep203DelayInformation(presence);
assertNull((Object)delay); assertNull(delay);
} }
} }

View file

@ -52,7 +52,7 @@ public class ForwardedTest {
.asString(outputProperties); .asString(outputProperties);
parser = PacketParserUtils.getParserFor(control); parser = PacketParserUtils.getParserFor(control);
fwd = (Forwarded) new ForwardedProvider().parse(parser); fwd = new ForwardedProvider().parse(parser);
// no delay in packet // no delay in packet
assertEquals(null, fwd.getDelayInformation()); assertEquals(null, fwd.getDelayInformation());
@ -79,7 +79,7 @@ public class ForwardedTest {
// @formatter:on // @formatter:on
parser = PacketParserUtils.getParserFor(control); parser = PacketParserUtils.getParserFor(control);
fwd = (Forwarded) new ForwardedProvider().parse(parser); fwd = new ForwardedProvider().parse(parser);
// assert there is delay information in packet // assert there is delay information in packet
DelayInformation delay = fwd.getDelayInformation(); DelayInformation delay = fwd.getDelayInformation();

View file

@ -90,10 +90,9 @@ public class JMFInit extends Frame implements Runnable {
tempDir = args[0]; tempDir = args[0];
message("Setting cache directory to " + tempDir); message("Setting cache directory to " + tempDir);
Registry r = new Registry();
try { try {
r.set("secure.cacheDir", tempDir); Registry.set("secure.cacheDir", tempDir);
r.commit(); Registry.commit();
message("Updated registry"); message("Updated registry");
} }
@ -207,6 +206,7 @@ public class JMFInit extends Frame implements Runnable {
PlugInManager.addPlugIn(dar, inputFormats, new Format[0], PlugInManager.addPlugIn(dar, inputFormats, new Format[0],
plType); plType);
// Move it to the top of the list // Move it to the top of the list
@SuppressWarnings("unchecked")
Vector<String> rendList = PlugInManager.getPlugInList(null, null, Vector<String> rendList = PlugInManager.getPlugInList(null, null,
plType); plType);
int listSize = rendList.size(); int listSize = rendList.size();
@ -244,6 +244,7 @@ public class JMFInit extends Frame implements Runnable {
if (rend instanceof ExclusiveUse if (rend instanceof ExclusiveUse
&& !((ExclusiveUse) rend).isExclusive()) { && !((ExclusiveUse) rend).isExclusive()) {
// sol8+, DAR supports mixing // sol8+, DAR supports mixing
@SuppressWarnings("unchecked")
Vector<String> rendList = PlugInManager.getPlugInList(null, null, Vector<String> rendList = PlugInManager.getPlugInList(null, null,
plType); plType);
int listSize = rendList.size(); int listSize = rendList.size();
@ -251,7 +252,7 @@ public class JMFInit extends Frame implements Runnable {
String rname = null; String rname = null;
for (int i = 0; i < listSize; i++) { for (int i = 0; i < listSize; i++) {
rname = (String) (rendList.elementAt(i)); rname = rendList.elementAt(i);
if (rname.equals(dar)) { // DAR is in the registry if (rname.equals(dar)) { // DAR is in the registry
found = true; found = true;
rendList.removeElementAt(i); rendList.removeElementAt(i);

View file

@ -17,6 +17,8 @@
package org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api; package org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -71,13 +73,13 @@ public class OctTreeQuantizer implements Quantizer {
private int reduceColors; private int reduceColors;
private int maximumColors; private int maximumColors;
private int colors = 0; private int colors = 0;
private Vector<OctTreeNode>[] colorList; private List<Vector<OctTreeNode>> colorList;
public OctTreeQuantizer() { public OctTreeQuantizer() {
setup(256); setup(256);
colorList = new Vector[MAX_LEVEL+1]; colorList = new ArrayList<>(MAX_LEVEL+1);
for (int i = 0; i < MAX_LEVEL+1; i++) for (int i = 0; i < MAX_LEVEL+1; i++)
colorList[i] = new Vector<OctTreeNode>(); colorList.add(i, new Vector<OctTreeNode>());
root = new OctTreeNode(); root = new OctTreeNode();
} }
@ -171,7 +173,7 @@ public class OctTreeQuantizer implements Quantizer {
node.leaf[index] = child; node.leaf[index] = child;
node.isLeaf = false; node.isLeaf = false;
nodes++; nodes++;
colorList[level].addElement(child); colorList.get(level).addElement(child);
if (level == MAX_LEVEL) { if (level == MAX_LEVEL) {
child.isLeaf = true; child.isLeaf = true;
@ -199,7 +201,7 @@ public class OctTreeQuantizer implements Quantizer {
private void reduceTree(int numColors) { private void reduceTree(int numColors) {
for (int level = MAX_LEVEL-1; level >= 0; level--) { for (int level = MAX_LEVEL-1; level >= 0; level--) {
Vector<OctTreeNode> v = colorList[level]; Vector<OctTreeNode> v = colorList.get(level);
if (v != null && v.size() > 0) { if (v != null && v.size() > 0) {
for (int j = 0; j < v.size(); j++) { for (int j = 0; j < v.size(); j++) {
OctTreeNode node = v.elementAt(j); OctTreeNode node = v.elementAt(j);
@ -217,7 +219,7 @@ public class OctTreeQuantizer implements Quantizer {
node.children--; node.children--;
colors--; colors--;
nodes--; nodes--;
colorList[level+1].removeElement(child); colorList.get(level+1).removeElement(child);
} }
} }
node.isLeaf = true; node.isLeaf = true;

View file

@ -392,6 +392,7 @@ public class RTPBridge extends IQ {
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @throws InterruptedException
*/ */
@SuppressWarnings("deprecation")
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException { public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) { if (!connection.isConnected()) {
@ -459,6 +460,7 @@ public class RTPBridge extends IQ {
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @throws InterruptedException
*/ */
@SuppressWarnings("deprecation")
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException { public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) { if (!connection.isConnected()) {
@ -495,6 +497,7 @@ public class RTPBridge extends IQ {
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @throws InterruptedException
*/ */
@SuppressWarnings("deprecation")
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException { public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException {
if (!xmppConnection.isConnected()) { if (!xmppConnection.isConnected()) {

View file

@ -175,6 +175,7 @@ public class STUN extends SimpleIQ {
* @throws NotConnectedException * @throws NotConnectedException
* @throws InterruptedException * @throws InterruptedException
*/ */
@SuppressWarnings("deprecation")
public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException { public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) { if (!connection.isConnected()) {

View file

@ -133,7 +133,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* *
* @param bestLocalCandidate the acceptedLocalCandidate to set * @param bestLocalCandidate the acceptedLocalCandidate to set
*/ */
private void setAcceptedLocalCandidate(TransportCandidate bestLocalCandidate) throws XMPPException { private void setAcceptedLocalCandidate(TransportCandidate bestLocalCandidate) {
for (int i = 0; i < resolver.getCandidateCount(); i++) { for (int i = 0; i < resolver.getCandidateCount(); i++) {
//TODO FIX The EQUAL Sentence //TODO FIX The EQUAL Sentence
if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp()) if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp())
@ -708,7 +708,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @param jingleTransport * @param jingleTransport
* @return the iq * @return the iq
*/ */
private IQ receiveTransportInfoAction(Jingle jingle) throws XMPPException { private IQ receiveTransportInfoAction(Jingle jingle) {
IQ response = null; IQ response = null;
// Parse the Jingle and get any proposed transport candidates // Parse the Jingle and get any proposed transport candidates
@ -755,7 +755,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
LOGGER.fine("Remote acccepted candidate addr: " + cand.getIp()); LOGGER.fine("Remote acccepted candidate addr: " + cand.getIp());
} }
TransportCandidate cand = (TransportCandidate) accepted.get(0); TransportCandidate cand = accepted.get(0);
setAcceptedLocalCandidate(cand); setAcceptedLocalCandidate(cand);
if (isEstablished()) { if (isEstablished()) {
@ -770,7 +770,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @param jingle * @param jingle
* @return the iq * @return the iq
*/ */
private IQ receiveSessionAcceptAction(Jingle jingle) { private static IQ receiveSessionAcceptAction(Jingle jingle) {
IQ response = null; IQ response = null;
LOGGER.fine("Transport stabilished"); LOGGER.fine("Transport stabilished");
@ -855,7 +855,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
ArrayList<TransportCandidate> cands = getValidRemoteCandidatesList(); ArrayList<TransportCandidate> cands = getValidRemoteCandidatesList();
if (!cands.isEmpty()) { if (!cands.isEmpty()) {
LOGGER.fine("RAW CAND"); LOGGER.fine("RAW CAND");
return (TransportCandidate) cands.get(0); return cands.get(0);
} else { } else {
LOGGER.fine("No Remote Candidate"); LOGGER.fine("No Remote Candidate");
return null; return null;

View file

@ -310,7 +310,7 @@ public abstract class TransportResolver {
if (cands.size() > 0) { if (cands.size() > 0) {
Collections.sort(cands); Collections.sort(cands);
// Return the last candidate // Return the last candidate
result = (TransportCandidate) cands.get(cands.size() - 1); result = cands.get(cands.size() - 1);
LOGGER.fine("Result: " + result.getIp()); LOGGER.fine("Result: " + result.getIp());
} }
@ -352,7 +352,7 @@ public abstract class TransportResolver {
TransportCandidate cand; TransportCandidate cand;
synchronized (candidates) { synchronized (candidates) {
cand = (TransportCandidate) candidates.get(i); cand = candidates.get(i);
} }
return cand; return cand;
} }

View file

@ -125,7 +125,7 @@ public abstract class JingleDescription implements ExtensionElement {
Iterator<PayloadType> jinglePtsIter = getPayloadTypes(); Iterator<PayloadType> jinglePtsIter = getPayloadTypes();
while (jinglePtsIter.hasNext()) { while (jinglePtsIter.hasNext()) {
PayloadType jpt = (PayloadType) jinglePtsIter.next(); PayloadType jpt = jinglePtsIter.next();
if (jpt instanceof PayloadType.Audio) { if (jpt instanceof PayloadType.Audio) {
PayloadType.Audio jpta = (PayloadType.Audio) jpt; PayloadType.Audio jpta = (PayloadType.Audio) jpt;
result.add(jpta); result.add(jpta);

View file

@ -63,7 +63,7 @@ public class JingleProvider extends IQProvider<Jingle> {
JingleDescriptionProvider jdpAudio = new JingleDescriptionProvider.Audio(); JingleDescriptionProvider jdpAudio = new JingleDescriptionProvider.Audio();
JingleTransportProvider jtpRawUdp = new JingleTransportProvider.RawUdp(); JingleTransportProvider jtpRawUdp = new JingleTransportProvider.RawUdp();
JingleTransportProvider jtpIce = new JingleTransportProvider.Ice(); JingleTransportProvider jtpIce = new JingleTransportProvider.Ice();
ExtensionElementProvider jmipAudio = new JingleContentInfoProvider.Audio(); ExtensionElementProvider<?> jmipAudio = new JingleContentInfoProvider.Audio();
int eventType; int eventType;
String elementName; String elementName;
@ -93,19 +93,19 @@ public class JingleProvider extends IQProvider<Jingle> {
if (elementName.equals(JingleContent.NODENAME)) { if (elementName.equals(JingleContent.NODENAME)) {
// Add a new <content> element to the jingle // Add a new <content> element to the jingle
currentContent = (JingleContent) jcp.parse(parser); currentContent = jcp.parse(parser);
jingle.addContent(currentContent); jingle.addContent(currentContent);
} else if (elementName.equals(JingleDescription.NODENAME) && namespace.equals(JingleDescription.Audio.NAMESPACE)) { } else if (elementName.equals(JingleDescription.NODENAME) && namespace.equals(JingleDescription.Audio.NAMESPACE)) {
// Set the <description> element of the <content> // Set the <description> element of the <content>
currentContent.setDescription((JingleDescription) jdpAudio.parse(parser)); currentContent.setDescription(jdpAudio.parse(parser));
} else if (elementName.equals(JingleTransport.NODENAME)) { } else if (elementName.equals(JingleTransport.NODENAME)) {
// Add all of the <transport> elements to the <content> of the jingle // Add all of the <transport> elements to the <content> of the jingle
// Parse the possible transport namespaces // Parse the possible transport namespaces
if (namespace.equals(JingleTransport.RawUdp.NAMESPACE)) { if (namespace.equals(JingleTransport.RawUdp.NAMESPACE)) {
currentContent.addJingleTransport((JingleTransport) jtpRawUdp.parse(parser)); currentContent.addJingleTransport(jtpRawUdp.parse(parser));
} else if (namespace.equals(JingleTransport.Ice.NAMESPACE)) { } else if (namespace.equals(JingleTransport.Ice.NAMESPACE)) {
currentContent.addJingleTransport((JingleTransport) jtpIce.parse(parser)); currentContent.addJingleTransport(jtpIce.parse(parser));
} else { } else {
throw new SmackException("Unknown transport namespace \"" + namespace + "\" in Jingle packet."); throw new SmackException("Unknown transport namespace \"" + namespace + "\" in Jingle packet.");
} }

View file

@ -217,7 +217,7 @@ public class AgentRoster {
Presence presence = null; Presence presence = null;
while (it.hasNext()) { while (it.hasNext()) {
p = (Presence)userPresences.get(it.next()); p = userPresences.get(it.next());
if (presence == null){ if (presence == null){
presence = p; presence = p;
} }
@ -346,7 +346,7 @@ public class AgentRoster {
// Fire an event. // Fire an event.
synchronized (entries) { synchronized (entries) {
for (Iterator<String> i = entries.iterator(); i.hasNext();) { for (Iterator<String> i = entries.iterator(); i.hasNext();) {
String entry = (String)i.next(); String entry = i.next();
if (entry.equals(key.asBareJidIfPossible())) { if (entry.equals(key.asBareJidIfPossible())) {
fireEvent(EVENT_PRESENCE_CHANGED, packet); fireEvent(EVENT_PRESENCE_CHANGED, packet);
} }

View file

@ -51,7 +51,7 @@ public class MacroGroup {
Collection<Macro> col = Collections.unmodifiableList(macros); Collection<Macro> col = Collections.unmodifiableList(macros);
Iterator<Macro> iter = col.iterator(); Iterator<Macro> iter = col.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Macro macro = (Macro)iter.next(); Macro macro = iter.next();
if (macro.getTitle().equalsIgnoreCase(title)) { if (macro.getTitle().equalsIgnoreCase(title)) {
return macro; return macro;
} }
@ -68,14 +68,14 @@ public class MacroGroup {
} }
public Macro getMacro(int location) { public Macro getMacro(int location) {
return (Macro)macros.get(location); return macros.get(location);
} }
public MacroGroup getMacroGroupByTitle(String title) { public MacroGroup getMacroGroupByTitle(String title) {
Collection<MacroGroup> col = Collections.unmodifiableList(macroGroups); Collection<MacroGroup> col = Collections.unmodifiableList(macroGroups);
Iterator<MacroGroup> iter = col.iterator(); Iterator<MacroGroup> iter = col.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
MacroGroup group = (MacroGroup)iter.next(); MacroGroup group = iter.next();
if (group.getTitle().equalsIgnoreCase(title)) { if (group.getTitle().equalsIgnoreCase(title)) {
return group; return group;
} }
@ -84,7 +84,7 @@ public class MacroGroup {
} }
public MacroGroup getMacroGroup(int location) { public MacroGroup getMacroGroup(int location) {
return (MacroGroup)macroGroups.get(location); return macroGroups.get(location);
} }

View file

@ -102,7 +102,7 @@ public class AgentStatus implements ExtensionElement {
if (!currentChats.isEmpty()) { if (!currentChats.isEmpty()) {
buf.append("<current-chats xmlns= \"http://jivesoftware.com/protocol/workgroup\">"); buf.append("<current-chats xmlns= \"http://jivesoftware.com/protocol/workgroup\">");
for (Iterator<ChatInfo> it = currentChats.iterator(); it.hasNext();) { for (Iterator<ChatInfo> it = currentChats.iterator(); it.hasNext();) {
buf.append(((ChatInfo)it.next()).toXML()); buf.append(it.next().toXML());
} }
buf.append("</current-chats>"); buf.append("</current-chats>");
} }
@ -251,7 +251,7 @@ public class AgentStatus implements ExtensionElement {
return agentStatus; return agentStatus;
} }
private ChatInfo parseChatInfo(XmlPullParser parser) { private static ChatInfo parseChatInfo(XmlPullParser parser) {
String sessionID = parser.getAttributeValue("", "sessionID"); String sessionID = parser.getAttributeValue("", "sessionID");
String userID = parser.getAttributeValue("", "userID"); String userID = parser.getAttributeValue("", "userID");

View file

@ -75,7 +75,7 @@ public class AgentStatusRequest extends IQ {
buf.rightAngleBracket(); buf.rightAngleBracket();
synchronized (agents) { synchronized (agents) {
for (Iterator<Item> i=agents.iterator(); i.hasNext(); ) { for (Iterator<Item> i=agents.iterator(); i.hasNext(); ) {
Item item = (Item) i.next(); Item item = i.next();
buf.append("<agent jid=\"").append(item.getJID()).append("\">"); buf.append("<agent jid=\"").append(item.getJID()).append("\">");
if (item.getName() != null) { if (item.getName() != null) {
buf.append("<name xmlns=\""+ AgentInfo.NAMESPACE + "\">"); buf.append("<name xmlns=\""+ AgentInfo.NAMESPACE + "\">");

View file

@ -112,7 +112,7 @@ public class QueueDetails implements ExtensionElement {
synchronized (users) { synchronized (users) {
for (Iterator<QueueUser> i=users.iterator(); i.hasNext(); ) { for (Iterator<QueueUser> i=users.iterator(); i.hasNext(); ) {
QueueUser user = (QueueUser)i.next(); QueueUser user = i.next();
int position = user.getQueuePosition(); int position = user.getQueuePosition();
int timeRemaining = user.getEstimatedRemainingTime(); int timeRemaining = user.getEstimatedRemainingTime();
Date timestamp = user.getQueueJoinTimestamp(); Date timestamp = user.getQueueJoinTimestamp();

View file

@ -101,7 +101,7 @@ public class ChatSettings extends IQ {
public ChatSetting getFirstEntry() { public ChatSetting getFirstEntry() {
if (settings.size() > 0) { if (settings.size() > 0) {
return (ChatSetting)settings.get(0); return settings.get(0);
} }
return null; return null;
} }
@ -146,7 +146,7 @@ public class ChatSettings extends IQ {
return chatSettings; return chatSettings;
} }
private ChatSetting parseChatSetting(XmlPullParser parser) throws XmlPullParserException, IOException { private static ChatSetting parseChatSetting(XmlPullParser parser) throws XmlPullParserException, IOException {
boolean done = false; boolean done = false;
String key = null; String key = null;

View file

@ -174,7 +174,7 @@ public class MessageEventManager extends Manager {
Method method = Method method =
MessageEventRequestListener.class.getDeclaredMethod( MessageEventRequestListener.class.getDeclaredMethod(
methodName, methodName,
new Class[] { String.class, String.class, MessageEventManager.class }); new Class<?>[] { String.class, String.class, MessageEventManager.class });
for (MessageEventRequestListener listener : messageEventRequestListeners) { for (MessageEventRequestListener listener : messageEventRequestListeners) {
method.invoke(listener, new Object[] { from, packetID, this }); method.invoke(listener, new Object[] { from, packetID, this });
} }
@ -194,7 +194,7 @@ public class MessageEventManager extends Manager {
Method method = Method method =
MessageEventNotificationListener.class.getDeclaredMethod( MessageEventNotificationListener.class.getDeclaredMethod(
methodName, methodName,
new Class[] { String.class, String.class }); new Class<?>[] { String.class, String.class });
for (MessageEventNotificationListener listener : messageEventNotificationListeners) { for (MessageEventNotificationListener listener : messageEventNotificationListeners) {
method.invoke(listener, new Object[] { from, packetID }); method.invoke(listener, new Object[] { from, packetID });
} }

View file

@ -70,7 +70,7 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
} else if (eventType == XmlPullParser.END_TAG) { } else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("item")) { if (parser.getName().equals("item")) {
// Create packet. // Create packet.
remoteRosterEntry = new RemoteRosterEntry(jid, name, (String[]) groupsName.toArray(new String[groupsName.size()])); remoteRosterEntry = new RemoteRosterEntry(jid, name, groupsName.toArray(new String[groupsName.size()]));
rosterExchange.addRosterEntry(remoteRosterEntry); rosterExchange.addRosterEntry(remoteRosterEntry);
} }
if (parser.getName().equals("x")) { if (parser.getName().equals("x")) {