184 Commits

Author SHA1 Message Date
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
Phillip Webb
01933f9b06 Merge previously split strings
Merge some string lines that were previously split because of the
90 chars wide formatting.
2019-07-15 00:24:19 +01:00
Phillip Webb
c3816bfe7b Polish output capture names 2019-07-15 00:24:18 +01:00
Andy Wilkinson
bd22ca0268 Polish 2019-07-04 19:36:32 +01:00
Andy Wilkinson
2816635418 Polish 2019-07-04 17:51:20 +01:00
Andy Wilkinson
4b2a116fa7 Use String indexOf(char) and lastIndexOf(char) where possible
Closes gh-11416
2019-07-04 17:44:40 +01:00
Phillip Webb
a66c4d3096 Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
2019-07-03 11:39:47 -07:00
Andy Wilkinson
6791dbb786 Merge branch '2.1.x'
Closes gh-17381
2019-07-01 15:47:48 +01:00
Andy Wilkinson
4083c721f2 Fix URL normalization when replacing /./ with /
Previously, a regular expression of /./ was used to replace /./ with
/.  The '.'' in the expression matches any single character so the
replacement was more broadly applicable than it should have been. For
example, /a/ would be replaced with /.

This commit uses Pattern.LITERAL to compile the regular expression
from the CURRENT_DIR (/./) contant. This allows the constant to be
used to check for occurances of /./ in the string before attempting
replacement, while also ensuring that the '.' is treated literally.

Closes gh-17341
2019-07-01 15:42:54 +01:00
Phillip Webb
605599138e Merge branch '2.1.x' 2019-06-28 23:56:02 -07:00
Phillip Webb
92bff3c328 Merge branch '2.0.x' into 2.1.x 2019-06-28 23:42:28 -07:00
Phillip Webb
cfeb0239b7 Merge branch '1.5.x' into 2.0.x 2019-06-28 23:28:34 -07:00
Stephane Nicoll
e560b7f6ba Remove public modifier on JUnit5 lifecycle methods
See gh-17292
2019-06-21 18:09:05 +02:00
Andy Wilkinson
6d8ba654cc Merge branch '2.1.x'
Closes gh-17276
2019-06-20 11:17:37 +01:00