197 Commits

Author SHA1 Message Date
Andy Wilkinson
e74f777971 Remove use of spring-core's Assert from PropertiesLauncher
Fixes gh-23474
2020-09-26 09:11:05 +01:00
dreis2211
fba1fb23e4 Fix multi-release JAR test on JDK 15
Backport of 54f93e9

See gh-23445
2020-09-22 10:09:18 +02:00
Phillip Webb
4945806d84 Make StringSequence.isEmpty() public
Make `StringSequence.isEmpty()` public for compatibility with JDK 15.

Closes gh-23440
2020-09-21 22:26:20 -07:00
Phillip Webb
195def0ec3 Merge branch '2.1.x' into 2.2.x 2020-09-15 08:48:00 -07:00
Phillip Webb
e0030094e2 Fix missing jar entry certificates
Ensure that the source jar entry is closed before reading
certificates and code signers from the entry.

gh-19041
2020-09-15 08:42:58 -07:00
Phillip Webb
b8e6b2ef94 Merge branch '2.1.x' into 2.2.x 2020-09-14 13:51:24 -07:00
Phillip Webb
4138e59c33 Fix potential JarFileEntries ClassCastException
Update `JarFileEntries` so that the interface is obtained rather than
the concrete implementation. This allows `JarEntry` values to be used
without causing a ClassCastException.

Closes gh-19041
2020-09-14 13:48:59 -07:00
Phillip Webb
a20fdf8e6a Merge branch '2.1.x' into 2.2.x
Closes gh-23263
2020-09-13 22:45:39 -07:00
Phillip Webb
895ff9c72d Merge pull request #19041 from mathieufortin01
* pr/19041:
  Polish 'Fix signed jar performance issues'
  Fix signed jar performance issues
  Ignore Visual Studio Code Files

Closes gh-19041
2020-09-13 22:40:05 -07:00
Phillip Webb
c6a9696dd1 Polish 'Fix signed jar performance issues'
Update the performance improvements to push certificate loading
and storage into the `JarFileEntries` class. This allows us to
keep certificates without needing to cache all entry data. We
now also keep certificates and code signers in a dedicated class
which is set whenever the full jar stream as been read, even if
the contained values are `null`. The logic that assumes META-INF
entries are not signed has been removed in favor of delegating to
the streamed entry results.

See gh-19041
2020-09-13 22:28:45 -07:00
mathieufortin01
4d053e15d8 Fix signed jar performance issues
Update Spring Boot nested JarFile support to improve the performance of
signed jars. Prior to this commit, `certificates` and `codeSigners`
were read by streaming the entire jar whenever the existing values
were `null`. Unfortunately, the contract for `getCertificates` and
get `getCodeSigners` states that `null` is a valid return value. This
meant that full jar streaming would occur whenever either method was
called on an entry that had no result. The problem was further
exacerbated by the fact that entries might not be cached.

See gh-19041
2020-09-13 22:14:03 -07:00
Phillip Webb
17e2d72bcb Fix Windows path issue in JarFileWrapperTests
See gh-22991
2020-08-19 10:33:23 -07:00
Phillip Webb
3fe2005e06 Use @AfterEach to close the source jar file
Update `JarFileWrapperTests` so that the jar files are closed after each
test.

See gh-22991
2020-08-19 10:22:10 -07:00
Phillip Webb
2a137a2d8a Remove Mockito from JarFileWrapperTests
Remove Mockto from JarFileWrapperTests since it seems to be failing on
later versions of Java.

See gh-22991
2020-08-18 16:20:05 -07:00
Phillip Webb
4e76138ebc Update copyright year of changed files 2020-08-18 15:37:59 -07:00
Phillip Webb
5997cbd21f Refine AbstractJarFile method visibility
Refine method visibility in an attempt to fix test issues on Java 11+.

See gh-22991
2020-08-18 15:37:37 -07:00
Phillip Webb
aac367e9c5 Attempt to fix memory leak in JarFile class
Create a new `JarFileWrapper` class so that we can wrap and existing
`JarFile` and offer a version that can be safely closed.

Prior to this commit, we provided wrapper functionality in the `JarFile`
class itself. Unfortunately, because we override `close` and also create
a lot of wrappers this caused memory issues when running on Java 11.

With Java 11 `java.util.zip.ZipFile` class uses `FinalizableResource`
for any implementation that overrides `close()`. This means that any
wrapper classes will not be garbage collected until the JVM finalizer
thread runs.

Closes gh-22991
2020-08-18 14:07:03 -07:00
Andy Wilkinson
f4508b4059 Merge branch '2.1.x' into 2.2.x
Closes gh-22547
2020-07-24 11:54:12 +01:00
Nelson Osacky
e41a53cf85 Add Gradle Enterprise Extension
This adds build caching and build scans.

The changes required disabling scans when using the maven invoker
plugin in order to not cause duplicate build scans when invoking other
maven builds. There is also an empty `.mvn` folder in the
spring-boot-starters project to prevent duplicate build scans as well
since there is no way to pass properties to the maven-javadoc-plugin.

The checkstyle plugin was causing a cache miss with the
`propertyExpansion` because it contains an absolute path. The absolute
path is now ignored and instead the files are added as inputs to the
checkstyle plugin. This only enables the local build cache. The remote
cache is not yet enabled.

On my local machine:

./mvnw clean install build times go from about 30 minutes to about 10 minutes.
./mvnw clean install -Pfull build times go from about 60 minutes to about 13 minutes.

See gh-22089
2020-07-24 11:47:24 +01:00
Phillip Webb
50e9674631 Backport "Attempt to prevent JarFiles from being left open"
Update `JarFile` so that `super.close()` is called early so that the
file is not left open. Since we re-implement `JarFile` methods to work
directly on the underlying `RandomAccessDataFile`, it should be safe
to close immediately.

Closes gh-21177
2020-04-27 19:03:52 -07:00
Phillip Webb
7d53f7d27f Attempt to prevent JarFiles from being left open
Update `JarFile` to also call `super.close()` early for nested jars.

See gh-21126
2020-04-25 22:20:53 -07:00
Phillip Webb
7c6e912463 Attempt to prevent JarFiles from being left open
Update `JarFile` so that `super.close()` is called early so that the
file is not left open. Since we re-implement `JarFile` methods to work
directly on the underlying `RandomAccessDataFile`, it should be safe
to close immediately.

See gh-21126
2020-04-25 13:03:07 -07:00
Phillip Webb
6bf933205c Merge branch '2.1.x' into 2.2.x
Fixes gh-21073
2020-04-21 17:21:32 -07:00
Phillip Webb
c85918b8b3 Create new JarFile instance for URL connections
Update `JarURLConnection` to ensure that when connections are opened
a new copy of the JarFile is provided.

Prior to this commit, a single `JarFile` instance was shared which meant
that it could be accidental closed if accessed via
`JarURLConnection.getJarFile()`. If the underlying jar file is closed
then it's possible for a `NoClassDefFoundError` to be thrown if running
on JDK 11 with an active `SecurityManager`.

Closes gh-17796
2020-04-21 16:32:51 -07:00
Stephane Nicoll
1dd8dcc6c9 Polish "Polish JarFile to extra anonymous inner class"
See gh-20882
2020-04-15 09:39:00 +02:00
Konrado85
e0d1cf0e38 Polish JarFile to extra anonymous inner class
See gh-20882
2020-04-15 09:33:24 +02:00
Stephane Nicoll
579a6ac254 Adapt tests for support for Java 14
See gh-20576
2020-03-19 14:54:33 +01:00
Andy Wilkinson
b7e250eb04 Merge branch '2.1.x' into 2.2.x 2020-01-15 20:45:24 +00:00
Andy Wilkinson
ebebe09a9d Fix file handle leak in JarFileTests
The JarFile was not being closed which linked a file handle and caused
a test failure on Windows.

The local variable has been renamed as, when declared in a
try-with-resources, Checkstyle was confused by the shadowing of the
jarFile field and required references to jarFile within the try-block
the be prefixed with this.

See gh-19595
2020-01-15 20:43:54 +00:00
Madhura Bhave
3bf943d597 Merge branch '2.1.x' into 2.2.x
Closes gh-19713
2020-01-14 18:51:50 -08:00
Madhura Bhave
91e459a5d4 Polish "Limit ChronoField values to their range"
See gh-19595
2020-01-14 18:26:01 -08:00
Dmytro Nosan
9bc68b9877 Limit ChronoField values to their range
See gh-19595
2020-01-14 18:25:28 -08:00
Johnny Lim
ea51947741 Use try-with-resources blocks in JarFileArchiveTests
See gh-18883
2019-11-06 08:01:50 +01:00
Stephane Nicoll
8108b556ad Fix resource cleanup in test
Closes gh-18569
2019-10-13 13:41:50 +02:00
Andy Wilkinson
46c30d6bb0 Merge branch '2.1.x'
Closes gh-18476
2019-10-02 10:48:57 +01:00
Andy Wilkinson
3d4157ad6d Correct SCM URLs in published poms
Previously, Maven's default behaviour was relied up which resulted
in the artifact ID being appended to each URL as it was inherited.
This behaviour can only be disabled in Maven 3.6 and later, a version
that we cannot use due to an incompatibility with the Flatten Plugin.

This commit works around Maven's default behaviour by defining
properties for the SCM URL, connection, and developer connection and
then explicitly defining the settings in each pom using these
properties. The explicit definition of the properties in each pom
prevents them being inherited from the parent, thereby disabling the
unwanted appending of the artifact ID to the URL.

Fixes gh-18328
2019-10-02 10:48:30 +01:00
Andy Wilkinson
02ac089767 Polish "Support zip64 jars"
See gh-16091
2019-09-20 14:35:19 +01:00
Camille Vienot
1917e1eac5 Support zip64 jars
See gh-16091
2019-09-20 12:44:04 +01:00
Andy Wilkinson
1b237de5f5 Use Awaitility in our own tests
Closes gh-18227
2019-09-13 20:50:14 +01:00
Andy Wilkinson
ff1983c9ae Merge branch '2.1.x'
Closes gh-18168
2019-09-06 14:38:45 +01:00
Andy Wilkinson
795c2f225f Support getComment() on a nested JarFile
Previously, calling getComment() on a nested jar file would result
in the outer jar file's comment being returned.

This commit updates the loader's JarFile to read the file's comment
from the central directory end record and return it from getComment().

Fixes gh-18128
2019-09-06 14:29:48 +01:00
thelproad
9c1f503e46 Simplify if statements
See gh-17884
2019-08-17 06:50:32 +02:00
dreis2211
b605cddb10 Polish some Collections API calls
See gh-17825
2019-08-11 10:36:10 +02:00
Madhura Bhave
8a9c60a29a Merge branch '2.1.x' 2019-08-08 11:52:50 -07:00
Madhura Bhave
541d3c4853 Fix typo 2019-08-08 11:52:05 -07:00
Phillip Webb
8bc780762a Merge branch '2.1.x' 2019-07-24 11:42:48 +01:00
Phillip Webb
fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 2019-07-24 11:41:32 +01:00
Phillip Webb
913e831f4e Merge '1.5.x' into 2.0.x 2019-07-24 11:39:58 +01:00
Stephane Nicoll
19eaf86efa Update multi release test jar to include Java 12
See gh-16970
2019-07-24 08:06:22 +02:00
Phillip Webb
a9ba7080ce Merge branch '2.1.x' 2019-07-17 21:48:42 +01:00