Skip to content

Commit

Permalink
Issue #12023 - Remove deprecated classes/methods.
Browse files Browse the repository at this point in the history
Removed deprecated methods from EndPoint.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Aug 23, 2024
1 parent 1af9980 commit b9bcb58
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.jetty.http2;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -54,30 +53,12 @@ public HTTP2StreamEndPoint(HTTP2Stream stream)
this.stream = stream;
}

@Override
public InetSocketAddress getLocalAddress()
{
SocketAddress local = getLocalSocketAddress();
if (local instanceof InetSocketAddress)
return (InetSocketAddress)local;
return null;
}

@Override
public SocketAddress getLocalSocketAddress()
{
return stream.getSession().getLocalSocketAddress();
}

@Override
public InetSocketAddress getRemoteAddress()
{
SocketAddress remote = getRemoteSocketAddress();
if (remote instanceof InetSocketAddress)
return (InetSocketAddress)remote;
return null;
}

@Override
public SocketAddress getRemoteSocketAddress()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.jetty.io;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.WritePendingException;
Expand Down Expand Up @@ -59,27 +58,9 @@ protected AbstractEndPoint(Scheduler scheduler)
super(scheduler);
}

@Override
public InetSocketAddress getLocalAddress()
{
SocketAddress local = getLocalSocketAddress();
if (local instanceof InetSocketAddress)
return (InetSocketAddress)local;
return null;
}

@Override
public abstract SocketAddress getLocalSocketAddress();

@Override
public InetSocketAddress getRemoteAddress()
{
SocketAddress remote = getRemoteSocketAddress();
if (remote instanceof InetSocketAddress)
return (InetSocketAddress)remote;
return null;
}

@Override
public abstract SocketAddress getRemoteSocketAddress();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,22 @@ interface Wrapper
EndPoint unwrap();
}

/**
* @return The local InetSocketAddress to which this {@code EndPoint} is bound, or {@code null}
* if this {@code EndPoint} is not bound to a Socket address.
* @deprecated use {@link #getLocalSocketAddress()} instead
*/
@Deprecated
InetSocketAddress getLocalAddress();

/**
* @return the local SocketAddress to which this {@code EndPoint} is bound or {@code null}
* if this {@code EndPoint} is not bound to a Socket address.
*/
default SocketAddress getLocalSocketAddress()
{
return getLocalAddress();
return null;
}

/**
* @return The remote InetSocketAddress to which this {@code EndPoint} is connected, or {@code null}
* if this {@code EndPoint} is not connected to a Socket address.
* @deprecated use {@link #getRemoteSocketAddress()} instead.
*/
@Deprecated
InetSocketAddress getRemoteAddress();

/**
* @return The remote SocketAddress to which this {@code EndPoint} is connected, or {@code null}
* if this {@code EndPoint} is not connected to a Socket address.
*/
default SocketAddress getRemoteSocketAddress()
{
return getRemoteAddress();
return null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,30 +879,12 @@ public void setIdleTimeout(long idleTimeout)
_endPoint.setIdleTimeout(idleTimeout);
}

@Override
public InetSocketAddress getLocalAddress()
{
SocketAddress local = getLocalSocketAddress();
if (local instanceof InetSocketAddress)
return (InetSocketAddress)local;
return null;
}

@Override
public SocketAddress getLocalSocketAddress()
{
return _local;
}

@Override
public InetSocketAddress getRemoteAddress()
{
SocketAddress remote = getRemoteSocketAddress();
if (remote instanceof InetSocketAddress)
return (InetSocketAddress)remote;
return null;
}

@Override
public SocketAddress getRemoteSocketAddress()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -103,12 +102,6 @@ public boolean handle(Request request, Response response, Callback callback)
SocketAddress remote = endPoint.getRemoteSocketAddress();
assertThat(remote, Matchers.instanceOf(UnixDomainSocketAddress.class));

// Verify that other address methods don't throw.
local = assertDoesNotThrow(endPoint::getLocalAddress);
assertNull(local);
remote = assertDoesNotThrow(endPoint::getRemoteAddress);
assertNull(remote);

assertDoesNotThrow(endPoint::toString);

callback.succeeded();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.jetty.websocket.core.internal;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ReadPendingException;
Expand All @@ -28,24 +27,12 @@ public class MockEndpoint implements EndPoint
{
public static final String NOT_SUPPORTED = "Not supported by MockEndPoint";

@Override
public InetSocketAddress getLocalAddress()
{
throw new UnsupportedOperationException(NOT_SUPPORTED);
}

@Override
public SocketAddress getLocalSocketAddress()
{
throw new UnsupportedOperationException(NOT_SUPPORTED);
}

@Override
public InetSocketAddress getRemoteAddress()
{
throw new UnsupportedOperationException(NOT_SUPPORTED);
}

@Override
public SocketAddress getRemoteSocketAddress()
{
Expand Down

0 comments on commit b9bcb58

Please sign in to comment.