Commit Graph

830 Commits

Author SHA1 Message Date
Florian Schmaus fa0c16d75c Introduce EqualsUtil and HashCode.(Builder|Cache) 2019-06-12 14:51:17 +02:00
Florian Schmaus 818ee8a727 Make Objects.requireNonNull() throw IllegalArgumentException
and not NullPointerException. Altough this differs from
java.util.Objects behavior, throwing an IllegalArgumentException
appears more sensible and makes it easier to catch it in Smack's
parsing function.
2019-06-11 12:47:40 +02:00
Florian Schmaus 6e1193edaf Use QName instead of XmppStringUtils.generateKey() 2019-06-11 12:47:39 +02:00
Florian Schmaus 7d59df9eed Change type of presence priority to 'Byte' 2019-06-11 12:47:39 +02:00
Florian Schmaus e911874e72 Make MultiMap use generics where sensible
I wonder why I orginally did not do it that way…
2019-06-11 12:47:39 +02:00
Florian Schmaus ce70308099 Introduce UInt(16|32) datatypes 2019-06-11 12:47:39 +02:00
Florian Schmaus b834df65e9 Add NumberUtil.requireUShort16(int) 2019-06-11 12:47:39 +02:00
Florian Schmaus b3b242f397 Add TODO comment to XmlStringBuilder 2019-06-11 12:47:39 +02:00
Florian Schmaus 4d36e3b521 Introduce FormFieldChildElement and make FormField immutable 2019-06-11 12:47:39 +02:00
Florian Schmaus 3c306eaff9 Improve comment in SmackReactor 2019-06-05 10:54:07 +02:00
Florian Schmaus 9a2cca2bd3 Merge branch 'master' of github.com:Flowdalic/Smack 2019-06-03 17:41:49 +02:00
Florian Schmaus b288768f77 Introduce util.InternetAddress
and use it where sensible. Also fixes a few unit tests along the way.
2019-06-03 17:41:10 +02:00
Florian Schmaus 4334ca33ff Add missing selector.wakeup() in SmackRactor.schedule()
Without this, newly scheduled runnables would potentially not be
scheduled in case the reactor thread was blocking in select(0)
indefinetly.

Thanks to Eng ChongMeng for reporting this.
2019-06-03 09:28:52 +02:00
Florian Schmaus 027cae3bd0 Remove unnecessary synchronization in SmackReater.schedule()
The DelayQueue 'scheduledActions' is already thread-safe.
2019-06-03 09:27:28 +02:00
Florian Schmaus 619b8e6f4a Add secure(OnlineAttackSafe|Unique|OfflineAttackSafe)RandomString()
and replace usages of java.util.UUID in Smack with
secureUniqueRandomString() because it uses a thread-local secure random
number generator.
2019-06-02 20:08:03 +02:00
Florian Schmaus 839e347676 Rename NumberUtil.checkIfInUInt32Range() to requireUInt32 2019-06-02 10:46:53 +02:00
Florian Schmaus 726a2de273 Deprecate ParserUtils.getQName() 2019-06-02 10:44:50 +02:00
Florian Schmaus 9352225f44 Rework SOCKS5 unit tests so that they can be run in parallel
As result it is now also possible to start multiple local SOCKS5
proxies with different port, which is usually not necessary in real
life but useful for unit tests.
2019-06-02 10:38:19 +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 04238bd36a Add CloseableUtil.maybeClose(Closeable) 2019-05-18 13:25:31 +02:00
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 381190a45c Add ConnectionConfiguration.getXmppServiceDomainAsDnsNameIfPossible()
in preperation of SMACK-870, so that the DNS name can be used for the
certificate verification.
2019-05-16 14:02:28 +02:00
Florian Schmaus 04f1d79d72 Try GC in MemoryLeakTestUtil.assertReferencesQueueSize()
It appears that we observe a partion GC run on some systems,
especially ones with few resources. Hopefully this increases the
chances to observe the expected GC affects so that the unit test
passes also on those systems.
2019-05-09 12:33:43 +02:00
Florian Schmaus 2dedd75cd7 Add comment about Thread.yield() in MemoryLeakTestUtil 2019-05-09 12:06:01 +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 f6be434f66 Remove deprecated methods in StanzaCollector 2019-05-08 20:42:08 +02:00
Florian Schmaus 32429bcb9c Add message to InterruptedException if blocking queue was shut down 2019-05-08 15:19:10 +02:00
Florian Schmaus d20a2675a8 Make StanzaCollector final 2019-05-08 12:44:48 +02:00
Florian Schmaus f8de22478b Double the timeout to 120s in MemoryLeakTestUtil
Because an failing test on Travis was observered using a timeout of
60s:

org.jivesoftware.smackx.muc.MucMemoryLeakTest > mucMemoryLeakTest FAILED
    java.lang.AssertionError: No reference found after 60000ms
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at org.junit.Assert.assertNotNull(Assert.java:712)
        at org.jivesoftware.smack.util.MemoryLeakTestUtil.assertReferencesQueueSize(MemoryLeakTestUtil.java:110)
        at org.jivesoftware.smack.util.MemoryLeakTestUtil.noResourceLeakTest(MemoryLeakTestUtil.java:103)
        at org.jivesoftware.smackx.muc.MucMemoryLeakTest.mucMemoryLeakTest(MucMemoryLeakTest.java:29)
2019-05-08 12:44:48 +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 7f0dc72dab Update errorprone(-plugin) and make Unused(Variable|Method) an error 2019-05-07 23:09:00 +02:00
Florian Schmaus 68d7d738b6 Remove all tabs and add checkstyle rule that enforces no-tabs
Fixes SMACK-866.
2019-05-07 21:24:00 +02:00
Florian Schmaus e1ed035beb Remove xmlunit-lagacy and add xmlunit-assertj 2019-05-07 19:06:16 +02:00
Florian Schmaus 505493d889 Add XmlStringBuilder.optAttribute(String, Number) 2019-05-07 10:18:55 +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 99bf8316f5 Add javadoc about callbacks to XMPPConnection 2019-04-16 09:33:07 +02:00
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 474ea68d4a Remove unused method in Smack's Base64 API 2019-04-09 10:56:47 +02:00
Florian Schmaus 62fd897cf7 Add support for XEP-0418: DNS Queries over XMPP (DoX)
Fixes SMACK-862.
2019-04-09 10:56:47 +02:00
Florian Schmaus 75b1d8ce13 Add AbstractError.Builder.setDescriptiveEnText(String, Exception) 2019-04-09 09:33:32 +02:00
Florian Schmaus 1122bf394c Add ExceptionUtil 2019-04-09 09:33:32 +02:00
Florian Schmaus 3075430713 Use IQ.isRequestIQ() in IQ 2019-04-09 09:33:32 +02:00
Florian Schmaus d1f2631771 Use IQ.isResponseIQ() in AbstractXMPPConnection 2019-04-09 09:33:32 +02:00
Florian Schmaus 87e0ac9ba1 Add IQ.isResponseIQ() 2019-04-09 09:33:32 +02:00
Florian Schmaus 7d5274dad1 Use java.util.Base64 and remove build-in Base64 API 2019-04-09 09:33:32 +02:00
Florian Schmaus d6b6fdca17 Add ConnectionConfiguration.setXmppAddressAndPassword() 2019-04-07 16:44:04 +02:00
Florian Schmaus 38384a1eed Improve javadoc of ConnectionConfiguration 2019-04-07 16:43:48 +02:00