Commit Graph

2950 Commits

Author SHA1 Message Date
Phillip Webb
eb0040c225 Fix ZipCentralDirectoryFileHeaderRecord entry comment read offset
Update `ZipCentralDirectoryFileHeaderRecord.copyTo` comment read offset
to account for the record position.

Fixes gh-39166
2024-01-17 13:16:43 -08:00
Andy Wilkinson
6bfac1f860 Fix handling of nested: UNC paths on Windows
Closes gh-38956
2024-01-12 15:53:19 +00:00
Andy Wilkinson
7087897507 Merge branch '3.1.x' into 3.2.x
Closes gh-39091
2024-01-11 10:33:57 +00:00
Andy Wilkinson
45c32854a5 Fix Checkstyle upgrade
Closes gh-38746
2024-01-10 15:37:38 +00:00
Phillip Webb
e5f489f338 Restore manifest support for nested directory jars
Update `NestedJarFile` so that the `getManifest()` method returns the
manifest from the parent jar file for nested jars based on directory
entries.

This restores the previous behavior supported by Spring Boot 3.1 and
allows class methods such as `getPackage().getImplementationVersion()`
to return non `null` results.

Fixes gh-38996
2024-01-09 12:33:10 -08:00
Phillip Webb
f31ffbf927 Don't duplicate META-INF entries in nested directory jars
Update `ZipContent` so that `META-INF` entries are no longer duplicated
in nested jars created from directory entries. This aligns with the
behavior of the classic loader and prevents the same META-INF file from
being discovered twice.

Fixes gh-38862
2023-12-20 17:36:06 -08:00
Phillip Webb
246a0e6f21 Merge branch '3.1.x'
Closes gh-38878
2023-12-19 23:10:49 -08:00
Yanming Zhou
8cb8999772 Ban call of URLEncoder.encode/URLDecoder.decode(String,String)
Add ArchUnit rules to ban the use of `URLEncoder` calls with String
charsets and use `Charset` calls instead.

See gh-38740
2023-12-19 23:10:18 -08:00
Phillip Webb
5354ad15b3 Merge branch '3.1.x'
Closes gh-38877
2023-12-19 22:51:48 -08:00
Yanming Zhou
b6e87cee35 Remove unnecessary extends Object from generic
See gh-38739
2023-12-19 22:38:19 -08:00
Yanming Zhou
ac18e3015c Use .isEmpty() where feasible
See gh-38739
2023-12-19 22:38:05 -08:00
Phillip Webb
88429b6a66 Use file urls for unpacked jars
Update `JarFileArchive` so that unpacked jars use `file:` URLs rather
than `jar:file:`. This aligns with the behavior of Spring Boot 3.1 and
allows calls to `class.getSigners()` to work again.

Fixes gh-38833
2023-12-17 10:55:31 -08:00
Phillip Webb
b4a4e91238 Update ZipString to deal with reads that do not return all data
Refine the logic in `ZipString.hash` and `ZipString.compare` to deal
with the fact a read operation may not return all available bytes.

Fixes gh-38751
2023-12-13 13:29:37 -08:00
Moritz Halbritter
e81d1226fe Prevent integer overflow when checking disk space 2023-12-12 16:26:58 +01:00
Moritz Halbritter
a242bd81e2 Merge branch '3.1.x'
Closes gh-38747
2023-12-12 13:55:44 +01:00
Yanming Zhou
3c65fdfa12 Use idiomatic AssertJ assertions
See gh-38702
2023-12-12 13:53:20 +01:00
Phillip Webb
ea87787279 Merge branch '3.1.x'
Closes gh-38741
2023-12-11 20:37:45 -08:00
Phillip Webb
39bc7c8582 Support getPermissions() call on Gradle 8.6-milestone-1
The `getPermissions` method is now part of the private
`ParentDirectoryStub` class so we now need to call
`setAccessible(true)`.

Fixes gh-38718
2023-12-11 20:35:06 -08:00
Moritz Halbritter
6330190913 Merge branch '3.1.x'
Closes gh-38728
2023-12-11 09:44:19 +01:00
Yanming Zhou
ebfbc0ef05 Cleanup kotlin sources
1. remove unused imports
2. remove redundant semicolon
3. remove empty class body
4. remove redundant 'constructor' keyword
5. remove redundant 'Unit' return type
6. use non-null type if possible

See gh-38708
2023-12-11 09:23:42 +01:00
Andy Wilkinson
e6970243ee Retry read on ClosedByInterruptException
In gh-38154, we started handling ClosedByInterruptException. The
FileChannel was repaired by recreating it and then the exception was
rethrown. This allowed other threads to use the channel that had been
read by an interrupted thread while allowing that interruption to
continue.

This approach has proven to be insufficient as there are scenarios
where the read needs to succeed on the interrupted thread. This
commit updates the handling of ClosedByInterruptException so that
this is the case. The FileChannel is recreated as before but the
thread's interrupted flag is now cleared before retrying the read.
The flag is then reinstated so that any subsequent actions that
should fail due to the interruption will do so.

We could clear and reinstate the interrupted flag before the first
read, rather than catching ClosedByInterruptException. This approach
was rejected as it will have an impact on the performance of the
happy path where the thread hasn't been interrupted.

Fixes gh-38611
2023-12-07 10:49:40 -08:00
Phillip Webb
359a6cb5bb Use encoded version of path for jar URLs
Update `JarUrl` so that the encoded version of the path is used.
This allows jars to placed in directories with `#` or `!` in the
name.

Fixes gh-38660
2023-12-06 16:20:27 -08:00
Phillip Webb
847daf484c Fix JarUrlTests
Fix `JarUrlTests` to use the jarFile rather than temp.
2023-12-06 16:19:57 -08:00
Andy Wilkinson
49990afd78 Polish
See gh-38592
2023-12-05 20:49:34 +00:00
Andy Wilkinson
16c2ddb02c Merge branch '3.1.x'
Closes gh-38665
2023-12-05 20:31:17 +00:00
Andy Wilkinson
b424254587 Test Gradle plugin against Gradle 8.5
Closes gh-38664
2023-12-05 20:30:54 +00:00
Moritz Halbritter
d172b22064 Escape pipe symbol in properties changelog table cells
Closes gh-38515
2023-11-30 11:37:25 +01:00
Phillip Webb
6fd691af58 Allow FileSystems to be create by splitting URLs
Relax the constraint that a `NestedLocation` must have a nested entry
name specified so that URLs can be split and rebuilt.

Prior to this commit, given a URL of the following form:

	jar:nested:/myjar.jar!/nested.jar!/my/file

It was possible to create a FileSystem from
"jar:nested:/myjar.jar!/nested.jar" and from that create a path to
"my/file".

However, it wasn't possible to create a FileSystem from
"jar:nested:/myjar.jar", then create another file system from the path
"nested.jar" and then finally create a path to "/nested.jar".

This was because `nested:/myjar.jar` was not considered a value URL
because it didn't include a nested entry name.

Projects such as `JobRunr` were relying on the ability to compose file
systems, so it makes sense to remove our somewhat artificial
restriction.

Fixes gh-38592
2023-11-28 22:14:29 -08:00
Phillip Webb
9a0f95420a Update NestedByteChannel.read to read all possible data when
Update `NestedByteChannel.read` so that it loops until all
remaining data has been read into the buffer. Prior to this
commit, it was possible for to read only some bytes into the
buffer. Although it looks like this should be OK according to
the API documentation, the `ZipFileSystem` relies on all
remaining bytes being returned.

Fixes gh-38595
2023-11-28 22:14:29 -08:00
Phillip Webb
8c7e8778a6 Fix NegativeArraySizeException caused by missing unsigned conversion
Update `ZipContent` so that `eocd.totalNumberOfCentralDirectoryEntries`
is converted from a short to an unsigned int to prevent a negative
number from being used.

This commit also updates the code to consistently use `X.toUnsigned...`
helper methods rather than using bitwise operators.

Fixed gh-38572
2023-11-27 23:33:15 -08:00
Phillip Webb
0856e10443 Fix IndexOutOfBoundsException exception from parseUrl with empty spec
Update jar `Handler` code so that the `parseUrl` method can accept an
empty `spec`. Prior to this commit, a `classLoader.getResource("")`
call would result in a `null` result. This breaks a number of things
including `ClassPathResource` and `PathMatchingResourcePatternResolver`.

Fixes gh-38524
2023-11-23 14:35:04 -08:00
Johnny Lim
f9f73aa146 Polish
See gh-38508
2023-11-23 09:39:01 +01:00
Johnny Lim
175b6473c7 Polish
See gh-38389
2023-11-22 10:16:19 +01:00
Scott Frederick
d433deb737 Merge branch '3.0.x' into 3.1.x
Closes gh-38485
2023-11-21 17:30:54 -06:00
Scott Frederick
dabcebf8a3 Merge branch '2.7.x' into 3.0.x
Closes gh-38484
2023-11-21 17:30:07 -06:00
Scott Frederick
d1cce0f8ef Upgrade default CNB builders to Paketo Jammy
Closes gh-38477
2023-11-21 17:22:32 -06:00
Phillip Webb
6c3dec42e0 Add container support for Oracle Free which replaces Oracle XE
Update Docker Compose and Testcontainers support to work with
`gvenzl/oracle-free` which replaces `gvenzl/oracle-xe`.

Closes gh-38476
2023-11-21 11:51:59 -08:00
Phillip Webb
3a32e4e913 Merge branch '3.1.x'
Closes gh-38405
2023-11-20 16:27:46 -08:00
Phillip Webb
f68df82b30 Support lenient ContainerConnectionDetailsFactory hint registration
Update `ContainerConnectionDetailsFactory` hint registration logic
so that types are optional on the classpath.

See gh-36606
Fixes gh-38392
2023-11-20 16:26:22 -08:00
Moritz Halbritter
82f0684cd8 Merge branch '3.1.x'
Closes gh-38354
2023-11-14 17:04:41 +01:00
Moritz Halbritter
22a991b334 Document tags format used in Gradle and Maven plugins
Closes gh-33088
2023-11-14 17:03:50 +01:00
Phillip Webb
dbbde18d41 Attempt to fix Windows build failure due to open files
See gh-38204
2023-11-08 07:04:46 -08:00
Moritz Halbritter
b9a5bdc294 Merge branch '3.1.x'
Closes gh-38249
2023-11-07 11:28:52 +01:00
Moritz Halbritter
e549380a59 Merge branch '3.0.x' into 3.1.x
Closes gh-38248
2023-11-07 11:28:20 +01:00
Moritz Halbritter
3664877d80 Merge branch '2.7.x' into 3.0.x
Closes gh-38247
2023-11-07 11:24:16 +01:00
Andy Wilkinson
08a4a836aa Merge branch '3.1.x'
Closes gh-38233
2023-11-06 14:26:09 +00:00
Andy Wilkinson
b01235e68d Copy attributes from runtimeClasspath to productionRuntimeClasspath
Fixes gh-38209
2023-11-06 11:50:27 +00:00
Phillip Webb
c0f8b90d31 Return getLastModified result from JarUrlConnection
Update `JarUrlConnection` and `NestedUrlConnection` so that calls
to `getLastModified()` and `getHeaderFieldDate("last-modified", 0)`
always return a result.

Fixes gh-38204
2023-11-04 19:43:54 -07:00
Phillip Webb
77218a644e Merge branch '3.1.x' 2023-11-02 14:16:37 -07:00
Phillip Webb
afa4d274c2 Merge branch '3.0.x' into 3.1.x 2023-11-02 14:14:19 -07:00