Commit Graph

117 Commits

Author SHA1 Message Date
Florian Schmaus 11cc2d8d77 [core] Align behavior of getParserFor(InputStream) and getParserFor(Reader)
Reported-by: Ingo Bauersachs <ingo@jitsi.org>
2021-11-30 10:49:55 +01:00
Florian Schmaus 3f2418dec7 [core] Fix spelling errors in code comment within PacketParserUtils 2021-08-25 22:54:23 +02:00
Florian Schmaus 3d4e7938a7 Make ExtensionElement marker interface wrt. QNAME field
ExtensionElement is now a marker interface that requires all
implementation non-abstract classes to carry a static final QNAME
field (of type QName). This is verified by a new unit test.

Also FullyQualifiedElement is renamed to simply XmlElement. XmlElement
is used over ExtensionElement when implementing classes do not
statically know the qualified name of the XML elements they
represent. In general, XmlElement should be used sparingly, and every
XML element should be modeled by its own Java class (implementing
ExtensionElement).
2021-04-18 21:07:19 +02:00
Florian Schmaus 02c9058c3d [core] Remove @SuppressWarnings for parseContentDepthWithRoundtrip()
Also use the most specific return type in the method's signature.
2020-11-25 20:55:05 +01:00
Florian Schmaus ca497a2199 [core] Fix parseContentDepthWithRoundtrip() and add tests 2020-11-25 20:55:05 +01:00
Aditya Borikar 7796b367cc Position parser at START_ELEMENT before parsing
This PR aims to provide parseXrdLinkReferencesFor() method the ability
to parse forward to the first START_ELEMENT tag.The HttpLookupMethodTest
tests the HttpLookupMethod class by parsing String. This makes use of
PacketParserUtils.getParserFor(String), which already does forward
winding to reach START_ELEMENT. However when fetching endpoints from a
remote host meta data, PacketParserUtils.getParserFor(InputStream) is
used which doesn't do winding in any form. And thus, even though
HttpLookupMethodTest tests pass, this implementation would crash while
parsing remote host-meta.
2020-08-07 15:01:53 +05:30
Florian Schmaus 14c351397d Implement message stanza <thread/> and <subject/> as ExtensionElement
Fixes SMACK-852.
2020-04-05 18:58:13 +02:00
Florian Schmaus eb4c2c5572 s/occured/occurred/ 2019-10-30 12:02:36 +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 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 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 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 7d59df9eed Change type of presence priority to 'Byte' 2019-06-11 12:47:39 +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 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 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 8df69bd3ce Use XmlEnvironment in parsing/provider subsystem 2019-02-15 23:21:30 +01:00
Florian Schmaus 7dee3b88a2 Introduce SmackParsingException 2019-02-10 19:01:47 +01:00
Florian Schmaus 083dac8b83 Rework exceptions in the parsing / provider subsystem 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 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 96f75a1857 Fix TODO in PacketParserUtils 2018-05-09 17:13:09 +02:00
Florian Schmaus 0df7734efc Slightly improve PacketParserUtils.parseSessionFeature() 2018-05-09 17:13:09 +02:00
Florian Schmaus 49417d2e20 Remove deprecated methods in PacketParserUtils 2018-05-09 17:13:09 +02:00
Florian Schmaus 6d76e8a1ae Remove PacketParserutils.getLanguageAttribute(XmlPullParser) 2018-05-09 17:13:09 +02:00
Florian Schmaus a9e45475ab Treat <body/> just like all other extension elements in Message
This turned out to be a rather large change.
2018-05-09 17:13:09 +02:00
Florian Schmaus cd5daa6fd7 Do net set a default language when parsing Message stanzas
the fallback is (usually) not needed, as most XMPP XML streams have a default
xml:lang set (See RFC 6120 § 4.7.4.).
2018-05-09 17:13:09 +02:00
Florian Schmaus ad932caf78 Do not use a reflection based initializer for core elements
like Message.Body from smack-core.
2018-05-09 16:45:14 +02:00
Florian Schmaus 2efec89050 Rename XMPPError to StanzaError
Fixes SMACK-769.
2018-04-07 22:59:25 +02:00
Florian Schmaus ad87243060 Globally 's;stanza(/packet);stanza;' 2018-03-31 14:17:30 +02:00
Paul Schaub 52398b535f
Fix javadoc issues in some packages 2017-12-23 20:21:19 +01:00
Paul Schaub cb18056613 Fix minor codestyle issues 2017-12-17 11:03:46 +01:00
Ingo Bauersachs 699145ee5f Get descriptive text from error without lang
A stanza with <error><text>Some text</text></error>, i.e. without a
xml:lang attribute, did not return the value 'Some text' in
getDescriptiveText().

Insert the empty string as key when the attribute is not present while
parsing the xml. When writing, omit the attribute if the key is the
empty string.
2017-09-27 00:21:40 +02:00
Florian Schmaus 1448fa4632 Add ParserUtils.getXmlLang(XmlPullParser)
and add TODO comment to PacketParserUtils.getLanguageAttribute().
2017-06-17 11:42:09 +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 51378aebee Revert "Throw exception if stanza child contains text"
This reverts commit eb9242768c.

Turns out, that there is in fact not such restriction in the
RFCs (only for <subject/>, <body/> and the a few others).
2017-01-24 22:47:16 +01:00
Florian Schmaus 9328182912 Rework Bits of Binary implementation 2017-01-03 11:05:46 +01:00
Florian Schmaus 9165e818d9 Add ParenPad and NoWhitespaceAfter checkstyle rules 2016-11-29 12:01:41 +01:00
Florian Schmaus eb9242768c Throw exception if stanza child contains text 2016-11-15 22:41:24 +01:00
Florian Schmaus 23201d5f0f Improve logging of failed presence extensions
Don't log the exception for now because the stack trace makes to much
noise in the log output. This is mostly caused by Googles outdated
Entity Capabilities implementation.
2016-01-18 22:08:23 +01:00
Florian Schmaus e6a9027cc6 Improve StringUtils.escapeForXml() 2016-01-18 22:04:20 +01:00
Florian Schmaus 45feaecdf7 Make XMPPError imutable and add stanza reference 2015-12-09 10:48:52 +01:00