If the connection got not instantanously shut down, then we also
dropped all SM state and should not report that SM resumption is
possible.
This most likely fixes SMACK-954.x
In the writer thread, we use shutdownTimestamp to determine if we
should break out of the writer loop. If we set
shutdownTimestamp *after* queue.shutdown(), then there is a brief
period where nextStreamElement() returns 'null' but done() still
returns 'true'. Hence, we switch the logic "setting" those values.
Instead of directly throwing the current connection exception, wrap
it, so we do not lose the stack trace of the thread invoking
waitForConditionorThrowConnectionException().
This was added in 02d8f53246 ("[core] Increase resilience against
faulty parser implementions"). However, NumberFormatException is a
subclass of IllegalArgumentException, which is already catched by the
outermost catch.
If one of the parser throws a NullPointerException or
NumberFormatException, then this should not lead to a disconnect due
to an unhandled exception. Instead wrap those in an exception that is
handled by the parsing exception callback and ask the user to fill a
bug report for those faulty parsers.
We may adjust the list of exceptions that are wrapped in the future.
Set RECEIVER_NOT_EXPORTED when registering the receiver in
ServerPingWithAlarmManager, as otherwise this will throw an exception
if the application targets Android API level 34 or higher.
This requires raising the minimum Android API level to 26 for
registerReceiver() with flags.
This reverts commit d217c32e72.
Since the new error prone version requires Java 17, we can also use
the bnd gradle plugin version that requires Java 17.
Bump Gradle from 6.8.3 to 8.10.2 and increase the minimum required
Java version from 8 to 11 (SMACK-953).
The switch from Java 8 to 11 caused some Bytecode portability issues
regarding NIO Buffers. Java changed with version 9 the return type of
some subclasses of Buffer to return the specific Buffer type instead
of the Buffer superclass [JDK-4774077]. For example, ByteBuffer.filp()
previously returned Buffer, while it does return ByteBuffer now.
This sensible change was not reflected by the Android API [1], which
means that AnimalSniffer rightfully started to complain that there is
no method "ByteBuffer ByteBuffer.flip()" in Android, there is only
"Buffer ByteBuffer.flip()", and those are incompatible methods on
Java's Bytecode layer.
As workaround, this changes
return charBuffer.flip().toString();
to
((java.nio.Buffer) charBuffer).flip();
return charBuffer.toString();
to restore the Bytecode portability between Android and Java.
Errorprone also got new checks, of which JavaUtilDate and JdkObsolete
are wroth mentioning.
JavaUtilData basically strongly recommends to use Java's newer time
API over java.util.Date. But since Smack was Java 8 until now,
j.u.Date is widely used.
Similar JdkObsolete mentions obsolete JDK APIs, like data structures
like Vector and Stack. But mostly LinkedList, which should usually be
replaced by ArrayList. And this is what this commit largely does.
JDK-4774077: https://bugs.openjdk.org/browse/JDK-4774077
1: https://issuetracker.google.com/issues/369219141