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:
Florian Schmaus 2015-03-17 21:19:06 +01:00
parent 4f64bb1036
commit b2221d5483
59 changed files with 382 additions and 202 deletions

View File

@ -6,6 +6,7 @@
<module name="SuppressionFilter">
<property name="file" value="config/suppressions.xml"/>
</module>
<module name="SuppressionCommentFilter"/>
<module name="Header">
<property name="headerFile" value="config/header.txt"/>
<property name="ignoreLines" value="3"/>
@ -22,6 +23,10 @@
<property name="format" value="^\s+$"/>
<property name="message" value="Line containing only whitespace character(s)"/>
</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
<module name="RegexpSingleline">
<property name="format" value="^.*\S+\s+$"/>
@ -29,6 +34,7 @@
</module>
-->
<module name="TreeWalker">
<module name="FileContentsHolder"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
@ -40,5 +46,15 @@
<module name="GenericWhitespace"/>
<module name="EmptyStatement"/>
<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>

View File

@ -45,4 +45,9 @@ public class AndroidDebugger extends AbstractDebugger {
protected void log(String logMessage) {
Log.d("SMACK", logMessage);
}
@Override
protected void log(String logMessage, Throwable throwable) {
Log.d("SMACK", logMessage, throwable);
}
}

View File

@ -244,10 +244,12 @@ public class PacketCollector {
*/
protected void processPacket(Stanza packet) {
if (packetFilter == null || packetFilter.accept(packet)) {
// CHECKSTYLE:OFF
while (!resultQueue.offer(packet)) {
// Since we know the queue is full, this poll should never actually block.
resultQueue.poll();
}
// CHECKSTYLE:ON
if (collectorToReset != null) {
collectorToReset.waitStart = System.currentTimeMillis();
}

View File

@ -98,15 +98,13 @@ public abstract class AbstractDebugger implements SmackDebugger {
log(
"XMPPConnection closed due to an exception (" +
connection.getConnectionCounter() +
")");
e.printStackTrace();
")", e);
}
public void reconnectionFailed(Exception e) {
log(
"Reconnection failed due to an exception (" +
connection.getConnectionCounter() +
")");
e.printStackTrace();
")", e);
}
public void reconnectionSuccessful() {
log(
@ -125,6 +123,8 @@ public abstract class AbstractDebugger implements SmackDebugger {
protected abstract void log(String logMessage);
protected abstract void log(String logMessage, Throwable throwable);
public Reader newConnectionReader(Reader newReader) {
reader.removeReaderListener(readerListener);
ObservableReader debugReader = new ObservableReader(newReader);

View File

@ -18,7 +18,9 @@ package org.jivesoftware.smack.debugger;
import org.jivesoftware.smack.XMPPConnection;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -47,7 +49,19 @@ public class ConsoleDebugger extends AbstractDebugger {
synchronized (dateFormatter) {
formatedDate = dateFormatter.format(new Date());
}
// CHECKSTYLE:OFF
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);
}
}

View File

@ -20,6 +20,7 @@ import org.jivesoftware.smack.XMPPConnection;
import java.io.Reader;
import java.io.Writer;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -46,4 +47,8 @@ public class JulDebugger extends AbstractDebugger {
LOGGER.fine(logMessage);
}
@Override
protected void log(String logMessage, Throwable throwable) {
LOGGER.log(Level.FINE, logMessage, throwable);
}
}

View File

@ -528,7 +528,9 @@ public class PacketParserUtils {
String language = getLanguageAttribute(parser);
if (language != null && !"".equals(language.trim())) {
// CHECKSTYLE:OFF
presence.setLanguage(language);
// CHECKSTYLE:ON
}
// Parse sub-elements
@ -993,15 +995,19 @@ public class PacketParserUtils {
}
private static String getLanguageAttribute(XmlPullParser parser) {
// CHECKSTYLE:OFF
for (int i = 0; i < parser.getAttributeCount(); i++) {
// CHECKSTYLE:ON
String attributeName = parser.getAttributeName(i);
if ( "xml:lang".equals(attributeName) ||
("lang".equals(attributeName) &&
"xml".equals(parser.getAttributePrefix(i)))) {
// CHECKSTYLE:OFF
return parser.getAttributeValue(i);
}
}
return null;
// CHECKSTYLE:ON
}
@Deprecated

View File

@ -134,17 +134,11 @@ public class DummyConnection extends AbstractXMPPConnection {
@Override
public void send(PlainStreamElement element) {
if (SmackConfiguration.DEBUG) {
System.out.println("[SEND]: " + element.toXML());
}
queue.add(element);
}
@Override
protected void sendStanzaInternal(Stanza packet) {
if (SmackConfiguration.DEBUG) {
System.out.println("[SEND]: " + packet.toXML());
}
queue.add(packet);
}
@ -194,10 +188,6 @@ public class DummyConnection extends AbstractXMPPConnection {
* @param packet the packet to process.
*/
public void processPacket(Stanza packet) {
if (SmackConfiguration.DEBUG) {
System.out.println("[RECV]: " + packet.toXML());
}
invokePacketCollectorsAndNotifyRecvListeners(packet);
}

View File

@ -20,6 +20,8 @@ import java.io.IOException;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
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.packet.IQ;
@ -33,6 +35,8 @@ import org.jivesoftware.smack.packet.IQ.Type;
*
*/
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<Stanza> messageQ = new LinkedBlockingQueue<Stanza>(5);
private volatile boolean timeout = false;
@ -82,7 +86,7 @@ public class ThreadedDummyConnection extends DummyConnection {
if (!messageQ.isEmpty())
new ProcessQueue(messageQ).start();
else
System.out.println("No messages to process");
LOGGER.warning("No messages to process");
}
class ProcessQueue extends Thread {
@ -97,7 +101,7 @@ public class ThreadedDummyConnection extends DummyConnection {
try {
processPacket(processQ.take());
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}

View File

@ -754,25 +754,30 @@ public class PacketParserUtilsTest {
@Test
public void validateSimplePresence() throws Exception {
// CHECKSTYLE:OFF
String stanza = "<presence from='juliet@example.com/balcony' to='romeo@example.net'/>";
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXMLEqual(stanza, presence.toXML().toString());
// CHECKSTYLE:ON
}
@Test
public void validatePresenceProbe() throws Exception {
// CHECKSTYLE:OFF
String stanza = "<presence from='mercutio@example.com' id='xv291f38' to='juliet@example.com' type='unsubscribed'/>";
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXMLEqual(stanza, presence.toXML().toString());
assertEquals(Presence.Type.unsubscribed, presence.getType());
// CHECKSTYLE:ON
}
@Test
public void validatePresenceOptionalElements() throws Exception {
// CHECKSTYLE:OFF
String stanza = "<presence xml:lang='en' type='unsubscribed'>"
+ "<show>dnd</show>"
+ "<status>Wooing Juliet</status>"
@ -786,6 +791,7 @@ public class PacketParserUtilsTest {
assertEquals("en", presence.getLanguage());
assertEquals("Wooing Juliet", presence.getStatus());
assertEquals(1, presence.getPriority());
// CHECKSTYLE:ON
}
@Test

View File

@ -289,8 +289,10 @@ public class EnhancedDebugger implements SmackDebugger {
new DefaultTableModel(
new Object[]{"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
0) {
// CHECKSTYLE:OFF
private static final long serialVersionUID = 8136121224474217264L;
public boolean isCellEditable(int rowIndex, int mColIndex) {
// CHECKSTYLE:ON
return false;
}
@ -583,7 +585,7 @@ public class EnhancedDebugger implements SmackDebugger {
connection.sendStanza(packetToSend);
}
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},
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
new Object[]{"Type", "Received", "Sent"}) {
// CHECKSTYLE:OFF
private static final long serialVersionUID = -6793886085109589269L;
public boolean isCellEditable(int rowIndex, int mColIndex) {
// CHECKSTYLE:ON
return false;
}
};

View File

@ -93,11 +93,15 @@ public class Privacy extends IQ {
*/
public void deletePrivacyList(String listName) {
// Remove the list from the cache
// CHECKSTYLE:OFF
this.getItemLists().remove(listName);
// CHECKSTYLE:ON
// Check if deleted list was the default list
if (this.getDefaultName() != null && listName.equals(this.getDefaultName())) {
// CHECKSTYLE:OFF
this.setDefaultName(null);
// CHECKSTYLE:ON
}
}
@ -108,11 +112,13 @@ public class Privacy extends IQ {
*/
public List<PrivacyItem> getActivePrivacyList() {
// Check if we have the default list
// CHECKSTYLE:OFF
if (this.getActiveName() == null) {
return null;
} else {
return this.getItemLists().get(this.getActiveName());
}
// CHECKSTYLE:ON
}
/**
@ -122,11 +128,13 @@ public class Privacy extends IQ {
*/
public List<PrivacyItem> getDefaultPrivacyList() {
// Check if we have the default list
// CHECKSTYLE:OFF
if (this.getDefaultName() == null) {
return null;
} else {
return this.getItemLists().get(this.getDefaultName());
}
// CHECKSTYLE:ON
}
/**
@ -147,6 +155,7 @@ public class Privacy extends IQ {
* @return a List with {@link PrivacyItem}
*/
public PrivacyItem getItem(String listName, int order) {
// CHECKSTYLE:OFF
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
PrivacyItem itemFound = null;
while (itemFound == null && values.hasNext()) {
@ -156,6 +165,7 @@ public class Privacy extends IQ {
}
}
return itemFound;
// CHECKSTYLE:ON
}
/**
@ -169,7 +179,9 @@ public class Privacy extends IQ {
this.setDefaultName(newDefault);
return true;
} else {
// CHECKSTYLE:OFF
return false;
// CHECKSTYLE:ON
}
}
@ -179,7 +191,9 @@ public class Privacy extends IQ {
* @param listName name of the list to remove.
*/
public void deleteList(String listName) {
// CHECKSTYLE:OFF
this.getItemLists().remove(listName);
// CHECKSTYLE:ON
}
/**
@ -188,9 +202,11 @@ public class Privacy extends IQ {
*
* @return the name of the active list.
*/
// CHECKSTYLE:OFF
public String getActiveName() {
return activeName;
}
// CHECKSTYLE:ON
/**
* 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.
*/
// CHECKSTYLE:OFF
public void setActiveName(String activeName) {
this.activeName = activeName;
}
// CHECKSTYLE:ON
/**
* 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.
*/
// CHECKSTYLE:OFF
public String getDefaultName() {
return defaultName;
}
// CHECKSTYLE:ON
/**
* 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.
*/
// CHECKSTYLE:OFF
public void setDefaultName(String defaultName) {
this.defaultName = defaultName;
}
// CHECKSTYLE:ON
/**
* 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
* collection of privacy items.
*/
// CHECKSTYLE:OFF
public Map<String, List<PrivacyItem>> getItemLists() {
return itemLists;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or declines the use of an active list.
*
* @return the decline status of the list.
*/
// CHECKSTYLE:OFF
public boolean isDeclineActiveList() {
return declineActiveList;
}
// CHECKSYTLE:ON
/**
* 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.
*/
// CHECKSTYLE:OFF
public void setDeclineActiveList(boolean declineActiveList) {
this.declineActiveList = declineActiveList;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or declines the use of a default list.
*
* @return the decline status of the list.
*/
// CHECKSTYLE:OFF
public boolean isDeclineDefaultList() {
return declineDefaultList;
}
// CHECKSTYLE:ON
/**
* 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.
*/
// CHECKSTYLE:OFF
public void setDeclineDefaultList(boolean declineDefaultList) {
this.declineDefaultList = declineDefaultList;
}
@ -282,10 +313,12 @@ public class Privacy extends IQ {
public Set<String> getPrivacyListNames() {
return this.itemLists.keySet();
}
// CHECKSTYLE:ON
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
buf.rightAngleBracket();
// CHECKSTYLE:OFF
// Add the active tag
if (this.isDeclineActiveList()) {
@ -323,7 +356,7 @@ public class Privacy extends IQ {
buf.append("</list>");
}
}
// CHECKSTYLE:ON
return buf;
}

View File

@ -131,8 +131,10 @@ public class PrivacyItem {
* @return the allow communication status.
*/
public boolean isAllow() {
// CHECKSTYLE:OFF
return allow;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
@ -140,8 +142,10 @@ public class PrivacyItem {
* @return the iq filtering status.
*/
public boolean isFilterIQ() {
// CHECKSTYLE:OFF
return filterIQ;
}
// CHECKSTYLE:ON
/**
* 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.
*/
public void setFilterIQ(boolean filterIQ) {
// CHECKSTYLE:OFF
this.filterIQ = filterIQ;
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or denies incoming messages or not.
@ -158,8 +165,10 @@ public class PrivacyItem {
* @return the message filtering status.
*/
public boolean isFilterMessage() {
// CHECKSTYLE:OFF
return filterMessage;
}
// CHECKSTYLE:ON
/**
* 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.
*/
public void setFilterMessage(boolean filterMessage) {
// CHECKSTYLE:OFF
this.filterMessage = filterMessage;
}
// CHECKSTYLE:ON
/**
* 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.
*/
public boolean isFilterPresenceIn() {
// CHECKSTYLE:OFF
return filterPresenceIn;
}
// CHECKSTYLE:ON
/**
* 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.
*/
public void setFilterPresenceIn(boolean filterPresenceIn) {
// CHECKSTYLE:OFF
this.filterPresenceIn = filterPresenceIn;
}
// CHECKSTYLE:ON
/**
* 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.
*/
public boolean isFilterPresenceOut() {
// CHECKSTYLE:OFF
return filterPresenceOut;
}
// CHECKSTYLE:ON
/**
* 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
*/
public void setFilterPresenceOut(boolean filterPresenceOut) {
// CHECKSTYLE:OFF
this.filterPresenceOut = filterPresenceOut;
}
// CHECKSTYLE:ON
/**
* Returns the order where the receiver is processed. List items are processed in
@ -216,8 +235,10 @@ public class PrivacyItem {
* @return the order number.
*/
public long getOrder() {
// CHECKSTYLE:OFF
return order;
}
// CHECKSTYLE:ON
/**
* Returns the type hold the kind of communication it will allow or block.
@ -227,7 +248,9 @@ public class PrivacyItem {
*/
public Type getType() {
return type;
// CHECKSTYLE:OFF
}
// CHECKSTYLE:ON
/**
* Returns the element identifier to apply the action.
@ -242,7 +265,9 @@ public class PrivacyItem {
*/
public String getValue() {
return value;
// CHECKSTYLE:OFF
}
// CHECKSTYLE:ON
/**
* Returns whether the receiver allows or denies every kind of communication.
@ -253,6 +278,7 @@ public class PrivacyItem {
* @return the all communications status.
*/
public boolean isFilterEverything() {
// CHECKSTYLE:OFF
return !(this.isFilterIQ() || this.isFilterMessage() || this.isFilterPresenceIn()
|| this.isFilterPresenceOut());
}
@ -295,6 +321,7 @@ public class PrivacyItem {
}
buf.append("</item>");
}
// CHECKSTYLE:ON
return buf.toString();
}

View File

@ -45,6 +45,7 @@ public class PrivacyProvider extends IQProvider<Privacy> {
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
// CHECKSTYLE:OFF
if (parser.getName().equals("active")) {
String activeName = parser.getAttributeValue("", "name");
if (activeName == null) {
@ -61,6 +62,7 @@ public class PrivacyProvider extends IQProvider<Privacy> {
privacy.setDefaultName(defaultName);
}
}
// CHECKSTYLE:ON
else if (parser.getName().equals("list")) {
parseList(parser, privacy);
}
@ -84,7 +86,9 @@ public class PrivacyProvider extends IQProvider<Privacy> {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("item")) {
// CHECKSTYLE:OFF
items.add(parseItem(parser));
// CHECKSTYLE:ON
}
}
else if (eventType == XmlPullParser.END_TAG) {
@ -95,10 +99,12 @@ public class PrivacyProvider extends IQProvider<Privacy> {
}
privacy.setPrivacyList(listName, items);
// CHECKSTYLE:OFF
}
// Parse the list complex type
private static PrivacyItem parseItem(XmlPullParser parser) throws XmlPullParserException, IOException, SmackException {
// CHECKSTYLE:ON
// Retrieves the required attributes
String actionValue = parser.getAttributeValue("", "action");
// Set the order number, this attribute is required
@ -135,7 +141,9 @@ public class PrivacyProvider extends IQProvider<Privacy> {
}
parseItemChildElements(parser, item);
return item;
// CHECKSTYLE:OFF
}
// CHECKSTYLE:ON
private static void parseItemChildElements(XmlPullParser parser, PrivacyItem privacyItem) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth();

View File

@ -85,7 +85,9 @@ public class Item extends NodeExtension
*/
public Item(String itemId, String nodeId)
{
// CHECKSTYLE:OFF
super(PubSubElementType.ITEM_EVENT, nodeId);
// CHECKSTYLE:ON
id = itemId;
}

View File

@ -26,6 +26,8 @@ import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
@ -36,6 +38,7 @@ import org.jivesoftware.smack.SmackException;
* @author Henning Staib
*/
public class Socks5TestProxy {
private static final Logger LOGGER = Logger.getLogger(Socks5TestProxy.class.getName());
/* SOCKS5 proxy singleton */
private static Socks5TestProxy socks5Server;
@ -102,7 +105,7 @@ public class Socks5TestProxy {
this.serverThread.start();
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, "exception", e);
// do nothing
}
}
@ -120,7 +123,7 @@ public class Socks5TestProxy {
}
catch (IOException e) {
// do nothing
e.printStackTrace();
LOGGER.log(Level.SEVERE, "exception", e);
}
if (this.serverThread != null && this.serverThread.isAlive()) {
@ -130,7 +133,7 @@ public class Socks5TestProxy {
}
catch (InterruptedException e) {
// do nothing
e.printStackTrace();
LOGGER.log(Level.SEVERE, "exception", e);
}
}
this.serverThread = null;
@ -176,7 +179,7 @@ public class Socks5TestProxy {
try {
wait(5000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, "exception", e);
} finally {
if (!startupComplete) {
throw new IllegalStateException("Startup of Socks5TestProxy failed within 5 seconds");
@ -230,7 +233,7 @@ public class Socks5TestProxy {
}
catch (Exception e) {
try {
e.printStackTrace();
LOGGER.log(Level.SEVERE, "exception", e);
socket.close();
}
catch (IOException e1) {

View File

@ -124,6 +124,7 @@ public class Protocol {
*/
@SuppressWarnings("unchecked")
public void verifyAll() {
// CHECKSTYLE:OFF
assertEquals(requests.size(), responsesList.size());
if (printProtocol)
@ -154,6 +155,7 @@ public class Protocol {
}
if (printProtocol)
System.out.println("=================== End =================\n");
// CHECKSTYLE:ON
}
/**

View File

@ -153,7 +153,9 @@ public class ChatManager extends Manager{
Message message = (Message) packet;
Chat chat;
if (message.getThread() == null) {
// CHECKSTYLE:OFF
chat = getUserChat(message.getFrom());
// CHECKSTYLE:ON
}
else {
chat = getThreadChat(message.getThread());

View File

@ -122,7 +122,7 @@ public class DirectoryRosterStore implements RosterStore {
for (File file : fileDir.listFiles(rosterDirFilter)) {
Item entry = readEntry(file);
if (entry == null) {
log("Roster store file '" + file + "' is invalid.");
LOGGER.severe("Roster store file '" + file + "' is invalid.");
}
else {
entries.add(entry);
@ -228,7 +228,7 @@ public class DirectoryRosterStore implements RosterStore {
groupNames.add(group);
}
else {
log("Invalid group entry in store entry file "
LOGGER.severe("Invalid group entry in store entry file "
+ file);
}
}
@ -245,9 +245,7 @@ public class DirectoryRosterStore implements RosterStore {
return null;
}
catch (XmlPullParserException e) {
log("Invalid group entry in store entry file "
+ file);
LOGGER.log(Level.SEVERE, "readEntry()", e);
LOGGER.log(Level.SEVERE, "Invalid group entry in store entry file", e);
return null;
}
@ -264,14 +262,14 @@ public class DirectoryRosterStore implements RosterStore {
item.setItemType(RosterPacket.ItemType.valueOf(type));
}
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;
}
if (status != null) {
RosterPacket.ItemStatus itemStatus = RosterPacket.ItemStatus
.fromString(status);
if (itemStatus == null) {
log("Invalid status in store entry file " + file);
LOGGER.severe("Invalid status in store entry file " + file);
return null;
}
item.setItemStatus(itemStatus);
@ -304,8 +302,4 @@ public class DirectoryRosterStore implements RosterStore {
String encodedJid = Base32.encode(bareJid.toString());
return new File(fileDir, ENTRY_PREFIX + encodedJid);
}
private void log(String error) {
System.err.println(error);
}
}

View File

@ -31,7 +31,6 @@ import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.im.InitSmackIm;
@ -716,38 +715,20 @@ public class RosterTest extends InitSmackIm {
public synchronized void entriesAdded(Collection<Jid> addresses) {
addressesAdded.addAll(addresses);
if (SmackConfiguration.DEBUG) {
for (Jid address : addresses) {
System.out.println("Roster entry for " + address + " added.");
}
}
reportInvoked();
}
public synchronized void entriesDeleted(Collection<Jid> addresses) {
addressesDeleted.addAll(addresses);
if (SmackConfiguration.DEBUG) {
for (Jid address : addresses) {
System.out.println("Roster entry for " + address + " deleted.");
}
}
reportInvoked();
}
public synchronized void entriesUpdated(Collection<Jid> addresses) {
addressesUpdated.addAll(addresses);
if (SmackConfiguration.DEBUG) {
for (Jid address : addresses) {
System.out.println("Roster entry for " + address + " updated.");
}
}
reportInvoked();
}
public void presenceChanged(Presence presence) {
if (SmackConfiguration.DEBUG) {
System.out.println("Roster presence changed: " + presence.toXML());
}
reportInvoked();
}

View File

@ -73,7 +73,7 @@ public class Demo extends JFrame {
initialize();
}
catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -100,7 +100,7 @@ public class Demo extends JFrame {
incoming.startIncoming();
}
catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}

View File

@ -233,7 +233,7 @@ public class JingleManagerTest extends SmackTestCase {
assertTrue(valCounter() > 0);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("An error occured with Jingle");
}
}
@ -278,7 +278,7 @@ public class JingleManagerTest extends SmackTestCase {
JingleSession session1 = request.accept();
session1.startIncoming();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
});
@ -293,7 +293,7 @@ public class JingleManagerTest extends SmackTestCase {
assertTrue(valCounter() > 0);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("An error occured with Jingle");
}
}
@ -369,7 +369,7 @@ public class JingleManagerTest extends SmackTestCase {
session1.startIncoming();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
});
@ -384,7 +384,7 @@ public class JingleManagerTest extends SmackTestCase {
assertTrue(valCounter() == 1);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("An error occured with Jingle");
}
}
@ -456,7 +456,7 @@ public class JingleManagerTest extends SmackTestCase {
session1.startIncoming();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
});
@ -498,7 +498,7 @@ public class JingleManagerTest extends SmackTestCase {
assertTrue(valCounter() == 2);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("An error occured with Jingle");
}
}
@ -542,7 +542,7 @@ public class JingleManagerTest extends SmackTestCase {
session.startIncoming();
session.terminate();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -588,7 +588,7 @@ public class JingleManagerTest extends SmackTestCase {
assertTrue(valCounter() > 0);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("An error occured with Jingle");
}
}
@ -625,7 +625,7 @@ public class JingleManagerTest extends SmackTestCase {
incCounter();
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -666,11 +666,11 @@ public class JingleManagerTest extends SmackTestCase {
ds1.close();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -737,7 +737,7 @@ public class JingleManagerTest extends SmackTestCase {
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -783,7 +783,7 @@ public class JingleManagerTest extends SmackTestCase {
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
System.out.println(valCounter());
@ -871,7 +871,7 @@ public class JingleManagerTest extends SmackTestCase {
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -893,7 +893,7 @@ public class JingleManagerTest extends SmackTestCase {
Thread.sleep(15000);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -941,7 +941,7 @@ public class JingleManagerTest extends SmackTestCase {
//
// ses.startIncoming();
// } catch (Exception e) {
// e.printStackTrace();
// LOGGER.log(Level.WARNING, "exception", e);
// }
// }
// });
@ -984,7 +984,7 @@ public class JingleManagerTest extends SmackTestCase {
// assertTrue(valCounter() > 0);
//
// } catch (Exception e) {
// e.printStackTrace();
// LOGGER.log(Level.WARNING, "exception", e);
// fail("An error occured with Jingle");
// }
// }

View File

@ -96,7 +96,7 @@ public class JingleMediaTest extends SmackTestCase {
// });
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -122,7 +122,7 @@ public class JingleMediaTest extends SmackTestCase {
Thread.sleep(60000);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -165,11 +165,11 @@ public class JingleMediaTest extends SmackTestCase {
try {
Thread.sleep(12000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -203,7 +203,7 @@ public class JingleMediaTest extends SmackTestCase {
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -238,7 +238,7 @@ public class JingleMediaTest extends SmackTestCase {
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -257,7 +257,7 @@ public class JingleMediaTest extends SmackTestCase {
x1.disconnect();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -293,7 +293,7 @@ public class JingleMediaTest extends SmackTestCase {
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -312,7 +312,7 @@ public class JingleMediaTest extends SmackTestCase {
x1.disconnect();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -355,7 +355,7 @@ public class JingleMediaTest extends SmackTestCase {
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -381,7 +381,7 @@ public class JingleMediaTest extends SmackTestCase {
x1.disconnect();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
});
@ -392,7 +392,7 @@ public class JingleMediaTest extends SmackTestCase {
try {
Thread.sleep(250000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -429,7 +429,7 @@ public class JingleMediaTest extends SmackTestCase {
session.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -459,7 +459,7 @@ public class JingleMediaTest extends SmackTestCase {
x1.disconnect();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -480,7 +480,7 @@ public class JingleMediaTest extends SmackTestCase {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
audioChannel0.stop();
@ -489,10 +489,10 @@ public class JingleMediaTest extends SmackTestCase {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -515,7 +515,7 @@ public class JingleMediaTest extends SmackTestCase {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
audioChannel0.stop();
@ -524,11 +524,11 @@ public class JingleMediaTest extends SmackTestCase {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}

View File

@ -106,7 +106,7 @@ public class BridgedResolverTest extends SmackTestCase {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
assertTrue(valCounter() == 1);

View File

@ -175,9 +175,9 @@ public class STUNResolverTest extends SmackTestCase {
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|"
+ candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
} catch (UtilityException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
} catch (UnknownHostException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
Candidate candidate = cc.getSortedCandidates().get(0);
@ -251,7 +251,7 @@ public class STUNResolverTest extends SmackTestCase {
Thread.sleep(55000);
assertTrue(valCounter() > 0);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -353,7 +353,7 @@ public class STUNResolverTest extends SmackTestCase {
});
session1.startIncoming();
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
});
@ -395,7 +395,7 @@ public class STUNResolverTest extends SmackTestCase {
assertTrue(valCounter() == 2);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("An error occured with Jingle");
}
}

View File

@ -52,7 +52,7 @@ public class TransportResolverTest extends SmackTestCase {
try {
tr.resolve(null);
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
fail("Error resolving");
}
}

View File

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.jingleold;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.ConnectionCreationListener;
@ -125,7 +126,7 @@ import org.jxmpp.jid.Jid;
* // Start the call
* session.start();
* } catch (XMPPException e) {
* e.printStackTrace();
* LOGGER.log(Level.WARNING, "exception", e);
* }
* <p/>
* }
@ -134,7 +135,7 @@ import org.jxmpp.jid.Jid;
* Thread.sleep(15000);
* <p/>
* } catch (Exception e) {
* e.printStackTrace();
* LOGGER.log(Level.WARNING, "exception", e);
* }
* <p/>
* To create an Outgoing Jingle Session:
@ -168,7 +169,7 @@ import org.jxmpp.jid.Jid;
* Thread.sleep(3000);
* <p/>
* } catch (Exception e) {
* e.printStackTrace();
* LOGGER.log(Level.WARNING, "exception", e);
* }
* </pre>
*
@ -239,7 +240,7 @@ public class JingleManager implements JingleSessionListener {
try {
aux.terminate();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -404,7 +405,7 @@ public class JingleManager implements JingleSessionListener {
try {
createdJingleSessionListener.sessionCreated(jingleSession);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -482,7 +483,7 @@ public class JingleManager implements JingleSessionListener {
try {
jingleSession.terminate();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
sessions.clear();

View File

@ -236,7 +236,7 @@ public abstract class JingleNegotiator {
*/
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
// CHECKSTYLE:OFF
public void start() {
isStarted = true;
doStart();
@ -245,6 +245,7 @@ public abstract class JingleNegotiator {
public boolean isStarted() {
return isStarted;
}
// CHECKSTYLE:ON
/**
* Each of the negotiators has their individual behavior when they start.

View File

@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
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.
// Each content negotiator may pass back a list of JingleContent for addition to the response packet.
// CHECKSTYLE:OFF
for (ContentNegotiator contentNegotiator : contentNegotiators) {
// 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
@ -307,6 +308,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
}
responses.addAll(contentNegotiator.dispatchIncomingPacket(iq, responseId));
}
// CHECKSTYLE:ON
}
// Acknowledge the IQ reception
@ -471,8 +473,10 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
}
// The the packet.
// CHECKSTYLE:OFF
if ((getConnection() != null) && (getConnection().isConnected()))
getConnection().sendStanza(jout);
// CHECKSTYLE:ON
}
return jout;
}
@ -644,11 +648,13 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
}
private void removeConnectionListener() {
// CHECKSTYLE:OFF
if (connectionListener != null) {
getConnection().removeConnectionListener(connectionListener);
LOGGER.fine("JINGLE SESSION: REMOVE CONNECTION LISTENER");
}
// CHECKSTYLE:ON
}
/**
@ -676,7 +682,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
try {
receivePacketAndRespond((IQ) packet);
} 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 {
if (isFullyEstablished()) {
// CHECKSTYLE:OFF
// Indicate that this session is active.
setSessionState(JingleSessionStateActive.getInstance());
for (ContentNegotiator contentNegotiator : contentNegotiators) {
// CHECKSTYLE:ON
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
contentNegotiator.triggerContentEstablished();
}
@ -1081,7 +1088,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
try {
resolver = transportManager.getResolver(this);
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {

View File

@ -16,6 +16,9 @@
*/
package org.jivesoftware.smackx.jingleold;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.jingleold.packet.Jingle;
import org.jivesoftware.smackx.jingleold.packet.JingleError;
@ -25,6 +28,8 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError;
* @see JingleSessionState
*/
public class JingleSessionStateActive extends JingleSessionState {
private static final Logger LOGGER = Logger.getLogger(JingleSessionStateActive.class.getName());
private static JingleSessionStateActive INSTANCE = null;
protected JingleSessionStateActive() {
@ -98,7 +103,7 @@ public class JingleSessionStateActive extends JingleSessionState {
try {
session.terminate("Closed remotely");
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return response;

View File

@ -16,6 +16,9 @@
*/
package org.jivesoftware.smackx.jingleold;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.jingleold.packet.Jingle;
@ -25,6 +28,8 @@ import org.jivesoftware.smackx.jingleold.packet.Jingle;
*/
public class JingleSessionStatePending extends JingleSessionState {
private static final Logger LOGGER = Logger.getLogger(JingleSessionStatePending.class.getName());
private static JingleSessionStatePending INSTANCE = null;
protected JingleSessionStatePending() {
@ -124,7 +129,7 @@ public class JingleSessionStatePending extends JingleSessionState {
try {
session.terminate("Closed remotely");
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return response;

View File

@ -16,6 +16,9 @@
*/
package org.jivesoftware.smackx.jingleold;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
@ -36,6 +39,8 @@ import org.jivesoftware.smackx.jingleold.packet.JingleTransport;
* @see JingleSessionState
*/
public class JingleSessionStateUnknown extends JingleSessionState {
private static final Logger LOGGER = Logger.getLogger(JingleSessionStateUnknown.class.getName());
private static JingleSessionStateUnknown INSTANCE = null;
protected JingleSessionStateUnknown() {
@ -171,7 +176,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
try {
resolver = transportManager.getResolver(session);
} catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
@ -205,7 +210,7 @@ public class JingleSessionStateUnknown extends JingleSessionState {
try {
session.terminate("Closed remotely");
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return response;

View File

@ -21,6 +21,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.Codec;
@ -173,7 +174,7 @@ public class AudioChannel {
}
}
catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -202,11 +203,11 @@ public class AudioChannel {
processor = javax.media.Manager.createProcessor(ds);
}
catch (NoProcessorException npe) {
npe.printStackTrace();
LOGGER.log(Level.WARNING, "exception", npe);
return "Couldn't create processor";
}
catch (IOException ioe) {
ioe.printStackTrace();
LOGGER.log(Level.WARNING, "exception", ioe);
return "IOException creating processor";
}
@ -277,7 +278,7 @@ public class AudioChannel {
tracks[i].setCodecChain(codec);
}
catch (UnsupportedPlugInException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -394,7 +395,7 @@ public class AudioChannel {
}
catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
return e.getMessage();
}
}
@ -421,7 +422,7 @@ public class AudioChannel {
}
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -514,7 +515,7 @@ public class AudioChannel {
Thread.sleep(5000);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
audioChannel0.setTrasmit(false);
@ -524,7 +525,7 @@ public class AudioChannel {
Thread.sleep(5000);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
audioChannel0.setTrasmit(true);
@ -534,7 +535,7 @@ public class AudioChannel {
Thread.sleep(5000);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
audioChannel0.stop();
@ -542,7 +543,7 @@ public class AudioChannel {
}
catch (UnknownHostException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}

View File

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.jingleold.mediaimpl.jmf;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.MediaLocator;
@ -144,7 +145,7 @@ public class AudioMediaSession extends JingleMediaSession {
return freePort;
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
try {
@ -153,7 +154,7 @@ public class AudioMediaSession extends JingleMediaSession {
ss.close();
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return freePort;
}

View File

@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.jingleold.JingleSession;
@ -141,8 +142,7 @@ public class JmfMediaManager extends JingleMediaManager {
jmfProperties.createNewFile();
}
catch (IOException ex) {
LOGGER.fine("Failed to create jmf.properties");
ex.printStackTrace();
LOGGER.log(Level.FINE, "Failed to create jmf.properties", ex);
}
}

View File

@ -21,6 +21,7 @@ import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.Logger;
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);
}
catch (NoProcessorException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
catch (UnsupportedFormatException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", 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("");
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -225,7 +226,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
return freePort;
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
try {
@ -234,7 +235,7 @@ public class AudioMediaSession extends JingleMediaSession implements MediaSessio
ss.close();
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return freePort;
}

View File

@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.jingleold.JingleSession;
@ -106,8 +107,7 @@ public class SpeexMediaManager extends JingleMediaManager {
jmfProperties.createNewFile();
}
catch (IOException ex) {
LOGGER.fine("Failed to create jmf.properties");
ex.printStackTrace();
LOGGER.log(Level.FINE, "Failed to create jmf.properties", ex);
}
}

View File

@ -24,6 +24,7 @@ import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
@ -83,7 +84,7 @@ public class ScreenShareSession extends JingleMediaSession {
transmitter = new ImageTransmitter(new DatagramSocket(getLocal().getPort()), remote, getRemote().getPort(),
new Rectangle(0, 0, width, height));
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
} else {
@ -106,7 +107,7 @@ public class ScreenShareSession extends JingleMediaSession {
height);
LOGGER.fine("Receiving on:" + receiver.getLocalPort());
} catch (UnknownHostException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
jp.add(receiver);
@ -176,7 +177,7 @@ public class ScreenShareSession extends JingleMediaSession {
ss.close();
return freePort;
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
try {
@ -184,7 +185,7 @@ public class ScreenShareSession extends JingleMediaSession {
freePort = ss.getLocalPort();
ss.close();
} catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return freePort;
}

View File

@ -17,14 +17,18 @@
package org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Implements a default PNG Encoder
*/
public class DefaultEncoder implements ImageEncoder{
private static final Logger LOGGER = Logger.getLogger(DefaultEncoder.class.getName());
public ByteArrayOutputStream encode(BufferedImage bufferedImage) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@ -32,7 +36,7 @@ public class DefaultEncoder implements ImageEncoder{
ImageIO.write(bufferedImage, "png", baos);
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
baos = null;
}
return baos;

View File

@ -25,6 +25,8 @@ import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* UDP Image Receiver.
@ -33,6 +35,7 @@ import java.net.SocketException;
* @author Thiago Rocha Camargo
*/
public class ImageReceiver extends Canvas {
private static final Logger LOGGER = Logger.getLogger(ImageReceiver.class.getName());
private static final long serialVersionUID = -7000112305305269025L;
private boolean on = true;
@ -81,7 +84,7 @@ public class ImageReceiver extends Canvas {
}
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}).start();
@ -101,20 +104,20 @@ public class ImageReceiver extends Canvas {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}).start();
}
catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
this.setSize(width, height);
}

View File

@ -27,6 +27,7 @@ import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -77,7 +78,7 @@ public class ImageTransmitter implements Runnable {
}
catch (AWTException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -141,7 +142,7 @@ public class ImageTransmitter implements Runnable {
socket.send(p);
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
tiles[i][j] = pixels;
@ -157,7 +158,7 @@ public class ImageTransmitter implements Runnable {
}
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -170,7 +171,7 @@ public class ImageTransmitter implements Runnable {
Thread.sleep(500 - trace);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}

View File

@ -24,6 +24,8 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
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
@ -31,6 +33,7 @@ import java.util.Enumeration;
* A very simple and easy to use resolver.
*/
public class BasicResolver extends TransportResolver {
private static final Logger LOGGER = Logger.getLogger(BasicResolver.class.getName());
/**
* Constructor.
@ -58,7 +61,7 @@ public class BasicResolver extends TransportResolver {
try {
ifaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
while (ifaces.hasMoreElements()) {
@ -81,7 +84,7 @@ public class BasicResolver extends TransportResolver {
try {
ifaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
while (ifaces.hasMoreElements()) {
@ -106,7 +109,7 @@ public class BasicResolver extends TransportResolver {
tr.setLocalIp(InetAddress.getLocalHost().getHostAddress() != null ? InetAddress.getLocalHost().getHostAddress() : InetAddress.getLocalHost().getHostName());
addCandidate(tr);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
setResolveEnd();

View File

@ -29,6 +29,8 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
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.
@ -39,6 +41,7 @@ import java.util.Random;
* The resolver adds this candidate
*/
public class BridgedResolver extends TransportResolver {
private static final Logger LOGGER = Logger.getLogger(BridgedResolver.class.getName());
XMPPConnection connection;
@ -122,7 +125,7 @@ public class BridgedResolver extends TransportResolver {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
while (ifaces.hasMoreElements()) {
@ -142,7 +145,7 @@ public class BridgedResolver extends TransportResolver {
return InetAddress.getLocalHost().getHostAddress();
}
catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return "127.0.0.1";

View File

@ -93,7 +93,7 @@ public class HttpServer {
processRequest();
}
catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -139,7 +139,7 @@ public class HttpServer {
}
catch (Exception e) {
// Do Nothing
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}

View File

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.jingleold.nat;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -258,7 +259,7 @@ public class ICECandidate extends TransportCandidate implements Comparable<ICECa
echo.testASync(checkingCandidate, getPassword());
}
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);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
for (TransportCandidate candidate : localCandidates) {

View File

@ -24,6 +24,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
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
// of the STUN server are much, much faster.
if (negociatorsMap.get(server) == null) {
// CHECKSTYLE:OFF
ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
negociatorsMap.put(server, iceNegociator);
@ -78,6 +80,7 @@ public class ICEResolver extends TransportResolver {
iceNegociator.gatherCandidateAddresses();
// priorize candidates
iceNegociator.prioritizeCandidates();
// CHECKSTYLE:ON
}
}
@ -135,7 +138,7 @@ public class ICEResolver extends TransportResolver {
i++;
}
} 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);
@ -145,7 +148,7 @@ public class ICEResolver extends TransportResolver {
transportCandidate.addCandidateEcho(session);
}
catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
this.addCandidate(transportCandidate);
@ -153,10 +156,10 @@ public class ICEResolver extends TransportResolver {
}
catch (UtilityException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
catch (UnknownHostException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
// Get a Relay Candidate from XMPP Server
@ -207,10 +210,10 @@ public class ICEResolver extends TransportResolver {
// }
// catch (UtilityException e) {
// e.printStackTrace();
// LOGGER.log(Level.WARNING, "exception", e);
// }
// catch (UnknownHostException e) {
// e.printStackTrace();
// LOGGER.log(Level.WARNING, "exception", e);
// }
// Get Public Candidate From XMPP Server
@ -229,7 +232,7 @@ public class ICEResolver extends TransportResolver {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
// If detect this address in local machine, don't use it.
@ -260,13 +263,13 @@ public class ICEResolver extends TransportResolver {
publicCandidate.addCandidateEcho(session);
}
catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
addCandidate(publicCandidate);
}
catch (UnknownHostException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}

View File

@ -16,6 +16,9 @@
*/
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.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
@ -26,6 +29,7 @@ import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;
import org.jivesoftware.smackx.jingleold.media.PayloadType;
public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
private static final Logger LOGGER = Logger.getLogger(ICETransportManager.class.getName());
ICEResolver iceResolver = null;
@ -35,7 +39,7 @@ public class ICETransportManager extends JingleTransportManager implements Jingl
iceResolver.initializeAndWait();
}
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);
}
catch (XMPPException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return iceResolver;
}

View File

@ -22,6 +22,7 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
@ -522,7 +523,7 @@ public class RTPBridge extends IQ {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
while (ifaces!=null&&ifaces.hasMoreElements()) {

View File

@ -16,6 +16,9 @@
*/
package org.jivesoftware.smackx.jingleold.nat;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.jingleold.JingleSession;
/**
@ -24,6 +27,8 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
* @author Thiago Camargo
*/
public class STUNTransportManager extends JingleTransportManager {
private static final Logger LOGGER = Logger.getLogger(STUNTransportManager.class.getName());
STUNResolver stunResolver = null;
public STUNTransportManager() {
@ -32,7 +37,7 @@ public class STUNTransportManager extends JingleTransportManager {
try {
stunResolver.initializeAndWait();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -40,7 +45,7 @@ public class STUNTransportManager extends JingleTransportManager {
try {
stunResolver.resolve(session);
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return stunResolver;
}

View File

@ -23,6 +23,7 @@ import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -56,7 +57,7 @@ public class TcpUdpBridgeClient {
LOGGER.fine("UDP: " + localUdpSocket.getLocalPort());
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
startBridge();
}
@ -88,7 +89,7 @@ public class TcpUdpBridgeClient {
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -122,7 +123,7 @@ public class TcpUdpBridgeClient {
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}

View File

@ -25,6 +25,7 @@ import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -59,7 +60,7 @@ public class TcpUdpBridgeServer {
LOGGER.fine("UDP: " + localUdpSocket.getLocalPort());
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
startBridge();
}
@ -89,7 +90,7 @@ public class TcpUdpBridgeServer {
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -124,7 +125,7 @@ public class TcpUdpBridgeServer {
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}

View File

@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.XMPPConnection;
@ -356,7 +357,9 @@ public abstract class TransportCandidate {
try {
// CHECKSTYLE:OFF
InetAddress candAddress = InetAddress.getByName(getIp());
// CHECKSTYLE:ON
isUsable = true;//candAddress.isReachable(TransportResolver.CHECK_TIMEOUT);
}
catch (Exception e) {
@ -646,7 +649,7 @@ public abstract class TransportCandidate {
}
}
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");
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
packet.setData(cont);
@ -706,7 +709,7 @@ public abstract class TransportCandidate {
Thread.sleep(delay);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -757,9 +760,11 @@ public abstract class TransportCandidate {
String ip = addr[0];
String pt = addr[1];
// CHECKSTYLE:OFF
if (pass.equals(password)
&& transportCandidate.getIp().indexOf(ip) != -1
&& transportCandidate.getPort() == Integer.parseInt(pt)) {
// CHECKSTYLE:ON
LOGGER.fine("ECHO OK: " + candidate.getIp() + ":" + candidate.getPort() + " <-> " + transportCandidate.getIp() + ":" + transportCandidate.getPort());
TestResult testResult = new TestResult();
testResult.setResult(true);
@ -770,7 +775,7 @@ public abstract class TransportCandidate {
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
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");
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
DatagramPacket packet = new DatagramPacket(content, content.length);
@ -794,7 +799,7 @@ public abstract class TransportCandidate {
packet.setAddress(InetAddress.getByName(transportCandidate.getIp()));
}
catch (UnknownHostException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
packet.setPort(transportCandidate.getPort());
@ -808,7 +813,7 @@ public abstract class TransportCandidate {
Thread.sleep(delay);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
@ -820,7 +825,7 @@ public abstract class TransportCandidate {
Thread.sleep(2000);
}
catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
removeListener(listener);

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
@ -164,7 +165,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
setNegotiatorState(JingleNegotiatorState.PENDING);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -302,7 +303,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
// Once we are in pending state, look for any valid remote
@ -397,7 +398,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
bestRemote = getBestRemoteCandidate();
@ -431,7 +432,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
session
.terminate("Unable to negotiate session. This may be caused by firewall configuration problems.");
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
}

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
@ -372,7 +373,7 @@ public abstract class TransportResolver {
LOGGER.fine("Transport resolved");
}
catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
@ -395,7 +396,7 @@ public abstract class TransportResolver {
return freePort;
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
}
try {
@ -404,7 +405,7 @@ public abstract class TransportResolver {
ss.close();
}
catch (IOException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, "exception", e);
}
return freePort;
}

View File

@ -113,6 +113,7 @@ public class MacroGroup {
}
public String toXML() {
// CHECKSTYLE:OFF
StringBuilder buf = new StringBuilder();
buf.append("<macrogroup>");
buf.append("<title>" + getTitle() + "</title>");
@ -136,6 +137,7 @@ public class MacroGroup {
buf.append("</macroGroups>");
}
buf.append("</macrogroup>");
return buf.toString();
return buf.toString();
// CHECKSTYLE:ON
}
}

View File

@ -82,10 +82,12 @@ public class Macros extends IQ {
if (isPersonal()) {
buf.append("<personal>true</personal>");
}
if (getPersonalMacroGroup() != null) {
if (getPersonalMacroGroup() != null) {
// CHECKSTYLE:OFF
buf.append("<personalMacro>");
buf.append(StringUtils.escapeForXML(getPersonalMacroGroup().toXML()));
buf.append("</personalMacro>");
// CHECKSTYLE:ON
}
return buf;
@ -123,6 +125,7 @@ public class Macros extends IQ {
}
public Macro parseMacro(XmlPullParser parser) throws XmlPullParserException, IOException {
// CHECKSTYLE:OFF
Macro macro = new Macro();
boolean done = false;
while (!done) {
@ -149,9 +152,11 @@ public class Macros extends IQ {
}
}
return macro;
// CHECKSTYLE:ON
}
public MacroGroup parseMacroGroup(XmlPullParser parser) throws XmlPullParserException, IOException {
// CHECKSTYLE:OFF
MacroGroup group = new MacroGroup();
boolean done = false;
@ -175,10 +180,11 @@ public class Macros extends IQ {
}
}
return group;
// CHECKSTYLE:ON
}
public MacroGroup parseMacroGroups(String macros) throws XmlPullParserException, IOException {
// CHECKSTYLE:OFF
MacroGroup group = null;
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
parser.setInput(new StringReader(macros));
@ -192,6 +198,7 @@ public class Macros extends IQ {
}
}
return group;
// CHECKSTYLE:ON
}
}
}

View File

@ -469,13 +469,17 @@ public class Workgroup {
private void fireInvitationEvent(WorkgroupInvitation invitation) {
for (WorkgroupInvitationListener listener : invitationListeners ){
// CHECKSTYLE:OFF
listener.invitationReceived(invitation);
// CHECKSTYLE:ON
}
}
private void fireQueueJoinedEvent() {
for (QueueListener listener : queueListeners){
// CHECKSTYLE:OFF
listener.joinedQueue();
// CHECKSTYLE:ON
}
}

View File

@ -47,7 +47,7 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
@Override
public RosterExchange parse(XmlPullParser parser, int initialDepth)
throws XmlPullParserException, IOException {
// CHECKSTYLE:OFF
RosterExchange rosterExchange = new RosterExchange();
boolean done = false;
RemoteRosterEntry remoteRosterEntry = null;
@ -78,7 +78,7 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
}
}
}
// CHECKSTYLE:ON
return rosterExchange;
}

View File

@ -97,8 +97,6 @@ public class ParseStreamManagementTest {
.element(errorCondition.toString(), XMPPError.NAMESPACE)
.asString(outputProperties);
System.err.println(failedStanza);
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
PacketParserUtils.getParserFor(failedStanza));