1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-18 10:02:05 +01:00
Commit graph

932 commits

Author SHA1 Message Date
Florian Schmaus
988954a9db core: delete deprecated filters
Those where deprecated in 2015 with d4a6d8e65 ("Rename
PacketFilter (and implementing classes) and PacketExtension"), now it
is time to delete them.
2020-04-13 20:52:07 +02:00
Florian Schmaus
c49999b933 core: add shortcut via hash in EqualsUtil
Return false as soon as the hashed value does not match. This is
sound, since every class that implements equals(Object) should also
implement hashCode().
2020-04-13 20:40:10 +02:00
Florian Schmaus
5438fb7b33 core: add hint towards StanzaView.getExtension(Class) 2020-04-12 12:17:05 +02:00
Florian Schmaus
d498cd8499 core: re-add Stanza.getExtension(String, String) and mark deprecated
This method was removed with 07da9ffb4 ("Do not have
Stanza.getExtension(String, String) return a generic type"). In order
to aide migration to the newer API, this commit re-adds the method and
marks it as deprecated.
2020-04-12 12:17:05 +02:00
Florian Schmaus
7bc2ebb731 core: fix javadoc of Stanza.getExtensionElement(String, String)
The element name must not be null or empty.
2020-04-12 12:17:05 +02:00
Florian Schmaus
7a57bb7c09 Rename Stanza.getExtension(String, String) to getExtensionElement() 2020-04-12 12:09:04 +02:00
Florian Schmaus
4ccced906e core: add SuppressWarnings("static-method") to getReactor() 2020-04-11 22:07:16 +02:00
Florian Schmaus
b5f9d4d7a3 Introduce test fixtures
This also removes the powermock dependency. Although powermock is a
fine library, it currently prevents dropping Junit4. And since we only
use the Whitebox API of powermock, this simply replaced powermock's
Whitebox with our own.
2020-04-11 22:05:36 +02:00
Florian Schmaus
2c83c73005 core: Avoid ClassCastException in getExtension(Class)
Ensure that he returned extension element is actually of the correct
type. It should not be common, but in theory, Smack's provider
architecture would allow for different types to be returned than the
ones one may expect.
2020-04-11 18:04:15 +02:00
Florian Schmaus
85af4a022d compression: remove Android SDK level < 19 compatiblity
Since we now require Android SDK 19 or higher, we can use the method
directly.
2020-04-09 20:54:36 +02:00
Florian Schmaus
f1dd925844 Mark code from the old integration-test dir as migration candidates 2020-04-09 15:14:09 +02:00
Florian Schmaus
f329b447f2 Delete some outdated code from the old integration-test dir
The code in the integration-test/ directories should either be
migrated to sinttest (or unit tests), or get deleted. This is a first
small step towards this goal.
2020-04-09 15:14:09 +02:00
Florian Schmaus
5579567572 core: use addCompressionHandler() instead directly adding to the list 2020-04-09 15:14:09 +02:00
Florian Schmaus
8b0de5ff85 Introduce TLSUtils.setEnabledTlsProtocolsToRecommended(B builder)
And deprecate no longer recommended methods.

Thanks to Milan Kral <milan.kral@azet.sk> for the initial PR which
triggered this commit.
2020-04-05 22:28:01 +02:00
Florian Schmaus
07da9ffb48 Do not have Stanza.getExtension(String, String) return a generic type
Returning a generic would allow for

List<ExtensionElement> list = stanza.getExtension("foo", "bar");

to compile (Note the we are calling getExtension(), not
getExtension*s*()).

Users are encouraged to use the type safe getExtension(Class<? extends
ExtensionElement) variant instead.

Fixes SMACK-825.
2020-04-05 22:10:05 +02:00
Florian Schmaus
62916b8490 Improve exception message of XmppElementUtil.getQNameFor() 2020-04-05 22:08:10 +02:00
Florian Schmaus
8d432e2303 Add StanzaView.hasExtension(Class<? extends ExtensionElement>) 2020-04-05 19:59:24 +02:00
Florian Schmaus
5380e5705f Remove deprecated Packet(Extension) and DefaultExtensionElement types
Those where deperecated in 2015. Time to remove them.
2020-04-05 19:12:10 +02:00
Florian Schmaus
3382cbdf44 Delete superfluous newline in SmackInitialization 2020-04-05 18:59:28 +02:00
Florian Schmaus
439e29a1c7 Do not import Message.Body explicitly in SmackInitialization 2020-04-05 18:59:02 +02:00
Florian Schmaus
14c351397d Implement message stanza <thread/> and <subject/> as ExtensionElement
Fixes SMACK-852.
2020-04-05 18:58:13 +02:00
Florian Schmaus
f9fb4d7627 Remove deprecated XmlStringBuilder.rightAngelBracket()
This method was marked deprecated with bbf89c65b ("Fix typo in
XmlStringBuilder, it's not an Angel"). Now it is time to remove it.
2020-04-05 17:26:21 +02:00
Florian Schmaus
12e20c2d6c Remove deprecated methods/fields scheduled for removal in Smack 4.4 2020-04-04 13:03:48 +02:00
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
4dd3800d82 Remove Bouncycastle as direct dependency
By not directly depending on Bouncycastle (BC), we avoid conflicts between
different bouncycastle versions. It is also part of the developers job
to take care that all required security primitives are available. If
they are provide by BC or some other security provider should not be
up to Smack to decide.

We now only add BC as test dependency to satisfy this requirement when
the unit tests are executed.
2020-03-13 16:58:45 +01:00
Florian Schmaus
39a833166a Add workaround for truststores in JKS format when using Java >= 9 2020-03-13 16:40:46 +01:00
Florian Schmaus
863d0bf403 Fix NPE in ServiceDiscoveryManager 2020-03-09 14:41:52 +01: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
78be8f3a04 junit: bump to 5.6.0 2020-02-23 19:12:54 +01:00
Florian Schmaus
961e56a47c proxy: modernize code by using (ByteArrayOutput|DataInput)Stream 2020-02-23 19:12:54 +01:00
Florian Schmaus
b6ad737aa4 proxy: do not call setTcpNoDelay() but instead flush the stream 2020-02-23 19:12:54 +01:00
Florian Schmaus
be2fc23f41 proxy: make it the caller's reponsibility to close the socket
This makes the code shorter as there is now a single place where the
socket should be closed.
2020-02-23 19:12:54 +01:00
adiaholic
ee3d25751d Correct ALPHABET in BASE32.java 2020-01-28 20:19:42 +05:30
Florian Schmaus
9d626bf787 core: improve AsyncButOrdered
Instead of marking the handle as not running by setting the handler's
value in the map to false, we now remove simply the key if there is no
handler running. This also means we no longer need to use a weak hash
map for this.

Also reduce the size of the synchronized blocks, mainly by scheduling
the handler outside of the synchronized(threadActiveMap) block.

Make some code better readable and add some more comments. Also do
start a new handler thread if the task threw.
2019-11-08 10:14:21 +01:00
Florian Schmaus
eb4c2c5572 s/occured/occurred/ 2019-10-30 12:02:36 +01:00
Florian Schmaus
b0277d7e74 Emit <starttls/> as empty element when possible 2019-10-30 12:00:20 +01:00
Florian Schmaus
2915101843 Use isEmpty() in StringUtils.requireNullOrNotEmpty() 2019-10-30 11:56:55 +01:00
Florian Schmaus
6d1252755b Mark more methods in Stanza as final 2019-10-30 09:23:01 +01:00
Florian Schmaus
63ba524758 Make IQ(IQ) constructor protected 2019-10-30 08:20:25 +01:00
Florian Schmaus
e2223254cf Organize imports everywhere 2019-10-29 21:12:22 +01:00
Florian Schmaus
69767e9538 Rename AbstractIqBuilder subclasses to their designated names 2019-10-29 19:34:18 +01:00
Florian Schmaus
6e32305987 Apply builder pattern to DiscoverInfo
This is the first transformation of an IQ type to the builder type.
2019-10-29 11:14:55 +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
8f371c5381 Fix datatype.Scalar equals() and hashCode() methods
The previously used Number.equals() and hashCode() was just delegated
to Object and hence did not behave as expected.
2019-10-17 12:24:30 +02:00
Florian Schmaus
db150a850a Fix order of 'actual' and 'expected' in XmlUnitUtils 2019-10-16 19:35:22 +02:00
Florian Schmaus
b510d373b5 reactor: have synchronized block include peeking at scheduled actions
If we do not peek at the scheduled actions in the reactors
synchronized block, then there is a kind of lost-update problem. While
Ractor.schedule() will call wakeup() on the selector, a thread could
have already determined the value of selectWait, while being blocked
at the start of the synchronized reactor section. Once it is able to
enter the section, it will use an outdated selectWait value.

This leads to scheduled actions not being executed on time.

Thanks to Eng ChongMeng for reporting this and suggesting the fix.
2019-10-12 10:22:31 +02:00
Florian Schmaus
05c920ab56 Fix typo in comment 2019-10-12 10:14:17 +02:00
Florian Schmaus
e23babf147 Add Stanza.setNewStanzaId() and ensureStanzaIdSet()
Also deprecate setStanzaId() since it was not clear if this would
create a new stanza ID or just ensure that one is set.
2019-10-05 23:16:15 +02:00