mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Add more checkstyle tests
- Lines containing tab(s) after space - Usage of printStackTrace - Usage of println - Add SupressionCommentFilter module SuppressionCommentFilter can be enabled with // CHECKSTYLE:OFF and disabled with // CHECKSTYLE:ON
This commit is contained in:
parent
4f64bb1036
commit
b2221d5483
59 changed files with 382 additions and 202 deletions
|
@ -6,6 +6,7 @@
|
||||||
<module name="SuppressionFilter">
|
<module name="SuppressionFilter">
|
||||||
<property name="file" value="config/suppressions.xml"/>
|
<property name="file" value="config/suppressions.xml"/>
|
||||||
</module>
|
</module>
|
||||||
|
<module name="SuppressionCommentFilter"/>
|
||||||
<module name="Header">
|
<module name="Header">
|
||||||
<property name="headerFile" value="config/header.txt"/>
|
<property name="headerFile" value="config/header.txt"/>
|
||||||
<property name="ignoreLines" value="3"/>
|
<property name="ignoreLines" value="3"/>
|
||||||
|
@ -22,6 +23,10 @@
|
||||||
<property name="format" value="^\s+$"/>
|
<property name="format" value="^\s+$"/>
|
||||||
<property name="message" value="Line containing only whitespace character(s)"/>
|
<property name="message" value="Line containing only whitespace character(s)"/>
|
||||||
</module>
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="^ +\t+"/>
|
||||||
|
<property name="message" value="Line containing tab(s) after space"/>
|
||||||
|
</module>
|
||||||
<!-- TODO enable this once eclilpse does no longer add javadoc with trailing whitespaces
|
<!-- TODO enable this once eclilpse does no longer add javadoc with trailing whitespaces
|
||||||
<module name="RegexpSingleline">
|
<module name="RegexpSingleline">
|
||||||
<property name="format" value="^.*\S+\s+$"/>
|
<property name="format" value="^.*\S+\s+$"/>
|
||||||
|
@ -29,6 +34,7 @@
|
||||||
</module>
|
</module>
|
||||||
-->
|
-->
|
||||||
<module name="TreeWalker">
|
<module name="TreeWalker">
|
||||||
|
<module name="FileContentsHolder"/>
|
||||||
<module name="UnusedImports">
|
<module name="UnusedImports">
|
||||||
<property name="processJavadoc" value="true"/>
|
<property name="processJavadoc" value="true"/>
|
||||||
</module>
|
</module>
|
||||||
|
@ -40,5 +46,15 @@
|
||||||
<module name="GenericWhitespace"/>
|
<module name="GenericWhitespace"/>
|
||||||
<module name="EmptyStatement"/>
|
<module name="EmptyStatement"/>
|
||||||
<module name="PackageDeclaration"/>
|
<module name="PackageDeclaration"/>
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<property name="format" value="printStackTrace"/>
|
||||||
|
<property name="message" value="Usage of printStackTrace"/>
|
||||||
|
<property name="ignoreComments" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<property name="format" value="println"/>
|
||||||
|
<property name="message" value="Usage of println"/>
|
||||||
|
<property name="ignoreComments" value="true"/>
|
||||||
|
</module>
|
||||||
</module>
|
</module>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -45,4 +45,9 @@ public class AndroidDebugger extends AbstractDebugger {
|
||||||
protected void log(String logMessage) {
|
protected void log(String logMessage) {
|
||||||
Log.d("SMACK", logMessage);
|
Log.d("SMACK", logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void log(String logMessage, Throwable throwable) {
|
||||||
|
Log.d("SMACK", logMessage, throwable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,10 +244,12 @@ public class PacketCollector {
|
||||||
*/
|
*/
|
||||||
protected void processPacket(Stanza packet) {
|
protected void processPacket(Stanza packet) {
|
||||||
if (packetFilter == null || packetFilter.accept(packet)) {
|
if (packetFilter == null || packetFilter.accept(packet)) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
while (!resultQueue.offer(packet)) {
|
while (!resultQueue.offer(packet)) {
|
||||||
// Since we know the queue is full, this poll should never actually block.
|
// Since we know the queue is full, this poll should never actually block.
|
||||||
resultQueue.poll();
|
resultQueue.poll();
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
if (collectorToReset != null) {
|
if (collectorToReset != null) {
|
||||||
collectorToReset.waitStart = System.currentTimeMillis();
|
collectorToReset.waitStart = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,15 +98,13 @@ public abstract class AbstractDebugger implements SmackDebugger {
|
||||||
log(
|
log(
|
||||||
"XMPPConnection closed due to an exception (" +
|
"XMPPConnection closed due to an exception (" +
|
||||||
connection.getConnectionCounter() +
|
connection.getConnectionCounter() +
|
||||||
")");
|
")", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
public void reconnectionFailed(Exception e) {
|
public void reconnectionFailed(Exception e) {
|
||||||
log(
|
log(
|
||||||
"Reconnection failed due to an exception (" +
|
"Reconnection failed due to an exception (" +
|
||||||
connection.getConnectionCounter() +
|
connection.getConnectionCounter() +
|
||||||
")");
|
")", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
public void reconnectionSuccessful() {
|
public void reconnectionSuccessful() {
|
||||||
log(
|
log(
|
||||||
|
@ -125,6 +123,8 @@ public abstract class AbstractDebugger implements SmackDebugger {
|
||||||
|
|
||||||
protected abstract void log(String logMessage);
|
protected abstract void log(String logMessage);
|
||||||
|
|
||||||
|
protected abstract void log(String logMessage, Throwable throwable);
|
||||||
|
|
||||||
public Reader newConnectionReader(Reader newReader) {
|
public Reader newConnectionReader(Reader newReader) {
|
||||||
reader.removeReaderListener(readerListener);
|
reader.removeReaderListener(readerListener);
|
||||||
ObservableReader debugReader = new ObservableReader(newReader);
|
ObservableReader debugReader = new ObservableReader(newReader);
|
||||||
|
|
|
@ -18,7 +18,9 @@ package org.jivesoftware.smack.debugger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -47,7 +49,19 @@ public class ConsoleDebugger extends AbstractDebugger {
|
||||||
synchronized (dateFormatter) {
|
synchronized (dateFormatter) {
|
||||||
formatedDate = dateFormatter.format(new Date());
|
formatedDate = dateFormatter.format(new Date());
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
System.out.println(formatedDate + ' ' + logMessage);
|
System.out.println(formatedDate + ' ' + logMessage);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void log(String logMessage, Throwable throwable) {
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
|
throwable.printStackTrace(pw);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
log(logMessage + sw);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,4 +47,8 @@ public class JulDebugger extends AbstractDebugger {
|
||||||
LOGGER.fine(logMessage);
|
LOGGER.fine(logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void log(String logMessage, Throwable throwable) {
|
||||||
|
LOGGER.log(Level.FINE, logMessage, throwable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,7 +528,9 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
String language = getLanguageAttribute(parser);
|
String language = getLanguageAttribute(parser);
|
||||||
if (language != null && !"".equals(language.trim())) {
|
if (language != null && !"".equals(language.trim())) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
presence.setLanguage(language);
|
presence.setLanguage(language);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse sub-elements
|
// Parse sub-elements
|
||||||
|
@ -993,15 +995,19 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
private static String getLanguageAttribute(XmlPullParser parser) {
|
private static String getLanguageAttribute(XmlPullParser parser) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
||||||
|
// CHECKSTYLE:ON
|
||||||
String attributeName = parser.getAttributeName(i);
|
String attributeName = parser.getAttributeName(i);
|
||||||
if ( "xml:lang".equals(attributeName) ||
|
if ( "xml:lang".equals(attributeName) ||
|
||||||
("lang".equals(attributeName) &&
|
("lang".equals(attributeName) &&
|
||||||
"xml".equals(parser.getAttributePrefix(i)))) {
|
"xml".equals(parser.getAttributePrefix(i)))) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return parser.getAttributeValue(i);
|
return parser.getAttributeValue(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -134,17 +134,11 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(PlainStreamElement element) {
|
public void send(PlainStreamElement element) {
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
System.out.println("[SEND]: " + element.toXML());
|
|
||||||
}
|
|
||||||
queue.add(element);
|
queue.add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendStanzaInternal(Stanza packet) {
|
protected void sendStanzaInternal(Stanza packet) {
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
System.out.println("[SEND]: " + packet.toXML());
|
|
||||||
}
|
|
||||||
queue.add(packet);
|
queue.add(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,10 +188,6 @@ public class DummyConnection extends AbstractXMPPConnection {
|
||||||
* @param packet the packet to process.
|
* @param packet the packet to process.
|
||||||
*/
|
*/
|
||||||
public void processPacket(Stanza packet) {
|
public void processPacket(Stanza packet) {
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
System.out.println("[RECV]: " + packet.toXML());
|
|
||||||
}
|
|
||||||
|
|
||||||
invokePacketCollectorsAndNotifyRecvListeners(packet);
|
invokePacketCollectorsAndNotifyRecvListeners(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.io.IOException;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
@ -33,6 +35,8 @@ import org.jivesoftware.smack.packet.IQ.Type;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ThreadedDummyConnection extends DummyConnection {
|
public class ThreadedDummyConnection extends DummyConnection {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(ThreadedDummyConnection.class.getName());
|
||||||
|
|
||||||
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
|
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
|
||||||
private BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<Stanza>(5);
|
private BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<Stanza>(5);
|
||||||
private volatile boolean timeout = false;
|
private volatile boolean timeout = false;
|
||||||
|
@ -82,7 +86,7 @@ public class ThreadedDummyConnection extends DummyConnection {
|
||||||
if (!messageQ.isEmpty())
|
if (!messageQ.isEmpty())
|
||||||
new ProcessQueue(messageQ).start();
|
new ProcessQueue(messageQ).start();
|
||||||
else
|
else
|
||||||
System.out.println("No messages to process");
|
LOGGER.warning("No messages to process");
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProcessQueue extends Thread {
|
class ProcessQueue extends Thread {
|
||||||
|
@ -97,7 +101,7 @@ public class ThreadedDummyConnection extends DummyConnection {
|
||||||
try {
|
try {
|
||||||
processPacket(processQ.take());
|
processPacket(processQ.take());
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,25 +754,30 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validateSimplePresence() throws Exception {
|
public void validateSimplePresence() throws Exception {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
String stanza = "<presence from='juliet@example.com/balcony' to='romeo@example.net'/>";
|
String stanza = "<presence from='juliet@example.com/balcony' to='romeo@example.net'/>";
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
|
|
||||||
assertXMLEqual(stanza, presence.toXML().toString());
|
assertXMLEqual(stanza, presence.toXML().toString());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validatePresenceProbe() throws Exception {
|
public void validatePresenceProbe() throws Exception {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
String stanza = "<presence from='mercutio@example.com' id='xv291f38' to='juliet@example.com' type='unsubscribed'/>";
|
String stanza = "<presence from='mercutio@example.com' id='xv291f38' to='juliet@example.com' type='unsubscribed'/>";
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
|
|
||||||
assertXMLEqual(stanza, presence.toXML().toString());
|
assertXMLEqual(stanza, presence.toXML().toString());
|
||||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validatePresenceOptionalElements() throws Exception {
|
public void validatePresenceOptionalElements() throws Exception {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
String stanza = "<presence xml:lang='en' type='unsubscribed'>"
|
String stanza = "<presence xml:lang='en' type='unsubscribed'>"
|
||||||
+ "<show>dnd</show>"
|
+ "<show>dnd</show>"
|
||||||
+ "<status>Wooing Juliet</status>"
|
+ "<status>Wooing Juliet</status>"
|
||||||
|
@ -786,6 +791,7 @@ public class PacketParserUtilsTest {
|
||||||
assertEquals("en", presence.getLanguage());
|
assertEquals("en", presence.getLanguage());
|
||||||
assertEquals("Wooing Juliet", presence.getStatus());
|
assertEquals("Wooing Juliet", presence.getStatus());
|
||||||
assertEquals(1, presence.getPriority());
|
assertEquals(1, presence.getPriority());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -289,8 +289,10 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
new DefaultTableModel(
|
new DefaultTableModel(
|
||||||
new Object[]{"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
|
new Object[]{"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
|
||||||
0) {
|
0) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
private static final long serialVersionUID = 8136121224474217264L;
|
private static final long serialVersionUID = 8136121224474217264L;
|
||||||
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
||||||
|
// CHECKSTYLE:ON
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +585,7 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
connection.sendStanza(packetToSend);
|
connection.sendStanza(packetToSend);
|
||||||
}
|
}
|
||||||
catch (InterruptedException | NotConnectedException e1) {
|
catch (InterruptedException | NotConnectedException e1) {
|
||||||
e1.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,8 +706,10 @@ public class EnhancedDebugger implements SmackDebugger {
|
||||||
new DefaultTableModel(new Object[][]{{"IQ", 0, 0}, {"Message", 0, 0},
|
new DefaultTableModel(new Object[][]{{"IQ", 0, 0}, {"Message", 0, 0},
|
||||||
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
|
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
|
||||||
new Object[]{"Type", "Received", "Sent"}) {
|
new Object[]{"Type", "Received", "Sent"}) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
private static final long serialVersionUID = -6793886085109589269L;
|
private static final long serialVersionUID = -6793886085109589269L;
|
||||||
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
||||||
|
// CHECKSTYLE:ON
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,11 +93,15 @@ public class Privacy extends IQ {
|
||||||
*/
|
*/
|
||||||
public void deletePrivacyList(String listName) {
|
public void deletePrivacyList(String listName) {
|
||||||
// Remove the list from the cache
|
// Remove the list from the cache
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
this.getItemLists().remove(listName);
|
this.getItemLists().remove(listName);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
// Check if deleted list was the default list
|
// Check if deleted list was the default list
|
||||||
if (this.getDefaultName() != null && listName.equals(this.getDefaultName())) {
|
if (this.getDefaultName() != null && listName.equals(this.getDefaultName())) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
this.setDefaultName(null);
|
this.setDefaultName(null);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,11 +112,13 @@ public class Privacy extends IQ {
|
||||||
*/
|
*/
|
||||||
public List<PrivacyItem> getActivePrivacyList() {
|
public List<PrivacyItem> getActivePrivacyList() {
|
||||||
// Check if we have the default list
|
// Check if we have the default list
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
if (this.getActiveName() == null) {
|
if (this.getActiveName() == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return this.getItemLists().get(this.getActiveName());
|
return this.getItemLists().get(this.getActiveName());
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -122,11 +128,13 @@ public class Privacy extends IQ {
|
||||||
*/
|
*/
|
||||||
public List<PrivacyItem> getDefaultPrivacyList() {
|
public List<PrivacyItem> getDefaultPrivacyList() {
|
||||||
// Check if we have the default list
|
// Check if we have the default list
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
if (this.getDefaultName() == null) {
|
if (this.getDefaultName() == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return this.getItemLists().get(this.getDefaultName());
|
return this.getItemLists().get(this.getDefaultName());
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,6 +155,7 @@ public class Privacy extends IQ {
|
||||||
* @return a List with {@link PrivacyItem}
|
* @return a List with {@link PrivacyItem}
|
||||||
*/
|
*/
|
||||||
public PrivacyItem getItem(String listName, int order) {
|
public PrivacyItem getItem(String listName, int order) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
|
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
|
||||||
PrivacyItem itemFound = null;
|
PrivacyItem itemFound = null;
|
||||||
while (itemFound == null && values.hasNext()) {
|
while (itemFound == null && values.hasNext()) {
|
||||||
|
@ -156,6 +165,7 @@ public class Privacy extends IQ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return itemFound;
|
return itemFound;
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +179,9 @@ public class Privacy extends IQ {
|
||||||
this.setDefaultName(newDefault);
|
this.setDefaultName(newDefault);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return false;
|
return false;
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +191,9 @@ public class Privacy extends IQ {
|
||||||
* @param listName name of the list to remove.
|
* @param listName name of the list to remove.
|
||||||
*/
|
*/
|
||||||
public void deleteList(String listName) {
|
public void deleteList(String listName) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
this.getItemLists().remove(listName);
|
this.getItemLists().remove(listName);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -188,9 +202,11 @@ public class Privacy extends IQ {
|
||||||
*
|
*
|
||||||
* @return the name of the active list.
|
* @return the name of the active list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public String getActiveName() {
|
public String getActiveName() {
|
||||||
return activeName;
|
return activeName;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name associated with the active list set for the session. Communications
|
* Sets the name associated with the active list set for the session. Communications
|
||||||
|
@ -198,9 +214,11 @@ public class Privacy extends IQ {
|
||||||
*
|
*
|
||||||
* @param activeName is the name of the active list.
|
* @param activeName is the name of the active list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public void setActiveName(String activeName) {
|
public void setActiveName(String activeName) {
|
||||||
this.activeName = activeName;
|
this.activeName = activeName;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the default list that applies to the user as a whole. Default list is
|
* Returns the name of the default list that applies to the user as a whole. Default list is
|
||||||
|
@ -209,9 +227,11 @@ public class Privacy extends IQ {
|
||||||
*
|
*
|
||||||
* @return the name of the default list.
|
* @return the name of the default list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public String getDefaultName() {
|
public String getDefaultName() {
|
||||||
return defaultName;
|
return defaultName;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the default list that applies to the user as a whole. Default list is
|
* Sets the name of the default list that applies to the user as a whole. Default list is
|
||||||
|
@ -222,9 +242,11 @@ public class Privacy extends IQ {
|
||||||
*
|
*
|
||||||
* @param defaultName is the name of the default list.
|
* @param defaultName is the name of the default list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public void setDefaultName(String defaultName) {
|
public void setDefaultName(String defaultName) {
|
||||||
this.defaultName = defaultName;
|
this.defaultName = defaultName;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the collection of privacy list that the user holds. A Privacy List contains a set of
|
* Returns the collection of privacy list that the user holds. A Privacy List contains a set of
|
||||||
|
@ -234,42 +256,51 @@ public class Privacy extends IQ {
|
||||||
* @return a map where the key is the name of the list and the value the
|
* @return a map where the key is the name of the list and the value the
|
||||||
* collection of privacy items.
|
* collection of privacy items.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public Map<String, List<PrivacyItem>> getItemLists() {
|
public Map<String, List<PrivacyItem>> getItemLists() {
|
||||||
return itemLists;
|
return itemLists;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or declines the use of an active list.
|
* Returns whether the receiver allows or declines the use of an active list.
|
||||||
*
|
*
|
||||||
* @return the decline status of the list.
|
* @return the decline status of the list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public boolean isDeclineActiveList() {
|
public boolean isDeclineActiveList() {
|
||||||
return declineActiveList;
|
return declineActiveList;
|
||||||
}
|
}
|
||||||
|
// CHECKSYTLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or declines the use of an active list.
|
* Sets whether the receiver allows or declines the use of an active list.
|
||||||
*
|
*
|
||||||
* @param declineActiveList indicates if the receiver declines the use of an active list.
|
* @param declineActiveList indicates if the receiver declines the use of an active list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public void setDeclineActiveList(boolean declineActiveList) {
|
public void setDeclineActiveList(boolean declineActiveList) {
|
||||||
this.declineActiveList = declineActiveList;
|
this.declineActiveList = declineActiveList;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or declines the use of a default list.
|
* Returns whether the receiver allows or declines the use of a default list.
|
||||||
*
|
*
|
||||||
* @return the decline status of the list.
|
* @return the decline status of the list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public boolean isDeclineDefaultList() {
|
public boolean isDeclineDefaultList() {
|
||||||
return declineDefaultList;
|
return declineDefaultList;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or declines the use of a default list.
|
* Sets whether the receiver allows or declines the use of a default list.
|
||||||
*
|
*
|
||||||
* @param declineDefaultList indicates if the receiver declines the use of a default list.
|
* @param declineDefaultList indicates if the receiver declines the use of a default list.
|
||||||
*/
|
*/
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public void setDeclineDefaultList(boolean declineDefaultList) {
|
public void setDeclineDefaultList(boolean declineDefaultList) {
|
||||||
this.declineDefaultList = declineDefaultList;
|
this.declineDefaultList = declineDefaultList;
|
||||||
}
|
}
|
||||||
|
@ -282,10 +313,12 @@ public class Privacy extends IQ {
|
||||||
public Set<String> getPrivacyListNames() {
|
public Set<String> getPrivacyListNames() {
|
||||||
return this.itemLists.keySet();
|
return this.itemLists.keySet();
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
||||||
buf.rightAngleBracket();
|
buf.rightAngleBracket();
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
|
|
||||||
// Add the active tag
|
// Add the active tag
|
||||||
if (this.isDeclineActiveList()) {
|
if (this.isDeclineActiveList()) {
|
||||||
|
@ -323,7 +356,7 @@ public class Privacy extends IQ {
|
||||||
buf.append("</list>");
|
buf.append("</list>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,8 +131,10 @@ public class PrivacyItem {
|
||||||
* @return the allow communication status.
|
* @return the allow communication status.
|
||||||
*/
|
*/
|
||||||
public boolean isAllow() {
|
public boolean isAllow() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return allow;
|
return allow;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
|
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
|
||||||
|
@ -140,8 +142,10 @@ public class PrivacyItem {
|
||||||
* @return the iq filtering status.
|
* @return the iq filtering status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterIQ() {
|
public boolean isFilterIQ() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return filterIQ;
|
return filterIQ;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or denies incoming IQ stanzas or not.
|
* Sets whether the receiver allows or denies incoming IQ stanzas or not.
|
||||||
|
@ -149,8 +153,11 @@ public class PrivacyItem {
|
||||||
* @param filterIQ indicates if the receiver allows or denies incoming IQ stanzas.
|
* @param filterIQ indicates if the receiver allows or denies incoming IQ stanzas.
|
||||||
*/
|
*/
|
||||||
public void setFilterIQ(boolean filterIQ) {
|
public void setFilterIQ(boolean filterIQ) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
|
|
||||||
this.filterIQ = filterIQ;
|
this.filterIQ = filterIQ;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies incoming messages or not.
|
* Returns whether the receiver allows or denies incoming messages or not.
|
||||||
|
@ -158,8 +165,10 @@ public class PrivacyItem {
|
||||||
* @return the message filtering status.
|
* @return the message filtering status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterMessage() {
|
public boolean isFilterMessage() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return filterMessage;
|
return filterMessage;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets wheather the receiver allows or denies incoming messages or not.
|
* Sets wheather the receiver allows or denies incoming messages or not.
|
||||||
|
@ -167,8 +176,10 @@ public class PrivacyItem {
|
||||||
* @param filterMessage indicates if the receiver allows or denies incoming messages or not.
|
* @param filterMessage indicates if the receiver allows or denies incoming messages or not.
|
||||||
*/
|
*/
|
||||||
public void setFilterMessage(boolean filterMessage) {
|
public void setFilterMessage(boolean filterMessage) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
this.filterMessage = filterMessage;
|
this.filterMessage = filterMessage;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies incoming presence or not.
|
* Returns whether the receiver allows or denies incoming presence or not.
|
||||||
|
@ -176,8 +187,10 @@ public class PrivacyItem {
|
||||||
* @return the iq filtering incoming presence status.
|
* @return the iq filtering incoming presence status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterPresenceIn() {
|
public boolean isFilterPresenceIn() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return filterPresenceIn;
|
return filterPresenceIn;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or denies incoming presence or not.
|
* Sets whether the receiver allows or denies incoming presence or not.
|
||||||
|
@ -185,8 +198,10 @@ public class PrivacyItem {
|
||||||
* @param filterPresenceIn indicates if the receiver allows or denies filtering incoming presence.
|
* @param filterPresenceIn indicates if the receiver allows or denies filtering incoming presence.
|
||||||
*/
|
*/
|
||||||
public void setFilterPresenceIn(boolean filterPresenceIn) {
|
public void setFilterPresenceIn(boolean filterPresenceIn) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
this.filterPresenceIn = filterPresenceIn;
|
this.filterPresenceIn = filterPresenceIn;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies incoming presence or not.
|
* Returns whether the receiver allows or denies incoming presence or not.
|
||||||
|
@ -194,8 +209,10 @@ public class PrivacyItem {
|
||||||
* @return the iq filtering incoming presence status.
|
* @return the iq filtering incoming presence status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterPresenceOut() {
|
public boolean isFilterPresenceOut() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return filterPresenceOut;
|
return filterPresenceOut;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or denies outgoing presence or not.
|
* Sets whether the receiver allows or denies outgoing presence or not.
|
||||||
|
@ -203,8 +220,10 @@ public class PrivacyItem {
|
||||||
* @param filterPresenceOut indicates if the receiver allows or denies filtering outgoing presence
|
* @param filterPresenceOut indicates if the receiver allows or denies filtering outgoing presence
|
||||||
*/
|
*/
|
||||||
public void setFilterPresenceOut(boolean filterPresenceOut) {
|
public void setFilterPresenceOut(boolean filterPresenceOut) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
this.filterPresenceOut = filterPresenceOut;
|
this.filterPresenceOut = filterPresenceOut;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the order where the receiver is processed. List items are processed in
|
* Returns the order where the receiver is processed. List items are processed in
|
||||||
|
@ -216,8 +235,10 @@ public class PrivacyItem {
|
||||||
* @return the order number.
|
* @return the order number.
|
||||||
*/
|
*/
|
||||||
public long getOrder() {
|
public long getOrder() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type hold the kind of communication it will allow or block.
|
* Returns the type hold the kind of communication it will allow or block.
|
||||||
|
@ -227,7 +248,9 @@ public class PrivacyItem {
|
||||||
*/
|
*/
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the element identifier to apply the action.
|
* Returns the element identifier to apply the action.
|
||||||
|
@ -242,7 +265,9 @@ public class PrivacyItem {
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies every kind of communication.
|
* Returns whether the receiver allows or denies every kind of communication.
|
||||||
|
@ -253,6 +278,7 @@ public class PrivacyItem {
|
||||||
* @return the all communications status.
|
* @return the all communications status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterEverything() {
|
public boolean isFilterEverything() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return !(this.isFilterIQ() || this.isFilterMessage() || this.isFilterPresenceIn()
|
return !(this.isFilterIQ() || this.isFilterMessage() || this.isFilterPresenceIn()
|
||||||
|| this.isFilterPresenceOut());
|
|| this.isFilterPresenceOut());
|
||||||
}
|
}
|
||||||
|
@ -295,6 +321,7 @@ public class PrivacyItem {
|
||||||
}
|
}
|
||||||
buf.append("</item>");
|
buf.append("</item>");
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class PrivacyProvider extends IQProvider<Privacy> {
|
||||||
while (!done) {
|
while (!done) {
|
||||||
int eventType = parser.next();
|
int eventType = parser.next();
|
||||||
if (eventType == XmlPullParser.START_TAG) {
|
if (eventType == XmlPullParser.START_TAG) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
if (parser.getName().equals("active")) {
|
if (parser.getName().equals("active")) {
|
||||||
String activeName = parser.getAttributeValue("", "name");
|
String activeName = parser.getAttributeValue("", "name");
|
||||||
if (activeName == null) {
|
if (activeName == null) {
|
||||||
|
@ -61,6 +62,7 @@ public class PrivacyProvider extends IQProvider<Privacy> {
|
||||||
privacy.setDefaultName(defaultName);
|
privacy.setDefaultName(defaultName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
else if (parser.getName().equals("list")) {
|
else if (parser.getName().equals("list")) {
|
||||||
parseList(parser, privacy);
|
parseList(parser, privacy);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +86,9 @@ public class PrivacyProvider extends IQProvider<Privacy> {
|
||||||
int eventType = parser.next();
|
int eventType = parser.next();
|
||||||
if (eventType == XmlPullParser.START_TAG) {
|
if (eventType == XmlPullParser.START_TAG) {
|
||||||
if (parser.getName().equals("item")) {
|
if (parser.getName().equals("item")) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
items.add(parseItem(parser));
|
items.add(parseItem(parser));
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eventType == XmlPullParser.END_TAG) {
|
else if (eventType == XmlPullParser.END_TAG) {
|
||||||
|
@ -95,10 +99,12 @@ public class PrivacyProvider extends IQProvider<Privacy> {
|
||||||
}
|
}
|
||||||
|
|
||||||
privacy.setPrivacyList(listName, items);
|
privacy.setPrivacyList(listName, items);
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the list complex type
|
// Parse the list complex type
|
||||||
private static PrivacyItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
private static PrivacyItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
|
||||||
|
// CHECKSTYLE:ON
|
||||||
// Retrieves the required attributes
|
// Retrieves the required attributes
|
||||||
String actionValue = parser.getAttributeValue("", "action");
|
String actionValue = parser.getAttributeValue("", "action");
|
||||||
// Set the order number, this attribute is required
|
// Set the order number, this attribute is required
|
||||||
|
@ -135,7 +141,9 @@ public class PrivacyProvider extends IQProvider<Privacy> {
|
||||||
}
|
}
|
||||||
parseItemChildElements(parser, item);
|
parseItemChildElements(parser, item);
|
||||||
return item;
|
return item;
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
private static void parseItemChildElements(XmlPullParser parser, PrivacyItem privacyItem) throws XmlPullParserException, IOException {
|
private static void parseItemChildElements(XmlPullParser parser, PrivacyItem privacyItem) throws XmlPullParserException, IOException {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
|
|
|
@ -85,7 +85,9 @@ public class Item extends NodeExtension
|
||||||
*/
|
*/
|
||||||
public Item(String itemId, String nodeId)
|
public Item(String itemId, String nodeId)
|
||||||
{
|
{
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
super(PubSubElementType.ITEM_EVENT, nodeId);
|
super(PubSubElementType.ITEM_EVENT, nodeId);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
id = itemId;
|
id = itemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.net.SocketException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ import org.jivesoftware.smack.SmackException;
|
||||||
* @author Henning Staib
|
* @author Henning Staib
|
||||||
*/
|
*/
|
||||||
public class Socks5TestProxy {
|
public class Socks5TestProxy {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(Socks5TestProxy.class.getName());
|
||||||
|
|
||||||
/* SOCKS5 proxy singleton */
|
/* SOCKS5 proxy singleton */
|
||||||
private static Socks5TestProxy socks5Server;
|
private static Socks5TestProxy socks5Server;
|
||||||
|
@ -102,7 +105,7 @@ public class Socks5TestProxy {
|
||||||
this.serverThread.start();
|
this.serverThread.start();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.SEVERE, "exception", e);
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +123,7 @@ public class Socks5TestProxy {
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.SEVERE, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.serverThread != null && this.serverThread.isAlive()) {
|
if (this.serverThread != null && this.serverThread.isAlive()) {
|
||||||
|
@ -130,7 +133,7 @@ public class Socks5TestProxy {
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.SEVERE, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.serverThread = null;
|
this.serverThread = null;
|
||||||
|
@ -176,7 +179,7 @@ public class Socks5TestProxy {
|
||||||
try {
|
try {
|
||||||
wait(5000);
|
wait(5000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.SEVERE, "exception", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!startupComplete) {
|
if (!startupComplete) {
|
||||||
throw new IllegalStateException("Startup of Socks5TestProxy failed within 5 seconds");
|
throw new IllegalStateException("Startup of Socks5TestProxy failed within 5 seconds");
|
||||||
|
@ -230,7 +233,7 @@ public class Socks5TestProxy {
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.SEVERE, "exception", e);
|
||||||
socket.close();
|
socket.close();
|
||||||
}
|
}
|
||||||
catch (IOException e1) {
|
catch (IOException e1) {
|
||||||
|
|
|
@ -124,6 +124,7 @@ public class Protocol {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void verifyAll() {
|
public void verifyAll() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
assertEquals(requests.size(), responsesList.size());
|
assertEquals(requests.size(), responsesList.size());
|
||||||
|
|
||||||
if (printProtocol)
|
if (printProtocol)
|
||||||
|
@ -154,6 +155,7 @@ public class Protocol {
|
||||||
}
|
}
|
||||||
if (printProtocol)
|
if (printProtocol)
|
||||||
System.out.println("=================== End =================\n");
|
System.out.println("=================== End =================\n");
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -153,7 +153,9 @@ public class ChatManager extends Manager{
|
||||||
Message message = (Message) packet;
|
Message message = (Message) packet;
|
||||||
Chat chat;
|
Chat chat;
|
||||||
if (message.getThread() == null) {
|
if (message.getThread() == null) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
chat = getUserChat(message.getFrom());
|
chat = getUserChat(message.getFrom());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chat = getThreadChat(message.getThread());
|
chat = getThreadChat(message.getThread());
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class DirectoryRosterStore implements RosterStore {
|
||||||
for (File file : fileDir.listFiles(rosterDirFilter)) {
|
for (File file : fileDir.listFiles(rosterDirFilter)) {
|
||||||
Item entry = readEntry(file);
|
Item entry = readEntry(file);
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
log("Roster store file '" + file + "' is invalid.");
|
LOGGER.severe("Roster store file '" + file + "' is invalid.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
|
@ -228,7 +228,7 @@ public class DirectoryRosterStore implements RosterStore {
|
||||||
groupNames.add(group);
|
groupNames.add(group);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("Invalid group entry in store entry file "
|
LOGGER.severe("Invalid group entry in store entry file "
|
||||||
+ file);
|
+ file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,9 +245,7 @@ public class DirectoryRosterStore implements RosterStore {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch (XmlPullParserException e) {
|
catch (XmlPullParserException e) {
|
||||||
log("Invalid group entry in store entry file "
|
LOGGER.log(Level.SEVERE, "Invalid group entry in store entry file", e);
|
||||||
+ file);
|
|
||||||
LOGGER.log(Level.SEVERE, "readEntry()", e);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,14 +262,14 @@ public class DirectoryRosterStore implements RosterStore {
|
||||||
item.setItemType(RosterPacket.ItemType.valueOf(type));
|
item.setItemType(RosterPacket.ItemType.valueOf(type));
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e) {
|
catch (IllegalArgumentException e) {
|
||||||
log("Invalid type in store entry file " + file);
|
LOGGER.log(Level.SEVERE, "Invalid type in store entry file " + file, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
RosterPacket.ItemStatus itemStatus = RosterPacket.ItemStatus
|
RosterPacket.ItemStatus itemStatus = RosterPacket.ItemStatus
|
||||||
.fromString(status);
|
.fromString(status);
|
||||||
if (itemStatus == null) {
|
if (itemStatus == null) {
|
||||||
log("Invalid status in store entry file " + file);
|
LOGGER.severe("Invalid status in store entry file " + file);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
item.setItemStatus(itemStatus);
|
item.setItemStatus(itemStatus);
|
||||||
|
@ -304,8 +302,4 @@ public class DirectoryRosterStore implements RosterStore {
|
||||||
String encodedJid = Base32.encode(bareJid.toString());
|
String encodedJid = Base32.encode(bareJid.toString());
|
||||||
return new File(fileDir, ENTRY_PREFIX + encodedJid);
|
return new File(fileDir, ENTRY_PREFIX + encodedJid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(String error) {
|
|
||||||
System.err.println(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
import org.jivesoftware.smack.DummyConnection;
|
import org.jivesoftware.smack.DummyConnection;
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.im.InitSmackIm;
|
import org.jivesoftware.smack.im.InitSmackIm;
|
||||||
|
@ -716,38 +715,20 @@ public class RosterTest extends InitSmackIm {
|
||||||
|
|
||||||
public synchronized void entriesAdded(Collection<Jid> addresses) {
|
public synchronized void entriesAdded(Collection<Jid> addresses) {
|
||||||
addressesAdded.addAll(addresses);
|
addressesAdded.addAll(addresses);
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
for (Jid address : addresses) {
|
|
||||||
System.out.println("Roster entry for " + address + " added.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reportInvoked();
|
reportInvoked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void entriesDeleted(Collection<Jid> addresses) {
|
public synchronized void entriesDeleted(Collection<Jid> addresses) {
|
||||||
addressesDeleted.addAll(addresses);
|
addressesDeleted.addAll(addresses);
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
for (Jid address : addresses) {
|
|
||||||
System.out.println("Roster entry for " + address + " deleted.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reportInvoked();
|
reportInvoked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void entriesUpdated(Collection<Jid> addresses) {
|
public synchronized void entriesUpdated(Collection<Jid> addresses) {
|
||||||
addressesUpdated.addAll(addresses);
|
addressesUpdated.addAll(addresses);
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
for (Jid address : addresses) {
|
|
||||||
System.out.println("Roster entry for " + address + " updated.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reportInvoked();
|
reportInvoked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void presenceChanged(Presence presence) {
|
public void presenceChanged(Presence presence) {
|
||||||
if (SmackConfiguration.DEBUG) {
|
|
||||||
System.out.println("Roster presence changed: " + presence.toXML());
|
|
||||||
}
|
|
||||||
reportInvoked();
|
reportInvoked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class Demo extends JFrame {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
catch (XMPPException e) {
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class Demo extends JFrame {
|
||||||
incoming.startIncoming();
|
incoming.startIncoming();
|
||||||
}
|
}
|
||||||
catch (XMPPException e) {
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
assertTrue(valCounter() > 0);
|
assertTrue(valCounter() > 0);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
JingleSession session1 = request.accept();
|
JingleSession session1 = request.accept();
|
||||||
session1.startIncoming();
|
session1.startIncoming();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -293,7 +293,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
assertTrue(valCounter() > 0);
|
assertTrue(valCounter() > 0);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
|
|
||||||
session1.startIncoming();
|
session1.startIncoming();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -384,7 +384,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
assertTrue(valCounter() == 1);
|
assertTrue(valCounter() == 1);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
|
|
||||||
session1.startIncoming();
|
session1.startIncoming();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -498,7 +498,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
assertTrue(valCounter() == 2);
|
assertTrue(valCounter() == 2);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
session.terminate();
|
session.terminate();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -588,7 +588,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
assertTrue(valCounter() > 0);
|
assertTrue(valCounter() > 0);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
incCounter();
|
incCounter();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,11 +666,11 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
ds1.close();
|
ds1.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -737,7 +737,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
|
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(valCounter());
|
System.out.println(valCounter());
|
||||||
|
@ -871,7 +871,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
|
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -893,7 +893,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
Thread.sleep(15000);
|
Thread.sleep(15000);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -941,7 +941,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
//
|
//
|
||||||
// ses.startIncoming();
|
// ses.startIncoming();
|
||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// LOGGER.log(Level.WARNING, "exception", e);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
@ -984,7 +984,7 @@ public class JingleManagerTest extends SmackTestCase {
|
||||||
// assertTrue(valCounter() > 0);
|
// assertTrue(valCounter() > 0);
|
||||||
//
|
//
|
||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// LOGGER.log(Level.WARNING, "exception", e);
|
||||||
// fail("An error occured with Jingle");
|
// fail("An error occured with Jingle");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
// });
|
// });
|
||||||
|
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
Thread.sleep(60000);
|
Thread.sleep(60000);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,11 +165,11 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(12000);
|
Thread.sleep(12000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -392,7 +392,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(250000);
|
Thread.sleep(250000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
|
|
||||||
session.startIncoming();
|
session.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioChannel0.stop();
|
audioChannel0.stop();
|
||||||
|
@ -489,10 +489,10 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioChannel0.stop();
|
audioChannel0.stop();
|
||||||
|
@ -524,11 +524,11 @@ public class JingleMediaTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class BridgedResolverTest extends SmackTestCase {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(valCounter() == 1);
|
assertTrue(valCounter() == 1);
|
||||||
|
|
|
@ -175,9 +175,9 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|"
|
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|"
|
||||||
+ candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
|
+ candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
|
||||||
} catch (UtilityException e) {
|
} catch (UtilityException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Candidate candidate = cc.getSortedCandidates().get(0);
|
Candidate candidate = cc.getSortedCandidates().get(0);
|
||||||
|
@ -251,7 +251,7 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
Thread.sleep(55000);
|
Thread.sleep(55000);
|
||||||
assertTrue(valCounter() > 0);
|
assertTrue(valCounter() > 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
});
|
});
|
||||||
session1.startIncoming();
|
session1.startIncoming();
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -395,7 +395,7 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
assertTrue(valCounter() == 2);
|
assertTrue(valCounter() == 2);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TransportResolverTest extends SmackTestCase {
|
||||||
try {
|
try {
|
||||||
tr.resolve(null);
|
tr.resolve(null);
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
fail("Error resolving");
|
fail("Error resolving");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.jingleold;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.ConnectionCreationListener;
|
import org.jivesoftware.smack.ConnectionCreationListener;
|
||||||
|
@ -125,7 +126,7 @@ import org.jxmpp.jid.Jid;
|
||||||
* // Start the call
|
* // Start the call
|
||||||
* session.start();
|
* session.start();
|
||||||
* } catch (XMPPException e) {
|
* } catch (XMPPException e) {
|
||||||
* e.printStackTrace();
|
* LOGGER.log(Level.WARNING, "exception", e);
|
||||||
* }
|
* }
|
||||||
* <p/>
|
* <p/>
|
||||||
* }
|
* }
|
||||||
|
@ -134,7 +135,7 @@ import org.jxmpp.jid.Jid;
|
||||||
* Thread.sleep(15000);
|
* Thread.sleep(15000);
|
||||||
* <p/>
|
* <p/>
|
||||||
* } catch (Exception e) {
|
* } catch (Exception e) {
|
||||||
* e.printStackTrace();
|
* LOGGER.log(Level.WARNING, "exception", e);
|
||||||
* }
|
* }
|
||||||
* <p/>
|
* <p/>
|
||||||
* To create an Outgoing Jingle Session:
|
* To create an Outgoing Jingle Session:
|
||||||
|
@ -168,7 +169,7 @@ import org.jxmpp.jid.Jid;
|
||||||
* Thread.sleep(3000);
|
* Thread.sleep(3000);
|
||||||
* <p/>
|
* <p/>
|
||||||
* } catch (Exception e) {
|
* } catch (Exception e) {
|
||||||
* e.printStackTrace();
|
* LOGGER.log(Level.WARNING, "exception", e);
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -239,7 +240,7 @@ public class JingleManager implements JingleSessionListener {
|
||||||
try {
|
try {
|
||||||
aux.terminate();
|
aux.terminate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +405,7 @@ public class JingleManager implements JingleSessionListener {
|
||||||
try {
|
try {
|
||||||
createdJingleSessionListener.sessionCreated(jingleSession);
|
createdJingleSessionListener.sessionCreated(jingleSession);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,7 +483,7 @@ public class JingleManager implements JingleSessionListener {
|
||||||
try {
|
try {
|
||||||
jingleSession.terminate();
|
jingleSession.terminate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
sessions.clear();
|
sessions.clear();
|
||||||
|
|
|
@ -236,7 +236,7 @@ public abstract class JingleNegotiator {
|
||||||
*/
|
*/
|
||||||
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
|
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
|
||||||
|
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
public void start() {
|
public void start() {
|
||||||
isStarted = true;
|
isStarted = true;
|
||||||
doStart();
|
doStart();
|
||||||
|
@ -245,6 +245,7 @@ public abstract class JingleNegotiator {
|
||||||
public boolean isStarted() {
|
public boolean isStarted() {
|
||||||
return isStarted;
|
return isStarted;
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each of the negotiators has their individual behavior when they start.
|
* Each of the negotiators has their individual behavior when they start.
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.AbstractConnectionClosedListener;
|
import org.jivesoftware.smack.AbstractConnectionClosedListener;
|
||||||
|
@ -296,7 +297,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
|
|
||||||
// Send the IQ to each of the content negotiators for further processing.
|
// Send the IQ to each of the content negotiators for further processing.
|
||||||
// Each content negotiator may pass back a list of JingleContent for addition to the response packet.
|
// Each content negotiator may pass back a list of JingleContent for addition to the response packet.
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
for (ContentNegotiator contentNegotiator : contentNegotiators) {
|
for (ContentNegotiator contentNegotiator : contentNegotiators) {
|
||||||
// If at this point the content negotiator isn't started, it's because we sent a session-init jingle
|
// If at this point the content negotiator isn't started, it's because we sent a session-init jingle
|
||||||
// packet from startOutgoing() and we're waiting for the other side to let us know they're ready
|
// packet from startOutgoing() and we're waiting for the other side to let us know they're ready
|
||||||
|
@ -307,6 +308,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
}
|
}
|
||||||
responses.addAll(contentNegotiator.dispatchIncomingPacket(iq, responseId));
|
responses.addAll(contentNegotiator.dispatchIncomingPacket(iq, responseId));
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
}
|
}
|
||||||
// Acknowledge the IQ reception
|
// Acknowledge the IQ reception
|
||||||
|
@ -471,8 +473,10 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
}
|
}
|
||||||
|
|
||||||
// The the packet.
|
// The the packet.
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
if ((getConnection() != null) && (getConnection().isConnected()))
|
if ((getConnection() != null) && (getConnection().isConnected()))
|
||||||
getConnection().sendStanza(jout);
|
getConnection().sendStanza(jout);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
return jout;
|
return jout;
|
||||||
}
|
}
|
||||||
|
@ -644,11 +648,13 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeConnectionListener() {
|
private void removeConnectionListener() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
if (connectionListener != null) {
|
if (connectionListener != null) {
|
||||||
getConnection().removeConnectionListener(connectionListener);
|
getConnection().removeConnectionListener(connectionListener);
|
||||||
|
|
||||||
LOGGER.fine("JINGLE SESSION: REMOVE CONNECTION LISTENER");
|
LOGGER.fine("JINGLE SESSION: REMOVE CONNECTION LISTENER");
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -676,7 +682,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
try {
|
try {
|
||||||
receivePacketAndRespond((IQ) packet);
|
receivePacketAndRespond((IQ) packet);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -823,11 +829,12 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
|
|
||||||
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
|
||||||
if (isFullyEstablished()) {
|
if (isFullyEstablished()) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
// Indicate that this session is active.
|
// Indicate that this session is active.
|
||||||
setSessionState(JingleSessionStateActive.getInstance());
|
setSessionState(JingleSessionStateActive.getInstance());
|
||||||
|
|
||||||
for (ContentNegotiator contentNegotiator : contentNegotiators) {
|
for (ContentNegotiator contentNegotiator : contentNegotiators) {
|
||||||
|
// CHECKSTYLE:ON
|
||||||
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
|
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
|
||||||
contentNegotiator.triggerContentEstablished();
|
contentNegotiator.triggerContentEstablished();
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1088,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
|
||||||
try {
|
try {
|
||||||
resolver = transportManager.getResolver(this);
|
resolver = transportManager.getResolver(this);
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
|
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingleold;
|
package org.jivesoftware.smackx.jingleold;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smackx.jingleold.packet.Jingle;
|
import org.jivesoftware.smackx.jingleold.packet.Jingle;
|
||||||
import org.jivesoftware.smackx.jingleold.packet.JingleError;
|
import org.jivesoftware.smackx.jingleold.packet.JingleError;
|
||||||
|
@ -25,6 +28,8 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError;
|
||||||
* @see JingleSessionState
|
* @see JingleSessionState
|
||||||
*/
|
*/
|
||||||
public class JingleSessionStateActive extends JingleSessionState {
|
public class JingleSessionStateActive extends JingleSessionState {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(JingleSessionStateActive.class.getName());
|
||||||
|
|
||||||
private static JingleSessionStateActive INSTANCE = null;
|
private static JingleSessionStateActive INSTANCE = null;
|
||||||
|
|
||||||
protected JingleSessionStateActive() {
|
protected JingleSessionStateActive() {
|
||||||
|
@ -98,7 +103,7 @@ public class JingleSessionStateActive extends JingleSessionState {
|
||||||
try {
|
try {
|
||||||
session.terminate("Closed remotely");
|
session.terminate("Closed remotely");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingleold;
|
package org.jivesoftware.smackx.jingleold;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smackx.jingleold.packet.Jingle;
|
import org.jivesoftware.smackx.jingleold.packet.Jingle;
|
||||||
|
|
||||||
|
@ -25,6 +28,8 @@ import org.jivesoftware.smackx.jingleold.packet.Jingle;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class JingleSessionStatePending extends JingleSessionState {
|
public class JingleSessionStatePending extends JingleSessionState {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(JingleSessionStatePending.class.getName());
|
||||||
|
|
||||||
private static JingleSessionStatePending INSTANCE = null;
|
private static JingleSessionStatePending INSTANCE = null;
|
||||||
|
|
||||||
protected JingleSessionStatePending() {
|
protected JingleSessionStatePending() {
|
||||||
|
@ -124,7 +129,7 @@ public class JingleSessionStatePending extends JingleSessionState {
|
||||||
try {
|
try {
|
||||||
session.terminate("Closed remotely");
|
session.terminate("Closed remotely");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingleold;
|
package org.jivesoftware.smackx.jingleold;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
@ -36,6 +39,8 @@ import org.jivesoftware.smackx.jingleold.packet.JingleTransport;
|
||||||
* @see JingleSessionState
|
* @see JingleSessionState
|
||||||
*/
|
*/
|
||||||
public class JingleSessionStateUnknown extends JingleSessionState {
|
public class JingleSessionStateUnknown extends JingleSessionState {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(JingleSessionStateUnknown.class.getName());
|
||||||
|
|
||||||
private static JingleSessionStateUnknown INSTANCE = null;
|
private static JingleSessionStateUnknown INSTANCE = null;
|
||||||
|
|
||||||
protected JingleSessionStateUnknown() {
|
protected JingleSessionStateUnknown() {
|
||||||
|
@ -171,7 +176,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
||||||
try {
|
try {
|
||||||
resolver = transportManager.getResolver(session);
|
resolver = transportManager.getResolver(session);
|
||||||
} catch (XMPPException e) {
|
} catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
|
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
|
||||||
|
@ -205,7 +210,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
|
||||||
try {
|
try {
|
||||||
session.terminate("Closed remotely");
|
session.terminate("Closed remotely");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.media.Codec;
|
import javax.media.Codec;
|
||||||
|
@ -173,7 +174,7 @@ public class AudioChannel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,11 +203,11 @@ public class AudioChannel {
|
||||||
processor = javax.media.Manager.createProcessor(ds);
|
processor = javax.media.Manager.createProcessor(ds);
|
||||||
}
|
}
|
||||||
catch (NoProcessorException npe) {
|
catch (NoProcessorException npe) {
|
||||||
npe.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", npe);
|
||||||
return "Couldn't create processor";
|
return "Couldn't create processor";
|
||||||
}
|
}
|
||||||
catch (IOException ioe) {
|
catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", ioe);
|
||||||
return "IOException creating processor";
|
return "IOException creating processor";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ public class AudioChannel {
|
||||||
tracks[i].setCodecChain(codec);
|
tracks[i].setCodecChain(codec);
|
||||||
}
|
}
|
||||||
catch (UnsupportedPlugInException e) {
|
catch (UnsupportedPlugInException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +395,7 @@ public class AudioChannel {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
return e.getMessage();
|
return e.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +422,7 @@ public class AudioChannel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -514,7 +515,7 @@ public class AudioChannel {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioChannel0.setTrasmit(false);
|
audioChannel0.setTrasmit(false);
|
||||||
|
@ -524,7 +525,7 @@ public class AudioChannel {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioChannel0.setTrasmit(true);
|
audioChannel0.setTrasmit(true);
|
||||||
|
@ -534,7 +535,7 @@ public class AudioChannel {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioChannel0.stop();
|
audioChannel0.stop();
|
||||||
|
@ -542,7 +543,7 @@ public class AudioChannel {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingleold.mediaimpl.jmf;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.media.MediaLocator;
|
import javax.media.MediaLocator;
|
||||||
|
@ -144,7 +145,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -153,7 +154,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
||||||
ss.close();
|
ss.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||||
|
@ -141,8 +142,7 @@ public class JmfMediaManager extends JingleMediaManager {
|
||||||
jmfProperties.createNewFile();
|
jmfProperties.createNewFile();
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
LOGGER.fine("Failed to create jmf.properties");
|
LOGGER.log(Level.FINE, "Failed to create jmf.properties", ex);
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.media.NoProcessorException;
|
import javax.media.NoProcessorException;
|
||||||
|
@ -138,16 +139,16 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
||||||
mediaSession = createSession(localIp, localPort, ip, remotePort, this, 2, false, true);
|
mediaSession = createSession(localIp, localPort, ip, remotePort, this, 2, false, true);
|
||||||
}
|
}
|
||||||
catch (NoProcessorException e) {
|
catch (NoProcessorException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
catch (UnsupportedFormatException e) {
|
catch (UnsupportedFormatException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
catch (GeneralSecurityException e) {
|
catch (GeneralSecurityException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +162,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
||||||
this.mediaReceived("");
|
this.mediaReceived("");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -234,7 +235,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
|
||||||
ss.close();
|
ss.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||||
|
@ -106,8 +107,7 @@ public class SpeexMediaManager extends JingleMediaManager {
|
||||||
jmfProperties.createNewFile();
|
jmfProperties.createNewFile();
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
LOGGER.fine("Failed to create jmf.properties");
|
LOGGER.log(Level.FINE, "Failed to create jmf.properties", ex);
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
@ -83,7 +84,7 @@ public class ScreenShareSession extends JingleMediaSession {
|
||||||
transmitter = new ImageTransmitter(new DatagramSocket(getLocal().getPort()), remote, getRemote().getPort(),
|
transmitter = new ImageTransmitter(new DatagramSocket(getLocal().getPort()), remote, getRemote().getPort(),
|
||||||
new Rectangle(0, 0, width, height));
|
new Rectangle(0, 0, width, height));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,7 +107,7 @@ public class ScreenShareSession extends JingleMediaSession {
|
||||||
height);
|
height);
|
||||||
LOGGER.fine("Receiving on:" + receiver.getLocalPort());
|
LOGGER.fine("Receiving on:" + receiver.getLocalPort());
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
jp.add(receiver);
|
jp.add(receiver);
|
||||||
|
@ -176,7 +177,7 @@ public class ScreenShareSession extends JingleMediaSession {
|
||||||
ss.close();
|
ss.close();
|
||||||
return freePort;
|
return freePort;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -184,7 +185,7 @@ public class ScreenShareSession extends JingleMediaSession {
|
||||||
freePort = ss.getLocalPort();
|
freePort = ss.getLocalPort();
|
||||||
ss.close();
|
ss.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,18 @@
|
||||||
package org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api;
|
package org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a default PNG Encoder
|
* Implements a default PNG Encoder
|
||||||
*/
|
*/
|
||||||
public class DefaultEncoder implements ImageEncoder{
|
public class DefaultEncoder implements ImageEncoder{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(DefaultEncoder.class.getName());
|
||||||
|
|
||||||
public ByteArrayOutputStream encode(BufferedImage bufferedImage) {
|
public ByteArrayOutputStream encode(BufferedImage bufferedImage) {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
@ -32,7 +36,7 @@ public class DefaultEncoder implements ImageEncoder{
|
||||||
ImageIO.write(bufferedImage, "png", baos);
|
ImageIO.write(bufferedImage, "png", baos);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
baos = null;
|
baos = null;
|
||||||
}
|
}
|
||||||
return baos;
|
return baos;
|
||||||
|
|
|
@ -25,6 +25,8 @@ import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDP Image Receiver.
|
* UDP Image Receiver.
|
||||||
|
@ -33,6 +35,7 @@ import java.net.SocketException;
|
||||||
* @author Thiago Rocha Camargo
|
* @author Thiago Rocha Camargo
|
||||||
*/
|
*/
|
||||||
public class ImageReceiver extends Canvas {
|
public class ImageReceiver extends Canvas {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(ImageReceiver.class.getName());
|
||||||
|
|
||||||
private static final long serialVersionUID = -7000112305305269025L;
|
private static final long serialVersionUID = -7000112305305269025L;
|
||||||
private boolean on = true;
|
private boolean on = true;
|
||||||
|
@ -81,7 +84,7 @@ public class ImageReceiver extends Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
@ -101,20 +104,20 @@ public class ImageReceiver extends Canvas {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SocketException e) {
|
catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
this.setSize(width, height);
|
this.setSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +78,7 @@ public class ImageTransmitter implements Runnable {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (AWTException e) {
|
catch (AWTException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,7 @@ public class ImageTransmitter implements Runnable {
|
||||||
socket.send(p);
|
socket.send(p);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
tiles[i][j] = pixels;
|
tiles[i][j] = pixels;
|
||||||
|
@ -157,7 +158,7 @@ public class ImageTransmitter implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ public class ImageTransmitter implements Runnable {
|
||||||
Thread.sleep(500 - trace);
|
Thread.sleep(500 - trace);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.net.InetAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic Resolver takes all IP addresses of the interfaces and uses the
|
* Basic Resolver takes all IP addresses of the interfaces and uses the
|
||||||
|
@ -31,6 +33,7 @@ import java.util.Enumeration;
|
||||||
* A very simple and easy to use resolver.
|
* A very simple and easy to use resolver.
|
||||||
*/
|
*/
|
||||||
public class BasicResolver extends TransportResolver {
|
public class BasicResolver extends TransportResolver {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(BasicResolver.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -58,7 +61,7 @@ public class BasicResolver extends TransportResolver {
|
||||||
try {
|
try {
|
||||||
ifaces = NetworkInterface.getNetworkInterfaces();
|
ifaces = NetworkInterface.getNetworkInterfaces();
|
||||||
} catch (SocketException e) {
|
} catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ifaces.hasMoreElements()) {
|
while (ifaces.hasMoreElements()) {
|
||||||
|
@ -81,7 +84,7 @@ public class BasicResolver extends TransportResolver {
|
||||||
try {
|
try {
|
||||||
ifaces = NetworkInterface.getNetworkInterfaces();
|
ifaces = NetworkInterface.getNetworkInterfaces();
|
||||||
} catch (SocketException e) {
|
} catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ifaces.hasMoreElements()) {
|
while (ifaces.hasMoreElements()) {
|
||||||
|
@ -106,7 +109,7 @@ public class BasicResolver extends TransportResolver {
|
||||||
tr.setLocalIp(InetAddress.getLocalHost().getHostAddress() != null ? InetAddress.getLocalHost().getHostAddress() : InetAddress.getLocalHost().getHostName());
|
tr.setLocalIp(InetAddress.getLocalHost().getHostAddress() != null ? InetAddress.getLocalHost().getHostAddress() : InetAddress.getLocalHost().getHostName());
|
||||||
addCandidate(tr);
|
addCandidate(tr);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
setResolveEnd();
|
setResolveEnd();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ import java.net.NetworkInterface;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bridged Resolver use a RTPBridge Service to add a relayed candidate.
|
* Bridged Resolver use a RTPBridge Service to add a relayed candidate.
|
||||||
|
@ -39,6 +41,7 @@ import java.util.Random;
|
||||||
* The resolver adds this candidate
|
* The resolver adds this candidate
|
||||||
*/
|
*/
|
||||||
public class BridgedResolver extends TransportResolver {
|
public class BridgedResolver extends TransportResolver {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(BridgedResolver.class.getName());
|
||||||
|
|
||||||
XMPPConnection connection;
|
XMPPConnection connection;
|
||||||
|
|
||||||
|
@ -122,7 +125,7 @@ public class BridgedResolver extends TransportResolver {
|
||||||
ifaces = NetworkInterface.getNetworkInterfaces();
|
ifaces = NetworkInterface.getNetworkInterfaces();
|
||||||
}
|
}
|
||||||
catch (SocketException e) {
|
catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ifaces.hasMoreElements()) {
|
while (ifaces.hasMoreElements()) {
|
||||||
|
@ -142,7 +145,7 @@ public class BridgedResolver extends TransportResolver {
|
||||||
return InetAddress.getLocalHost().getHostAddress();
|
return InetAddress.getLocalHost().getHostAddress();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "127.0.0.1";
|
return "127.0.0.1";
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class HttpServer {
|
||||||
processRequest();
|
processRequest();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public class HttpServer {
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// Do Nothing
|
// Do Nothing
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.jingleold.nat;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,7 +259,7 @@ public class ICECandidate extends TransportCandidate implements Comparable<ICECa
|
||||||
echo.testASync(checkingCandidate, getPassword());
|
echo.testASync(checkingCandidate, getPassword());
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +272,7 @@ public class ICECandidate extends TransportCandidate implements Comparable<ICECa
|
||||||
Thread.sleep(400);
|
Thread.sleep(400);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TransportCandidate candidate : localCandidates) {
|
for (TransportCandidate candidate : localCandidates) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
@ -71,6 +72,7 @@ public class ICEResolver extends TransportResolver {
|
||||||
// we now cache established/initialized negotiators for each STUN server, so that subsequent uses
|
// we now cache established/initialized negotiators for each STUN server, so that subsequent uses
|
||||||
// of the STUN server are much, much faster.
|
// of the STUN server are much, much faster.
|
||||||
if (negociatorsMap.get(server) == null) {
|
if (negociatorsMap.get(server) == null) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
|
ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
|
||||||
negociatorsMap.put(server, iceNegociator);
|
negociatorsMap.put(server, iceNegociator);
|
||||||
|
|
||||||
|
@ -78,6 +80,7 @@ public class ICEResolver extends TransportResolver {
|
||||||
iceNegociator.gatherCandidateAddresses();
|
iceNegociator.gatherCandidateAddresses();
|
||||||
// priorize candidates
|
// priorize candidates
|
||||||
iceNegociator.prioritizeCandidates();
|
iceNegociator.prioritizeCandidates();
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,7 +138,7 @@ public class ICEResolver extends TransportResolver {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
} catch (SocketException e1) {
|
} catch (SocketException e1) {
|
||||||
e1.printStackTrace();
|
LOGGER.log(Level.WARNING, "exeption", e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(Math.abs(random.nextLong())), candidate.getPort(), "1", candidate.getPriority(), iceType);
|
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(Math.abs(random.nextLong())), candidate.getPort(), "1", candidate.getPriority(), iceType);
|
||||||
|
@ -145,7 +148,7 @@ public class ICEResolver extends TransportResolver {
|
||||||
transportCandidate.addCandidateEcho(session);
|
transportCandidate.addCandidateEcho(session);
|
||||||
}
|
}
|
||||||
catch (SocketException e) {
|
catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
this.addCandidate(transportCandidate);
|
this.addCandidate(transportCandidate);
|
||||||
|
|
||||||
|
@ -153,10 +156,10 @@ public class ICEResolver extends TransportResolver {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (UtilityException e) {
|
catch (UtilityException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a Relay Candidate from XMPP Server
|
// Get a Relay Candidate from XMPP Server
|
||||||
|
@ -207,10 +210,10 @@ public class ICEResolver extends TransportResolver {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// catch (UtilityException e) {
|
// catch (UtilityException e) {
|
||||||
// e.printStackTrace();
|
// LOGGER.log(Level.WARNING, "exception", e);
|
||||||
// }
|
// }
|
||||||
// catch (UnknownHostException e) {
|
// catch (UnknownHostException e) {
|
||||||
// e.printStackTrace();
|
// LOGGER.log(Level.WARNING, "exception", e);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Get Public Candidate From XMPP Server
|
// Get Public Candidate From XMPP Server
|
||||||
|
@ -229,7 +232,7 @@ public class ICEResolver extends TransportResolver {
|
||||||
ifaces = NetworkInterface.getNetworkInterfaces();
|
ifaces = NetworkInterface.getNetworkInterfaces();
|
||||||
}
|
}
|
||||||
catch (SocketException e) {
|
catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If detect this address in local machine, don't use it.
|
// If detect this address in local machine, don't use it.
|
||||||
|
@ -260,13 +263,13 @@ public class ICEResolver extends TransportResolver {
|
||||||
publicCandidate.addCandidateEcho(session);
|
publicCandidate.addCandidateEcho(session);
|
||||||
}
|
}
|
||||||
catch (SocketException e) {
|
catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCandidate(publicCandidate);
|
addCandidate(publicCandidate);
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingleold.nat;
|
package org.jivesoftware.smackx.jingleold.nat;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
@ -26,6 +29,7 @@ import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;
|
||||||
import org.jivesoftware.smackx.jingleold.media.PayloadType;
|
import org.jivesoftware.smackx.jingleold.media.PayloadType;
|
||||||
|
|
||||||
public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
|
public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(ICETransportManager.class.getName());
|
||||||
|
|
||||||
ICEResolver iceResolver = null;
|
ICEResolver iceResolver = null;
|
||||||
|
|
||||||
|
@ -35,7 +39,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
|
||||||
iceResolver.initializeAndWait();
|
iceResolver.initializeAndWait();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +48,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
|
||||||
iceResolver.resolve(session);
|
iceResolver.resolve(session);
|
||||||
}
|
}
|
||||||
catch (XMPPException e) {
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
return iceResolver;
|
return iceResolver;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.net.InetAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
@ -522,7 +523,7 @@ public class RTPBridge extends IQ {
|
||||||
ifaces = NetworkInterface.getNetworkInterfaces();
|
ifaces = NetworkInterface.getNetworkInterfaces();
|
||||||
}
|
}
|
||||||
catch (SocketException e) {
|
catch (SocketException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
while (ifaces!=null&&ifaces.hasMoreElements()) {
|
while (ifaces!=null&&ifaces.hasMoreElements()) {
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingleold.nat;
|
package org.jivesoftware.smackx.jingleold.nat;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingleold.JingleSession;
|
import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +27,8 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
|
||||||
* @author Thiago Camargo
|
* @author Thiago Camargo
|
||||||
*/
|
*/
|
||||||
public class STUNTransportManager extends JingleTransportManager {
|
public class STUNTransportManager extends JingleTransportManager {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(STUNTransportManager.class.getName());
|
||||||
|
|
||||||
STUNResolver stunResolver = null;
|
STUNResolver stunResolver = null;
|
||||||
|
|
||||||
public STUNTransportManager() {
|
public STUNTransportManager() {
|
||||||
|
@ -32,7 +37,7 @@ public class STUNTransportManager extends JingleTransportManager {
|
||||||
try {
|
try {
|
||||||
stunResolver.initializeAndWait();
|
stunResolver.initializeAndWait();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +45,7 @@ public class STUNTransportManager extends JingleTransportManager {
|
||||||
try {
|
try {
|
||||||
stunResolver.resolve(session);
|
stunResolver.resolve(session);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
return stunResolver;
|
return stunResolver;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +57,7 @@ public class TcpUdpBridgeClient {
|
||||||
LOGGER.fine("UDP: " + localUdpSocket.getLocalPort());
|
LOGGER.fine("UDP: " + localUdpSocket.getLocalPort());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
startBridge();
|
startBridge();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,7 @@ public class TcpUdpBridgeClient {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ public class TcpUdpBridgeClient {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +60,7 @@ public class TcpUdpBridgeServer {
|
||||||
LOGGER.fine("UDP: " + localUdpSocket.getLocalPort());
|
LOGGER.fine("UDP: " + localUdpSocket.getLocalPort());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
startBridge();
|
startBridge();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ public class TcpUdpBridgeServer {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ public class TcpUdpBridgeServer {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
@ -356,7 +357,9 @@ public abstract class TransportCandidate {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
InetAddress candAddress = InetAddress.getByName(getIp());
|
InetAddress candAddress = InetAddress.getByName(getIp());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
isUsable = true;//candAddress.isReachable(TransportResolver.CHECK_TIMEOUT);
|
isUsable = true;//candAddress.isReachable(TransportResolver.CHECK_TIMEOUT);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -646,7 +649,7 @@ public abstract class TransportCandidate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -691,7 +694,7 @@ public abstract class TransportCandidate {
|
||||||
cont = (password + ";" + candidate.getIp() + ":" + candidate.getPort()).getBytes("UTF-8");
|
cont = (password + ";" + candidate.getIp() + ":" + candidate.getPort()).getBytes("UTF-8");
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
packet.setData(cont);
|
packet.setData(cont);
|
||||||
|
@ -706,7 +709,7 @@ public abstract class TransportCandidate {
|
||||||
Thread.sleep(delay);
|
Thread.sleep(delay);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -757,9 +760,11 @@ public abstract class TransportCandidate {
|
||||||
String ip = addr[0];
|
String ip = addr[0];
|
||||||
String pt = addr[1];
|
String pt = addr[1];
|
||||||
|
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
if (pass.equals(password)
|
if (pass.equals(password)
|
||||||
&& transportCandidate.getIp().indexOf(ip) != -1
|
&& transportCandidate.getIp().indexOf(ip) != -1
|
||||||
&& transportCandidate.getPort() == Integer.parseInt(pt)) {
|
&& transportCandidate.getPort() == Integer.parseInt(pt)) {
|
||||||
|
// CHECKSTYLE:ON
|
||||||
LOGGER.fine("ECHO OK: " + candidate.getIp() + ":" + candidate.getPort() + " <-> " + transportCandidate.getIp() + ":" + transportCandidate.getPort());
|
LOGGER.fine("ECHO OK: " + candidate.getIp() + ":" + candidate.getPort() + " <-> " + transportCandidate.getIp() + ":" + transportCandidate.getPort());
|
||||||
TestResult testResult = new TestResult();
|
TestResult testResult = new TestResult();
|
||||||
testResult.setResult(true);
|
testResult.setResult(true);
|
||||||
|
@ -770,7 +775,7 @@ public abstract class TransportCandidate {
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.fine("ECHO Wrong Data: " + datagramPacket.getAddress().getHostAddress() + ":" + datagramPacket.getPort());
|
LOGGER.fine("ECHO Wrong Data: " + datagramPacket.getAddress().getHostAddress() + ":" + datagramPacket.getPort());
|
||||||
|
@ -785,7 +790,7 @@ public abstract class TransportCandidate {
|
||||||
content = new String(password + ";" + getIp() + ":" + getPort()).getBytes("UTF-8");
|
content = new String(password + ";" + getIp() + ":" + getPort()).getBytes("UTF-8");
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
DatagramPacket packet = new DatagramPacket(content, content.length);
|
DatagramPacket packet = new DatagramPacket(content, content.length);
|
||||||
|
@ -794,7 +799,7 @@ public abstract class TransportCandidate {
|
||||||
packet.setAddress(InetAddress.getByName(transportCandidate.getIp()));
|
packet.setAddress(InetAddress.getByName(transportCandidate.getIp()));
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e) {
|
catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
packet.setPort(transportCandidate.getPort());
|
packet.setPort(transportCandidate.getPort());
|
||||||
|
|
||||||
|
@ -808,7 +813,7 @@ public abstract class TransportCandidate {
|
||||||
Thread.sleep(delay);
|
Thread.sleep(delay);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -820,7 +825,7 @@ public abstract class TransportCandidate {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeListener(listener);
|
removeListener(listener);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
@ -164,7 +165,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
setNegotiatorState(JingleNegotiatorState.PENDING);
|
setNegotiatorState(JingleNegotiatorState.PENDING);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -302,7 +303,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once we are in pending state, look for any valid remote
|
// Once we are in pending state, look for any valid remote
|
||||||
|
@ -397,7 +398,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
bestRemote = getBestRemoteCandidate();
|
bestRemote = getBestRemoteCandidate();
|
||||||
|
@ -431,7 +432,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
session
|
session
|
||||||
.terminate("Unable to negotiate session. This may be caused by firewall configuration problems.");
|
.terminate("Unable to negotiate session. This may be caused by firewall configuration problems.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
@ -372,7 +373,7 @@ public abstract class TransportResolver {
|
||||||
LOGGER.fine("Transport resolved");
|
LOGGER.fine("Transport resolved");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +396,7 @@ public abstract class TransportResolver {
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -404,7 +405,7 @@ public abstract class TransportResolver {
|
||||||
ss.close();
|
ss.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
LOGGER.log(Level.WARNING, "exception", e);
|
||||||
}
|
}
|
||||||
return freePort;
|
return freePort;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ public class MacroGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<macrogroup>");
|
buf.append("<macrogroup>");
|
||||||
buf.append("<title>" + getTitle() + "</title>");
|
buf.append("<title>" + getTitle() + "</title>");
|
||||||
|
@ -137,5 +138,6 @@ public class MacroGroup {
|
||||||
}
|
}
|
||||||
buf.append("</macrogroup>");
|
buf.append("</macrogroup>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,11 @@ public class Macros extends IQ {
|
||||||
buf.append("<personal>true</personal>");
|
buf.append("<personal>true</personal>");
|
||||||
}
|
}
|
||||||
if (getPersonalMacroGroup() != null) {
|
if (getPersonalMacroGroup() != null) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
buf.append("<personalMacro>");
|
buf.append("<personalMacro>");
|
||||||
buf.append(StringUtils.escapeForXML(getPersonalMacroGroup().toXML()));
|
buf.append(StringUtils.escapeForXML(getPersonalMacroGroup().toXML()));
|
||||||
buf.append("</personalMacro>");
|
buf.append("</personalMacro>");
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -123,6 +125,7 @@ public class Macros extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Macro parseMacro(XmlPullParser parser) throws XmlPullParserException, IOException {
|
public Macro parseMacro(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
Macro macro = new Macro();
|
Macro macro = new Macro();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
|
@ -149,9 +152,11 @@ public class Macros extends IQ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return macro;
|
return macro;
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
public MacroGroup parseMacroGroup(XmlPullParser parser) throws XmlPullParserException, IOException {
|
public MacroGroup parseMacroGroup(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
MacroGroup group = new MacroGroup();
|
MacroGroup group = new MacroGroup();
|
||||||
|
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
@ -175,10 +180,11 @@ public class Macros extends IQ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
|
|
||||||
public MacroGroup parseMacroGroups(String macros) throws XmlPullParserException, IOException {
|
public MacroGroup parseMacroGroups(String macros) throws XmlPullParserException, IOException {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
MacroGroup group = null;
|
MacroGroup group = null;
|
||||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||||
parser.setInput(new StringReader(macros));
|
parser.setInput(new StringReader(macros));
|
||||||
|
@ -192,6 +198,7 @@ public class Macros extends IQ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,13 +469,17 @@ public class Workgroup {
|
||||||
|
|
||||||
private void fireInvitationEvent(WorkgroupInvitation invitation) {
|
private void fireInvitationEvent(WorkgroupInvitation invitation) {
|
||||||
for (WorkgroupInvitationListener listener : invitationListeners ){
|
for (WorkgroupInvitationListener listener : invitationListeners ){
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
listener.invitationReceived(invitation);
|
listener.invitationReceived(invitation);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireQueueJoinedEvent() {
|
private void fireQueueJoinedEvent() {
|
||||||
for (QueueListener listener : queueListeners){
|
for (QueueListener listener : queueListeners){
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
listener.joinedQueue();
|
listener.joinedQueue();
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
|
||||||
@Override
|
@Override
|
||||||
public RosterExchange parse(XmlPullParser parser, int initialDepth)
|
public RosterExchange parse(XmlPullParser parser, int initialDepth)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
RosterExchange rosterExchange = new RosterExchange();
|
RosterExchange rosterExchange = new RosterExchange();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
RemoteRosterEntry remoteRosterEntry = null;
|
RemoteRosterEntry remoteRosterEntry = null;
|
||||||
|
@ -78,7 +78,7 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// CHECKSTYLE:ON
|
||||||
return rosterExchange;
|
return rosterExchange;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,8 +97,6 @@ public class ParseStreamManagementTest {
|
||||||
.element(errorCondition.toString(), XMPPError.NAMESPACE)
|
.element(errorCondition.toString(), XMPPError.NAMESPACE)
|
||||||
.asString(outputProperties);
|
.asString(outputProperties);
|
||||||
|
|
||||||
System.err.println(failedStanza);
|
|
||||||
|
|
||||||
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
|
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
|
||||||
PacketParserUtils.getParserFor(failedStanza));
|
PacketParserUtils.getParserFor(failedStanza));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue