Commit Graph

230 Commits

Author SHA1 Message Date
Florian Schmaus cc636fff21 Introduce Smack's Modular Connection Architecture
This is a complete redesign of what was previously
XmppNioTcpConnection. The new architecture allows to extend an XMPP
client to server (c2s) connection with new transport bindings and
other extensions.
2020-04-04 13:03:31 +02:00
Florian Schmaus 00dd77b346 Try to guess the default truststore and path
Tested with OpenJDK 8 and 11. The 'JKS' fallback is for OpenJDK 11.
2020-03-09 13:39:19 +01:00
Florian Schmaus 6440f322fe Ensure a X509TrustManager is set 2020-03-09 10:12:43 +01:00
Florian Schmaus eb4c2c5572 s/occured/occurred/ 2019-10-30 12:02:36 +01:00
Florian Schmaus e2d206e741 Introduce XMPPConnection.add(Message|Presence)Interceptor
add deprecate addStanzaInterceptor().
2019-10-25 21:41:55 +02:00
Florian Schmaus 5db6191110 Introduce StanzaBuilder
As first step to immutable Stanza types.
2019-10-25 21:41:55 +02:00
Florian Schmaus eeb6c52f7e Move SASL logic into AbstractXMPPConnection
Besides the way the transport handles the stream after SASL
<success/>, the SASL logic is independend from the underlying
transport (BOSH, TCP, …). Hence move it up into
AbstractXMPPConnection.

This also has the benefit that we can make some more methods private
or package-private.

Also introduce XmlStringBuilder.optTextChild(), which causes some
associated changes.
2019-09-25 13:49:21 +02:00
Florian Schmaus 93aaf6d8d7 Remove SASLAuthentication.init() 2019-09-23 20:01:10 +02:00
Florian Schmaus bd4b91fc26 Introduce AbstractXMPPConnection.outgoingStreamXmlEnvironment 2019-09-23 16:12:48 +02:00
Florian Schmaus 1a3067c89b Enable werror for javadoc and fix javadoc issues 2019-08-30 12:08:30 +02:00
Florian Schmaus 851bd3c5dd Add IllegalArgumentException to parsing exceptions
As it is thrown by many Element constructors.
2019-08-27 09:01:12 +02:00
Florian Schmaus 8f2eefaeb0 Fix whitespace errors in AbstractXMPPConnection 2019-08-22 15:28:54 +02:00
Florian Schmaus c6b75d8bcc
Merge pull request #308 from adiaholic/SMACK-718
Prevent extremely long reply timeouts from being set.
2019-08-22 14:54:15 +02:00
Georg Lukas 6a0e0f0f67 Implement xml:lang support in ConnectionConfiguration and AbstractXMPPConnection
This patch makes it possible to change the stream-level language as part
of the connection configuration, to allow a properly implemented
entities to provide i18n'ed response messages. The Locale type is used
for this configuration, and the effective language string can be
obtained via `ConnectionConfiguration.getXmlLang()`.

This code does not cover XMPPBOSHConnection!

Signed-off-by: Georg Lukas <georg@op-co.de>
2019-08-03 22:19:45 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus 6e1193edaf Use QName instead of XmppStringUtils.generateKey() 2019-06-11 12:47:39 +02:00
adiaholic f91044657f Generic Exception replaced with Type Specific Exceptions.
'parseAndProcessStanza()' throws generic Exceptions.
Since there are plenty of exceptions that should not be
catched by smack, it's better to throw Type Specific Exceptions.
This Commit is was in response to SMACK-839.
2019-05-19 17:09:01 +05:30
Florian Schmaus f7762c5db7 Add "whitespace after comma" checkstyle rule 2019-05-17 21:56:46 +02:00
Florian Schmaus 7e25c3ada5 Merge branch '4.3' 2019-05-16 20:52:27 +02:00
Florian Schmaus edcde28ecd Set UncaughtExceptionHandler for CACHED_EXECUTOR_SERVICE
In order to avoid uncaught exceptions from terminating the
program (SMACK-896).
2019-05-09 11:04:26 +02:00
Florian Schmaus 49f4de0cdb Replace 'key' with QName 2019-05-08 21:10:39 +02:00
Florian Schmaus d2f5efcb20 Use StandardCharsets.(UTF_8|US_ASCII)
This also gets rid of a ton of UnsupportedEncodingException s.
2019-05-08 12:44:48 +02:00
Florian Schmaus 4133eb175c Replace XPP3 by XmlPullParser interface wrapping StAX and XPP3
Introducing Smack's own XmlPullParser interface which tries to stay as
compatible as possible to XPP3. The interface is used to either wrap
StAX's XMLStreamReader if Smack is used on Java SE, and XPP3's
XmlPullParser if Smack is used on on Android.

Fixes SMACK-591.

Also introduce JUnit 5 and non-strict javadoc projects.
2019-05-06 22:10:50 +02:00
adiaholic af5f161fff Prevent extremely long reply timeouts from being set.
Smack will throw an IllegalArguementException if extremely
long reply timeouts are tried to be set. I assumed currentTimeMilli()
to be the boundary condition as per SMACK-718
2019-04-26 20:32:35 +05:30
Florian Schmaus 9c30e4f3cc Merge branch '4.3' 2019-04-16 09:27:48 +02:00
Florian Schmaus 6076a9dfa5 Introduce asyncGoLimited()
which limits the number of threads created for asynchronous
operations.

Fixes SMACK-864.
2019-04-14 21:40:09 +02:00
Florian Schmaus d1f2631771 Use IQ.isResponseIQ() in AbstractXMPPConnection 2019-04-09 09:33:32 +02:00
Florian Schmaus 8e52e80399 Synchronize later in notifyConnectionError(Exception)
especially *after* the sync points have been notified so that a
potential thread currently callin gconnect()/login() throws and leaves
the synchronized section.

This commit is more or less equivalent to
3ded023629 of the 4.3 branch.
2019-03-16 10:43:41 +01:00
Florian Schmaus daab6039a1 Smack 4.3.3
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlyKV9tfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFL4vQf/Qfg3VzNEnmk0+KjOtuvfAbhMfzE92gfo15vE0PPEIe9VA0Pzkvqhva4k
 Efw7BhD2zx8hWvo0d5FfkdII89hSYnOCiSmhiX1Ln9q/gUqFW0TDAKpsMfAl7jAK
 Fap8M7uUStP9T6fF/gq01djYCYoWA/4v1lGKv4J4b9gWCqzGIF2sK0M7of7VERnr
 pEXJSUM228rk6EYjVmX/9Ujo1Y+xaNMFFZZSbKYrirAqjP540v0OPBCRQyB8qFaI
 NTcNJ+qESe6Q80mw5V+y/kD6kX0LERSDB+pigzOOOlmfMtD1uADR84tAynuTKNAU
 7/5K/YSQxceRY6RTgD17Al5lHIH5nw==
 =ToR+
 -----END PGP SIGNATURE-----

Merge tag '4.3.3'

Smack 4.3.3
2019-03-14 18:23:33 +01:00
Florian Schmaus 569f7417a8 Add AuthenticatedConnectionInitiallyEstablished timestamp 2019-03-10 21:24:37 +01:00
Florian Schmaus c4289b2c18 Add AbstractXMPPConnection.initState()
and init/reset the sychronization points there.

This method is called right at the beginning of connect() and at the
end of shutdown().
2019-03-10 21:24:37 +01:00
Florian Schmaus 7d2c3ac9f9 Do not call synchronized methods in reader/writer thread
This may cause deadlocks with a call to acquire(2) on the introduced
readerWriterSemaphore in initConnection(), which is also synchronized.
2019-03-10 21:24:37 +01:00
Florian Schmaus f602de8771 Call shutdown() in connect() on exception
to clean up the state build up by connect().

Related to SMACK-855 there is the possiblitiy of a stray (writer)
thread if, for example, tlsHandled.checkifSuccessOrWaitorThrow() in
XMPPTCPConnection.connectInternal() throws. This commit should prevent
that.
2019-03-04 20:14:12 +01:00
Florian Schmaus 9f3d2d2f28 Log if reported XMPP domain does not match expected 2019-02-16 21:54:11 +01:00
Florian Schmaus 8df69bd3ce Use XmlEnvironment in parsing/provider subsystem 2019-02-15 23:21:30 +01:00
Florian Schmaus 7dee3b88a2 Introduce SmackParsingException 2019-02-10 19:01:47 +01:00
Florian Schmaus 163ca2b009 Merge branch '4.3' 2019-02-09 20:15:09 +01:00
Florian Schmaus 09bffb8dca Fail sync points on exception in XMPPTCPConnection 2019-02-09 18:12:03 +01:00
Florian Schmaus 083dac8b83 Rework exceptions in the parsing / provider subsystem 2019-02-05 13:18:03 +01:00
Florian Schmaus 4c42d0cd32 Add concurrent but in-order listeners to XMPPConnection 2019-02-05 13:18:03 +01:00
Florian Schmaus dc780ffd6c Make sendStanza() final 2019-02-05 13:18:03 +01:00
Florian Schmaus e98d42790a SmackReactor/NIO, Java8/Android19, Pretty print XML, FSM connections
This commit adds
- SmackReactor / NIO
- a framework for finite state machine connections
- support for Java 8
- pretty printed XML debug output

It also
- reworks the integration test framework
- raises the minimum Android API level to 19
- introduces XmppNioTcpConnection

Furthermore fixes SMACK-801 (at least partly). Java 8 language
features are available, but not all runtime library methods. For that
we would need to raise the Android API level to 24 or higher.
2019-02-05 13:18:03 +01:00
Florian Schmaus fb2a9b2167 Merge branch '4.3' 2018-12-14 23:09:59 +01:00
Florian Schmaus f6da386dea Ensure that IQ response 'to' address and ID are set correctly
Fixes SMACK-845.
2018-12-14 17:18:53 +01:00
Florian Schmaus 5c090c35d4 Ensure sync listeners not being called after they removed themselves 2018-11-11 16:55:57 +01:00
Florian Schmaus b7ea226c56 Bump "Error Prone" to 2.3.2
and gradle-errorprone-plugin to 0.6.
2018-10-31 16:06:31 +01:00
Florian Schmaus 51e800c034 Smack 4.3.0
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAltjB1dfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFISagf/bFhu9Getz7tvo3R+Z2brTszQSKVIvXf6DFKXWapUwOLeZp6EQGQXbnym
 UOz1ykMnkCrgKRyNmPFwG2ZBcHWdL0/2nvyfm0e6nhd5gsoTJoqH8gMtVNlIsa47
 lGatkr0JhsyHUREtMbnRmGMEh5M+pMGGWGLqHIFXJIZJ2/IV2cMlBx0jPFpd+Toc
 IKXfe8euZp6Ic8JKk4V7SIcpTJw9zsihsXP3zwwDjn0xft89tI8lpT6MfaWL9q+Z
 bUSEoEv27gJvK1iFbxKR4A1TGnmesl8GMBeWhU2+aF8PardYuc3+0qjD9yah6o6p
 hlg4um1bgWixqRgGWfkcbhDHS1E04A==
 =+uoq
 -----END PGP SIGNATURE-----

Merge tag '4.3.0'

Smack 4.3.0
2018-08-02 16:17:58 +02:00
Florian Schmaus 5bf0fd64ac Add ExceptionThrowingCallbackWithHint and javadoc
about parsing exceptions also providing rationale.
2018-08-02 09:40:11 +02:00
Paul Schaub 74bebc13e6
requireNotNullOrEmpty -> requireNotNullNorEmpty 2018-07-17 15:10:39 +02:00
Florian Schmaus 9e18ba2327 Remove deprecated methods in XMPPConnection 2018-06-14 10:00:37 +02:00