Update Netty to 4.1.44.Final and remove usage of some deprecated methods

This commit is contained in:
md_5 2019-12-21 11:52:45 +11:00
parent 4204fa2966
commit 065893b523
6 changed files with 11 additions and 12 deletions

View File

@ -28,8 +28,8 @@ public final class NativeCode<T>
{
try
{
return ( loaded ) ? nativeImpl.newInstance() : javaImpl.newInstance();
} catch ( IllegalAccessException | InstantiationException ex )
return ( loaded ) ? nativeImpl.getDeclaredConstructor().newInstance() : javaImpl.getDeclaredConstructor().newInstance();
} catch ( ReflectiveOperationException ex )
{
throw new RuntimeException( "Error getting instance", ex );
}

View File

@ -67,7 +67,7 @@
<properties>
<build.number>unknown</build.number>
<netty.version>4.1.43.Final</netty.version>
<netty.version>4.1.44.Final</netty.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -1,7 +1,6 @@
package net.md_5.bungee.entitymap;
import com.flowpowered.nbt.stream.NBTInputStream;
import com.google.common.base.Throwables;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
@ -257,7 +256,7 @@ public abstract class EntityMap
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
} catch ( IOException ex )
{
throw Throwables.propagate( ex );
throw new RuntimeException( ex );
}
break;
case 15:
@ -305,7 +304,7 @@ public abstract class EntityMap
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
} catch ( IOException ex )
{
throw Throwables.propagate( ex );
throw new RuntimeException( ex );
}
}
}

View File

@ -9,7 +9,7 @@ import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoop;
import io.netty.handler.codec.http.DefaultHttpRequest;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpVersion;
@ -81,7 +81,7 @@ public class HttpClient
String path = uri.getRawPath() + ( ( uri.getRawQuery() == null ) ? "" : "?" + uri.getRawQuery() );
HttpRequest request = new DefaultHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.GET, path );
request.headers().set( HttpHeaders.Names.HOST, uri.getHost() );
request.headers().set( HttpHeaderNames.HOST, uri.getHost() );
future.channel().writeAndFlush( request );
} else

View File

@ -36,7 +36,7 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
if ( msg instanceof HttpResponse )
{
HttpResponse response = (HttpResponse) msg;
int responseCode = response.getStatus().code();
int responseCode = response.status().code();
if ( responseCode == HttpResponseStatus.NO_CONTENT.code() )
{
@ -46,7 +46,7 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
if ( responseCode != HttpResponseStatus.OK.code() )
{
throw new IllegalStateException( "Expected HTTP response 200 OK, got " + response.getStatus() );
throw new IllegalStateException( "Expected HTTP response 200 OK, got " + response.status() );
}
}
if ( msg instanceof HttpContent )

View File

@ -3,7 +3,7 @@ package net.md_5.bungee.http;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.timeout.ReadTimeoutHandler;
import java.util.concurrent.TimeUnit;
@ -26,7 +26,7 @@ public class HttpInitializer extends ChannelInitializer<Channel>
ch.pipeline().addLast( "timeout", new ReadTimeoutHandler( HttpClient.TIMEOUT, TimeUnit.MILLISECONDS ) );
if ( ssl )
{
SSLEngine engine = SslContext.newClientContext().newEngine( ch.alloc(), host, port );
SSLEngine engine = SslContextBuilder.forClient().build().newEngine( ch.alloc(), host, port );
ch.pipeline().addLast( "ssl", new SslHandler( engine ) );
}