1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-15 20:12:04 +01:00
Commit graph

348 commits

Author SHA1 Message Date
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
b1a5509927 smack-tcp: Split dot to png into two makefile steps
Since using a pipe, as we did previously would not error the target if
the first command in the pipe fails.

It is still far from ideal, since the dot file is also generated if
the gradle command fails. At some point, this should probably become
part of gradle build step instead of shelling out to a Makefile.
2019-09-23 16:12:48 +02:00
Florian Schmaus
bd4b91fc26 Introduce AbstractXMPPConnection.outgoingStreamXmlEnvironment 2019-09-23 16:12:48 +02:00
Florian Schmaus
002d060584 XmlStringBuilder: Map all XML serialization to appendXmlTo()
this is now the single place where serializatin happens.
2019-09-23 16:12:48 +02:00
Florian Schmaus
65576cf3c2 Rework XML Element hierarchy and XmlStringBuilder
- Reduce the amount of types that are subtypes of NamedElement. See
javadoc of NamedElement for rationale.
- Work more with XmlEnvironment in XmlStringBuilder.
- Some minor changes to XmlStringBuilder API.
2019-09-07 18:17:08 +02:00
Florian Schmaus
1a3067c89b Enable werror for javadoc and fix javadoc issues 2019-08-30 12:08:30 +02:00
Florian Schmaus
4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus
89b64fbf0c Add TODO comment to XmppNioTcpConnection 2019-07-05 09:17:14 +02:00
Florian Schmaus
60c7e0ab76 Fix typo in XmppNioTcpConnection: s/Therfore/Therefore/ 2019-07-05 09:17:14 +02:00
Florian Schmaus
7e25c3ada5 Merge branch '4.3' 2019-05-16 20:52:27 +02:00
Florian Schmaus
2ceadc0de1 Introduce verificationSuccessful boolean 2019-05-16 16:51:31 +02:00
Florian Schmaus
f60e4055ec Use ACE representation of XMPP domain on certificate verification
This is based on the patch provided by Georg Lukas, modified to take
XMPP domain names that can not be represented as DNS names into
account. See c42d2eea24 (r269250137)

Fixes SMACK-870.
2019-05-16 14:14:10 +02:00
Florian Schmaus
68b7eb26f3 Fix PacketWriterTest: Expect also InterruptedException
which is thrown in case the queue was shut down.
2019-05-08 15:19:48 +02:00
Florian Schmaus
7f0dc72dab Update errorprone(-plugin) and make Unused(Variable|Method) an error 2019-05-07 23:09:00 +02:00
Florian Schmaus
575364cc1f Print exception's stacktrace in PacketWriterTest 2019-05-07 21:02:07 +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
Florian Schmaus
b3646abecd XMPPTCPConnection: Move openStream() call from writer into reader thread
and also call notifyConnectionError() on exception thrown by
openStream().

In hindsight I wonder why openStream() was ever called in the writer
thread, as it only caused unnecessary synchronization overhead, as can
be seen by the initialOpenStreamSend synchronization point.
2019-04-30 13:55:55 +02:00
Florian Schmaus
d6b6fdca17 Add ConnectionConfiguration.setXmppAddressAndPassword() 2019-04-07 16:44:04 +02:00
Florian Schmaus
d10319f1a0 Merge branch '4.3' 2019-04-05 10:22:12 +02:00
Florian Schmaus
25b3f35421 Ensure that shutdown() terminates reader/writer threads
In case an exception happens in connect()/login() the
'disconnectedButResumable' boolean may (still) be set. Which causes
only one of the reader and writer threads to exit, typically the
reader thread, because shutdown() will bail out very early. This
leaves a dangling (writer) thread causing memory leaks and deadlocks
on a subsequent connect()/login().
2019-03-28 17:58:25 +01:00
Florian Schmaus
5d46e281fc XMPPTCPConnection log when reader/writer threads start and exit 2019-03-26 17:23:27 +01:00
Florian Schmaus
a23adfab6e Merge branch '4.3' 2019-03-24 00:16:24 +01:00
Georg Lukas
8e88cd2e31 Proxy mode: add failed address on error 2019-03-24 00:11:01 +01:00
Florian Schmaus
7059b60672 Wait for reader/writer thread termination at the end of shutdown()
This synchronizes the place with what the master branch currently
does.
2019-03-16 11:11:58 +01:00
Florian Schmaus
3ded023629 Remove 'synchronized' from notifyConnectionError()
as it is not neccessary and causes stalls and deadlocks with a
concurrent connect()/login() (which could be resolved interrupting the
connect()/login() calling thread):

"Smack Reader (0)" daemon prio=5 tid=21 Blocked
  | group="main" sCount=1 dsCount=0 obj=0x12c84670 self=0x7e072ca200
  | sysTid=14965 nice=0 cgrp=default sched=0/0 handle=0x7e06155450
  | state=S schedstat=( 63430626 3034269 21 ) utm=5 stm=0 core=2 HZ=100
  | stack=0x7e06053000-0x7e06055000 stackSize=1037KB
  | held mutexes=
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.notifyConnectionError(XMPPTCPConnection.java:-1)
  - waiting to lock <0x0ec6e6bb> (a org.jivesoftware.smack.tcp.XMPPTCPConnection) held by thread 22
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$3900(XMPPTCPConnection.java:154)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1330)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$900(XMPPTCPConnection.java:1064)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1081)
  at java.lang.Thread.run(Thread.java:761)

"connect" prio=5 tid=22 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12c8e820 self=0x7e19bcd600
  | sysTid=15047 nice=0 cgrp=default sched=0/0 handle=0x7e05ee4450
  | state=S schedstat=( 14067083 7475835 14 ) utm=1 stm=0 core=0 HZ=100
  | stack=0x7e05de2000-0x7e05de4000 stackSize=1037KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x0c058b14> (a java.lang.Object)
  at java.lang.Thread.parkFor$(Thread.java:2127)
  - locked <0x0c058b14> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:325)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:161)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:840)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:994)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303)
  at java.util.concurrent.Semaphore.acquire(Semaphore.java:446)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.initConnection(XMPPTCPConnection.java:685)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:942)
  at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:417)
  - locked <0x0ec6e6bb> (a org.jivesoftware.smack.tcp.XMPPTCPConnection)
  at org.yaxim.androidclient.service.SmackableImp.connectAndLogin(SmackableImp.java:717)
  - locked <0x0ec6e6bb> (a org.jivesoftware.smack.tcp.XMPPTCPConnection)
  at org.yaxim.androidclient.service.SmackableImp.doConnect(SmackableImp.java:304)
  at org.yaxim.androidclient.service.SmackableImp$5.run(SmackableImp.java:391)
2019-03-16 10:42:36 +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
Georg Lukas
e5bbd19ef1 StanzaDroppedListener for XEP-0198 resumption failures
If a stream resume fails, smack will re-send all queued stanzas after a
reconnect. However, it does not make sense to re-send them:

* IQs / IQ responses have probably timed out
* MUC messages and PMs will be rejected as you haven't rejoined yet
* regular messages should be amended with a <delay> element

This patch adds a StanzaDroppedListener interface to the
XMPPTCPConnection. If at least one StanzaDroppedListener is provided,
all queued messages will be drained into the StanzaDroppedListener(s).
Otherwise, the original behavior of attempting to transmit them will be
followed.

Discussion: https://discourse.igniterealtime.org/t/xep-0198-resume-failure-reconnect-resending-of-muc-messages/83510/3

Signed-off-by: Georg Lukas <georg@op-co.de>
2019-03-10 21:24:37 +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
5da6dea138 Throw exception to reduce call sites of notifyConnectionError()
in XMPPTCPConnection.
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
8df69bd3ce Use XmlEnvironment in parsing/provider subsystem 2019-02-15 23:21:30 +01:00
Florian Schmaus
43bb418d99 Call onOpenStream() in XmppNioTcpConnection 2019-02-15 23:17:12 +01:00
Florian Schmaus
7fce6b5a98 Introduce SmackMessageException 2019-02-10 21:50:39 +01:00
Florian Schmaus
bb759a136e Use SmackWrappedException where sensible 2019-02-10 21:50:39 +01:00
Florian Schmaus
b7d6edcd1e Do not wrap XmlPullParser exception in openStream() 2019-02-10 19:03:07 +01:00
Florian Schmaus
163ca2b009 Merge branch '4.3' 2019-02-09 20:15:09 +01:00
Florian Schmaus
78dcaec75b Remove null checks for writer/reader fields in XMPPTCPConnection
as those are never null since
60f324eb1b (the previous commit).
2019-02-09 18:20:55 +01:00
Florian Schmaus
60f324eb1b Make writer/reader fields final in XMPPTCPConnection 2019-02-09 18:12:36 +01:00
Florian Schmaus
09bffb8dca Fail sync points on exception in XMPPTCPConnection 2019-02-09 18:12:03 +01:00
Florian Schmaus
5c8e830157 Log if not all reader/writer threads where terminated 2019-02-09 18:12:01 +01:00
Florian Schmaus
62cba0d96f XMPPTCPConnection: Ensure both writer/reader threads are terminated
This should fix SMACK-855.
2019-02-09 13:36:42 +01:00
Florian Schmaus
fee3ed81ca Introduce XmlEnvironment 2019-02-05 13:18:03 +01:00
Florian Schmaus
5705f18f58 Remove SmackDaneVerifier.finish(SSLSocket) 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
7a3f6f29cc Merge branch '4.3' 2018-12-21 13:21:50 +01:00
Florian Schmaus
b9c12d44c3 Use InetSocketAddress in log message in XMPPTCPConnection
The inetAddressAndPort String is redundant since
a2743549b8, because we now construct the
InetSocketAddress earlier and can hence use it in the log statement.
2018-12-21 12:09:03 +01:00
Florian Schmaus
a2743549b8 Make TCP socket connection attempt interruptable
by introducing SmackFuture.SocketFuture.

Fixes SMACK-847.
2018-12-21 12:03:49 +01:00
Florian Schmaus
48e3127172 Always wait for stream features after authentication
The purpose of the "maybeCompressFeaturesReceived" synchronization
point is to wait for the stream features after authentication. This is
not really reflected by its name and furthermore its
checkIfSuccessOrWait() method was only invoked if compression was
enabled, but we always want to wait for the stream features after
authentication. Hence move the call before the isCompressionEnabled()
check and one layer up in the call stack.

Fixes SMACK-846.
2018-12-20 16:52:44 +01:00
Florian Schmaus
fb2a9b2167 Merge branch '4.3' 2018-12-14 23:09:59 +01:00
Florian Schmaus
5ddaa623da Check if unacknowledged stanzas queue is full before adding to it
to avoid an IllegalStateException.

Fixes SMACK-844.
2018-12-08 22:54:13 +01:00
Marcel Heckel
1ea10831b6 Enables the HTTP compression in JBOSH
Adds an extra parameter "compressionEnabled" to ConnectionConfiguration
that is used to set the setCompressionEnabled() of BOSHClientConfig
2018-11-08 13:36:45 +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
01f9b228f2 Consider enclosing namespace in Stream Management elements 2018-10-18 21:05:23 +02:00
Florian Schmaus
a00aa726fe Introduce CloseableUtil 2018-08-15 17:25:22 +02:00
74bebc13e6
requireNotNullOrEmpty -> requireNotNullNorEmpty 2018-07-17 15:10:39 +02:00
Florian Schmaus
23bb5c5625 Add XMPPErrorException.getStanzaError()
Also deprecate getXMPPError and let StanzaError implement
ExtensionElement.
2018-06-20 22:17:11 +02:00
Florian Schmaus
e8923b9d16 Enable trailing whitespace checkstyle check
for all source code regions, including javadoc.
2018-05-09 23:26:39 +02:00
Florian Schmaus
5ab2903c32 Change Element.toXml() to toXml(String enclosingNamespace) 2018-04-27 10:05:25 +02:00
Florian Schmaus
74f14484e6 Smack 4.2.4
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlrTPy5fFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFI5aAf/Rb6Y+hqxiHRbsmww74rt7HfgQnOjOjz3bPhgbVH2emzBHzxsU2pBBY87
 iTfCXjXA3qQ9FzluBchLrd9EciDEXq1A/ZblYnR+kch1DK7wvVipTPWIzOHt6ahD
 q7vfS9EmmFBCRjNM4tW8zwaajWWeJAWimXoZFxuy/n+2FORnx0x5NrnIHwYvyUtf
 nY432BOiCg7l6J9sgfcoYDgP0Ot4SkdfUIgGOYonv0lzKW8HkU/OZZwEMbFhlCHU
 s0inbU5ldDDP7xXIinDqHVSKpRlSIkaOJ0zbAQLjFz8h2fCnqDGhpnNbun8Xb7l2
 agsATloOl91tlUV5D+qRWjzkx7pDxA==
 =YqLS
 -----END PGP SIGNATURE-----

Merge tag '4.2.4'

Smack 4.2.4
2018-04-15 14:48:22 +02:00
Florian Schmaus
b5bc7d8d9f Use XMPP service name when creating the TLS socket
instead of the hostname. This should make SNI also to use the XMPP
service name instead of the hostname.

Fixes SMACK-813.
2018-04-09 08:26:20 +02:00
Florian Schmaus
270e378287 Fix StreamManagement.Failed.toXML()
Note that this method is currently not used by Smack, as XMPP clients
usually do not emit that Nonza.
2018-04-07 23:10:58 +02:00
Florian Schmaus
d275d9a7da Remove TODO comment in packet.StreamManagement
as the comment appears to be incorrect.
2018-04-07 23:06:49 +02:00
Florian Schmaus
2efec89050 Rename XMPPError to StanzaError
Fixes SMACK-769.
2018-04-07 22:59:25 +02:00
Florian Schmaus
6a42d5baff Rework FileUtils 2018-04-06 10:25:06 +02:00
Florian Schmaus
ad87243060 Globally 's;stanza(/packet);stanza;' 2018-03-31 14:17:30 +02:00
Florian Schmaus
a9ca1a0989 Enable ModifierOrder checkstyle check
Fixes SMACK-812
2018-03-29 12:35:11 +02:00
Florian Schmaus
3132d9a224 Bump errorprone to 2.2.0 2018-03-28 15:56:04 +02:00
Florian Schmaus
b5209f4701 Enable RedundantModifier checkstyle check 2018-03-28 14:02:21 +02:00
Florian Schmaus
5b9254aff5
Merge pull request #209 from fuentesj11/rename-deprecate-xmppconnection-methods
Rename and deprecate XMPPConnection methods
2018-03-28 12:11:32 +02:00
Jesus Fuentes
a70063dc89 Rename and deprecate XMPPConnection methods
Rename and deprecate XMPPConnections methods as described in SMACK-802
2018-03-22 15:40:40 -05:00
Florian Schmaus
f42d9137b5 Merge branch '4.2' 2018-03-21 15:22:22 +01:00
Jesus Fuentes
903f90e1c1 Update/fix javadocs 2018-03-09 07:15:46 -06:00
Florian Schmaus
42c2e4d077 Remove stanza ID ack'ed listeneres after max 3 instead of 12 hours 2018-02-23 18:53:47 +01:00
Florian Schmaus
3bdeca44f2 Merge branch '4.2' 2018-02-23 18:35:34 +01:00
Florian Schmaus
793d3c47ad Move TLS and SASL sync points into subclasses
In preperation of subclasses with different connection approaches.
2018-02-23 10:37:17 +01:00
Florian Schmaus
a48e8ef843 Merge branch '4.2' 2018-02-21 20:13:05 +01:00
9f47daa7ad
Add missing package-info descriptions. 2018-02-21 16:47:11 +01:00
Florian Schmaus
5333bde2e8 Merge branch '4.2' 2018-02-10 12:14:09 +01:00
Florian Schmaus
6dfc20ee5e Rename "Packet (Reader|Writer)" to just Reader or Writer 2018-02-09 10:26:42 +01:00
Florian Schmaus
3c4225d167 Merge branch '4.2' 2017-12-25 14:16:43 +01:00
Florian Schmaus
34373e8710 Enable javadoc 'html' doclint
Also make all 'test' tasks depend on the 'javadoc' task.

Fixes SMACK-650.
2017-12-25 14:08:18 +01:00
Florian Schmaus
431e5b3c67 Merge branch '4.2' into master-paul-merged 2017-12-17 11:16:02 +01:00
cb18056613 Fix minor codestyle issues 2017-12-17 11:03:46 +01:00
Florian Schmaus
76a6b9f2a1 Smack 4.2.2
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAloZnf5fFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFLcIQgAsTLRI3sWIZDPRuI5YaU/y6beqqzMp5cQgk/9+9DHGBoziLEU1spkvBs2
 Yvlwu3NtHSJsI+ibzYLEFRnzEwuW07vXw7R5J+kRSZrsE40z1HCQRwUIXDkPgghe
 MuL6vT6OV+kLqKb33YLSBuT2fj2pzVE6mRmMsnFekay/weEqOGUZaY9Hd5lJ31/9
 33fQC0FQfKULQ5t7PbdfX4dDDNWn0n6v+KjvjaskHI0oA+vqPWxPkj8gNXWW8b72
 tVV4h5uXQ0ziK3oED79+GH+DSiET9N2PmsZ7woXiFy5H8KbcQDVe5Pazf+Iq2VQ+
 Vi6Vxikr6Ak+v2Xkt+e3x9E6mZDI1w==
 =CVqq
 -----END PGP SIGNATURE-----

Merge tag '4.2.2'

Smack 4.2.2
2017-11-25 18:45:32 +01:00
Florian Schmaus
d804d4ed6d Do not abort if we could not get a KeyManagerFactory
using the default algorithm. Instead continue with 'null' as value of
the KeyManager[] array (kms). This makes the SSLContext.init() methods
to search the default security providers for implementations, which is
also OK.

This change is needed because it appears that on Android
KeyManagerFactory.getDefaultAlgorithm returns 'SunX509', which
subsequently results in

W/AbstractXMPPConnection: Connection XMPPTCPConnection[not-authenticated] (0) closed with error
  java.security.NoSuchAlgorithmException: KeyManagerFactory SunX509 implementation not found
      at org.apache.harmony.security.fortress.Engine.notFound(Engine.java:190)
      at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:139)
      at javax.net.ssl.KeyManagerFactory.getInstance(KeyManagerFactory.java:77)
      at org.jivesoftware.smack.tcp.XMPPTCPConnection.proceedTLSReceived(XMPPTCPConnection.java:747)
      at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1200(XMPPTCPConnection.java:149)
      at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1053)
      at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:980)
      at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:996)
      at java.lang.Thread.run(Thread.java:818)

Note that this is possibly because the Secuurity Provider was
not (yet) intialized.
2017-11-23 08:21:55 +01:00
Florian Schmaus
573358b459 Limit the scope of local variables in proceedTLSReceived() 2017-11-23 08:15:52 +01:00
Florian Schmaus
81002c4fbd Merge branch '4.2' 2017-11-22 08:37:47 +01:00
Florian Schmaus
853324a998
Merge pull request #185 from mityada/sm-resumption-race-condition
Prevent race condition after stream resumption
2017-11-22 08:29:36 +01:00
Florian Schmaus
813a5ba63f
Merge pull request #184 from mityada/stream-management-exception
Drop stream management state on StreamManagementException
2017-11-21 21:15:41 +01:00
Florian Schmaus
9e11b68144 Add comment style checkstyle rule requiring a space 2017-11-20 08:53:19 +01:00
Dmitry Deshevoy
230a226424 Prevent race condition after stream resumption
New stanzas sent directly after stream resumption might have been added
to unacknowledgedStanzas before the old unacknowledged stanzas
are resent. This caused new stanzas to be sent twice and later led
to a StreamManagementCounterError.

Fixes SMACK-786
2017-11-18 19:37:07 +03:00
Dmitry Deshevoy
4f11dc5b14 Drop stream management state on StreamManagementException 2017-11-16 19:10:52 +03:00
Florian Schmaus
65b4f506dc Add SubscribeAnswer.ApproveAndAlsoRequestIfRequired 2017-11-06 22:41:28 +01:00
Florian Schmaus
1b2521269e Make END_TAG parsing more NPE robust
by calling String.equals() on the constant string and not on the
return value of parser.getName().

Also perform the access to 'parser' on a different LOC than
equals(). This should help debugging things like

okt 25, 2017 2:02:54 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection XMPPTCPConnection[***@***/***] (0) closed with error
java.lang.NullPointerException
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1194)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:982)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:998)
	at java.lang.Thread.run(Thread.java:745)

which where recently reported on the forums.
2017-10-27 17:48:00 +02:00
Florian Schmaus
43abd52d76 Smack 4.2.1
-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlmR75tfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFLeXggAjdgj7YVUe22NtamnROBj1c3PaWwgSY0gEjcyDPsOz5qeqNUdQLHbmt2j
 XQQpYZWKg1/1uoQHlsixaFKbGVctKRk72aNEodRfd1osta11WTOwZKEb8nI411Tt
 7M0Fhf430WZY6nioZiZIorsmid57fftJ2EMPlmjEDp2FD0AVGAXkEhCneGaPtt9Q
 hbWbepIy9tApeIH+QgmFLBmPLnFCaSg+X6NUden3Z21bUz5vH8pmcbeUVfsNB7kW
 nkkDuNwKHPFLgjuhcq7D+KAKRwNU7n8WEuHseRzM7bMCEB+S/rZok5KPXe/tV4v+
 YZKN2e+2yh4j5l4FT/fCzELfWcvrgA==
 =MV3G
 -----END PGP SIGNATURE-----

Merge tag '4.2.1'

Smack 4.2.1
2017-08-14 21:01:36 +02:00
Florian Schmaus
b8ee8d808f Rework Smack debugger.
Also fixes SMACK-728.
2017-07-28 12:01:11 +02:00
Florian Schmaus
685edde308 Don't hardcode "SunX509" as key algorithm
in XMPPTCPConnection. Instead use the default algorithm.

Fixes SMACK-771.
2017-07-02 18:30:53 +02:00