Update Netty to 4.1.44.Final and remove usage of some deprecated methods
This commit is contained in:
parent
4204fa2966
commit
065893b523
@ -28,8 +28,8 @@ public final class NativeCode<T>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ( loaded ) ? nativeImpl.newInstance() : javaImpl.newInstance();
|
return ( loaded ) ? nativeImpl.getDeclaredConstructor().newInstance() : javaImpl.getDeclaredConstructor().newInstance();
|
||||||
} catch ( IllegalAccessException | InstantiationException ex )
|
} catch ( ReflectiveOperationException ex )
|
||||||
{
|
{
|
||||||
throw new RuntimeException( "Error getting instance", ex );
|
throw new RuntimeException( "Error getting instance", ex );
|
||||||
}
|
}
|
||||||
|
2
pom.xml
2
pom.xml
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<build.number>unknown</build.number>
|
<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.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.md_5.bungee.entitymap;
|
package net.md_5.bungee.entitymap;
|
||||||
|
|
||||||
import com.flowpowered.nbt.stream.NBTInputStream;
|
import com.flowpowered.nbt.stream.NBTInputStream;
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufInputStream;
|
import io.netty.buffer.ByteBufInputStream;
|
||||||
@ -257,7 +256,7 @@ public abstract class EntityMap
|
|||||||
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
|
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
|
||||||
} catch ( IOException ex )
|
} catch ( IOException ex )
|
||||||
{
|
{
|
||||||
throw Throwables.propagate( ex );
|
throw new RuntimeException( ex );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
@ -305,7 +304,7 @@ public abstract class EntityMap
|
|||||||
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
|
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
|
||||||
} catch ( IOException ex )
|
} catch ( IOException ex )
|
||||||
{
|
{
|
||||||
throw Throwables.propagate( ex );
|
throw new RuntimeException( ex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import io.netty.channel.ChannelFutureListener;
|
|||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.EventLoop;
|
import io.netty.channel.EventLoop;
|
||||||
import io.netty.handler.codec.http.DefaultHttpRequest;
|
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.HttpMethod;
|
||||||
import io.netty.handler.codec.http.HttpRequest;
|
import io.netty.handler.codec.http.HttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpVersion;
|
import io.netty.handler.codec.http.HttpVersion;
|
||||||
@ -81,7 +81,7 @@ public class HttpClient
|
|||||||
String path = uri.getRawPath() + ( ( uri.getRawQuery() == null ) ? "" : "?" + uri.getRawQuery() );
|
String path = uri.getRawPath() + ( ( uri.getRawQuery() == null ) ? "" : "?" + uri.getRawQuery() );
|
||||||
|
|
||||||
HttpRequest request = new DefaultHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.GET, path );
|
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 );
|
future.channel().writeAndFlush( request );
|
||||||
} else
|
} else
|
||||||
|
@ -36,7 +36,7 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
|
|||||||
if ( msg instanceof HttpResponse )
|
if ( msg instanceof HttpResponse )
|
||||||
{
|
{
|
||||||
HttpResponse response = (HttpResponse) msg;
|
HttpResponse response = (HttpResponse) msg;
|
||||||
int responseCode = response.getStatus().code();
|
int responseCode = response.status().code();
|
||||||
|
|
||||||
if ( responseCode == HttpResponseStatus.NO_CONTENT.code() )
|
if ( responseCode == HttpResponseStatus.NO_CONTENT.code() )
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
|
|||||||
|
|
||||||
if ( responseCode != HttpResponseStatus.OK.code() )
|
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 )
|
if ( msg instanceof HttpContent )
|
||||||
|
@ -3,7 +3,7 @@ package net.md_5.bungee.http;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.handler.codec.http.HttpClientCodec;
|
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.ssl.SslHandler;
|
||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||||
import java.util.concurrent.TimeUnit;
|
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 ) );
|
ch.pipeline().addLast( "timeout", new ReadTimeoutHandler( HttpClient.TIMEOUT, TimeUnit.MILLISECONDS ) );
|
||||||
if ( ssl )
|
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 ) );
|
ch.pipeline().addLast( "ssl", new SslHandler( engine ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user