Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Make PipelineUtil.containsCause check if the instance is of the class type
Dieser Commit ist enthalten in:
Ursprung
7f6069e76b
Commit
6b58d86248
@ -6,7 +6,6 @@ import io.netty.channel.ChannelPipeline;
|
|||||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -90,14 +89,15 @@ public class PipelineUtil {
|
|||||||
*
|
*
|
||||||
* @param t The throwable
|
* @param t The throwable
|
||||||
* @param c The exception to look for
|
* @param c The exception to look for
|
||||||
* @return True if the stack trace contained it as its cause.
|
* @return True if the stack trace contained it as its cause or if t is an instance of c.
|
||||||
*/
|
*/
|
||||||
public static boolean containsCause(Throwable t, Class<? extends Throwable> c) {
|
public static boolean containsCause(Throwable t, Class<? extends Throwable> c) {
|
||||||
while (t != null) {
|
do {
|
||||||
t = t.getCause();
|
if (t != null) {
|
||||||
if (t != null)
|
|
||||||
if (c.isAssignableFrom(t.getClass())) return true;
|
if (c.isAssignableFrom(t.getClass())) return true;
|
||||||
|
t = t.getCause();
|
||||||
}
|
}
|
||||||
|
} while (t != null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren