Commit Graph

811 Commits

Author SHA1 Message Date
Sam Brannen dba48a1ff5 Isolate thrown exception in AssertTests 2015-04-14 20:42:23 +02:00
Sam Brannen fefbd8f85b Polish Javadoc for StringUtils and Assert 2015-04-14 20:05:56 +02:00
Sam Brannen 47f8d435e6 Introduce isNotEmpty() aliases in StringUtils
This commit introduces isNotEmpty() aliases for the existing hasLength()
methods in StringUtils.

Issue: SPR-12909
2015-04-14 20:02:18 +02:00
Arjen Poutsma b119a9c82c FutureAdapter should wrap RuntimeExceptions
RuntimeExceptions thrown from FutureAdapter.adapt() should be wrapped in
an ExecutionException, not thrown as is.

Issue: SPR-12887
2015-04-10 12:52:15 +02:00
Sam Brannen abaf81f1b5 Clean up warnings in DefaultConversionServiceTests 2015-04-07 22:40:06 -04:00
Juergen Hoeller e78b0860df AnnotatedElementUtils leniently ignores TypeNotPresentExceptions (just like AnnotationUtils)
Also refines logIntrospectionFailure to just log at debug level for meta-annotation introspection failures.

Issue: SPR-12889
2015-04-04 00:20:16 +02:00
Juergen Hoeller 514eb4281c Polishing 2015-04-01 17:23:45 +02:00
Juergen Hoeller 2c637dcb2e ReaderEditor supports Reader injection analogous to InputStreamEditor (from Spring resource location)
Also, EncodedResource implements InputStreamSource now since it declares getInputStream() anyway.

Issue: SPR-12876
2015-04-01 17:02:55 +02:00
Juergen Hoeller 1d33fd039a AnnotationUtils.getAnnotationAttributes makes Method accessible (analogous to AnnotationUtils.getValue)
Issue: SPR-12858
2015-03-31 10:28:42 +02:00
Sam Brannen 502fa1796e Polish Javadoc for ClassUtils 2015-03-30 17:34:36 +02:00
Sam Brannen a4af5b8a3e Verify which factory methods are invoked in DefaultConversionServiceTests 2015-03-30 17:34:14 +02:00
Sam Brannen bddc4373fb Refactor ObjectToObjectConverter & improve exception msg
- The exception message now mentions lacking to-Object method as well.

- Documented explicit lacking support for toString() for conversions.

- Introduced dedicated has*() methods for greater clarity and to reduce
  code duplication.

- Static factory methods (i.e., of, from, valueOf) are now supported for
  conversion to a String.
2015-03-30 17:32:59 +02:00
Sam Brannen db96113bcf Polish Javadoc for converters 2015-03-30 16:24:24 +02:00
Sam Brannen 72d7963b30 Polish ConversionService tests
- Now correctly using @Test(expected=...) where appropriate.

- Renamed DefaultConversionTests to DefaultConversionServiceTests.

- Moved all tests related to DefaultConversionService from
  GenericConversionServiceTests to DefaultConversionServiceTests.

- No longer printing to System.out.

- Removed all duplicate instantiation of conversion services.

- Now using Java 8 streams to simplify implementations of custom test
  converters. Also using streams in tests where appropriate.
2015-03-30 15:58:29 +02:00
Juergen Hoeller d23893fd25 Consistent javadoc param declarations for type variables 2015-03-25 00:44:01 +01:00
Juergen Hoeller 22670b7fad Fixed addConverterFactory assertion 2015-03-25 00:42:51 +01:00
Juergen Hoeller 09027f7972 ResolvableType.forRawClass as a straight wrapper for Class.isAssignableFrom
Issue: SPR-12846
2015-03-24 19:20:15 +01:00
Juergen Hoeller 56273a8ff3 Polishing 2015-03-21 01:19:01 +01:00
Arjen Poutsma da48739628 Support byte ranges in ResourceHttpRequestHandler
This commit introduces support for HTTP byte ranges in the
ResourceHttpRequestHandler. This support consists of a number of
changes:

- Parsing of HTTP Range headers in HttpHeaders, using a new HttpRange
  class and inner ByteRange/SuffixByteRange subclasses.
- MIME boundary generation moved from FormHttpMessageConverter to
  MimeTypeUtils.
- writePartialContent() method introduced in ResourceHttpRequestHandler,
  handling the byte range logic
- Additional partial content tests added to
  ResourceHttpRequestHandlerTests.

Issue: SPR-10805
2015-03-20 15:35:43 -04:00
Juergen Hoeller 192462902e Consistent support for Java 8 default methods (in interfaces implemented by user classes)
Covers ReflectionUtils.doWithMethods as well as affected annotation post-processors.
Includes an extension of MethodMetadata for the detection of @Bean default methods.

Issue: SPR-12822
Issue: SPR-10919
2015-03-19 16:50:15 +01:00
Juergen Hoeller 778a01943b ResolvableType-based type matching at the BeanFactory API level
Issue: SPR-12147
2015-03-18 23:05:13 +01:00
Juergen Hoeller bc6a98c144 Polishing (in particular updating javadoc references to Apache Commons) 2015-03-13 18:19:10 +01:00
Sam Brannen 08c67cf045 Polish AnnotationAwareOrderComparator 2015-03-07 22:35:49 +01:00
Sam Brannen afee546973 Delete unused method in TypeDescriptor 2015-03-07 22:27:11 +01:00
Sam Brannen d90cee78ef Remove trailing whitespace in source code 2015-03-07 21:16:18 +01:00
Juergen Hoeller ff4ac5b837 Collections.unmodifiableMultiValueMap explicitly casts to List<V> (for compatibility with JDK 9 build 53)
Issue: SPR-12549
2015-03-06 11:52:51 +01:00
Juergen Hoeller b541fc9366 Polishing 2015-03-05 18:56:57 +01:00
Juergen Hoeller 1e26d17a3d Preparations for JDK 9
Issue: SPR-12549
2015-03-05 18:56:07 +01:00
Juergen Hoeller 7e8ffc7bf5 CompositePropertySource rejects getPropertyNames call when containing a non-enumerable source
Issue: SPR-12788
2015-03-05 18:53:25 +01:00
Juergen Hoeller f786fc3226 ObjectToOptionalConverter preserves existing Optional instances
Issue: SPR-12785
2015-03-05 18:53:03 +01:00
Juergen Hoeller dcb1145354 Converter interface explicitly documents null values
Issue: SPR-12780
2015-03-05 18:52:38 +01:00
Sam Brannen 93c70b7440 Include charset in EncodedResource.equals()
Prior to this commit, the implementation of equals() in EncodedResource
was based solely on the resource and encoding. Thus, if a Charset were
specified instead of an encoding, invocations of equals() would not
work as expected.

This commit addresses this issue by including the charset in the
implementation of equals() and introducing corresponding tests in a new
EncodedResourceTests class. Furthermore, this commit makes
EncodedResource immutable and updates all Javadoc to reflect support
for the encoding and charset properties.

Issue: SPR-12767
2015-02-28 17:37:02 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 540d8792fe Fixed javadoc warnings and revised FastByteArrayOutputStream code style 2015-02-27 23:49:55 +01:00
Sam Brannen fe8289b5e3 Implement description consistently across Resources
This commit ensures Resources have consistent, non-empty, meaningful
implementations for getDescription(), thus ensuring that calls to
toString() (e.g., in log statements) no longer return an empty String.

This commit also polishes the Javadoc for various Resource
implementations.
2015-02-27 21:41:37 +01:00
Sam Brannen 088238443b Polish Javadoc for ResourcePropertySource 2015-02-27 21:41:37 +01:00
Sam Brannen 228d9db4d4 Polish StreamConverter(Tests) 2015-02-27 19:27:37 +01:00
Juergen Hoeller 287045ef74 Allow for shared Objenesis caching in ObjenesisCglibAopProxy
Issue: SPR-12755
2015-02-26 18:34:52 +01:00
Juergen Hoeller cc33d3fac8 Polishing 2015-02-25 19:05:06 +01:00
Stephane Nicoll 4ca32d1ce5 polishing 2015-02-24 10:23:16 +01:00
Stephane Nicoll 018adb04f2 Add converter support for Stream
Add StreamConverter to provide full support for converting
java.util.stream.Stream instances to and from collections or arrays.

Also attempt to convert the element type if necessary.

StreamConverter is registered by default in the DefaultConversionService
as long as Java8 is available.

Issue: SPR-12175
2015-02-24 10:17:27 +01:00
Juergen Hoeller 91a0107e4a ResolvableType.getType() returns ParameterizedType when built with forClassWithGenerics
Issue: SPR-12701
2015-02-20 21:53:44 +01:00
Rossen Stoyanchev b94c6fdf7a Add tests for SPR-12738 2015-02-20 13:19:15 -05:00
Stephane Nicoll 1aec6a6cc2 Detect Order on target class as well
Previously, the `@Order` annotation was managed in an inconsistent way
when placed at the implementation level. For simple beans, it was
discovered properly but wasn't for beans requiring a proxy.

OrderComparator.SourceProvider now explicitly allows to return several
order sources; the default implementation returns not only the factory
method (if  any) but also the target class if it happens to be different
from the class of the bean.

Issue: SPR-12636
2015-02-19 09:47:20 +01:00
Juergen Hoeller 0c15a54007 Polishing 2015-02-18 16:45:16 +01:00
Juergen Hoeller 6ebac00f32 @RequestPart supports java.util.Optional
Issue: SPR-12644
2015-02-18 16:17:07 +01:00
Sam Brannen add718d75c Polish EnumerablePropertySource 2015-02-16 20:26:49 +01:00
Juergen Hoeller f58abd3d9a Polishing (forward-ported from 4.1.x) 2015-02-10 23:04:12 +01:00
Juergen Hoeller 058714b03a Polishing 2015-02-10 19:30:59 +01:00
Sam Brannen 6e10f7c8cf Update TODOs for SPR-11598 2015-01-24 18:01:43 +01:00
Sam Brannen e97712b95b Update copyright headers in IdGenerators 2015-01-23 21:12:45 +01:00
Rossen Stoyanchev 52b8f34468 Add JdkIdGenerator and use it in SockJS client
Issue: SPR-12658
2015-01-22 21:27:36 -05:00
Juergen Hoeller 0ddf8dde12 AnnotationUtils explicitly handles null parameters
Issue: SPR-12604
2015-01-20 16:01:44 +01:00
Craig Andrews 213a3fd779 Performance improvements in ShallowEtagHeaderFilter
Prior to this change, the ShallowEtagHeaderFilter would use a
ResizableByteArrayOutputStream to internally write data and calculate
the ETag. While that implementation is faster than the regular
ByteArrayOutputStream (since it has a better strategy for growing the
internal buffer), a lot of buffer copying/writing still happens.

This change adds a new FastByteArrayOutputStream implementation that
internally uses a LinkedList<Byte[]> to store the content. So when
writing bytes to that OutputStream implementation, new byte[] are
added to the list when the previous ones are full. This saves most
of the instantiating/copying operations.

Note that new methods were added in DigestUtils to allow usage of
Streams instead of byte[], which is more efficient in our case.

Fixes #653

Issue: SPR-12081
2015-01-08 16:08:09 +01:00
Sam Brannen 40cd1be14c Update Javadoc for AnnotationUtils.findAnnotation()
This commit updates the Javadoc for findAnnotation() to reflect recent
changes to the algorithm it implements.
2015-01-07 21:08:00 +01:00
John 46b094bfc4 Fix typo 2015-01-07 00:28:51 -05:00
Sam Brannen 4a49a6535d Document type safety limitations of the CollectionFactory API
Issue: SPR-12596
2015-01-04 22:48:15 +01:00
Juergen Hoeller ec84fa6da3 ObjectToOptionalConverter uses Optional.ofNullable after ConversionService invocation
Issue: SPR-12589
2015-01-02 14:57:42 +01:00
Juergen Hoeller 9ac02b319d Remove pre-3.2 deprecated classes and methods
Issue: SPR-12578
2014-12-30 20:05:15 +01:00
Juergen Hoeller 86b8112c90 Polishing 2014-12-29 15:13:40 +01:00
Juergen Hoeller dfdfc03ff3 Polishing 2014-12-22 20:02:25 +01:00
Sam Brannen c62fbea2ba Demonstrate that the CollectionFactory API is not type-safe
This commit introduces test methods in CollectionFactoryTests that
demonstrate how the APIs for createCollection() and createMap() are not
type-safe, specifically regarding the use of generics, raw types, and
casting.
2014-12-11 15:55:41 +01:00
Sam Brannen aec284a4ca Create empty EnumSets & EnumMaps in CollectionFactory
SPR-12483 introduced automatic type conversion support for EnumSet and
EnumMap. However, the corresponding changes in CollectionFactory
contradict the existing contract for the "create approximate" methods
by creating a copy of the supplied set or map, thereby potentially
including elements in the returned collection when the returned
collection should in fact be empty.

This commit addresses this issue by ensuring that the collections
returned by createApproximateCollection() and createApproximateMap()
are always empty.

Furthermore, this commit improves the Javadoc throughout the
CollectionFactory class.

Issue: SPR-12533
2014-12-10 22:59:00 +01:00
Sam Brannen fb426fe611 Demonstrate that the CollectionFactory API is not type-safe
This commit introduces test methods in CollectionFactoryTests that
demonstrate how the APIs for createApproximateCollection() and
createApproximateMap() are not type-safe, specifically regarding the use
of generics, raw types, and casting.
2014-12-10 17:36:01 +01:00
Sam Brannen 978b8c81e5 Cover maps & more collections in CollectionFactoryTests 2014-12-10 16:44:52 +01:00
Sam Brannen 86f99ec8f7 Improve error handling in CollectionFactory
This commit improves error handling in CollectionFactory by asserting
preconditions.

In addition, this commit introduces ConnectionFactoryTests.
2014-12-10 14:47:15 +01:00
Sam Brannen 5aaed147d5 Use public AssumptionViolatedException in Assume
JUnit 4.12 created a 'public' version of the previously 'internal'
AssumptionViolatedException.

This commit upgrades Spring's Assume class to use this new public
version.
2014-12-10 00:29:52 +01:00
Sam Brannen d8ef666764 Suppress "rawtypes" warnings in CollectionFactory
This commit also adds links to the newly created Eclipse bug that was
raised for this issue.
2014-12-09 21:29:05 +01:00
Sam Brannen fe78900524 Work-around for Eclipse bug regarding EnumSets
This commit introduces superfluous casts in CollectionFactory to
address a bug in Eclipse 4.4.1 that prevents the code from compiling
within Eclipse. Specifically, without these casts Eclipse displays the
following error for use of the EnumSet.copyOf() and EnumSet.noneOf()
methods:

Type mismatch: cannot convert from EnumSet<Enum<Enum<E>>> to
Collection<E>
2014-12-09 20:54:36 +01:00
Juergen Hoeller bb1d1e916e Polishing 2014-12-07 20:52:18 +01:00
Juergen Hoeller 5018889d78 AnnotationAttributesReadingVisitor defensively handles meta-annotation retrieval failure
Issue: SPR-12493
2014-12-02 15:12:23 +01:00
Juergen Hoeller c94d584f37 OrderUtils defensively checks for presence of javax.annotation.Priority
Issue: SPR-12489
2014-12-01 18:08:11 +01:00
Juergen Hoeller efb114d49a Polishing 2014-11-29 20:49:21 +01:00
Juergen Hoeller bfbd25a0e9 BeanWrapper auto-growing support for EnumSet / EnumMap
Issue: SPR-12483
2014-11-29 20:49:06 +01:00
Juergen Hoeller 7635e7b7f2 Polishing
Issue: SPR-12483
2014-11-28 20:32:35 +01:00
Juergen Hoeller fef4cd0ed6 Default conversion support for EnumSet / EnumMap
Issue: SPR-12483
2014-11-28 20:30:46 +01:00
Juergen Hoeller f44217a0c2 Clarified getAllAnnotationAttributes behavior
Issue: SPR-12473
(cherry picked from commit 5ac8680)
2014-11-26 16:14:41 +01:00
Juergen Hoeller ab5856b6a8 Tracking ASM 5.0.4 development: Fix for ASM issue 317545
Issue: SPR-12470
2014-11-26 11:42:30 +01:00
Juergen Hoeller 223d849a14 Polishing 2014-11-23 00:12:02 +01:00
Juergen Hoeller 7fcadaa393 MethodParameter generally uses volatile variables where applicable now (as well as a local copy of the parameterNameDiscoverer field)
Issue: SPR-12453
2014-11-22 16:45:26 +01:00
Juergen Hoeller 1ef06cc743 MutablePropertySources uses an internal CopyOnWriteArrayList for defensiveness against concurrent modifications
Issue: SPR-12428
2014-11-22 16:12:28 +01:00
Chris Beams dff48ad8dd Allow non-String args in JOptCommandLinePropertySource
Prior to this commit, JOptCommandLinePropertySource prevented the
possibility of non-String option arguments. This effectively prevents
the use of JOpt's #ofType support (which allows specifying custom
argument types).

Now, non-String arguments are detected and converted to strings as
necessary. JOpt's #ofType now works as expected. A test has been added
to cover this case.
2014-11-20 12:03:29 +01:00
Juergen Hoeller 285dca027b Polishing
(cherry picked from commit acefd83)
2014-11-02 11:48:09 +01:00
Juergen Hoeller 1146d5ba1d Polishing 2014-10-29 22:44:59 +01:00
Juergen Hoeller 725ad0df50 SimpleMetadataReaderFactory is capable of resolving inner class names with dot syntax now (analogous to ClassUtils.forName)
Issue: SPR-12390
2014-10-29 22:03:01 +01:00
Juergen Hoeller b70c5d1ff1 Normalized AnnotationAttributesReadingVisitor class layout and improved diagnostics through delegating to AnnotationUtils
Issue: SPR-12387
2014-10-28 19:08:45 +01:00
Juergen Hoeller 06632822e9 Log4jConfigurer initLogging(location) throws FileNotFoundException for file URL as well
Issue: SPR-9725
2014-10-28 16:18:55 +01:00
Juergen Hoeller cb095132b1 Defensive String equals comparison in ClassReader
Issue: SPR-12382
2014-10-28 13:23:55 +01:00
Juergen Hoeller b16048b061 ClassReader relies on autoboxing for reuse of cached primitive values
Issue: SPR-12365
2014-10-23 14:24:59 +02:00
Juergen Hoeller 2956049c30 Polishing 2014-10-22 17:04:50 +02:00
Juergen Hoeller 2b6f841b03 OrderUtils.getPriority uses AnnotationUtils.findAnnotation for consistent lookup rules and diagnostics
Issue: SPR-12357
2014-10-21 12:27:14 +02:00
Juergen Hoeller 47dde91763 Consistent use of logIntrospectionFailure
Issue: SPR-12325
2014-10-21 12:16:51 +02:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Juergen Hoeller 716916b281 AnnotationUtils favors local composed annotations over interface annotations and consistently logs introspection failures via lazily initialized logger
Issue: SPR-12355
Issue: SPR-12325
Issue: SPR-12329
2014-10-20 21:47:47 +02:00
Juergen Hoeller c7e7d11156 Polishing 2014-10-14 14:27:03 +02:00
Juergen Hoeller 70fec47944 Provider declaration for @Value method argument works again
Issue: SPR-12297
2014-10-06 18:08:19 +02:00
Juergen Hoeller 9d969587ab CompositePropertySource extends EnumerablePropertySource now
Issue: SPR-12292
2014-10-02 20:19:32 +02:00
Juergen Hoeller 05c995cfb3 DecoratingClassLoader and its subclasses register themselves as parallel capable on Java 7+
Issue: SPR-12285
2014-10-02 14:33:13 +02:00
Juergen Hoeller 7d307b3853 Polishing 2014-09-30 20:17:58 +02:00
Stephane Nicoll 6f1acdd561 Optimize ResolvableType cache
Prior to this commit, the ResolvableType static cache was holding a lot
of duplicates for simple types. We are using too much metadata to compute
the key when the class has no generic information. so setFoo(String foo)
and setBar(String bar) would result in two entries in the cache because
the TypeProvider is different. On a very simple application 65% of the
entries in the cache were duplicate.

When the type is a Class with no generic information, the ResolvableType
instance is a simple wrapper around it so we might just as well not cache
it at all as the cost of finding it back from the cache is higher than
creating that simple wrapper.

This commit adds an explicit check; if the type is a simple Class we just
return a "resolved" ResolvableType instance for it. On a few test cases,
this reduces the size of the cache by 85%

Issue: SPR-12275
2014-09-30 18:01:40 +02:00
Brian Clozel d293889bb3 Fix invalid PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
Prior to this commit, `AntPathMatcher.extractPathWithinPattern` would
not process correctly `**` patterns and would only match *one* path
segment in the given path.

This commit changes `extractPathWithinPattern` to allow multiple path
segments to be matched against a single `**` pattern segment.

Issue: SPR-10515
2014-09-30 15:32:46 +02:00
Sam Brannen a6c2d4595b Polish Javadoc for BackOff implementations 2014-09-28 15:26:30 +02:00
Juergen Hoeller e8486e2afe Tracking ASM 5.0.4 development: Fix for ASM issue 317539
Issue: SPR-12255
2014-09-26 16:07:01 +02:00
Juergen Hoeller 1f3e195dac Polishing 2014-09-25 17:00:45 +02:00
Juergen Hoeller 587a81617c SystemEnvironmentPropertySource uses actual SecurityManager check and direct keySet access
Issue: SPR-12224
2014-09-24 17:56:38 +02:00
Juergen Hoeller 1936dee991 Replaced postProcessFindAllClassPathResourcesResult with doFindAllClassPathResources
Issue: SPR-12231
2014-09-22 17:31:03 +02:00
Sam Brannen f27c7df004 Avoid Gradle compiler warnings 2014-09-21 21:23:54 +02:00
Phillip Webb 1947de3334 Provide subclass hooks in path matching resolver
Update PathMatchingResourcePatternResolver to include additional
protected methods that can be used by subclasses to optimize which
JARs are searched.

Issue: SPR-12231
2014-09-21 10:56:24 -07:00
Phillip Webb c41ea96177 Optimize ReflectionUtils.isCglibRenamedMethod
Optimize ReflectionUtils.isCglibRenamedMethod by removing the regular
expression.

Issue: SPR-12227
2014-09-20 00:23:58 -07:00
Phillip Webb 752574de1d Optimize SystemEnvPropertySource when possible
Update SystemEnvironmentPropertySource to attempt optimized Map lookups
first, and only fall-back to the defensive SecurityManager safe-mode
if these fail.

Issue: SPR-12224
2014-09-20 00:17:10 -07:00
Juergen Hoeller 1884d18183 Polishing 2014-09-20 01:04:05 +02:00
Juergen Hoeller 16325c2eaa Polishing 2014-09-20 00:29:16 +02:00
Juergen Hoeller 65cc57dabb SystemEnvironmentPropertySource uses regular property names check instead of optimized Map lookup (for defensiveness in SecurityManager scenarios)
Issue: SPR-12224
2014-09-20 00:26:37 +02:00
Phillip Webb e71fbb9f46 Implement containsProperty on MapPropertySource
Improve the performance of MapPropertySource by directly implementing
the containsProperty property.

Issue: SPR-12224
2014-09-18 23:17:13 -07:00
Juergen Hoeller 15320db414 Polishing 2014-09-17 02:35:41 +02:00
Juergen Hoeller 9b2da37f79 GenericConversionService detects enum subclasses as well
Issue: SPR-12181
2014-09-12 17:23:51 +02:00
Juergen Hoeller 553930a9f0 CompositePropertySource allows for access to its nested property sources
Issue: SPR-12182
2014-09-12 16:51:49 +02:00
Juergen Hoeller 1e7bfd91a7 Polishing 2014-09-10 01:28:54 +02:00
Sam Brannen 559e81bec7 Make SocketUtils a concrete class
Per the Javadoc for the SocketUtils() constructor, SocketUtils can be
instantiated as a Spring Bean in XML configuration files; however,
SocketUtils is currently abstract which prevents such usage.

This commit removes the 'abstract' declaration thereby allowing
SocketUtils to be instantiated as a Spring bean.

Issue: SPR-12169
2014-09-09 16:08:27 -05:00
Juergen Hoeller 86b7118da8 Polishing 2014-09-04 02:30:25 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Juergen Hoeller c6d29f1a31 Refactored support for @Order on @Bean methods as well as @Priority handling
Issue: SPR-11310
Issue: SPR-10548
2014-09-04 00:41:13 +02:00
Sebastien Deleuze 7ea69fb96c Improve ResolvableType.hashCode() for better performance
Prior to this commit, when there was a lot of entries in the
ResolvableType.cache HashMap, getting a simple value could
take a lot of time due to a lot of calls to ResolvableType.equals().
ResolvableType.equals() used this.type, getSource(),
this.variableResolver.getSource() and this.componentType, but
ResolvableType.hashCode() used only this.type.

With this commit, ResolvableType.hashCode() now uses the same
fields than ResolvableType.equals().

Performance on the spring-resolvabletype-benchmark project:
 - 8000 us before this commit
 - 120 us with this commit

Issue: SPR-12122
2014-08-27 10:35:22 +02:00
Juergen Hoeller 9dfbc5326b Revised ResourcePropertySource in order to avoid ConfigurationClassProcessor's AnnotationPropertySource subclass
Issue: SPR-12115
2014-08-22 13:54:39 +02:00
Phillip Webb 5ba3db6a7d Fix failing CompositePropertySourceTests
Fix CompositePropertySourceTests which fails when run we debug logging.
2014-08-21 21:57:22 -07:00
Phillip Webb 84564a0c7b Rework @PropertySource early parsing logic
Rework the @PropertySource parsing logic recently changed in commit
7c608886 to deal with the same source appearing on a @Configuration
class and an @Import class.

Processing now occurs in a single sweep, with any previously added
sources being converted to a CompositePropertySource.

Issue: SPR-12115
2014-08-21 21:21:15 -07:00
Juergen Hoeller b73c531527 PropertySource implementations perform conversion to String arrays via StringUtils (getting rid of EMPTY_NAMES_ARRAY) 2014-08-21 22:46:33 +02:00
Juergen Hoeller 60e58a2012 Polishing 2014-08-21 14:29:14 +02:00
Juergen Hoeller 8c76381d95 PathMatchingResourcePatternResolver supports "classpath*" searches in jar file roots as well
Issue: SPR-12095
2014-08-19 20:34:45 +02:00
Sam Brannen 0dba70fe15 Merge pull request #625 from eujungkim/spr-warning
Clean up warnings in CompoundComparator
2014-08-18 10:16:26 +02:00
eujung kim c315adf72d Remove unnecessary @SupressWarnings. 2014-08-18 17:03:03 +09:00
Sam Brannen 1a88007688 Improve documentation of SpringFactoriesLoader 2014-08-16 17:07:30 +02:00
Juergen Hoeller 69587f3fa4 Polishing 2014-08-14 23:49:29 +02:00
Sam Brannen e6d16148e5 Support automatic discovery of default TELs
Prior to this commit, there was no declarative mechanism for a custom
TestExecutionListener to be registered as a default
TestExecutionListener.

This commit introduces support for discovering default
TestExecutionListener implementations via the SpringFactoriesLoader
mechanism. Specifically, the spring-test module declares all core
default TestExecutionListeners under the
org.springframework.test.context.TestExecutionListener key in its
META-INF/spring.factories properties file, and third-party frameworks
and developers can contribute to the list of default
TestExecutionListeners in the same manner.

 - AbstractTestContextBootstrapper uses the SpringFactoriesLoader to
   look up the class names of all registered default
   TestExecutionListeners and sorts the instantiated listeners using
   AnnotationAwareOrderComparator.

 - DefaultTestContextBootstrapper and WebTestContextBootstrapper now
   rely on the SpringFactoriesLoader mechanism for finding default
   TestExecutionListeners instead of hard coding fully qualified class
   names.

 - To ensure that default TestExecutionListeners are registered in the
   correct order, each can implement Ordered or declare @Order.

 - AbstractTestExecutionListener and all default TestExecutionListeners
   provided by Spring now implement Ordered with appropriate values.

 - Introduced "copy constructors" in MergedContextConfiguration and
   WebMergedContextConfiguration

 - SpringFactoriesLoader now uses AnnotationAwareOrderComparator
   instead of OrderComparator.

Issue: SPR-11466
2014-08-14 22:29:21 +02:00
Juergen Hoeller 8dbfa80b13 Unit test for circular reference in default profile property, plus related polishing
Issue: SPR-12078
2014-08-12 19:23:36 +02:00
Juergen Hoeller ef51d4dbdb AnnotatedElementUtils adapts post-processed values to AnnotationAttributes as well
Issue: SPR-12065
2014-08-08 15:15:29 +02:00
Sebastien Deleuze 3922f6fc53 Update references to RFC 2616
Replace references to the old RFC 2616 (HTTP 1.1) with references
to the new RFCs 7230 to 7235.

This commit also deprecates:
 - HttpStatus.USE_PROXY
 - HttpStatus.REQUEST_ENTITY_TOO_LARGE in favor of HttpStatus.PAYLOAD_TOO_LARGE
 - HttpStatus.REQUEST_URI_TOO_LONG in favor of HttpStatus.URI_TOO_LONG

Issue: SPR-12067
2014-08-07 14:50:45 +02:00
David Haraburda d0e6f0f73f Change GenericConversionService to better handle enum
Prior to this commit, given an enum which implements some interface,
GenericConversionService would select the String -> Enum converter even
if a converter for String -> SomeInterface was registered.  This also
affected converters that were registered for String ->
SomeBaseInterface, when SomeInterface extended SomeBaseInterface.

This change modifies the behavior of the private method
getClassHierarchy() by placing Enum.class as late as possible, pretty
much the same way as Object.class is handled.

Issue: SPR-12050
2014-08-06 10:42:28 +02:00
Sam Brannen 6cfe76eeec Polish Javadoc for MutablePropertySources 2014-08-02 12:17:57 +03:00
Sam Brannen 154cf5dc7e Polish Javadoc for AnnotationCacheKey 2014-08-02 12:17:15 +03:00
Juergen Hoeller 8f484d382e Polishing 2014-07-29 11:42:37 +02:00
Juergen Hoeller 8cc0fa5ae1 Polishing 2014-07-28 22:05:40 +02:00
Juergen Hoeller a3163ceb88 AbstractTypeHierarchyTraversingFilter leniently ignores non-loadable super classes and interfaces
Issue: SPR-12042
2014-07-28 22:05:20 +02:00
Juergen Hoeller 0ce90f1d16 TypeDescriptor's getResolvableType() and getSource() are @since 4.0 2014-07-24 12:13:37 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller 48fea0bafa ClassUtils.isCacheSafe defensively catches SecurityException (for Google App Engine compatibility)
Issue: SPR-12002
2014-07-16 20:33:36 +02:00
Juergen Hoeller 4e25a14f6c Merge pull request #571 from sdeleuze/SPR-11820
Make ListenableFuture compliant with Java 8 lambda
2014-07-16 16:41:41 +02:00
Sebastien Deleuze 86e8bdab6b Make ListenableFuture compliant with Java 8 lambda
Make it possible to use a ListenableFuture with Java 8
lambda expressions, using a syntax like
listenableFuture.addCallback(() -> ..., () -> ...);

Issue: SPR-11820
2014-07-16 16:06:24 +02:00
Arjen Poutsma d6950d8add StaxStreamXMLReader ignores significant whitespace
The StaxStreamXMLReader no longer handles all whitespace as ignorable
whitespace.

Issue: SPR-12000
2014-07-16 13:16:20 +02:00
Juergen Hoeller c18b6bf0b7 NestedIOException can use IOException constructor with cause argument on JDK 6+ 2014-07-15 22:05:45 +02:00
Juergen Hoeller 2665d56209 Polishing 2014-07-15 15:13:35 +02:00
Rossen Stoyanchev ab2526a586 Update support for using "." as path separator
Issue: SPR-11660
2014-07-14 18:49:25 -04:00
Sebastien Deleuze 928a466b5d Allow to customize separator for messaging destinations
In order to be able to use separators like "." (used by default
by most broker relays) instead of "/" for destination patterns
handling, the PathMatcher used in spring-messaging can now
be customized easily thanks to XML websocket namespace
or JavaConfig.

AntPathMatcher has been updated in order to use the configured path
separator instead of an hardcoded "/" for path concatenation.
Extension handling is now disabled when the "." separator is configured.

Issue: SPR-11660
2014-07-14 18:49:24 -04:00
Juergen Hoeller 29f6f3d7e7 Test ASM5's bytecode parsing of INVOKESPECIAL/STATIC on interfaces
Issue: SPR-11979
2014-07-10 15:46:18 +02:00
Juergen Hoeller 0d4ff1adbf Polishing 2014-07-09 22:25:35 +02:00
Juergen Hoeller 1fadd1c954 BackOff abstraction lives in util.backoff subpackage now
Issue: SPR-11746
2014-07-09 21:53:32 +02:00
Juergen Hoeller bf9ccc8138 ExceptionTypeFilter and InstanceFilter live in util package itself now
Issue: SPR-9616
2014-07-09 21:43:19 +02:00
Juergen Hoeller 01264dc673 Polishing 2014-07-08 00:59:31 +02:00
Juergen Hoeller e90143e03b Polishing 2014-07-01 12:52:09 +02:00
Juergen Hoeller db616dc438 Polishing 2014-06-30 14:55:43 +02:00
Juergen Hoeller 682a910bb6 ReflectionUtils caches Class.getDeclaredMethods() results; AnnotationUtils caches findAnnotation results
Issue: SPR-11882
2014-06-27 17:07:06 +02:00
Juergen Hoeller 98d6f7b443 Polishing 2014-06-26 16:01:24 +02:00
Juergen Hoeller 938a2846c8 Avoid pattern matching in isCglibRenamedMethod as far as possible (for performance reasons)
Issue: SPR-11894
2014-06-24 21:07:08 +02:00
Juergen Hoeller d6635802c4 TypeDescriptor's nested type traversal leniently returns null in case of unresolvable nested type
Issue: SPR-11898
2014-06-24 20:57:09 +02:00
Juergen Hoeller 18131bf611 Consistent declaration of private static final logger variables
Issue: SPR-11905
2014-06-24 14:02:05 +02:00
Juergen Hoeller 2c0c081bbb AnnotationUtils defensively catches and logs unexpected exceptions from retrieval attempts (proceeding like the annotation wasn't there)
Issue: SPR-11874
2014-06-24 13:36:04 +02:00
Juergen Hoeller fd809cd18e AnnotationUtils defensively catches unexpected exceptions from retrieval attempts (proceeding like the annotation wasn't there)
This is analogous to what the JVM does for cases where the annotation type itself isn't present on the classpath. We're effectively extending that policy to values referenced within an annotation declaration.

Issue: SPR-11874
2014-06-24 11:01:37 +02:00
Juergen Hoeller d801f9da89 ResourceUtils isFileURL detects "vfsfile" as a file system protocol (again)
Issue: SPR-11887
2014-06-20 01:03:01 +02:00
Juergen Hoeller dfc370c368 PathMatchingResourcePatternResolver's findPathMatchingResources needs to check for VFS before checking isJarResource
Issue: SPR-11887
2014-06-19 23:09:12 +02:00
Juergen Hoeller ab5aea5a13 Defensively check javaUtilOptionalEmpty
Issue: SPR-11888
2014-06-19 21:25:46 +02:00
Juergen Hoeller ef25b9e7af ObjectToOptionalConverter needs to be marked as @UsesJava8 2014-06-18 23:39:19 +02:00
Rossen Stoyanchev bb4a9cca1b Add suppress warning in SettableListenableFuture 2014-06-16 17:06:52 -04:00
Rossen Stoyanchev 0640a32863 Revise SettableListenableFuture implementation
This change modifies the SettableListenableFuture implementation to use
internally a ListenableFutureTask created with a "settable" Callable.

Issue: SPR-11614
2014-06-16 15:37:30 -04:00
Mattias Severson 38b525aa9e Created SettableListenableFuture with tests
A SettableListenableFuture implementation of Spring's ListenableFuture
The class is inspired by Google Guava’s
com.google.common.util.concurrent.SettableFuture, but this
implementation uses ReentrantReadWriteLock and CountDownLatch
internally to handle thread synchronization.

Issue: SPR-11614
2014-06-16 15:14:12 -04:00
Rossen Stoyanchev 0dc6082b01 Support java.util.Optional for @MVC named value args
After this change, java.util.Optional is supported with @RequestParam,
@RequestHeader, and @MatrixVariable arguments in Java 8. When Optional
is used the required flag is effectively ignored.

Issue: SPR-11829
2014-06-16 14:16:56 -04:00
hengyunabc 4d328d6188 Improve StringUtils#trimAllWhitespace
Prior to this commit, StringUtils#trimAllWhitespace(String str) was
unecessary slower. Using sb.deleteCharAt(index) leads to a complete
copy of the char[]
2014-06-13 18:18:19 +02:00
Brian Clozel d746e3fbfa Rollback AntPathMatcher behavior for ".*" comparisons
Prior to this commit, AntPathMatcher had been refactored for SPR-6741.
During that process, a key feature has been removed:
When comparing two patterns, pattern elements (*, {}, etc) are counted
to score those patterns. When a pattern ends with ".*", the ending
wildcard should not be counted against pattern elements for this
pattern.

This commit reintroduces that behavior.

Issue: SPR-6741
2014-06-11 20:51:09 +02:00
Rossen Stoyanchev ce0473f926 Further encapsulate AntPatternComparator$PatternInfo
Issue: SPR-6741
2014-06-11 20:51:09 +02:00
Brian Clozel f829cd1b35 Fix "**" precedence in AntPathMatcher comparator
Prior to this commit, "**" and "*" pattern elements had
the same priority when comparing two patterns.
So when comparing several patterns, the computed order was:
1- /hotels/{hotel}/bookings/{booking}
2- /hotels/**
3- /hotels/{hotel}/bookings/{booking}/customer/{customer}

This commit updates the comparator so that patterns ending
with "**" (a.k.a "catch-all" patterns) are less specific than
the others; in the previous example, the 2nd pattern would
then end up last.

This commit also optimizes the comparator implementation.

Issue: SPR-6741
2014-06-11 20:51:09 +02:00
Lukasz Kryger 0dc52a8343 Fix method comment for getRequiredProperty(String) 2014-06-11 11:56:58 +02:00
Juergen Hoeller 5cb3f8eada Support for java.util.Optional within ObjectFactory/Provider
Includes support for arbitrary deep nesting levels in DependencyDescriptor's getDependencyType() and MethodParameter's getNestedParameterType().

Issue: SPR-11833
2014-06-06 15:29:50 +02:00
Juergen Hoeller 2cf88ac6a3 Polishing 2014-06-04 21:49:23 +02:00
Juergen Hoeller f7b465390c Moved @Uses annotations to org.springframework.lang; fixed Base64Utils to declare Java 8, and fixed PathResource's declaration to refer to Java 7.
Issue: SPR-11604
2014-06-04 21:34:23 +02:00
Stephane Nicoll 001d0e734c Support for @Order at the bean declaration level
This commit introduces OrderProvider and OrderProviderComparator, two
interfaces designed to externalize how a collection of element is sorted
according to their order value.

FactoryAwareOrderProvider is an OrderProvider implementation that knows
about the objects to order and the corresponding BeanFactory instance.
This allows to retrieve additional metadata about the actual instances
to sort, such as its factory method.

A @Bean method can now holds an additional @Order to define the order
value that this bean should have when injected as part of a collection
or array.

Issue: SPR-11310
2014-06-04 21:04:13 +02:00
Juergen Hoeller 64bb308763 GsonBuilderUtils for programmatic Base64 serialization setup; common Base64Utils class adapts between Java 8 and Commons Codec
Issue: SPR-9488
2014-06-04 13:22:11 +02:00
Juergen Hoeller b4954780aa ClassMetadata exposes isAnnotation() now, and correctly returns false from hasSuperClass() for interfaces and annotations
Issue: SPR-11711
2014-05-30 18:14:36 +02:00
Juergen Hoeller 8f2ed66b4a ServletRequestAttributes considers standard Number subclasses (as defined in NumberUtils) as immutable
Issue: SPR-11738
2014-05-27 17:43:31 +02:00
Juergen Hoeller 03ce4a5024 Polishing 2014-05-20 00:31:24 +02:00
Juergen Hoeller cfc720db25 Latest patches from ASM trunk 2014-05-19 22:29:27 +02:00
Juergen Hoeller 295a6aeed6 StringUtils.parseLocaleString parses variant correctly when variant contains country code
This commit also includes a JUnit 4 style revision of StringUtilsTests and ObjectUtilsTests.

Issue: SPR-11806
2014-05-19 22:29:19 +02:00
Rossen Stoyanchev 8ee4651038 Improve StringUtils.cleanPath
Issue: SPR-11793
2014-05-15 17:26:52 -04:00
Juergen Hoeller 782d10c66f JasperReports-related polishing 2014-05-12 20:27:53 +02:00
Stephane Nicoll 89fc3c0257 Add BackOffExecution to isolate state
This commit separates the BackOff configuration from an actual
 execution. BackOffExecution now contains all the state of a
 particular execution and BackOff is only meant to start (i.e.
 create) a new execution.

 The method "reset" has been removed as its no longer necessary:
 when an execution does not need to be used for a given operation
 anymore it can be simply discarded.

 Issue: SPR-11746
2014-05-09 16:39:01 +02:00
Stephane Nicoll 6a0483128a Configurable back off for listener recovery
Prior to this commit, DefaultMessageListenerContainer was recovering
on failure using a fixed time interval, potentially in an infinite way.

This commit adds an extra "backoff" property to the container that
permits to fine tune the recovery interval using a BackOff instance.

FixedBackOff provides a fixed interval between two attempts and a
maximum number of retries. ExponentialBackOff increases an initial
interval until a maximum interval has been reached. A BackOff instance
can return a special "STOP" time value that indicates that no further
attemps should be made. DefaultMessageListenerContainer uses this
value to stop the container.

protected method "sleepInbetweenRecoveryAttempts" has been renamed
to "applyBackOff" and now returns a boolean that indicate if the
back off has been applied and a new attempt should now be made.

Issue: SPR-11746
2014-05-09 11:56:15 +02:00
Juergen Hoeller 381ccde48d IdToEntityConverter defensively handles access to getDeclaredMethods
Issue: SPR-11758
2014-05-06 18:49:16 +02:00
Juergen Hoeller bea34ea41c GenericTypeResolver returns null for entirely unresolvable type arguments only
Issue: SPR-11763
2014-05-06 18:06:26 +02:00
Juergen Hoeller 842a8a851d AnnotationMetadataReadingVisitor passes metaAnnotationMap into getMergedAnnotationAttributes algorithm, for finding out about applicable overrides
Issue: SPR-11649
2014-04-30 22:51:36 +02:00
Juergen Hoeller 39e1342302 Revised definition of @UsesX annotations 2014-04-30 22:51:22 +02:00
Stephane Nicoll bd85c916eb Integrate animal sniffer
Animal sniffer provides tools to assist verifying that classes
compiled with a newer JDK are compatible with an older JDK.

This integratesthe latest version of the tool (1.11) that
permits the use of custom annotations. Added @UsesJava7,
@UsesJava8 and @UsesSunHttpServer and annotated the few places
where we rely on a specific environment.

The verification process can be invoked by running the 'sniff'
task.

Issue: SPR-11604

polishing
2014-04-30 13:51:01 +02:00
Juergen Hoeller 02aca9c754 Polishing 2014-04-30 00:01:07 +02:00
Juergen Hoeller dc2e62fab9 Polishing 2014-04-29 19:07:45 +02:00
Juergen Hoeller e510f6393a Polishing 2014-04-29 15:45:56 +02:00
Juergen Hoeller be5f2a8b4e Polishing 2014-04-28 23:37:07 +02:00
Juergen Hoeller ab24dda4ff Revised @PropertySource parsing for consistent PropertySource naming, avoiding accidental overriding by name
Issue: SPR-11637
2014-04-28 23:24:57 +02:00
Juergen Hoeller 6f2e61b19f Polishing
(cherry picked from commit c97c246)
2014-04-28 00:47:50 +02:00
Juergen Hoeller 6cb45f714e General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
(cherry picked from commit 59cef3c)
2014-04-28 00:47:21 +02:00
Juergen Hoeller 310bdbcb15 @Bean processing explicitly ignores bridge methods (for method overrides with return type narrowing on JDK 8)
Issue: SPR-11718
(cherry picked from commit 656fc52)
2014-04-28 00:33:04 +02:00
Juergen Hoeller 9353332a61 Polishing 2014-04-23 23:55:43 +02:00
Juergen Hoeller c05ab3e2e8 General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
2014-04-23 23:54:55 +02:00
Juergen Hoeller 9cb5f48459 SpringProperties falls back to ClassLoader.getSystemResource when loaded in bootstrap ClassLoader
Issue: SPR-11721
2014-04-23 18:18:46 +02:00
Juergen Hoeller fb66567bba Final patches from ASM 5.0.2 release
Issue: SPR-11212
2014-04-23 14:25:50 +02:00
Juergen Hoeller 700c3b257f Polishing 2014-04-22 20:48:26 +02:00
Juergen Hoeller 5ab7076118 considerInterfaces should work without considerInherited as well
Issue: SPR-11719
2014-04-22 20:47:33 +02:00
Juergen Hoeller 945335d14b AnnotationTypeFilter prevents ASM-based loading of java.* interfaces as well
Issue: SPR-11719
2014-04-22 20:46:36 +02:00
HejiaHo 16410cad4d Fix ConcurrentReferenceHashMap max constraints
Update calculateShift to respect the maximum upper bound as well as the
minimum value.

Issue: SPR-11720
2014-04-22 14:56:05 +01:00
Stephane Nicoll 5559209233 Remove useless imports 2014-04-22 09:57:12 +02:00
Sam Brannen e1720d89fc Don't mutate annotation metadata when merging attrs
Prior to this commit, invoking the getMergedAnnotationAttributes()
method in AnnotationReadingVisitorUtils resulted in mutation of the
internal state of the ASM-based annotation metadata supplied to the
method.

This commit fixes this issue by making a copy of the original
AnnotationAttributes for the target annotation before merging attribute
values from the meta-annotation hierarchy.

This commit also introduces a slight performance improvement by
avoiding duplicate processing of the attributes of the target
annotation.

Issue: SPR-11710
2014-04-21 12:46:38 -04:00
Juergen Hoeller 48c977afdc Polishing 2014-04-17 21:19:47 +02:00
Juergen Hoeller 637ad20cd3 Latest ASM patches (fix for bug 317151 from ASM HEAD; ASM's 1.8 bytecode processing needs to be lenient with CGLIB 3.1)
Issue: SPR-11212
2014-04-16 12:35:26 +02:00
Juergen Hoeller a167a1b591 JBoss "vfszip" resources need to be treated as jar URLs
Issue: SPR-11676
(cherry picked from commit 196f629)
2014-04-09 20:57:28 +02:00
Juergen Hoeller 0041e245a1 Polishing
Issue: SPR-11637
2014-04-09 17:43:09 +02:00
Stephane Nicoll 47a4327193 Add JSR-107 cache annotations support
This commit adds support for the JSR-107 cache annotations alongside
the Spring's cache annotations, that is @CacheResult, @CachePut,
@CacheRemove and @CacheRemoveAll as well as related annotations
@CacheDefaults, @CacheKey and @CacheValue.

Spring's caching configuration infrastructure detects the presence of
the JSR-107 API and Spring's JCache implementation. Both
@EnableCaching and the cache namespace are able to configure the
required JCache infrastructure when necessary. Both proxy mode
and AspectJ mode are supported.

As JSR-107 permits the customization of the CacheResolver to use for
both regular and exception caches, JCacheConfigurer has been
introduced as an extension of CachingConfigurer and permits to define
those.

If an exception is cached and should be rethrown, it is cloned and
the call stack is rewritten so that it matches the calling thread each
time. If the exception cannot be cloned, the original exception is
returned.

Internally, the interceptors uses Spring's caching abstraction by default
with an adapter layer when a JSR-107 component needs to be called.
This is the case for CacheResolver and CacheKeyGenerator.

The implementation uses Spring's CacheManager abstraction behind the
scene. The standard annotations can therefore be used against any
CacheManager implementation.

Issue: SPR-9616
2014-04-07 12:07:20 +02:00
Sam Brannen d9ee44cd7c Clean up warnings that show up in Gradle build 2014-04-06 16:25:28 +02:00
Juergen Hoeller 8006696613 Revised ByteArrayOutputStream handling in MarshallingView and co
Issue: SPR-11646
2014-04-02 20:57:09 +02:00
Stephane Nicoll dcf5f4a6a3 javax.annotation.Priority alternative to @Order
This commit rationalizes the use of @Order so that the standard
@Priority annotation can be used instead. The handling of both
annotations are now defined in OrderUtils.

This also updates the link to the JavaEE API so that we refer to
JavaEE7 instead of JavaEE6.

Issue: SPR-11639
2014-04-01 14:30:47 +02:00
Sam Brannen 34eb4dba3a Update Javadoc for supported JBoss VFS version 2014-03-28 21:54:23 +01:00
Juergen Hoeller 9859b97037 Consider a null ClassLoader (typically the bootstrap CL) as cache-safe
Issue: SPR-11606
(cherry picked from commit a4a2e80)
2014-03-26 23:51:53 +01:00
Juergen Hoeller b9bac1d3b6 Relaxed getElementTypeDescriptor assertion to not insist on a ResolvableType-known array
Issue: SPR-11608
2014-03-26 16:09:15 +01:00
Arjen Poutsma f2f355e76c Improved StAX<->SAX bridge
Improved the SAX to StAX (and vice-versa) bridge exposed via StaxUtils.
The old integration had some issues with namespace declaration
attributes, brought to light in a XMLUnit upgrade.

Issue: SPR-11549
2014-03-25 20:58:58 +01:00
Sam Brannen a2f1169e82 Don't detect annotations on superclass in StAnMeta
Changes introduced in conjunction with issue SPR-11475 altered the
behavior of StandardAnnotationMetadata such that annotations could be
detected on superclasses, specifically in the case where the
AnnotatedElementUtils.getAllAnnotationAttributes() method is invoked to
obtain multiple annotations of the same type (on the lowest level in the
class hierarchy), as is the case for @Profile and @Conditional.

This commit partially reverts these changes as follows:

 - All methods in AnnotatedElementUtils now set the
   traverseClassHierarchy to false, thereby effectively reverting the
   changes made in commit 1d30bf83a0.
   Note, however, that the changes made to AnnotationUtils remain in
   place.

 - Introduced tests in AnnotationMetadataTests that verify behavior
   present in Spring Framework 4.0.2 and earlier.

 - Updated tests in AnnotatedElementUtilsTests so that they pass against
   the reverted changes (i.e., align with the behavior present in Spring
   Framework 4.0.2 and earlier).

 - Refined Javadoc in AnnotationMetadata with regard to annotations
   being "present" vs. "defined".

 - Refined Javadoc in AnnotatedTypeMetadata.

Issue: SPR-11475, SPR-11595
2014-03-25 17:48:06 +01:00
Juergen Hoeller 9280ca7749 Upgraded to ASM 5.0.1
Issue: SPR-11239
2014-03-25 11:51:31 +01:00
Juergen Hoeller dd7f54c3c0 Revised ResizableByteArrayOutputStream as an actual subclass of ByteArrayOutputStream, and consistently applied appropriate ByteArrayOutputStream initial capacities across the codebase
Issue: SPR-11594
2014-03-24 22:57:38 +01:00
Brian Clozel ae012ae6e2 ShallowEtagHeaderFilter use specified contentlength
Prior to this commit, the ShallowEtagHeaderFilter did not use the
content length given by the content generator to set the
ByteArrayOutputStream's buffer size.
This can lead to performance issues for large content since the buffer
grows as the content is being written.

This commit adds a new ByteArrayOutputStream variant called
ResizableByteArrayOutputStream. This implementation has public methods
for modifying the internal buffer size and does not synchronize on
buffer access.
This commit also make use of this new variant in
ShallowEtagHeaderFilter.

Issue: SPR-8271
2014-03-24 12:11:59 +01:00
Sam Brannen 796af90ba7 Polish ASM-based annotation processing
- AnnotationAttributesReadingVisitor no longer processes annotations
  from the java.lang.annotation package.

- Simplified logic in AnnotationReadingVisitorUtils
  getMergedAnnotationAttributes().

Issue: SPR-11574
2014-03-21 15:26:13 +01:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller ad09f1b5ec Upgraded embedded ASM version to 5.0
Issue: SPR-11239
2014-03-20 01:06:22 +01:00
Sam Brannen 99cd2f6098 Support meta-annotation overrides in ASM processing
Prior to this commit, Spring supported meta-annotation attribute
overrides in custom composed annotations with reflection-based
annotation processing but not with ASM-based annotation processing.

This commit ensures that meta-annotation attribute overrides are
supported in AnnotationMetadataReadingVisitor.getAnnotationAttributes().

Issue: SPR-11574
2014-03-19 23:44:13 +01:00
Sam Brannen 9ce0df89ff Support Class meta-annotation attributes with ASM
Prior to this commit, AnnotationAttributesReadingVisitor treated Class
annotation attributes as Strings instead of Classes. As a result,
look-ups for Class attributes in meta-annotations failed with an
IllegalArgumentException.

This commit fixes this issue by consistently treating Class attributes
as Classes in AnnotationAttributesReadingVisitor.

Issue: SPR-11557
2014-03-18 18:20:15 +01:00
Juergen Hoeller 5ff1c696c8 Check raw Type objects, not ResolvableType instances, during isAssignableFrom recursion
Issue: SPR-11522
2014-03-14 00:45:40 +01:00
Juergen Hoeller 4744180d3d NumberUtils reports overflow when converting from BigInteger/BigDecimal to Long
Issue: SPR-11434
2014-03-13 17:03:55 +01:00
Sam Brannen 2bfd6ddcf4 Refactor SQL script support
This commit continues the work in the previous commit as follows:

 - Introduced an exception hierarchy for exceptions related to SQL
   scripts, with ScriptException as the base.

 - CannotReadScriptException and ScriptStatementFailedException now
   extend ScriptException.

 - Introduced ScriptParseException, used by ScriptUtils.splitSqlScript().

 - DatabasePopulatorUtils.execute() now explicitly throws a
   DataAccessException.

 - Polished Javadoc in ResourceDatabasePopulator.

 - Overhauled Javadoc in ScriptUtils and documented all constants.

 - Added missing @author tags for original authors in ScriptUtils and
   ScriptUtilsTests.

 - ScriptUtils.splitSqlScript() now asserts preconditions.

 - Deleted superfluous methods in ScriptUtils and changed method
   visibility to private or package private as appropriate.

 - Deleted the ScriptStatementExecutor introduced in the previous
   commit; ScriptUtils.executeSqlScript() now accepts a JDBC Connection;
   JdbcTestUtils, AbstractTransactionalJUnit4SpringContextTests, and
   AbstractTransactionalTestNGSpringContextTests now use
   DatabasePopulatorUtils to execute a ResourceDatabasePopulator instead
   of executing a script directly via ScriptUtils.

 - Introduced JdbcTestUtilsIntegrationTests.

Issue: SPR-9531
2014-03-13 12:00:01 +01:00
Juergen Hoeller bea94d5302 CollectionToCollectionConverter avoids collection copy for untyped collection when simply returning source anyway
Also uses addAll instead of iteration over untyped collection now, supporting optimized addAll in target collection type, and avoids repeated getElementTypeDescriptor calls.

Issue: SPR-11479
2014-03-10 15:59:19 +01:00
Sam Brannen b364599278 Update links to Spring JIRA server 2014-03-10 12:26:29 +01:00
Sam Brannen 1ade9b5433 Polish various test classes 2014-03-07 18:06:30 +01:00
Juergen Hoeller 3dfa7e9ac0 Avoid stack overflow in case of circular type reference
Issue: SPR-11522
2014-03-07 00:08:15 +01:00
Juergen Hoeller 793cab4f80 Allow generics-based injection in case of nested unresolved type variable
Issue: SPR-11471
2014-03-06 14:13:33 +01:00
Juergen Hoeller 2a2816dfc3 Restored proper handling of varargs in case of unresolvable type variable
Fixed through falling back to the raw parameter type in the TypeDescriptor(MethodParameter) constructor, properly detecting the vararg array even in case of an unresolvable type variable, and through restoring getElementTypeDescriptor's original behavior for arrays, i.e. always returning a non-null descriptor.

Issue: SPR-11494
2014-03-05 22:36:12 +01:00
Juergen Hoeller f3884084f2 Optimized DefaultResourceLoader's getResource implementation for "/..." paths, not relying on URL parsing exceptions for such a common case anymore
Issue: SPR-8283
2014-03-04 13:31:51 +01:00
Juergen Hoeller ac61b13a7c AnnotatedElementUtils wraps unexpected exceptions with descriptive IllegalStateException
Issue: SPR-10441
2014-02-28 14:17:37 +01:00
Juergen Hoeller 1763bfbad0 Fixed content length check in XmlValidationModeDetector
Issue: SPR-11477
2014-02-28 14:00:32 +01:00