1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-04 23:55:58 +01:00
Commit graph

1946 commits

Author SHA1 Message Date
Florian Schmaus
f69e81d7ea Smack 4.1.0-alpha1-SNAPSHOT 2014-05-24 16:02:28 +02:00
Florian Schmaus
183ecb5542 Smack 4.0.0-rc2 2014-05-24 11:45:02 +02:00
Florian Schmaus
d790db5729 Don't throw an IOException if IBBStream got closed by the remote
Smack should not throw an IOException in case a stream got closed by
the remote peer and the user is trying to read() from the stream. This
commit fixes that, by making Smack return '-1' if the stream got
closed by the remote. An IOException will only be thrown if the user
tries to read from a stream that got already closed by *himself*.

SMACK-468
2014-05-23 13:13:24 +02:00
Florian Schmaus
a19181ce04 Make XMPPConnection.schedule() protected
This method was never intended to be part of the public API. It's also
critical that the given Runnables complete within a reasonable
time frame so that they don't block following ones.
2014-05-23 13:13:24 +02:00
Florian Schmaus
1302dbe9cb Re-use executorService as listenerExecutor 2014-05-23 13:13:21 +02:00
Florian Schmaus
f4f7eca7ca Shutdown listenerExecutor to prevent the Thread from leaking
listenerExecutor needs to get shutdown once it is no longer required.

SMACK-567
2014-05-21 21:45:15 +02:00
Florian Schmaus
f1f7713513 Introduced unchangedEntries in Roster logic
If the connection has been reconnected, then we will receive entries
that have been unchanged since the last time we received a roster
result. Without this change, those entries ended up in 'toDelete' and
got deleted.

This change also inlines some roster methods.
2014-05-17 10:50:01 +02:00
Florian Schmaus
9a61c75ab0 Make Roster.hasValidSubscriptionType() static 2014-05-17 09:45:20 +02:00
Florian Schmaus
c80a4044e6 Replace deprecated Z(Input|Output)Stream
Thanks to Волков Вячеслав (Vyacheslav Volkov) for the hint.
2014-05-15 16:44:34 +02:00
Florian Schmaus
4c76f2652d Reworked OSGi support of Smack (SMACK-343)
Because of OSGi, no subproject of Smack (which is the same as a OSGi
bundle) must export a package that is already exported by another
subproject.

Therefore it was necessary to move the TCP and BOSH code into their own
packages: org.jivesoftware.smack.(tcp|bosh).

OSGi classloader restrictions also made it necessary to create a
Declarative Service for smack-extensions, smack-experimental and
smack-lagacy (i.e. smack subprojects which should be initialized), in
order to initialize them accordingly, as smack-core is, when used in a
OSGi environment, unable to load and initialize classes from other smack
bundles. OSGi's "Service Component Runtime" (SCR) will now take care of
running the initialization code of the particular Smack bundle by
activating its Declarative Service.

That is also the reason why most initialization related method now have an
additional classloader argument.

Note that due the refactoring, some ugly changes in XMPPTCPConnection
and its PacketReader and PacketWriter where necessary.
2014-05-15 16:09:37 +02:00
Jared DiCioccio
541b8b3798 Update Presence.java
No code changes. Proofread API docs for Presence.java
Fixed grammar / unclear sentences in some javadocs.
Changed some nouns to be more consistent with API terminology.
Fixed some typos.
2014-05-12 19:25:23 +02:00
Florian Schmaus
98333e362d Add 'null' check to parseContentDepth
Does not fix the actual problem, but at least prevents resource
allocation until OOM.
2014-05-11 10:18:49 +02:00
Florian Schmaus
e0b8577930 Make IQ attributes final in parseIQ() 2014-05-11 10:15:14 +02:00
Florian Schmaus
de6eb4b21c Tell Gradle to download javadoc
when creating the classpath for eclipse.
2014-05-11 09:38:13 +02:00
Florian Schmaus
90ea9ba2fc Make ProviderManager static
also remove initialize() from ProviderFileLoader, by simply putting the
code into the constructor.
2014-05-11 09:27:41 +02:00
Florian Schmaus
0111be1a04 Fix description of subprojects POMs file
by adding evaluationDependsOnChildren() on the root project. Thanks to
Peter Niederwieser for the hint.
2014-05-10 21:00:40 +02:00
Florian Schmaus
82654cd15e Use StringBuilder in parseContentDepth()
instead of StringBuffer, which comes with unnecessary synchronization
overhead.
2014-05-10 10:53:03 +02:00
Florian Schmaus
5618da4e23 Add parseContentDepthTest() 2014-05-10 10:51:45 +02:00
Florian Schmaus
ecccfe61af Reset usingTLS in XMPPTCPConnection.shutdown() 2014-05-10 10:26:48 +02:00
Florian Schmaus
7a5533c823 Fix NPE in DiscoverInfo.Identities XmlStringBuilder
The 'name' attribute of an service discovery identity is
optional. Thanks to Jens Offenbach for reporting.
2014-05-07 12:46:24 +02:00
Florian Schmaus
07d6b9203c Synchronize PacketWriter shutdown
try the best to send the queue elements and the closing stream element.
2014-05-06 07:47:57 +02:00
Florian Schmaus
74d188aabb Fix appendix in smack-core
Now that we do not longer use the appendix for the subproject
name (91fd15) we need to set instead of appending the appendix in
smack-core.
2014-05-05 19:26:45 +02:00
Florian Schmaus
39c837190d Don't make non-core packages a fragment bundle
as there exists no longer a dependency from smack (now smack-core) to
smackx (now mostly smack-extensions). Therefore this approach is no
longer needed.

SMACK-343
2014-05-05 19:26:45 +02:00
Florian Schmaus
0e664863d9 Add newlines to smack-core/build.gradle 2014-05-05 19:26:45 +02:00
Florian Schmaus
f940d72fcd Move duplicate code into XMPPConnection
from XMPPTCPConnection and XMPPBOSHConnection.
2014-05-05 19:26:45 +02:00
Florian Schmaus
7d72b9b770 Fix NPE in JavaxResolver
Attributes.get(String) could return 'null'. Take care of that case.
2014-05-05 19:26:45 +02:00
Florian Schmaus
9484fb9259 Update javadoc for (get|set)CustomSSLContext() 2014-05-05 19:26:45 +02:00
Florian Schmaus
42f2eae8fb Make sendPacket throw NotConnectedException
also use XMPPConnection.sendPacket() instead of
PacketWriter.sendPacket() in XMPPTCPConnection.
2014-05-05 19:26:45 +02:00
Florian Schmaus
7041e90522 Properly sync PacketWriter's queue
by using a custom ArrayBlockingQueueWithShutdown. Fixes a race condition
where nextpacket() would wait for a notification that would never
arrive, because all all put(Packet) calls are still blocking.

SMACK-560
2014-05-05 19:26:42 +02:00
Florian Schmaus
ed8b80c2ff Synchronize bindingRequired
Right after PacketReader receives the 'success' stanza, indicating
successful SASL authentication, it opens a new stream. The login
process continues in another thread and checks for bindingRequired,
which may not have been set a this point yet.

bindResourceAndEstablishSession() now waits until either the binding
feature stanza is parsed or the default packet timeout occurs.
2014-05-03 12:12:36 +02:00
Florian Schmaus
fd532be9b6 Fix unfiledEntries not updating
If an roster push with a roster entry without any group is processed,
then the entry is not updated, because unfiledEntries.contains(entry)
would return true, as the RosterEntry.equals() method only compares the
name.

We simply fix it by always removing the entry first and then adding it
again.

Thanks to Christian Schudt for pointing this out.

SMACK-559
2014-04-29 15:26:48 +02:00
Florian Schmaus
10e82fae45 Add log statements to Roster 2014-04-29 15:26:48 +02:00
Florian Schmaus
6e12409b82 Make roster push and presence packet filter static final
Also remove the check of IQ.Type.SET in processPacket(). This is now
done with help of a PacketFilter.
2014-04-29 15:26:21 +02:00
Florian Schmaus
9fd0961c32 Simplified Roster
Removed some throw declarations from methods, so some try/catch blocks
could be removed.

Use switch/case instead of if/else if.

Make members final when possible.

Add logger statements in case of error IQ result and remove superfluous
check of instanceof IQ.
2014-04-29 15:24:10 +02:00
Florian Schmaus
2375c59791 Extend JivePropertiesManager
with getPropertiesNames() and getProperties()
2014-04-28 20:23:26 +02:00
Florian Schmaus
91fd15ad86 Prefix subprojects with 'smack-'
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.

Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.

SMACK-265
2014-04-28 19:44:14 +02:00
Florian Schmaus
b6fb1f3743 Notify PacketReader in case of TLS exceptions
PacketReader will be waiting in startup() as long as either:
- the timeout occurs
- notify is called because the last feature stanza was parser
- notify is called because of an exception while parsing
2014-04-28 18:53:50 +02:00
Florian Schmaus
5a19668544 Add Eclipse-(PatchFragment|ExtensibleAPI) manifest data
to the jar manifests. Thanks to Jens Offenbach for reporting.
2014-04-28 17:42:23 +02:00
Florian Schmaus
bc176d72a3 Throw exceptions of SSLSocket.startHandshake() in connect()
instead of throwing a NoResponseException in case startHandshake()
throws an Exception. The NoResponseException was then thrown when
performing SASL auth, which usually directly followes securing the
connection via TLS (if enabled and provided by the server).
2014-04-28 17:36:10 +02:00
Florian Schmaus
ddb47c2d60 Don't throw XmlPullParserException
removes the need to wrap the exception in a SmackException in
XMPPTCPConnection.initConnection()
2014-04-28 17:35:59 +02:00
Florian Schmaus
06c6546d2e Strip 'smack-' prefix from artifacts
This was causing some trouble, e.g. the maven plugin resolved the
dependency only to artifactId 'core', when it should be
'smack-core'. It was previously working, but likely broke when the
configuration of the subprojects was put into their own build.gradle
files.

SMACK-265
2014-04-28 17:35:59 +02:00
Florian Schmaus
858492b177 Fix OSGi Bundle-Version
Bundle-Version's forth field, the qualifier, must be separated from
the 'micro' version with a dot.
2014-04-28 11:22:42 +02:00
Florian Schmaus
656b1c70be Only send scheduled Pings if no Pong was received
in the meantime. Also do not distinguish between successful automatic
and manual Ping. Just record the time of the last received XMPP Pong.
2014-04-28 11:20:54 +02:00
Florian Schmaus
854489e785 No need to synchronize bindingRequired
If binding is required or not is told the client by the server within
the features stanzas. Smacks guarantees that connect() blocks until the
features stanzas has been received and processed.
2014-04-28 07:58:39 +02:00
Florian Schmaus
874a22489e Remove resource binding out of sasl auth
Follow XEP-170 recommendations: Resource binding *after* compression.

Fixes also a bunch of race conditions related to the wait()/notify()
pattern used in the early stages of a Connection where
createPacketCollectorAndSend(Packet).nextResultOrThrow() can not be
used. Those wait()/notify() patterns are currently
- SASL authentication
- compression
- resource binding

Fixes SMACK-454
2014-04-28 07:58:34 +02:00
Florian Schmaus
d17f64ed9a Improve stream compression for TCP connections
Fix a race condition in useCompression where the compression request was
send outside the synchronized block, this could cause notify() to be
called without a previoius call to wait().

s/streamCompressionDenied/streamCompressionNegotiationDone/ and re-use
the method once the server ack'd stream compression.

Also don't call notifyConnectionError() when requestStreamCompression()
encounters an exception, instead throw the exception.
2014-04-27 11:39:38 +02:00
Florian Schmaus
9b235d0d8f Improve javadoc of Java7ZlibInputOutputStream 2014-04-27 11:04:15 +02:00
Florian Schmaus
86ad192bea Log connectionClosedOnError exceptions 2014-04-27 10:49:58 +02:00
Florian Schmaus
790ebeca33 Make PacketReader.resetParser() throw the exception
there is no need to catch it and disguise it.
2014-04-27 10:49:58 +02:00
Florian Schmaus
a613d5f574 Improve PacketReader startup()
Instead of using the connectionID, we now use a new boolean
lastFeaturesParsed to mark when startup() is able to continue or when a
NoResponseException should be thrown.

Fixes the problem when the connectionId was set and the wait() would
timeout, resulting in startup() believing that everything was ok, while
in fact the features where not yet received (or parsed). SMACK-558.
2014-04-27 10:49:56 +02:00