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

@ -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;
}