Commit Graph

680 Commits

Author SHA1 Message Date
Brian Clozel
2b65d0e51f Fix error when writing empty String to DataBuffer
Prior to this commit, `DataBuffer.write` would throw an
`IllegalStateException` when called with an empty `String`, since the
`CharsetEncoder` would be flushed on an incorrent state.

This commit skips entirely the encoding phase for empty `String`.

Fixes #22262
2019-01-17 11:09:48 -05:00
Juergen Hoeller
72dddfbc7b Polishing 2019-01-09 12:26:58 +01:00
Andrzej Leśkiewicz
952045c216 SPR-17606 @Profile mishandles "not" operand mixed with "&" (#2066)
Correct handling of not/and expressions in ProfilesParser

Issue: SPR-17606
2019-01-08 22:24:15 +01:00
Juergen Hoeller
31a24720a6 Consistent support for EnumSet subclasses in CollectionFactory
Issue: SPR-17619
2018-12-25 13:20:31 +01:00
Arjen Poutsma
5a8b8b11e4 Add test for calculateCapacity
Issue: SPR-17558
Closes gh-2054
2018-12-20 21:34:15 +01:00
Brian Clozel
4955d08f28 Use DataBuffer.write in CharSequenceEncoder
Since SPR-17558, `DataBuffer` now offers a new method to write Strings
to them. This commit makes `CharSequenceEncoder` use that.

Issue: SPR-17558
2018-12-20 21:33:44 +01:00
Brian Clozel
6361b0cb23 Write CharSequence instances to DataBuffers
Prior to this commit, one could write a `CharSequence` to an existing
`DataBuffer` instance by turning it into a byte array or `ByteBuffer`
first. This had the following disadvantages:

1. Memory allocation was not efficient (not leveraging pooled memory
when available)
2. Dealing with `CharsetEncoder` is not always easy
3. `DataBuffer` implementations, like `NettyDataBuffer` can use
optimized implementations in some cases

This commit adds a new `DataBuffer#write(CharSequence, Charset)` method
for those cases and also an `ensureCapacity` method useful for checking
that the current buffer has enough capacity to write to it..

Issue: SPR-17558
2018-12-20 21:33:33 +01:00
igor-suhorukov
93189a6733 String.indexOf() expressions can be replaced with a call to the String.contains() method available in Java 5 and newer. 2018-12-13 12:29:31 +01:00
Rossen Stoyanchev
38ae282c3b Update log category precision for all tests
Replace the full category capped at 36 chars with the class name only
and 1 char per package, e.g. org.apache.commons.Foo -> o.a.c.Foo
2018-12-12 11:40:33 -05:00
Juergen Hoeller
6d7827e36b Polishing 2018-12-03 23:53:00 +01:00
Sam Brannen
a528407d0c Suppress warning 2018-11-23 18:05:47 +01:00
Juergen Hoeller
56234fe877 Polishing 2018-11-22 22:03:36 +01:00
Juergen Hoeller
8c7579eba8 Polishing 2018-11-20 22:06:44 +01:00
Vojtech Janota
12f168290d SPR-17492: FastByteArrayOutputStream.read byte-to-int conversion 2018-11-20 17:08:01 +01:00
Arjen Poutsma
63275ae2b7 Add Test for LeakAwareDataBufferFactory 2018-11-19 16:56:25 +01:00
Stephane Nicoll
7b6f2f8fb3 Polish contribution
Closes gh-2019
2018-11-19 08:45:33 +01:00
Hanope
bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
Arjen Poutsma
539cfc24c6 Refactor AbstractEncoderTestCase
Refactor AbstractEncoderTestCase to resemble AbstractDecoderTestCase

Issue: SPR-17449
2018-11-16 14:33:26 +01:00
Arjen Poutsma
39ce989d1a Add and use AbstractDecoderTestCase
Introduce new base test case for decoder tests, and use it.

Issue: SPR-17449
2018-11-16 14:33:26 +01:00
Rossen Stoyanchev
ba3fef3e8a Refactor media types parsing improvements
Issue: SPR-17459
2018-11-13 23:02:09 -05:00
Dimitrios Liapis
f4b05dc2e7 MediaType parsing supports comma inside quotes
Issue: SPR-17459
2018-11-13 16:59:57 -05:00
Arjen Poutsma
4182935b7a Revert optimization in StringDecoder
This commit reverts the first optimizations listed in
fa096dc60f, as the default delimiters
do vary, namely by the charset given in the message mime type.
The mimetype charset might not be compatible with ASCII (i.e. anything
but UTF-8 or ISO-8859-1, for instance it might be UTF-16), and will not
successfully find the default delimiters as a consequence.

Added test to indicate the bug.
2018-11-13 13:38:13 +01:00
Arjen Poutsma
3bab3515b1 Add and use AbstractEncoderTestCase
Introduce new base test case for encoder tests, and use it.

Issue: SPR-17449
2018-11-13 13:35:37 +01:00
Arjen Poutsma
0c0de851f4 Add LeakAwareDataBufferFactory
Introduce a data buffer factory that can check for memory leaks in
@After methods.

Issue: SPR-17449
2018-11-13 13:35:37 +01:00
Rossen Stoyanchev
c187cb2fa1 Ensure client response is drained with onStatus hook
Issue: SPR-17473
2018-11-08 22:41:22 -05:00
Arjen Poutsma
488a1d4561 Review DataBufferUtils for cancellation memory leaks
Issue: SPR-17408
2018-10-24 16:28:21 +02:00
Arjen Poutsma
51bb96db47 Fix ResourceRegionEncoder and tests
Fix ResourceRegionEncoder so that it checks for resource existance
before writing boundaries. Also defer data buffer allocation until
necessary.

Issue: SPR-17419
2018-10-23 16:41:48 +02:00
Arjen Poutsma
eac9e66c46 Fix memory leak when canceling read from AsynchronousFileChannel
This commit fixes a memory leak that occurs when reading from a
AsynchronousFileChannel, and cancelling the subscription.

Issue: SPR-17419
2018-10-23 16:41:48 +02:00
Arjen Poutsma
946ec7e22e Fix memory leaks in ProtobufDecoder
Issue: SPR-17418
2018-10-22 16:00:32 +02:00
Arjen Poutsma
f738273486 Fix buffering issue in StringDecoder
Issue: SPR-17418
2018-10-22 16:00:32 +02:00
Juergen Hoeller
dd2ce20687 SpringFactoriesLoader tolerates whitespace around class names
Issue: SPR-17413
2018-10-22 15:13:58 +02:00
Arjen Poutsma
149d416e8e Review DataBufferUtils for error/cancellation memory leaks
Issue: SPR-17408
2018-10-19 12:16:18 +02:00
Sebastien Deleuze
2c5a1af236 Leverage Java reflection for Kotlin enums
As discussed in KT-25165, from a Kotlin POV enum constructors
have no parameter, this is an "implementation detail"
required for running on the JVM, so it seems relevant to skip
Kotlin reflection in that case and just delegate to Java
reflection.

Issue: SPR-16931
2018-10-16 16:40:02 +02:00
Juergen Hoeller
b7e4a56e5c Mark PathResourceTests as deprecated (along with PathResource)
Issue: SPR-17320
2018-10-12 13:17:28 +02:00
Juergen Hoeller
83909e6e1e Consistent exposure of empty attribute arrays in AnnotationMetadata
Issue: SPR-17347
2018-10-09 23:14:13 +02:00
Juergen Hoeller
cf3635b42d Resource.lastModified() propagates 0 value if target resource exists
Includes use of Files.getLastModifiedTime for NIO Paths, preservation of NIO-based resolution on createRelative, deprecation of PathResource, and consistent use of getContentLengthLong over getContentLength.

Issue: SPR-17320
2018-10-09 23:13:11 +02:00
Rossen Stoyanchev
c01f350abe Move MonoToListenableFutureAdapter to spring-core
This was a package private class in spring-messaging since 5.0, and was
recently made public in 5.1. This commit promotes it to spring-core
where it belongs next to all other ListenableFuture support classes.

Follow-up refactoring for SPR-17336
2018-10-09 16:26:24 -04:00
Juergen Hoeller
ad29f97a05 Polishing 2018-09-29 17:16:25 +02:00
Arjen Poutsma
09af706af6 Use concatWith instead of mergeWith 2018-09-11 13:36:44 +02:00
Arjen Poutsma
1a0522b805 DataBufferUtils does not release DataBuffer on error cases
This commit makes sure that in DataBufferUtils.write, any received data
buffers are returned as part of the returned flux, even when an error
occurs or is received.

Issue: SPR-16782
2018-09-11 13:36:44 +02:00
Juergen Hoeller
84ec382201 XMLEventReader.getElementText() properly checks for start element
Issue: SPR-17233
2018-09-07 12:56:15 +02:00
Sebastien Deleuze
8d45e3e7ef Fix Kotlin inner class nested configuration handling
Before this commit, Kotlin inner class nested configuration
handling thrown an IndexOutOfBoundsException due to bogus filtering
of its constructor parameter reference to an instance of the outer
class.

This commit keep constructor parameter of type INSTANCE in order to
throw a more meaningful NoSuchBeanDefinitionException.

Issue: SPR-17222
2018-09-07 11:39:30 +02:00
Arjen Poutsma
259b2ca5f4 Added tests for errors in the source stream
This commit adds decoder/message-reader tests for errors in
the source data buffer publisher. Because the tests extend
AbstractDataBufferAllocatingTestCase, they also check whether
the buffers that precede the error in the stream are properly
released.

Issue: SPR-17025
2018-09-05 11:08:07 +02:00
Arjen Poutsma
196c0adf47 Fixed DataBufferUtils.join leak for error in source
This commit fixes an issue where DataBufferUtils.join() would not
release databuffers that preceded an error signal.

Issue: SPR-17025
2018-09-05 11:07:57 +02:00
Sam Brannen
326895246d Polishing 2018-09-04 13:55:22 +02:00
Stephane Nicoll
2c1dca5b5e Polish capitalisation of units on DataSize and javadoc of DataUnit
Issue: SPR-17240
2018-09-04 13:46:41 +02:00
Sam Brannen
08ba53dd0e Ensure SocketUtils can be instantiated
Issue: SPR-17215
2018-08-26 21:49:21 +02:00
Juergen Hoeller
2ac23badee SimpleAliasRegistry.hasAlias properly resolves multiple chained aliases
Issue: SPR-17191
2018-08-17 09:54:14 +02:00
Stephane Nicoll
f931a3fb59 Improve DataSize to support negative values
Issue: SPR-17154
2018-08-10 18:21:09 +02:00
Juergen Hoeller
aebb2d52e0 Logging refinements for transaction and cache processing (debug/trace)
Issue: SPR-16946
2018-08-10 15:45:46 +02:00