1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-07 13:41:08 +01:00

's;^\s+$;;' on all source files

And add checkstyle test for lines containing only whitespace characters.
This commit is contained in:
Florian Schmaus 2015-03-17 11:33:02 +01:00
parent 05c97c494b
commit 0fde39fa45
193 changed files with 1066 additions and 1062 deletions

View file

@ -27,7 +27,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError;
*/
public class JingleException extends XMPPException {
private static final long serialVersionUID = -1521230401958103382L;
private final JingleError error;
/**

View file

@ -185,7 +185,7 @@ import org.jxmpp.jid.Jid;
public class JingleManager implements JingleSessionListener {
private static final Logger LOGGER = Logger.getLogger(JingleManager.class.getName());
// non-static
final List<JingleSession> jingleSessions = new ArrayList<JingleSession>();
@ -247,7 +247,7 @@ public class JingleManager implements JingleSessionListener {
}
/**
* Setup the jingle system to let the remote clients know we support Jingle.
* (This used to be a static part of construction. The problem is a remote client might

View file

@ -53,9 +53,9 @@ public abstract class JingleNegotiator {
private String expectedAckId;
private JingleNegotiatorState state;
private boolean isStarted;
/**
* Default constructor.
*/
@ -78,9 +78,9 @@ public abstract class JingleNegotiator {
}
public void setNegotiatorState(JingleNegotiatorState stateIs) {
JingleNegotiatorState stateWas = state;
LOGGER.fine("Negotiator state change: " + stateWas + "->" + stateIs + "(" + this.getClass().getSimpleName() + ")");
switch (stateIs) {
@ -236,21 +236,21 @@ public abstract class JingleNegotiator {
*/
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException;
public void start() {
isStarted = true;
doStart();
}
public boolean isStarted() {
return isStarted;
}
/**
* Each of the negotiators has their individual behavior when they start.
*/
protected abstract void doStart();
/**
* Close the negotiation.
*/

View file

@ -77,7 +77,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
private String sid; // A unique id that identifies this session
ConnectionListener connectionListener;
StanzaListener packetListener;
StanzaFilter packetFilter;
@ -91,7 +91,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
private XMPPConnection connection;
private String sessionInitPacketID;
private Map<String, JingleMediaSession> mediaSessionMap;
/**
@ -121,7 +121,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// Initially, we don't known the session state.
setSessionState(JingleSessionStateUnknown.getInstance());
contentNegotiators = new ArrayList<ContentNegotiator>();
mediaSessionMap = new HashMap<String, JingleMediaSession>();
@ -394,7 +394,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
contentNegotiators.add(inContentNegotiator);
}
// ----------------------------------------------------------------------------------------------------------
// Send section
@ -642,11 +642,11 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
connection.addConnectionListener(connectionListener);
}
}
private void removeConnectionListener() {
if (connectionListener != null) {
getConnection().removeConnectionListener(connectionListener);
LOGGER.fine("JINGLE SESSION: REMOVE CONNECTION LISTENER");
}
}
@ -823,17 +823,17 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
// Indicate that this session is active.
setSessionState(JingleSessionStateActive.getInstance());
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
contentNegotiator.triggerContentEstablished();
}
if (getSessionState().equals(JingleSessionStatePending.getInstance())) {
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
// Build up a response packet from each media manager.
@ -1109,7 +1109,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
// Give each of the content negotiators a chance to start
// and return a portion of the structure to make the Jingle packet.
// Don't do this anymore. The problem is that the other side might not be ready.
// Later when we receive our first jingle packet from the other side we'll fire-up the negotiators
// before processing it. (See receivePacketAndRespond() above.
@ -1125,9 +1125,9 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
//updatePacketListener();
}
protected void doStart() {
}
/**
@ -1142,7 +1142,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
transNeg.start();
}
}
/**
* The jingle session may have one or more media managers that are trying to establish media sessions.
* When the media manager succeeds in creating a media session is registers it with the session by the
@ -1151,7 +1151,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
public void addJingleMediaSession(String mediaManagerName, JingleMediaSession mediaSession) {
mediaSessionMap.put(mediaManagerName, mediaSession);
}
/**
* The jingle session may have one or more media managers that are trying to establish media sessions.
* When the media manager succeeds in creating a media session is registers it with the session by the

View file

@ -86,7 +86,7 @@ public class JingleSessionStateActive extends JingleSessionState {
}
return response;
}
/**
* Receive and process the <session-terminate> action.
*/
@ -103,5 +103,5 @@ public class JingleSessionStateActive extends JingleSessionState {
return response;
}
}

View file

@ -27,7 +27,7 @@ import org.jivesoftware.smackx.jingleold.packet.JingleError;
* @see JingleSessionState
*/
public class JingleSessionStateEnded extends JingleSessionState {
private static final Logger LOGGER = Logger.getLogger(JingleSessionStateEnded.class.getName());
private static JingleSessionStateEnded INSTANCE = null;
@ -64,7 +64,7 @@ public class JingleSessionStateEnded extends JingleSessionState {
*/
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
IQ response = null;
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
return response;

View file

@ -26,5 +26,5 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
public interface CreatedJingleSessionListener {
public void sessionCreated(JingleSession jingleSession);
}

View file

@ -81,5 +81,5 @@ public interface JingleSessionListener extends JingleListener {
* @param participant description of the participant
*/
public void sessionMediaReceived(JingleSession jingleSession, String participant);
}

View file

@ -33,7 +33,7 @@ import java.util.List;
* @author Thiago Camargo
*/
public abstract class JingleMediaManager {
public static final String MEDIA_NAME = "JingleMediaManager";
// Each media manager must keep track of the transport manager that it uses.
@ -42,7 +42,7 @@ public abstract class JingleMediaManager {
public JingleMediaManager(JingleTransportManager transportManager) {
this.transportManager = transportManager;
}
/**
* Return The transport manager that goes with this media manager.
*/
@ -76,7 +76,7 @@ public abstract class JingleMediaManager {
*/
public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote,
final TransportCandidate local, JingleSession jingleSession);
// This is to set the attributes of the <content> element of the Jingle packet.
public String getName() {
return MEDIA_NAME;

View file

@ -213,10 +213,10 @@ public class MediaNegotiator extends JingleNegotiator {
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
if (bestCommonAudioPt == null) {
setNegotiatorState(JingleNegotiatorState.FAILED);
response = session.createJingleError(jingle, JingleError.NEGOTIATION_ERROR);
} else {
setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
@ -242,7 +242,7 @@ public class MediaNegotiator extends JingleNegotiator {
offeredPayloads = description.getAudioPayloadTypesList();
bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);
synchronized (remoteAudioPts) {
remoteAudioPts.addAll(offeredPayloads);
}

View file

@ -24,7 +24,7 @@ package org.jivesoftware.smackx.jingleold.media;
public class PayloadType {
public static final String NODENAME = "payload-type";
public static int MAX_FIXED_PT = 95;
public static int INVALID_PT = 65535;
@ -195,7 +195,7 @@ public class PayloadType {
return true;
}
/**
* Returns the XML element name of the element.
*
@ -204,7 +204,7 @@ public class PayloadType {
public static String getElementName() {
return NODENAME;
}
public String toXML() {
StringBuilder buf = new StringBuilder();
@ -224,10 +224,10 @@ public class PayloadType {
buf.append(getChildAttributes());
}
buf.append("/>");
return buf.toString();
}
protected String getChildAttributes() {
StringBuilder buf = new StringBuilder();
if (this instanceof PayloadType.Audio) {
@ -235,7 +235,7 @@ public class PayloadType {
buf.append(" clockrate=\"").append(pta.getClockRate()).append("\" ");
}
return buf.toString();
}

View file

@ -69,7 +69,7 @@ import org.jivesoftware.smackx.jingleold.media.JingleMediaSession;
public class AudioChannel {
private static final Logger LOGGER = Logger.getLogger(AudioChannel.class.getName());
private MediaLocator locator;
private String localIpAddress;
private String remoteIpAddress;
@ -215,7 +215,7 @@ public class AudioChannel {
if (!result){
return "Couldn't configure processor";
}
// Get the tracks from the processor
TrackControl[] tracks = processor.getTrackControls();

View file

@ -43,7 +43,7 @@ public class JmfMediaManager extends JingleMediaManager {
public static final String MEDIA_NAME = "JMF";
private List<PayloadType> payloads = new ArrayList<PayloadType>();
private String mediaLocator = null;
@ -159,7 +159,7 @@ public class JmfMediaManager extends JingleMediaManager {
private static void runLinuxPreInstall() {
// @TODO Implement Linux Pre-Install
}
public String getName() {
return MEDIA_NAME;
}

View file

@ -124,7 +124,7 @@ public class SpeexMediaManager extends JingleMediaManager {
private static void runLinuxPreInstall() {
// @TODO Implement Linux Pre-Install
}
public String getName() {
return MEDIA_NAME;
}

View file

@ -95,7 +95,7 @@ public class MultiMediaManager extends JingleMediaManager {
public void setPreferredPayloadType(PayloadType preferredPayloadType) {
this.preferredPayloadType = preferredPayloadType;
}
public String getName() {
return MEDIA_NAME;
}

View file

@ -104,7 +104,7 @@ public class ScreenShareMediaManager extends JingleMediaManager {
public void setEncoder(ImageEncoder encoder) {
this.encoder = encoder;
}
public String getName() {
return MEDIA_NAME;
}

View file

@ -34,11 +34,11 @@ public abstract class AbstractBufferedImageOp implements BufferedImageOp, Clonea
dstCM = src.getColorModel();
return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null);
}
public Rectangle2D getBounds2D( BufferedImage src ) {
return new Rectangle(0, 0, src.getWidth(), src.getHeight());
}
public Point2D getPoint2D( Point2D srcPt, Point2D dstPt ) {
if ( dstPt == null )
dstPt = new Point2D.Double();

View file

@ -48,7 +48,7 @@ public class OctTreeQuantizer implements Quantizer {
int totalGreen;
int totalBlue;
int index;
/**
* A debugging method which prints the tree out.
*/
@ -72,7 +72,7 @@ public class OctTreeQuantizer implements Quantizer {
private int maximumColors;
private int colors = 0;
private Vector<OctTreeNode>[] colorList;
public OctTreeQuantizer() {
setup(256);
colorList = new Vector[MAX_LEVEL+1];
@ -89,7 +89,7 @@ public class OctTreeQuantizer implements Quantizer {
maximumColors = numColors;
reduceColors = Math.max(512, numColors * 2);
}
/**
* Add pixels to the quantizer.
* @param pixels the array of ARGB pixels
@ -241,7 +241,7 @@ public class OctTreeQuantizer implements Quantizer {
buildColorTable(root, table, 0);
return table;
}
/**
* A quick way to use the quantizer. Just create a table the right size and pass in the pixels.
* @param inPixels the input colors
@ -281,6 +281,6 @@ public class OctTreeQuantizer implements Quantizer {
}
return index;
}
}

View file

@ -64,14 +64,14 @@ public class PixelUtils {
public static int interpolate(int v1, int v2, float f) {
return clamp((int)(v1+f*(v2-v1)));
}
public static int brightness(int rgb) {
int r = (rgb >> 16) & 0xff;
int g = (rgb >> 8) & 0xff;
int b = rgb & 0xff;
return (r+g+b)/3;
}
public static boolean nearColors(int rgb1, int rgb2, int tolerance) {
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
@ -81,19 +81,19 @@ public class PixelUtils {
int b2 = rgb2 & 0xff;
return Math.abs(r1-r2) <= tolerance && Math.abs(g1-g2) <= tolerance && Math.abs(b1-b2) <= tolerance;
}
private final static float[] hsb1 = new float[3];//FIXME-not thread safe
private final static float[] hsb2 = new float[3];//FIXME-not thread safe
// Return rgb1 painted onto rgb2
public static int combinePixels(int rgb1, int rgb2, int op) {
return combinePixels(rgb1, rgb2, op, 0xff);
}
public static int combinePixels(int rgb1, int rgb2, int op, int extraAlpha, int channelMask) {
return (rgb2 & ~channelMask) | combinePixels(rgb1 & channelMask, rgb2, op, extraAlpha);
}
public static int combinePixels(int rgb1, int rgb2, int op, int extraAlpha) {
if (op == REPLACE)
return rgb1;

View file

@ -82,7 +82,7 @@ public class QuantizeFilter extends WholeImageFilter {
public void setSerpentine(boolean serpentine) {
this.serpentine = serpentine;
}
/**
* Return the serpentine setting
* @return the current setting
@ -90,7 +90,7 @@ public class QuantizeFilter extends WholeImageFilter {
public boolean getSerpentine() {
return serpentine;
}
public void quantize(int[] inPixels, int[] outPixels, int width, int height, int numColors, boolean dither, boolean serpentine) {
int count = width*height;
Quantizer quantizer = new OctTreeQuantizer();
@ -165,7 +165,7 @@ public class QuantizeFilter extends WholeImageFilter {
protected int[] filterPixels( int width, int height, int[] inPixels, Rectangle transformedSpace ) {
int[] outPixels = new int[width*height];
quantize(inPixels, outPixels, width, height, numColors, dither, serpentine);
return outPixels;
@ -174,5 +174,5 @@ public class QuantizeFilter extends WholeImageFilter {
public String toString() {
return "Colors/Quantize...";
}
}

View file

@ -27,7 +27,7 @@ public interface Quantizer {
* @param numColors the number of colors we're quantizing to.
*/
public void setup(int numColors);
/**
* Add pixels to the quantizer.
* @param pixels the array of ARGB pixels
@ -35,13 +35,13 @@ public interface Quantizer {
* @param count the count of pixels
*/
public void addPixels(int[] pixels, int offset, int count);
/**
* Build a color table from the added pixels.
* @return an array of ARGB pixels representing a color table
*/
public int[] buildColorTable();
/**
* Using the previously-built color table, return the index into that table for a pixel.
* This is guaranteed to return a valid index - returning the index of a color closer

View file

@ -36,7 +36,7 @@ public abstract class WholeImageFilter extends AbstractBufferedImageOp {
* The input image bounds.
*/
protected Rectangle originalSpace;
/**
* Construct a WholeImageFilter.
*/
@ -72,7 +72,7 @@ public abstract class WholeImageFilter extends AbstractBufferedImageOp {
*/
protected void transformSpace(Rectangle rect) {
}
/**
* Actually filter the pixels.
* @param width the image width

View file

@ -53,7 +53,7 @@ public class TestMediaSession extends JingleMediaSession {
* Starts transmission and for NAT Traversal reasons start receiving also.
*/
public void startTrasmit() {
}
/**
@ -63,7 +63,7 @@ public class TestMediaSession extends JingleMediaSession {
* @param active active state
*/
public void setTrasmit(boolean active) {
}
/**
@ -77,13 +77,13 @@ public class TestMediaSession extends JingleMediaSession {
* Stops transmission and for NAT Traversal reasons stop receiving also.
*/
public void stopTrasmit() {
}
/**
* For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf
*/
public void stopReceive() {
}
}

View file

@ -65,7 +65,7 @@ public class BasicResolver extends TransportResolver {
NetworkInterface iface = ifaces.nextElement();
Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
while (iaddresses.hasMoreElements()) {
InetAddress iaddress = iaddresses.nextElement();
if (!iaddress.isLoopbackAddress() && !iaddress.isLinkLocalAddress() && !iaddress.isSiteLocalAddress()) {

View file

@ -27,9 +27,9 @@ import org.jivesoftware.smackx.jingleold.media.PayloadType;
*
*/
public class FixedTransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
FixedResolver resolver;
public FixedTransportManager(FixedResolver inResolver) {
resolver = inResolver;
}
@ -37,7 +37,7 @@ public class FixedTransportManager extends JingleTransportManager implements Jin
protected TransportResolver createResolver(JingleSession session) {
return resolver;
}
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
}
@ -56,7 +56,7 @@ public class FixedTransportManager extends JingleTransportManager implements Jin
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
// Do Nothing
}
public void sessionCreated(JingleSession jingleSession) {
jingleSession.addListener(this);
}

View file

@ -73,7 +73,7 @@ public class ICEResolver extends TransportResolver {
if (negociatorsMap.get(server) == null) {
ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
negociatorsMap.put(server, iceNegociator);
// gather candidates
iceNegociator.gatherCandidateAddresses();
// priorize candidates
@ -137,7 +137,7 @@ public class ICEResolver extends TransportResolver {
} catch (SocketException e1) {
e1.printStackTrace();
}
TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress().getHostAddress(), 1, nicNum, String.valueOf(Math.abs(random.nextLong())), candidate.getPort(), "1", candidate.getPriority(), iceType);
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
transportCandidate.setPort(getFreePort());
@ -166,8 +166,8 @@ public class ICEResolver extends TransportResolver {
String localIp;
int network;
// JBW/GW - 17JUL08: ICENegotiator.getPublicCandidate() always returned null in JSTUN 1.7.0, and now the API doesn't exist in JSTUN 1.7.1
// if (iceNegociator.getPublicCandidate() != null) {
// localIp = iceNegociator.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();

View file

@ -439,7 +439,7 @@ public class RTPBridge extends IQ {
// return true;
// }
// }
DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName());
for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) {
if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {

View file

@ -98,7 +98,7 @@ public class TcpUdpBridgeClient {
public void run() {
try {
InputStream in = localTcpSocket.getInputStream();
InetAddress remoteHost = InetAddress.getByName(remoteUdpHost);
process.start();

View file

@ -354,7 +354,7 @@ public abstract class TransportCandidate {
public void run() {
boolean isUsable;
try {
InetAddress candAddress = InetAddress.getByName(getIp());
isUsable = true;//candAddress.isReachable(TransportResolver.CHECK_TIMEOUT);

View file

@ -40,7 +40,7 @@ import org.jivesoftware.smackx.jingleold.JingleSession;
public abstract class TransportResolver {
private static final Logger LOGGER = Logger.getLogger(TransportResolver.class.getName());
public enum Type {
rawupd, ice
@ -304,7 +304,7 @@ public abstract class TransportResolver {
if (tpcan instanceof ICECandidate)
cands.add((ICECandidate) tpcan);
}
// (ArrayList<ICECandidate>) getCandidatesList();
if (cands.size() > 0) {
Collections.sort(cands);

View file

@ -57,7 +57,7 @@ public class Jingle extends IQ {
private Jid responder; // The responder
// Sub-elements of a Jingle object.
private final List<JingleContent> contents = new ArrayList<JingleContent>();
private JingleContentInfo contentInfo;
@ -353,7 +353,7 @@ public class Jingle extends IQ {
buf.append(" sid=\"").append(getSid()).append("\"");
}
buf.append(">");
synchronized (contents) {
for (JingleContent content : contents) {
buf.append(content.toXML());