Merge pull request #719 from galimru/dev

The fix to workaround OpenJDK bug which throw internal error
This commit is contained in:
Ruben Bermudez 2020-04-26 00:48:33 +01:00 committed by GitHub
commit bd0c96f5e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ import org.telegram.telegrambots.meta.generics.UpdatesReader;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.lang.reflect.InvocationTargetException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets;
@ -274,7 +275,15 @@ public class DefaultBotSession implements BotSession {
} catch (InterruptedException e) {
log.info(e.getLocalizedMessage(), e);
interrupt();
} catch (InternalError e) {
// handle InternalError to workaround OpenJDK bug (resolved since 13.0)
// https://bugs.openjdk.java.net/browse/JDK-8173620
if (e.getCause() instanceof InvocationTargetException) {
Throwable cause = e.getCause().getCause();
log.error(cause.getLocalizedMessage(), cause);
} else throw e;
}
return Collections.emptyList();
}
}