Commit Graph

111 Commits

Author SHA1 Message Date
Danny Baumann aafc24a966 Conditionally reduce severity of roster reload error logging
If the roster feature is not supported by the server, there's no need to
log this at SEVERE log level.
2022-02-15 12:21:27 +01:00
Florian Schmaus aab48570c9 Call XMPPConnection.sendIqRequestAndWaitForResponse(IQ) where possible
Refactored using

find . -type f -name "*.java" |\
	 xargs sed -i -E |\
		's/\.createStanzaCollectorAndSend\((\w+)\)\.nextResultOrThrow\(\);/.sendIqRequestAndWaitForResponse(\1);/'

and some manual refactoring.
2021-05-12 10:12:40 +02:00
Florian Schmaus a7b3303f3e Bump ErrorProne to 2.5.1 and refactor Providers a bit
This also resulted in a refactoring of the Providers and parsing
Exceptions. NumberFormatException and ParseException can now be thrown
directly, the wrapping in a SmackParsingException is down at a higher
layer, i.e. in AbstractProvider.
2021-01-29 09:26:15 +01:00
Florian Schmaus 3f9ca68134 Delete TypedCloneable 2020-06-14 17:38:51 +02:00
Florian Schmaus ab2d3a2b79 [core] Deprecate AbstractConnectionListener 2020-05-13 22:14:43 +02:00
Florian Schmaus 5db6191110 Introduce StanzaBuilder
As first step to immutable Stanza types.
2019-10-25 21:41:55 +02:00
Florian Schmaus 1a3067c89b Enable werror for javadoc and fix javadoc issues 2019-08-30 12:08:30 +02:00
Florian Schmaus f863bd222c Merge branch '4.3' 2019-08-22 11:52:41 +02:00
Florian Schmaus d40b16b5a7 Fix log message format in Roster: s/{}/{0}/
The MessageFormat used by the JUL Logger requires integers between the
curly brackets (unlike SLF4J).
2019-08-22 10:55:33 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus 91ec6cc955 Javadoc changes for Java 11 compatibility 2019-07-19 23:05:46 +02:00
Florian Schmaus f7762c5db7 Add "whitespace after comma" checkstyle rule 2019-05-17 21:56:46 +02:00
Florian Schmaus af0fb7543c
Merge pull request #309 from vanitasvitae/rosterListenerDoc
Add missing Roster documentation
2019-04-06 15:19:59 +02:00
Paul Schaub af88227919
Add missing Roster documentation 2019-04-06 02:36:32 +02:00
Florian Schmaus d10319f1a0 Merge branch '4.3' 2019-04-05 10:22:12 +02:00
Florian Schmaus 9be498c440 Fix NPE in Roster's presence listeners if 'from' is not set
The NPE is caused by an inbound presence stanza without the 'from'
attribute set. The stacktrace of the NPE is:

FATAL EXCEPTION: Smack Cached Executor
Process: de.fhg.ivi.senetz.mobile.android.mbk.debug, PID: 13365
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:944)
    at org.jivesoftware.smack.roster.Roster.getPresencesInternal(Roster.java:374)
    at org.jivesoftware.smack.roster.Roster.getOrCreatePresencesInternal(Roster.java:388)
    at org.jivesoftware.smack.roster.Roster.access$1100(Roster.java:94)
    at org.jivesoftware.smack.roster.Roster$PresencePacketListener$1.run(Roster.java:1519)
    at org.jivesoftware.smack.AsyncButOrdered$Handler.run(AsyncButOrdered.java:121)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)

Thanks to Marcel Heckel for reporting this.

Fixes SMACK-861.
2019-04-02 14:28:41 +02:00
Florian Schmaus 9c4e5d0330 Add Roster.createItem() and Roster.createItemAndRequestSubscription()
and deprecate createEntry().

createEntry() would also send a subscription request which may is
suprising given that you can also create an roster item without having
to send a subscription request out.

This also fixes a bug in
LowLevelRosterIntegrationTest.testPresenceEventListenersOffline()
where createEntry() was used, which would also trigger a presence
subscription request which in turn made the test fail if the
SubscribeListener of ensureSubscribedTo() was not yet set
up. So the test would fail depending on the timing.
2019-03-16 21:23:45 +01:00
spslinger 1e21ab763c
Fix getPresence ConcurrentModificationException
Fix for SMACK-841

Since Smack 4.2.4, the getPresencesInternal method in the Roster class
can return a LruCache object, which is a LinkedHashMap with access
order. This means that any access using get or getOrDefault will be a
modification of the Map. If you loop over the keySet of the Map and
there are more than one, the second call to get will throw a
ConcurrentModificationException!

Since the keys are only used here to obtain the corresponding
values, the simplest solution is to just loop over the values instead.
2018-10-11 12:29:32 +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 476fdf99a1 Inroduce AsyncButOrdered 2018-04-08 21:21:50 +02:00
Florian Schmaus 2efec89050 Rename XMPPError to StanzaError
Fixes SMACK-769.
2018-04-07 22:59:25 +02:00
Florian Schmaus 193688e553 Merge branch '4.2' 2018-03-28 12:51:28 +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
Florian Schmaus dddf62763e Also store unavailable presences in the map for non-Roster presences
Fixes SMACK-808.
2018-03-13 19:38:07 +01:00
Florian Schmaus 1fd03c396a Make Roster's non-roster presence second-level map bounded
Fixes SMACK-809.
2018-03-13 19:38:07 +01:00
Jesus Fuentes 903f90e1c1 Update/fix javadocs 2018-03-09 07:15:46 -06: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
Paul Schaub cb18056613 Fix minor codestyle issues 2017-12-17 11:03:46 +01:00
Florian Schmaus 81002c4fbd Merge branch '4.2' 2017-11-22 08:37:47 +01:00
Florian Schmaus 65b4f506dc Add SubscribeAnswer.ApproveAndAlsoRequestIfRequired 2017-11-06 22:41:28 +01:00
Florian Schmaus 384c285fbc Merge branch '4.2' 2017-10-14 14:56:36 +02:00
iachimoe c92a95136f Updated comments to indicate that reject_all is default SubscriptionMode 2017-08-26 12:16:07 -05:00
Florian Schmaus 6203d163c4 Deprecate old async API 2017-08-16 13:46:42 +02:00
Florian Schmaus 2d4312272c Allow roster pushes from our full JID
SMACK-773
2017-07-03 11:07:26 +02:00
Florian Schmaus 08e897113d Add CustomImportOrder checkstyle rule
And matching ImportOrder settings for Eclipse in
resources/eclipse/smack.importorder
2017-06-14 17:12:43 +02:00
Florian Schmaus ce1cddc722 More checkstyle whitespace related checks 2017-05-24 14:42:38 +02:00
Florian Schmaus e141de9aa4 Fix possible NPE in roster push listener
Daniele Ricci reporting the following NPE using Smack 4.1.9

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.indexOf(int)' on a null object reference
       at org.jxmpp.util.XmppStringUtils.parseBareJid(XmppStringUtils.java:124)
       at org.jivesoftware.smack.roster.Roster$RosterPushListener.handleIQRequest(Roster.java:1416)
       at org.jivesoftware.smack.AbstractXMPPConnection$2.run(AbstractXMPPConnection.java:1061)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

This is possibly caused by a service sending roster pushes for unbound
connections, i.e. where getUsers() returns 'null'. We now log such
situations instead throwing an NPE.
2017-03-10 17:47:13 +01:00
Florian Schmaus 46e8866440 Improve log message of RosterResultListener 2017-01-30 17:09:30 +01:00
Florian Schmaus 85fcb55bd9 Fix roster handling of outgoing 'unavailable' presence
make sure that the 'to' attribute is not set, as otherwhise the
listener would also be invoked e.g. when the user leaves a MUC.
2017-01-29 11:12:30 +01:00
Florian Schmaus 7c46f58c80 Rename "PacketReplyTimeout" → "ReplyTimeout" 2017-01-12 20:57:19 +01:00
Florian Schmaus 90a5e289f8 s/processPacket/processStanza/ s/PacketCollector/StanzaCollector/ 2017-01-03 11:35:04 +01:00
Florian Schmaus 1bce31fcd9 Handle outgoing 'unavailabe' presences in Roster
Fixes SMACK-733
2017-01-03 10:56:01 +01:00
Florian Schmaus 183c605278 Bump JXMPP to 0.5.0 2017-01-02 09:40:46 +01:00
Florian Schmaus 6f66b31fb7 Set default subscription mode to "reject all"
In order to make the defaults of Smack more secure.
2016-12-28 23:42:30 +01:00
Florian Schmaus 7655ac17f2 Re-activate EntityCaps integration test 2016-12-24 10:27:04 +01:00
Florian Schmaus 1d3c48e6ce Add support for IoT Friend approvals
This adds supports for an experimental protocol flow where a pending
friend request's decission is later on deliverd to the requestor after
the owner made its decission.
2016-10-31 14:50:37 +01:00