Commit Graph

351 Commits

Author SHA1 Message Date
Florian Schmaus 57961a8cc1 Remove SynchronizationPoint
This continues the design started with e98d42790 ("SmackReactor/NIO,
Java8/Android19, Pretty print XML, FSM connections"), where the
exceptions that caused an operation to fail, are not recorded within
SynchronizationPoint but within the connection instance itself.
2020-05-31 19:48:47 +02:00
Florian Schmaus f5448c5faa [core] Rework TLS logic
This moves the logic in AbstractXMPPConnection.getSmackTlsContext()
into the ConnectionConfiguration constructor.

Also introduce SslContextFactory and use it in
ConnectionConfiguration.
2020-05-25 15:41:57 +02:00
Florian Schmaus d65f2c932e Bump Error Prone version to 2.3.4 and fix new bug patterns 2020-05-24 21:10:01 +02:00
Florian Schmaus 9a8ee3c8e3 [core] Improve NumberUtil's exception message and fix javadoc 2020-05-24 13:08:03 +02:00
Florian Schmaus dfdd0acf91 Introduce AbstractStats 2020-05-18 09:15:14 +02:00
Florian Schmaus 77e26fc575 Re-work data form API
Apply builder pattern to form fields and replace getVariable() with
getFieldName(). Refer to the field name as "field name" instead of
"variable" everyone, just as XEP-0004 does.

Improve the high-level form API: introduce FilledForm and FillableForm
which perform stronger validation and consistency checks.

Also add FormFieldRegistry to enable processing of 'submit' forms
where the form field types are omitted.

Smack also now does omit the form field type declaration on 'submit'
type forms, as it is allowed by XEP-0004.
2020-05-13 20:14:41 +02:00
Florian Schmaus ad13effe41
Merge pull request #382 from vanitasvitae/typo
Fix typo in XmppElementUtil
2020-04-13 23:03:34 +02:00
Florian Schmaus 5114f6dfa4 core: remove deprecated methods in PacketUtil
Those where deprecated in 2015 with 8409dddff ("Add
PacketUtil.extensionElementFrom()"), and in 2017 with
2288825b1 ("Retain smack-core API").
2020-04-13 21:25:28 +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
Paul Schaub 905d5dc102
Fix typo in XmppElementUtil 2020-04-13 18:18:31 +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 62916b8490 Improve exception message of XmppElementUtil.getQNameFor() 2020-04-05 22:08:10 +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 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 39a833166a Add workaround for truststores in JKS format when using Java >= 9 2020-03-13 16:40:46 +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 961e56a47c proxy: modernize code by using (ByteArrayOutput|DataInput)Stream 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 eb4c2c5572 s/occured/occurred/ 2019-10-30 12:02:36 +01:00
Florian Schmaus 2915101843 Use isEmpty() in StringUtils.requireNullOrNotEmpty() 2019-10-30 11:56:55 +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 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 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 6d7b2b70e8 Add util.Consumer and use it in StateDescriptorGraph 2019-09-23 16:12:48 +02:00
Florian Schmaus 3318a44016 XmlStringBuilder: Declare actual return type instead of supertype 2019-09-18 09:01:04 +02:00
Florian Schmaus 5483e95920 LazyStringBuilder: Wrap NPE in RuntimeException
instead of using a Logger.
2019-09-18 09:01:04 +02:00
Florian Schmaus 8086a11c6c XmlStringBuilder: Use potential length for target StringBuilder 2019-09-18 08:55:51 +02:00
Florian Schmaus fb3a71a14d Fix ConcurrentModificationException in XmlStringBuilder.appendToXml()
We want to append to appendable, not sb, the LazyStringBuilder we are
currently iterating over,
2019-09-18 08:48:39 +02:00
Florian Schmaus f2e1d7ddd5 Add XmlEnvironment conscious ParserUtils.getXmlLang()
and unify parsing of common stanza attributes where this new method is
used.
2019-09-12 15:15:57 +02:00
Florian Schmaus 86c28e9d13 Use XmlEnvironment.EMPTY instead of null in PacketParserUtils 2019-09-12 15:15:57 +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 dd4df0a5ef Improve how XmlStringBuilder handles enclosing XML environments
to avoid emitting unnecessary attributes like xmlns.

Also add a test for MediaElement that checks that <uri/> does not
carry a xmlns attribute.
2019-09-04 10:22:56 +02:00
Florian Schmaus 935465a11b Remove duplicate code in XmlStringBuilder 2019-09-04 10:22:55 +02:00
Florian Schmaus 85ef149c83 Make XmlStringBuilder.prelude() protected
as the user should never be required to call it.
2019-09-04 10:22:55 +02:00
Florian Schmaus 1a3067c89b Enable werror for javadoc and fix javadoc issues 2019-08-30 12:08:30 +02:00
Florian Schmaus d7b7abc7eb Delete XML whitespace before feeding the Base64 decoder 2019-08-06 12:48:31 +02:00
Florian Schmaus 1bc8a22b28 Add StringUtils.deleteXmlWhitespace(String) 2019-08-05 22:20:21 +02:00
Florian Schmaus 12cbeede57 Use Enum.toString() in XmlStringBuilder.element(String, Enum)
as toString() is often overriden by Enums to yield the expected XMPP
wire protocol representation.
2019-08-03 22:15:44 +02:00
Florian Schmaus eecd5b70d3 Merge branch 'master' of github.com:igniterealtime/Smack 2019-07-30 11:35:45 +02:00
Florian Schmaus 8da954f7a4 OpenPGP: Bump Pgpainless to 0.0.1-alpha7
Also unify how new Security Providers are installed.

Thanks to Paul Schaub for helping with this.
2019-07-30 09:37:19 +02:00
Florian Schmaus 96e14471d0
Merge pull request #324 from adiaholic/spellcorrection
Correcting mini typing error
2019-07-28 18:11:56 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
adiaholic fe85ab3b83 Correcting mini typing error 2019-07-09 22:12:26 +05:30
Florian Schmaus 870e6c674a Make ExceptionUtil.getStackTrace(Throwable) null safe 2019-07-04 15:47:46 +02:00