From 23cd620acccc8e7945c54bf7c8d387519b872560 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Mon, 4 Oct 2010 07:49:05 +0000 Subject: [PATCH] Fixes warnings, javadocs, formatting. --- .../jabber/jinglesdp/JingleUtils.java | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java b/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java index 4513cef07..01d2230c1 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java @@ -32,11 +32,10 @@ public class JingleUtils { /** - * The Logger used by the JingleUtils - * class and its instances for logging output. + * The Logger used by the JingleUtils class and its + * instances for logging output. */ - private static final Logger logger = Logger.getLogger(JingleUtils.class - .getName()); + private static final Logger logger = Logger.getLogger(JingleUtils.class); /** * Extracts and returns an {@link RtpDescriptionPacketExtension} provided @@ -51,8 +50,7 @@ public class JingleUtils public static RtpDescriptionPacketExtension getRtpDescription( ContentPacketExtension content) { - return (RtpDescriptionPacketExtension)content - .getFirstChildOfType(RtpDescriptionPacketExtension.class); + return content.getFirstChildOfType(RtpDescriptionPacketExtension.class); } /** @@ -93,10 +91,9 @@ public static List extractFormats( { if(logger.isTraceEnabled()) logger.trace("Unsupported remote format: " + ptExt.toXML()); - continue; } - - mediaFmts.add(format); + else + mediaFmts.add(format); } return mediaFmts; @@ -181,9 +178,11 @@ public static List extractRTPExtensions( for (ExtmapPacketExtension extmap : extmapList) { - RTPExtension rtpExtension = new RTPExtension(extmap.getUri(), + RTPExtension rtpExtension + = new RTPExtension( + extmap.getUri(), MediaDirection.parseString(extmap.getDirection()), - extmap.getAttributes());; + extmap.getAttributes()); if(rtpExtension != null) extensionsList.add( rtpExtension ); @@ -242,7 +241,7 @@ public static SendersEnum getSenders(MediaDirection direction, * content 'senders' attribute) or the absence thereof and returns the * corresponding MediaDirection entry. The * initiatorPerspectice allows callers to specify whether the - * direction is to be considered from the session initator's perspective + * direction is to be considered from the session initiator's perspective * or that of the responder. *

* Example: An initiator value would be translated to @@ -318,7 +317,8 @@ public static MediaStreamTarget extractDefaultTarget( catch (UnknownHostException exc) { throw new IllegalArgumentException( - "Failed to parse address " + rtpCand.getIP(), exc); + "Failed to parse address " + rtpCand.getIP(), + exc); } //rtp port @@ -346,11 +346,13 @@ public static MediaStreamTarget extractDefaultTarget( catch (UnknownHostException exc) { throw new IllegalArgumentException( - "Failed to parse address " + rtcpCand.getIP(), exc); + "Failed to parse address " + rtcpCand.getIP(), + exc); } //rtcp port int rtcpPort = rtcpCand.getPort(); + rtcpTarget = new InetSocketAddress(rtcpAddress, rtcpPort); } @@ -376,8 +378,7 @@ public static CandidatePacketExtension getFirstCandidate( //passing IceUdp would also return RawUdp transports as one extends //the other. IceUdpTransportPacketExtension transport - = (IceUdpTransportPacketExtension)content.getFirstChildOfType( - IceUdpTransportPacketExtension.class); + = content.getFirstChildOfType(IceUdpTransportPacketExtension.class); if ( transport == null) return null; @@ -473,9 +474,7 @@ public static PayloadTypePacketExtension formatToPayloadType( int payloadType = format.getRTPPayloadType(); if (payloadType == MediaFormat.RTP_PAYLOAD_TYPE_UNKNOWN) - { payloadType = ptRegistry.obtainPayloadTypeNumber(format); - } ptExt.setId(payloadType); ptExt.setName(format.getEncoding()); @@ -520,23 +519,21 @@ public static IceUdpTransportPacketExtension createTransport( IceMediaStream stream) { IceUdpTransportPacketExtension trans - = new IceUdpTransportPacketExtension(); + = new IceUdpTransportPacketExtension(); + Agent iceAgent = stream.getParentAgent(); - trans.setUfrag(stream.getParentAgent().getLocalUfrag()); - trans.setPassword(stream.getParentAgent().getLocalPassword()); + trans.setUfrag(iceAgent.getLocalUfrag()); + trans.setPassword(iceAgent.getLocalPassword()); for(Component component : stream.getComponents()) { for(Candidate cand : component.getLocalCandidates()) - { trans.addCandidate(createCandidate(cand)); - } } return trans; } - /** * Creates a {@link CandidatePacketExtension} and initializes it so that it * would describe the state of candidate @@ -556,14 +553,19 @@ private static CandidatePacketExtension createCandidate(Candidate candidate) //make sure that doesn't change ... possibly by setting a property there packet.setFoundation(Integer.parseInt( candidate.getFoundation())); - packet.setComponent( candidate.getParentComponent().getComponentID()); + Component component = candidate.getParentComponent(); + + packet.setComponent(component.getComponentID()); packet.setProtocol(candidate.getTransport().toString()); packet.setPriority(candidate.getPriority()); - packet.setGeneration(candidate.getParentComponent() - .getParentStream().getParentAgent().getGeneration()); + packet.setGeneration( + component.getParentStream().getParentAgent().getGeneration()); + + TransportAddress transportAddress = candidate.getTransportAddress(); + + packet.setIP(transportAddress.getHostAddress()); + packet.setPort(transportAddress.getPort()); - packet.setIP(candidate.getTransportAddress().getHostAddress()); - packet.setPort(candidate.getTransportAddress().getPort()); packet.setType(CandidateType.valueOf(candidate.getType().toString())); TransportAddress relAddr = candidate.getRelatedAddress(); @@ -574,8 +576,6 @@ private static CandidatePacketExtension createCandidate(Candidate candidate) packet.setRelPort(relAddr.getPort()); } - return packet; } - }