396 Commits

Author SHA1 Message Date
Phillip Webb
c4e41305d5 Prevent Tomcat URL "reflective access" warnings
Update the jar `Handler` class to support a non-reflective fallback
mechanism when possible. The updated code attempts to capture a regular
jar URL before our handler is installed. It can then use that URL as
context when creating the a fallback URL. The JDK jar `Handler` will
be copied from the context URL to the fallback URL.

Without this commit, resolving new Tomcat URLs of the form
`jar:war:file:...` would result in an ugly "Illegal reflective access"
warning.

Fixes gh-18631
2020-12-17 20:43:41 -08:00
Phillip Webb
4fba7d0c60 Merge branch '2.3.x' into 2.4.x 2020-12-15 19:48:52 -08:00
Phillip Webb
29300530c6 Polish 2020-12-15 19:44:40 -08:00
Phillip Webb
cd5ff6e4af Merge branch '2.3.x'
Closes gh-24404
2020-12-08 12:13:02 -08:00
Phillip Webb
11f285bde5 Merge branch '2.2.x' into 2.3.x
Closes gh-24403
2020-12-08 12:12:51 -08:00
Andy Wilkinson
bbad377ecc Merge branch '2.3.x'
Closes gh-24017
2020-11-03 18:00:22 +00:00
Andy Wilkinson
f3d4b3e5ac Allow entries to be streamed from JarURLConnections' jar file
Fixes gh-23821
2020-11-03 17:59:38 +00:00
Santhoshkumar. P
5cb07e292d Polish empty string checks
See gh-23550
2020-10-05 10:38:47 +02:00
Andy Wilkinson
558c2b4591 Merge branch '2.3.x'
Closes gh-23501
2020-09-26 09:17:08 +01:00
Andy Wilkinson
9bd040cb0f Merge branch '2.2.x' into 2.3.x
Closes gh-23500
2020-09-26 09:16:46 +01:00
Andy Wilkinson
e74f777971 Remove use of spring-core's Assert from PropertiesLauncher
Fixes gh-23474
2020-09-26 09:11:05 +01:00
Stephane Nicoll
37ded9f6d3 Merge branch '2.2.x' into 2.3.x
Closes gh-23446
2020-09-22 10:10:24 +02: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
3fca8c6b4e Merge branch '2.2.x' into 2.3.x
Closes gh-23441
2020-09-21 22:27:45 -07: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
5b74d464a6 Merge branch '2.3.x' 2020-09-15 08:48:51 -07:00
Phillip Webb
5c1055dc22 Merge branch '2.2.x' into 2.3.x 2020-09-15 08:48:25 -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
433b357423 Merge branch '2.3.x' 2020-09-14 13:53:00 -07:00
Phillip Webb
a249a1a3d1 Merge branch '2.2.x' into 2.3.x 2020-09-14 13:52:22 -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
3a8c15af0d Merge branch '2.3.x'
Closes gh-23265
2020-09-13 22:50:28 -07:00
Phillip Webb
45275e6586 Merge branch '2.2.x' into 2.3.x
Closes gh-23264
2020-09-13 22:49:21 -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
Andy Wilkinson
6619dfacf3 Merge branch '2.3.x'
Closes gh-23241
2020-09-10 10:03:09 +01:00
Andy Wilkinson
e7e77a917f Align PropertiesLauncher's close behavior with JarLauncher
Previously, PropertiesLauncher would close each archive that it
iterated over when creating its ClassLoader. This was not aligned
with JarLauncher's behaviour and left the ClassLoader with closed
archives. The close was introduced in [1] and became more apparent
following the change to fail operations on closed archives [2].

This commit updates Launcher to remove the close() that was added in
[1]. This aligns the behavior of PropertiesLauncher with JarLauncher
and ensures that the ClassLoader does not have entries backed by
closed archives on its classpath.

Fixes gh-23165

[1] ad72f86bdb
[2] ed7a5db174
2020-09-10 09:40:44 +01:00
dreis2211
33cd875cb8 Simplify InputStream assertions
See gh-23052
2020-08-24 11:35:17 +02:00
Phillip Webb
ea8bd75ba1 Merge branch '2.3.x' 2020-08-19 10:34:17 -07:00
Phillip Webb
73038267a0 Merge branch '2.2.x' into 2.3.x 2020-08-19 10:34:06 -07:00
Phillip Webb
17e2d72bcb Fix Windows path issue in JarFileWrapperTests
See gh-22991
2020-08-19 10:33:23 -07:00
Phillip Webb
bd5266b9b1 Merge branch '2.3.x' 2020-08-19 10:22:55 -07:00
Phillip Webb
0dd38a7264 Merge branch '2.2.x' into 2.3.x 2020-08-19 10:22:45 -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
cfc053d75e Merge branch '2.3.x' 2020-08-18 16:21:23 -07:00
Phillip Webb
c5b12effbf Merge branch '2.2.x' into 2.3.x 2020-08-18 16:21:03 -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
aa2580bb51 Merge branch '2.3.x' 2020-08-18 15:39:08 -07:00
Phillip Webb
ba2ab3363b Merge branch '2.2.x' into 2.3.x 2020-08-18 15:38:53 -07:00
Phillip Webb
60b5de192c Merge branch '2.2.x' into 2.3.x 2020-08-18 15:38:11 -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
b60820564e Merge branch '2.3.x'
Closes gh-22999
2020-08-18 14:35:59 -07:00
Phillip Webb
2b1b096fac Merge branch '2.2.x' into 2.3.x
Closes gh-22998
2020-08-18 14:35:45 -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
Stephane Nicoll
dac63fc3e5 Polish 2020-08-06 17:35:01 +02:00