Commit Graph

280 Commits

Author SHA1 Message Date
Sam Brannen db535863dd Consistently use class literals for primitive types
To improve consistency and avoid confusion regarding primitive types
and their wrapper types, this commit ensures that we always use class
literals for primitive types.

For example, instead of using the `Void.TYPE` constant, we now
consistently use `void.class`.
2024-01-30 15:26:12 +01:00
Sam Brannen 7e53a1f048 Re-enable Jaxb2MarshallerTests on JDK 22+
Since the bug in JDK 22-ea builds has been fixed [1], this commit
re-enables the disabled tests.

Verified using: OpenJDK Runtime Environment (build 22-ea+31-2314)

[1] https://bugs.openjdk.org/browse/JDK-8322214
2024-01-23 11:36:24 +01:00
Stéphane Nicoll 153f8895cb Polish 2023-12-29 18:19:26 +01:00
Brian Clozel 4516e0d413 Ignore XML tests on JDK 22
This is until https://bugs.openjdk.org/browse/JDK-8322216 is resolved.

See gh-31459
2023-12-19 18:06:47 +01:00
Sam Brannen 2d792f000a Polish "Apply SingleSpaceSeparator Checkstyle module"
See gh-31469
2023-10-22 14:18:18 +02:00
Johnny Lim 64e9fcad53 Apply SingleSpaceSeparator Checkstyle module
This commit also fixes its violations.

Closes gh-31469
2023-10-22 14:09:57 +02:00
Sam Brannen 526fc391ee Use Class#componentType() for consistency with arrayType()
Java 12 introduced java.lang.Class#componentType() as a shortcut for
getComponentType().

Since we started using arrayType() in fe5560400c, this commit switches
to componentType() for consistent API usage style.
2023-08-07 12:43:40 +03:00
Juergen Hoeller d250a5155a Consistent dependency declarations 2023-08-02 00:56:50 +02:00
Krzysztof Krasoń 1734deca1e
Refactor AssertJ assertions into more idiomatic ones
This commit refactors some AssertJ assertions into more idiomatic and
readable ones. Using the dedicated assertion instead of a generic one
will produce more meaningful error messages. 

For instance, consider collection size:
```
// expected: 5 but was: 2
assertThat(collection.size()).equals(5);
// Expected size: 5 but was: 2 in: [1, 2]
assertThat(collection).hasSize(5);
```

Closes gh-30104
2023-04-04 17:34:07 +02:00
Sam Brannen dafc7a2aab Apply "instanceof pattern matching" in remainder of spring-oxm module
See gh-30067
2023-03-06 17:07:49 +01:00
Sam Brannen 0502d18e3d Update copyright headers 2023-01-19 16:20:03 +01:00
Sam Brannen c4c786596f Migrate to Mockito.mock(T...) where feasible 2023-01-19 16:20:02 +01:00
Juergen Hoeller aaeb5eb0d2 Avoid direct URL construction and URL equality checks
Closes gh-29486
2022-11-14 23:23:12 +01:00
Sam Brannen 0fb9de5d0e Merge branch '5.3.x' 2022-07-13 16:36:01 +02:00
Marc Wrobel bd3499671c Fix typos in test code
This commit fixes typos in test class names, test method names, and
test variable names.

Closes gh-28807
2022-07-13 16:24:11 +02:00
Sam Brannen ddd11610cf Merge branch '5.3.x'
# Conflicts:
#	spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DriverManagerDataSource.java
#	spring-orm/src/main/java/org/springframework/orm/jpa/JpaVendorAdapter.java
2022-07-13 13:46:34 +02:00
Marc Wrobel b30eb6837c Fix and improve Javadoc in spring-oxm
See gh-28796
2022-07-13 13:42:42 +02:00
Sam Brannen b570f60560 Merge branch '5.3.x'
# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
#	spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
#	spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedNotification.java
#	spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedOperationParameter.java
#	spring-core/src/main/java/org/springframework/javapoet/support/package-info.java
#	spring-core/src/main/java/org/springframework/util/TypeUtils.java
#	spring-web/src/main/java/org/springframework/http/HttpMethod.java
2022-03-18 16:47:12 +01:00
Sam Brannen 64b64d9ba0 Stop referring to features as "Java 5" features
With a Java 8 baseline in place for quite some time now, it no longer
makes sense to refer to features such as annotations as "Java 5
annotations".

This commit also removes old `Tiger*Tests` classes, thereby avoiding
duplicate execution of various tests.
2022-03-18 16:32:30 +01:00
Sam Brannen d57bc176f2 Merge branch '5.3.x' 2022-01-10 14:21:25 +01:00
Sam Brannen df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
Stephane Nicoll e986ff8d07 Update copyright year of changed files
See gh-27239
2021-12-02 11:32:46 +01:00
Frederick Zhang baed0785fd Replace XMLReaderFactory with SAXParserFactory
XMLReaderFactory has been marked as deprecated and without additional
configuration, and it's slower than SAXParserFactory.

Previously `XMLReaderFactory.createXMLReader()` is called upon every
request. This is an anti-pattern as mentioned in [1] and it can be very
slow since it loads the jar service file unless a parser has been
pre-assigned [2] (e.g. by setting org.xml.sax.driver).

SAXParserFactory uses a FactoryFinder [3] instead, which takes advantage
of a thread-local cache provided by ServiceLoader. Developers can still
pre-assign a factory by setting javax.xml.parsers.SAXParserFactory to
make it faster.

[1] https://bugs.openjdk.java.net/browse/JDK-6925410
[2] c8add223a1/src/java.xml/share/classes/org/xml/sax/helpers/XMLReaderFactory.java (L144-L148)
[3] 66c653c561/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java (L181-L185)

See gh-27239
2021-12-02 11:32:46 +01:00
Arjen Poutsma a7789db067 Polishing 2021-11-23 11:42:34 +01:00
Arjen Poutsma 38062c3373 Polishing contribution
See gh-1607
2021-11-23 11:42:34 +01:00
qxo 247d2bb0ae Repect StaxDriver in XStreamMarshaller::marshalXmlStreamWriter
This commit makes sure that namespaces configured via the streamDriver
property are respected.
2021-11-23 11:42:33 +01:00
Arjen Poutsma 2271b6078e Polishing contribution
See gh-1607
2021-11-23 10:44:45 +01:00
qxo e8eeb99ac8 Repect StaxDriver in XStreamMarshaller::marshalXmlStreamWriter
This commit makes sure that namespaces configured via the streamDriver
property are respected.
2021-11-23 10:41:04 +01:00
Christoph Dreis 5c972fcc54 Use Charset variants of URLEncoder and URLDecoder methods 2021-11-10 16:12:11 +01:00
Juergen Hoeller 54bd66755c Consistently replace String encoding names with StandardCharset arguments
Closes gh-27664
2021-11-10 15:19:51 +01:00
Sam Brannen 9b4f3880b3 Apply "instanceof pattern matching" in spring-oxm
This has only been applied to `src/main/java`.
2021-10-14 22:08:40 +02:00
Sam Brannen 30efa4d478 Change default driver in XStreamMarshaller from XppDriver to DomDriver
As explained in commit a247b83cd9, the
XppDriver from XStream relies on the XPP3 library which publishes
javax.xml.namespace.QName as part of its JAR. The QName type is also
published by the java.xml system module in modular JREs (i.e., Java 9
or higher).

This results in a split package between the unnamed module and the
java.xml system module, which the Java Language Specification defines
as illegal (see §6.5.5.2 and §7.4.3).

Most Java compilers do not currently enforce this rule; however, the
Eclipse compiler does. This makes it impossible to use spring-oxm out
of the box in the Eclipse IDE. In addition, if bug JDK-8215739 is fixed
in future versions of other JDK implementations, this rule will affect
any users using spring-oxm with those JDKs.

This commit therefore switches the default driver in XStreamMarshaller
from XppDriver to DomDriver. Users can naturally switch back to the
XppDriver if they wish, since the driver is configurable.

Closes gh-27464
2021-09-25 15:06:45 +02:00
Sam Brannen a247b83cd9 Ensure projects can be imported into Eclipse IDE with JDK 17
Prior to this commit, the Spring Framework projects could not be
imported into Eclipse IDE when using JDK 17 to build the projects.

The primary obstacle is the fact that Eclipse enforces a strict
"no split packages between the unnamed module and a system module" rule
when building with a "modular JDK" (such as JDK 17).

Resources:

- https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928
- https://bugs.openjdk.java.net/browse/JDK-8215739
- http://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-December/014077.html
- https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10/53824670#53824670

Since the bug (JDK-8215739) has not been fixed in OpenJDK, the strict
"no split packages" rule does not apply to the Java compiler used in
Spring Framework's Gradle build or the compiler in IntelliJ IDEA. Hence,
this issue only arrises when building the framework in Eclipse IDE.

This commit addresses this issue in the following affected projects.

- spring-oxm: removal of the dependency on XPP3 which publishes
    javax.xml.namespace.QName as part of the JAR. The QName type is
    also published by the java.xml JDK 17 system module. To make the
    tests pass, we have switched to using the DomDriver instead of the
    XppDriver in our XStream tests.

- spring-test: HtmlUnit has a transitive dependency on xml-apis which
    publishes several packages also published by java.xml JDK 17 system
    module. Thus, we have explicitly excluded the transitive dependency
    on xml-apis for our `optional` configuration.

See gh-27407
2021-09-22 16:22:27 +02:00
Juergen Hoeller d84ca2ba90 Jakarta EE 9 migration
Upgrades many dependency declarations; removes old EJB 2.x support and outdated Servlet-based integrations (Commons FileUpload, FreeMarker JSP support, Tiles).

Closes gh-22093
Closes gh-25354
Closes gh-26185
Closes gh-27423
See gh-27424
2021-09-17 09:14:07 +02:00
Juergen Hoeller 3c8724ba3d Remove JiBX support
Closes gh-27425
2021-09-17 08:58:52 +02:00
Juergen Hoeller b74e93807e Remove JDK 9 workarounds etc
See gh-17778
2021-09-17 08:58:19 +02:00
Sam Brannen b1a4d3033b Avoid usage of deprecated Gradle API in spring-oxm.gradle
This upgrade avoids the warning about the following on Gradle 7.1+.

- The SourceDirectorySet.outputDir property has been deprecated.

Closes gh-26870
2021-09-14 11:35:12 +02:00
Brian Clozel cecc0849a8 Upgrade to Gradle 7.2
This commit upgrades Gradle to 7.2.
Gradle configuration names are updated accordingly.
This also upgrades Gradle build plugins.

See gh-26870
2021-09-13 09:37:35 +02:00
Juergen Hoeller 837301fdb3 Convenient configuration of type permissions for XStream 1.4.18
Closes gh-27343
2021-09-02 22:20:52 +02:00
Juergen Hoeller 8680fdb8bc Polishing 2021-07-09 13:26:46 +02:00
Sam Brannen a28511cdbd Polish Jaxb2MarshallerTests 2021-05-04 13:46:31 +02:00
Sam Brannen 668b938832 Remove obsolete order.xsd file
The order.xsd is no longer used by any tests and probably has not been
since commit 89a7e752ef, which removed support for Castor.

See gh-22250
2021-05-04 13:34:42 +02:00
Sam Brannen 091e7bb891 Remove duplicate copy of flight.xsd
See 85eb589c2e
See gh-25787
2021-05-04 13:19:04 +02:00
Brian Clozel 85eb589c2e Fix Gradle Java Toolchain configuration
This commit fixes various issues with the configuration of the Gradle
Java toolchain in the build.

First, the configuration of build properties is fixed in the CI pipeline
because it wasn't properly checked.
The JMH plugin is also upgraded and we now configure its toolchain
support.
This commit also rewrites the XJC tasks in the spring-oxm module,
leveraging a Gradle plugin that creates actual compile tasks we can
configure.

See gh-25787
2021-05-03 15:02:09 +02:00
Juergen Hoeller 79cf6b4353 Merge branch '5.2.x' 2020-08-30 12:18:49 +02:00
Juergen Hoeller ae4160e131 Avoid direct use of non-exported XStream CompositeClassLoader class
Closes gh-25662
2020-08-30 12:15:45 +02:00
Juergen Hoeller ff11467a0c Avoid resizing of fixed-size HashMap/LinkedHashMap variants
Closes gh-25349
2020-08-25 19:26:18 +02:00
Sam Brannen 9d5881e0ad Suppress warnings, remove unused code, etc. 2020-06-20 17:15:35 +02:00
Sam Brannen 4805288122 Use SingletonSupplier for XStream instance in XStreamMarshaller
Closes gh-25017
2020-05-07 12:35:32 +02:00
Sam Brannen ce11fdfa80 Fix concurrency issues in XStreamMarshaller
Prior to this commit, if an instance of XStreamMarshaller was used
concurrently from multiple threads without having first invoked the
afterPropertiesSet() method, the private `xstream` field could be
initialized multiple times resulting in a ConcurrentModificationException
in XStream's internal DefaultConverterLookup.

This commit fixes these concurrency issues by making the `xstream` field
volatile and by implementing a double-checked locking algorithm in
getXStream() to avoid concurrent instance creation.

Closes gh-25017
2020-05-06 18:49:47 +02:00