Commit Graph

2885 Commits

Author SHA1 Message Date
Phillip Webb
4af9ed4d1d Fix Tomcat TldScanner issues by returning raw zip data for nested jars
Update JarUrlConnection so that the full raw zip data is returned from
nested jars when no entry name is specified. This update allows
Tomcat's `WarURLConnection` to work with our nested connections since
they can parse the returned raw zip data.

Fixes gh-38047
2023-10-26 23:00:20 -07:00
Phillip Webb
bba323ba5f Copy zip data descriptor records when creating virtual zip data
The zip specification states that when 'bit 3' of the general purpose
flags is set then a data descriptor record must be present. Prior to
this commit, our `VirtualZipDataBlock` ignored such records and would
create invalid data.

Although the generated data would work for zip parsers that read the
central directory records, it causes problems with streaming reader
implementations such as `JarInputStream`.

This commit updates the code so that it now copies the data descriptor
records. It support both blocks that have a signature and those that
don't. It also updates the generation logic to correctly deal with
any extra data bytes present after the local file header record.

Fixes gh-38063
2023-10-26 23:00:20 -07:00
Phillip Webb
b35c4d6497 Open loader jar URLs by default using runtimeVersion
Update `UrlJarFileFactory` so that `runtimeVersion` is used by default
instead of `baseVersion`. Prior to this commit we tried to mirror the
JDK handler on look for a `#runtime` fragment. This unfortunately
doesn't work with the URLs produced by `URLClassPath`.

This commit also fixes a bug in `NestedJarFile` where we didn't return
the correct result from `hasEntry`.

Fixes gh-38050
2023-10-25 21:20:42 -07:00
Andy Wilkinson
b167eb3b02 Merge branch '3.1.x' 2023-10-25 14:50:30 +01:00
Andy Wilkinson
4dea11ef96 Merge branch '3.0.x' into 3.1.x 2023-10-25 14:50:21 +01:00
Andy Wilkinson
ead0c77a5b Polish
See gh-38030
2023-10-25 14:50:07 +01:00
Andy Wilkinson
0d1a223fee Merge branch '3.1.x'
Closes gh-38032
2023-10-25 14:08:22 +01:00
Andy Wilkinson
649117de35 Merge branch '3.0.x' into 3.1.x
Closes gh-38031
2023-10-25 14:08:10 +01:00
Andy Wilkinson
331bf51332 Merge branch '2.7.x' into 3.0.x
Closes gh-38030
2023-10-25 14:07:57 +01:00
Andy Wilkinson
666f68ea60 Document configuration for building images with Colima
Closes gh-34522
2023-10-25 14:07:43 +01:00
Phillip Webb
4e7c0737d4 Fix PropertiesLauncher classpath detection without 'loader.path' set
Update `PropertiesLauncher` to restore classpath detection logic applied
when no `loader.path` property is set.

Fixes gh-37992
2023-10-24 17:03:18 -07:00
Johnny Lim
b5d4983829 Polish
See gh-37984
2023-10-23 11:15:27 +02:00
Phillip Webb
e1bd24695d Try @AssertFileChannelDataBlocksClosed for Windows fix
This updates commit dad5dc6750 to
see if @AssertFileChannelDataBlocksClosed will take care of
closing files.

See gh-7161
2023-10-20 10:05:43 -07:00
Andy Wilkinson
d13d38a141 Trim multiple leading slashes in NestedLocation
See gh-37668
2023-10-20 11:55:35 +01:00
Andy Wilkinson
88bf3dfba2 Close byte channel created by newByteChannelReturnsByteChannel
See gh-7161
2023-10-20 11:22:16 +01:00
Andy Wilkinson
dad5dc6750 Try to fix NestedFileSystemProviderTests on Windows
See gh-7161
2023-10-20 10:56:08 +01:00
Andy Wilkinson
4161eb1853 Fix path handling in NestedLocation on Windows
See 4b495ca
See gh-37668
2023-10-20 09:15:54 +01:00
Phillip Webb
3eeb1b2849 Merge branch '3.1.x' 2023-10-19 23:21:42 -07:00
Phillip Webb
7c864804d5 Merge branch '2.7.x' into 3.0.x 2023-10-19 23:21:08 -07:00
Phillip Webb
d47f8bf945 Update copyright year of changed files 2023-10-19 23:20:43 -07:00
Phillip Webb
d638bbb0ba Merge branch '3.1.x'
Closes gh-37967
2023-10-19 21:25:44 -07:00
Phillip Webb
1d456e09d2 Merge branch '3.0.x' into 3.1.x
Closes gh-37966
2023-10-19 21:12:52 -07:00
Phillip Webb
a0b999c8b4 Merge branch '2.7.x' into 3.0.x
Closes gh-37965
2023-10-19 20:55:51 -07:00
Phillip Webb
abdad1cabe Constently use assertThatExceptionOf... assertions
Closes gh-37964
2023-10-19 20:17:26 -07:00
Phillip Webb
b8365e3118 Fix misconfigured Maven test
See gh-37669
2023-10-18 22:58:45 -07:00
Phillip Webb
3c62defb9d Support java.nio.file Paths and FileSystems with nested jars
Add a `NestedFileSystemProvider` implementation so that the JDK's
`ZipFileSystem` can load content from nested jars and nested
directory entries.

Creating a `ZipFileSystem` may be a relatively expensive operation as
zip structures need to be parsed and in the case of directory entries
a virtual datablock nees to be generated on the fly. As such, we
install the `ZipFileSystem` as late as possible since in a typical
application it may never be needed.

This commit also tweaks Gradle and Maven plugins to ensure that the
service loader file is written to repackaged jars.

Closes gh-7161
2023-10-18 20:46:36 -07:00
Phillip Webb
4b495ca2a9 Change NestedLocation to hold a Path rather than a File
Refactor `NestedLocation` so that it holds a `Path` rather than a
`File`.

See gh-37668
2023-10-18 20:46:35 -07:00
Andy Wilkinson
1559485f56 Fix Gradle plugin test classpath after Kotlin upgrade
See gh-37926
2023-10-18 14:07:49 +01:00
Phillip Webb
33c5e1269a Write signature files to uber jars to for Oracle Java 17 verification
Update Gradle and Maven plugins to write an empty `META-INF/BOOT.SF`
file whenever there is a nested signed jar.

This update allows Oracle Java 17 to correctly verify the nested JARs.
The file is required because `JarVerifier` has code roughly equivalent
to:

	if (!jarManifestNameChecked && SharedSecrets
			.getJavaUtilZipFileAccess().getManifestName(jf, true) == null) {
    	throw new JarException("The JCE Provider " + jarURL.toString() +
    		" is not signed.");
	}

The `SharedSecrets.getJavaUtilZipFileAccess().getManifestName(jf, true)`
call ends up in `ZipFile.getManifestName(onlyIfSignatureRelatedFiles)`
which is a private method that we cannot override in our `NestedJarFile`
subclass. By writing an empty `.SF` file we ensure that the `Manifest`
is always returned because there are always "signature related files".

Fixes gh-28837
2023-10-16 16:19:16 -07:00
Andy Wilkinson
d6a9295c26 Allow additional build info properties to have provided values
Closes gh-37889
2023-10-16 18:15:42 +01:00
Andy Wilkinson
084bd3a420 Merge branch '3.1.x' 2023-10-13 21:38:06 +01:00
Andy Wilkinson
ccaa54436b Merge branch '3.0.x' into 3.1.x 2023-10-13 21:37:56 +01:00
Andy Wilkinson
b1eb08faba Merge branch '2.7.x' into 3.0.x 2023-10-13 21:37:44 +01:00
Andy Wilkinson
3dba0d76d2 Polish
See gh-37878
2023-10-13 21:17:12 +01:00
Andy Wilkinson
2231244d2c Merge branch '3.1.x' 2023-10-13 20:42:15 +01:00
Andy Wilkinson
e957c3087c Merge branch '3.0.x' into 3.1.x 2023-10-13 20:36:51 +01:00
Andy Wilkinson
c25e532aeb Merge branch '2.7.x' into 3.0.x 2023-10-13 20:36:32 +01:00
Andy Wilkinson
dbc06faed8 Polish
See gh-37878
2023-10-13 20:36:16 +01:00
Andy Wilkinson
60f05eaa94 Merge branch '3.1.x'
Closes gh-37882
2023-10-13 16:01:47 +01:00
Andy Wilkinson
5af13d191f Merge branch '3.0.x' into 3.1.x
Closes gh-37881
2023-10-13 16:01:32 +01:00
Andy Wilkinson
ae2693b7f1 Merge branch '2.7.x' into 3.0.x
Closes gh-37880
2023-10-13 16:01:14 +01:00
Andy Wilkinson
42ee6b9e74 Use new permissions API with Gradle 8.3+
Closes gh-37878
2023-10-13 16:00:54 +01:00
Johnny Lim
446677375e Polish gh-35082
See gh-37831
2023-10-12 14:17:02 +02:00
Andy Wilkinson
bdaf7a7603 Merge branch '3.1.x'
Closes gh-37830
2023-10-11 15:06:09 +01:00
Andy Wilkinson
411586347c Merge branch '3.0.x' into 3.1.x
Closes gh-37829
2023-10-11 15:04:21 +01:00
Andy Wilkinson
781ac2ece2 Merge branch '2.7.x' into 3.0.x
Closes gh-37828
2023-10-11 15:02:36 +01:00
Andy Wilkinson
5a75fae23b Polish "Polish"
See gh-37745
2023-10-11 14:58:04 +01:00
Johnny Lim
303015ea2d Polish
See gh-37745
2023-10-11 14:57:38 +01:00
Andy Wilkinson
d0486ef43f Merge branch '3.1.x'
Closes gh-37827
2023-10-11 14:47:35 +01:00
Andy Wilkinson
40461488db Merge branch '3.0.x' into 3.1.x
Closes gh-37826
2023-10-11 14:47:23 +01:00