Age | Commit message (Collapse) | Author |
|
Use and ArrayList<byte[]> as the internal storage, instead of
Vector<Byte>.
Constructors and methods that supply a byte[] to add to the instance
will have that value copied, rather than just taking ownership of the
byte[]. There is an argument, on efficiency grounds, for providing
methods that take ownership of the supplied argument.
The earlier discussions about use of synchronization in the class are
revisited. This is a low-level container that should be thread-safe or
take precautions against non-thread-safe use. It is anticipated that the
vast majority of uses will be thread-safe. Use of synchronization
permits occasional deviations from this without imposing any significant
overhead for the normal case - uncontended synchronization is close to
free.
Change-Id: Ifb7b2915d5c96345c53aec8e33673d892c430431
|
|
TLSLayer could not be updated because it requires TLS to be ported first.
Updates other classes, only for having compatibility with SafeByteArray because of updates in Stream Stack.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests added for StreamStack and XMPPLayer, which passes.
Change-Id: I8707fc1f16d622d2a90f6f39f671b7e7c46aa170
|
|
Updates Serializers and Parsers along with one minor change in XMPPlayer.
Update Non Payload Serializers to return SafeByteArray.
Updates SafeByteArray to return SafeByteArray on append and plus method.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
None.
Change-Id: I6fe665a26b10cac37b3e3acd9ec15c211ac9b8ab
|
|
Adds PubSubEvent Element.
Adds StreamFeaturesSerializer.
Adds ParserTester, ElementParserTester, StanzaParserTester, PayloadParserTester, PayloadsSerializer and EnumParser.
Updates Error Payload, JingleFIleTransferHash Elements/
Updates StreamFeaturesParser, ParserElement.
Updates Delay Serializer, Error Serializer.
Updates AuthChallenge and AuthRequest Element.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Test are added for:
AuthChallenge Serializer, AuthRequest Serializer, AuthResponse Serializer, AuthSuccess Serializer.
GenericPayloadTreeParserTest.
IQ Parser.
Message Parser.
Presence Parser.
StanzaAck Parser.
Stanza Parser.
StreamFeatures Parser and Serializer.
StreamManagementEnabled Parser.
Private Storage Parser and Serializer.
RawXMLPayload Parser.
Storage Parser and Serializer.
Error Serializer.
Jingle Serializer.
PubSubItem Serializer and PubSubItems Serializer.
Serializing Parser.
All tests passes.
Change-Id: I79e00dc5b5c4f85e659bf88b1547dd7c17825805
|
|
Adds FileSize, SafeString, StartStoppable, StartStopper and TriState.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
None.
Change-Id: I94020700a77bb33dab39fb838eefc96c07b73868
|
|
Adds ComponentHandshake Element, its parser and Serializer.
Adds ComponentHandshake Generator.
Adds TopLevelElement.
Updates SafeByteArray.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Test added for ComponentHandshakeGenerator, which passes.
Change-Id: If3026a3db2207e6c65aa2306fee56d8dd5dee86f
|
|
Completes the JavaCryptoProvider providing functionalities for SHA-1 Hash, MD5 Hash and HMACSHA1 Hash.
Also updates reference for JavaCryptoProvider in JavaNetworkFactories.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests are added for JavaCryptoProvider, which passes.
Change-Id: I2439e5fd76a23e9b5c4e9132a9856543a7ca53fd
|
|
Adds functionalities for URL processing such as extracting parameters from URL, decoding URL.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Corresponding tests are added for each function which passes.
Change-Id: I1d54b86167b4f368c365f16c63641a6e6a91cbb8
|
|
Adds the Simple ID Generator as well as Random ID Generator.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests added for both IDGenerator and SimpleIDGenerator which passes.
Change-Id: I9bce3a172774effead3ada695bcceb0b0f81b851
|
|
MemoryStorages, Storages
NickManager, NickResolver
CryptoProvider, Hash, SafeByteArray, JavaCryptoProvider
CapsInfoGenerator, CapsManager, CapsMemoryStorage, CapsProvider,
CapsStorage, CapsInfo
CapsInfoSerializer, CapsInfoParser
ClientDiscoManager, DiscoInfoResponder, EntityCapsManager,
EntityCapsProvider
GetDiscoInfoRequest
ChatState, Idle
Presence, PayloadAddingPresenceSender, PresenceOracle,
SubscriptionManager
StatusSerializer, StatusShowSerializer, StatusParser, StatusShowParser,
Replace, ReplaceParser, ReplaceSerializer
SecurityLabel, SecurityLabelsCatalog, GetSecurityLabelsCatalogRequest
VCard, GetVCardRequest, SetVCardRequest, VCardManager,
VCardMemoryStorage, VCardStorage
RosterMemoryStorage, RosterPushResponder, RosterStorage,
SetRosterRequest
XMPPRoster, XMPPRosterController, XMPPRosterImpl, XMPPRosterItem
GetRosterRequest, SetResponder
Add parsers and serializers for Idle, VCard, PrivateStorage & Stroage.
Add
parser for Subject.
Add impromptu flag to MUCInvitation.
Update copyrights.
Change-Id: I9949f506b70e60b3a64f1dadde8f9b235b322e1d
|
|
Change-Id: I97fa434712eb32ad2c56558434a09fe5b1e3fb92
|
|
Default Locale is unsafe as one could, for example, get Arabic numerals
instead of ASCII ones.
Change-Id: Ib70d271bf433c4928accca3b4802c3ba3cb2aa0e
|
|
Change-Id: I4e5368f9ac86446b7ebf976e2cb63d64ebefe7b2
|
|
Some discussion followed the "Fix synchronization problem in
ByteArray" patch, and that led us to believe that it would be better
to change the JavaConnection class so that it does not rely on being
able to pass ByteArrays around in a way that makes them vulnerable to
the problems that had been seen.
The JavaConnection class accepts a ByteArray in its "write()" method,
and emits a ByteArray when it has read data.
ByteArrays are not the ideal way for the JavaConnection class to
manipulate data and so this patch changes the implementation so that:
a) the "write()" method extracts the byte[] from the supplied
ByteArray and uses these objects, rather than keeping
references to the ByteArray objects (which might lead to
synchronisation issues).
b) the "doRead()" method uses a ByteArrayOutputStream to hold incoming
data, and only constructs a ByteArray out of it when it is ready to
return the data to the application.
These changes make the class more efficient, since in the case of (a),
the need to create temporary ByteArrays is removed, and in (b) the
code no longer creates ByteArrays by iterating through the network
data one byte at a time and appending it to a ByteArray.
It also means that the "synchronized" patch (which would fix the
problem) is no longer necessary, and so that code is reverted.
Test-information:
I patched the code to emulate the situation that would occur when a
buffer is only partially written, and verified that in this case it
correctly re-inserted the unwritten portion of the buffer at the
front of the pending queue.
Ran MLC to various servers, all seems to work OK.
Tested in Harrier, seems to work OK, and does not exhibit problems
that we had seen previously which led us to investigate this issue.
Change-Id: Ifcda547402430c87da45ba7d692518b5af285763
Signed-off-by: Nick Hudson <nick.hudson@isode.com>
|
|
We noticed that in certain circumstances a stream of data being sent
to a server was being corrupted.
According to the "onDataWritten" signal, we could see that the data
which Stroke thought it was writing was valid, but by adding debug
code to the JavaConnection class, we could see that what was actually
being sent over the socket was wrong. For example, where
"onDataWritten" would report something like
some text for the server
the actual data being written to the socket (as shown by
toString() of the bytestream) would be something like:
some text fo\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300\200\300
i.e. the length of data is correct, but the last part of the buffer is broken.
We saw this on non-TLS connections, but never on TLS connections.
The reason for this (verified after some debugging) is that the
"ByteData.getData()" method was unsynchronized. In the failing cases,
two threads are calling this method at once. The first one finds that
"dataCopy_" is null, and so new's it and starts filling it with data.
The second thread calls "getData()" before this completes, which means
it sees "dataCopy_" as non-null, and uses that value (even though the
first thread hasn't finished populating it yet).
In the failing scenario, the two threads involved were (1) thread that
was handling the "onDataWritten()" callback (which called "getData()"
to get a String that it sent to a debug stream) and (2) the
JavaConnection code (which wants to write the data to the socket).
It seems likely that the reason this doesn't happen for TLS
connections is that in that case, the JavaConnection object will be
processing a ByteArray object that has been generated via the
SSLEngine (rather than the one which "onDataWritten()" sees, and so
the chance of two threads both calling "getData()" is reduced.
(I have not followed the TLS code path thoroughly to verify this).
So this change makes any method in ByteArray that touches "dataCopy_"
be synchronized (as well as hashCode() as suggested by findbugs)
Test-information:
Having inserted some debug code, I could reproduce the "data
corruption" problem reliably.
After adding the "synchronized" directive to "getData()", I could no
longer reproduce the corruption.
Ran MLC with this patch and works with no problems
Change-Id: I02008736a2a8bd44f3702c4526fd67369a3c136a
Signed-off-by: Nick Hudson <nick.hudson@isode.com>
|
|
|
|
This change provides implementation for the previously empty
"readFromFile" method, which is based on the code inside Swiften's
ByteArray.readByteArrayFromFile().
Note that, as for the Swiften method, no errors are reported if an
attempt to read from a file fails; it just leaves the contents of the
object unchanged.
Some javadoc was also provided, especially noting that the various
String methods are only safe so long as you're working with UTF-8
Strings.
Test-information:
Existing Stroke unit tests still pass
Signed-off-by: Nick Hudson <nick.hudson@isode.com>
|
|
Updates requisite classes in line with Swiften.
Also fixes bugs in the EventLoops not using handleEvent.
|
|
|
|
Also updates build.xml so the path to the xpp library can be specified,
rather than needing the same layout as my build tree.
|
|
|