diff --git a/src/main/java/org/ice4j/ice/Agent.java b/src/main/java/org/ice4j/ice/Agent.java index 432ecd02..f021ad28 100644 --- a/src/main/java/org/ice4j/ice/Agent.java +++ b/src/main/java/org/ice4j/ice/Agent.java @@ -1466,44 +1466,45 @@ public boolean isControlling() /** * Returns the local LocalCandidate with the specified - * localAddress if it belongs to any of this {@link Agent}'s + * address if it belongs to any of this {@link Agent}'s * streams or null if it doesn't. * - * @param localAddress the {@link TransportAddress} we are looking for. + * @param address the {@link TransportAddress} we are looking for. * * @return the local LocalCandidate with the specified - * localAddress if it belongs to any of this {@link Agent}'s + * address if it belongs to any of this {@link Agent}'s * streams or null if it doesn't. */ - public LocalCandidate findLocalCandidate(TransportAddress localAddress) + public LocalCandidate findLocalCandidate(TransportAddress address) { - return findLocalCandidate(localAddress, null); + return findLocalCandidate(address, null); } /** * Returns the local LocalCandidate with the specified - * localAddress if it belongs to any of this {@link Agent}'s + * address if it belongs to any of this {@link Agent}'s * streams or null if it doesn't. If {@code base} is also specified, * tries to find a candidate whose base matches {@code base}. * - * @param localAddress the {@link TransportAddress} we are looking for. + * @param address the {@link TransportAddress} we are looking for. * @param base an optional base to match. * * @return the local LocalCandidate with the specified - * localAddress if it belongs to any of this {@link Agent}'s + * address if it belongs to any of this {@link Agent}'s * streams or null if it doesn't. */ public LocalCandidate findLocalCandidate( - TransportAddress localAddress, + TransportAddress address, LocalCandidate base) { for (IceMediaStream stream : mediaStreams.values()) { - LocalCandidate cnd = stream.findLocalCandidate(localAddress, base); + LocalCandidate localCandidate + = stream.findLocalCandidate(address, base); - if (cnd != null) + if (localCandidate != null) { - return cnd; + return localCandidate; } } return null; diff --git a/src/main/java/org/ice4j/ice/Component.java b/src/main/java/org/ice4j/ice/Component.java index a91d371e..4b79e68b 100644 --- a/src/main/java/org/ice4j/ice/Component.java +++ b/src/main/java/org/ice4j/ice/Component.java @@ -925,41 +925,41 @@ public LocalCandidate findLocalCandidate(TransportAddress localAddress) /** * Returns the local LocalCandidate with the specified - * localAddress if it belongs to this component or null + * address if it belongs to this component or null * if it doesn't. If {@code base} is also specified, tries to find a * candidate whose base matches {@code base}. * - * @param localAddress the {@link TransportAddress} we are looking for. + * @param address the {@link TransportAddress} we are looking for. * @param base an optional base to match. * * @return the local LocalCandidate with the specified - * localAddress if it belongs to this component or null + * address if it belongs to this component or null * if it doesn't. */ - public LocalCandidate findLocalCandidate(TransportAddress localAddress, LocalCandidate base) + public LocalCandidate findLocalCandidate(TransportAddress address, LocalCandidate base) { - for (LocalCandidate localCnd : localCandidates) + for (LocalCandidate localCandidate : localCandidates) { - if (localCnd.getTransportAddress().equals(localAddress)) + if (localCandidate.getTransportAddress().equals(address)) { - if (base == null || base.equals(localCnd.getBase())) + if (base == null || base.equals(localCandidate.getBase())) { - return localCnd; + return localCandidate; } } } // In case the above loop failed to find a result because `base` was // specified, fallback to the original behavior and return the first - // candidate matching `localAddress` regardless of `base`. - for (LocalCandidate localCnd : localCandidates) + // candidate matching `address` regardless of `base`. + for (LocalCandidate localCandidate : localCandidates) { - if (localCnd.getTransportAddress().equals(localAddress)) + if (localCandidate.getTransportAddress().equals(address)) { logger.warn("Returning a candidate matching the address, " + "while no candidates match both address (" - + localAddress + ") and base (" + base +"): " + localCnd - + " with base " + localCnd.getBase()); - return localCnd; + + address + ") and base (" + base +"): " + localCandidate + + " with base " + localCandidate.getBase()); + return localCandidate; } } diff --git a/src/main/java/org/ice4j/ice/IceMediaStream.java b/src/main/java/org/ice4j/ice/IceMediaStream.java index be2e8a6e..6a4d22c3 100644 --- a/src/main/java/org/ice4j/ice/IceMediaStream.java +++ b/src/main/java/org/ice4j/ice/IceMediaStream.java @@ -507,26 +507,27 @@ protected void setMaxCheckListSize(int nSize) /** * Returns the local LocalCandidate with the specified - * localAddress if it belongs to any of this stream's components + * address if it belongs to any of this stream's components * or null otherwise. If {@code base} is also specified, tries to * find a candidate whose base matches {@code base}. * - * @param localAddress the {@link TransportAddress} we are looking for. + * @param address the {@link TransportAddress} we are looking for. * @param base an optional base to match. * * @return the local LocalCandidate with the specified - * localAddress if it belongs to any of this stream's components + * address if it belongs to any of this stream's components * or null otherwise. */ - public LocalCandidate findLocalCandidate(TransportAddress localAddress, LocalCandidate base) + public LocalCandidate findLocalCandidate(TransportAddress address, LocalCandidate base) { - for (Component cmp : components.values()) + for (Component component : components.values()) { - LocalCandidate cnd = cmp.findLocalCandidate(localAddress, base); + LocalCandidate localCandidate + = component.findLocalCandidate(address, base); - if (cnd != null) + if (localCandidate != null) { - return cnd; + return localCandidate; } }