120 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Madhura Bhave
541d3c4853 Fix typo 2019-08-08 11:52:05 -07: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
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
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
Andy Wilkinson
a5ae1de706 Fix spring-boot-loader's tests on Windows
Closes gh-17275
2019-06-20 11:08:35 +01:00
Andy Wilkinson
7d59b78829 Fix handling of jar files with + chars in their path
Closes gh-17208
2019-06-17 10:31:51 +01:00
Andy Wilkinson
c12ccfb342 Close JarFile if failure occurs during construction
Fixes gh-17123
2019-06-12 12:59:14 +01:00
Andy Wilkinson
24925c3dae Merge branch '2.0.x' into 2.1.x
Closes gh-17078
2019-06-07 10:50:34 +01:00
Andy Wilkinson
c6c139d980 Merge branch '1.5.x' into 2.0.x 2019-06-07 10:46:31 +01:00
Phillip Webb
ccfbd03482 Merge branch '2.0.x' into 2.1.x 2019-06-04 02:07:14 -07:00
Phillip Webb
b442d3b906 Merge branch '1.5.x' into 2.0.x 2019-06-04 01:49:03 -07:00
Andy Wilkinson
864942ad4f Merge branch '2.0.x' into 2.1.x 2019-03-28 09:35:53 +00:00
Andy Wilkinson
ba4671f0ab Merge branch '1.5.x' into 2.0.x 2019-03-27 19:59:36 +00:00
Andy Wilkinson
4900505425 Merge branch '2.0.x' into 2.1.x 2019-03-26 13:53:57 +00:00
Andy Wilkinson
fedb40a2bf Merge branch '1.5.x' into 2.0.x 2019-03-26 13:48:32 +00:00
Stephane Nicoll
567a82f4ba Update multi release test jar to include Java 12
See gh-16212
2019-03-25 16:13:24 +01:00
Andy Wilkinson
e23f72c8b0 Merge branch '2.0.x' into 2.1.x 2019-03-20 16:53:48 +00:00
Andy Wilkinson
9fbd38ab3c Merge branch '1.5.x' into 2.0.x 2019-03-20 16:45:26 +00:00
Andy Wilkinson
a36aa67b52 Merge branch '2.0.x' into 2.1.x 2019-03-19 17:04:41 +00:00
Spring Operator
3e2b6ac8ed Update build and setup configuration to use HTTPS
See gh-16246
2019-03-19 16:58:31 +00:00
Andy Wilkinson
68e3de0357 Use name from header not alias when checking entry has expected name
Previously, an entry’s potentially aliased name would be used when
checking that it has a particular name. The alias would always be
applied, irrespective of the name in the header. As a result, when
there was a clashing hash and an entry with a particular index did
not have the expected name, this would be concealed by the alias
being applied and the name check being done with the alias.

This commit reworks JarEntry to store the name in its header in
addition to its alias, if any. When checking that the entry has the
expected name, the unaliased name is passed in and the entry compares
it with the name from the header rather than the alias.

Closes gh-15981
2019-02-18 17:29:25 +00:00
Andy Wilkinson
8a7958ef55 Do not use reflection to fall back to JDKs jar URLStreamHandler
Closes gh-15844
2019-02-05 10:59:32 +00:00
Stephane Nicoll
51d3626c3b Merge branch '2.0.x' into 2.1.x 2018-12-20 17:59:33 +01:00
dreis2211
27e89bbb8a Optimize StringSequence
Closes gh-15473
2018-12-20 17:55:30 +01:00
Stephane Nicoll
7dbe70dc61 Merge branch '2.0.x' into 2.1.x 2018-12-17 18:26:36 +01:00
Stephane Nicoll
c0b07a9429 Polish "Fix StringSequence.equals() for different lengths"
Closes gh-15465
2018-12-17 18:24:08 +01:00
dreis2211
2a0680c2ba Fix StringSequence.equals() for different lengths
See gh-15465
2018-12-17 18:20:09 +01:00
Stephane Nicoll
ef40241bf6 Merge branch '2.0.x' into 2.1.x 2018-12-05 15:56:04 +01:00
dreis2211
d864b427eb Remove unused ByteArrayStartsWith matcher
Closes gh-15386
2018-12-05 15:52:42 +01:00
Andy Wilkinson
3fac0f0360 Polish multi-release jar support to avoid possible StackOverflowError
See gh-12523
2018-11-20 17:26:28 +00:00
Andy Wilkinson
56eebc9385 Update fat jar loader to support multi-release jar files
Closes gh-12523
2018-11-20 15:22:30 +00:00
Phillip Webb
f3fa20b2d1 Polish 2018-10-29 14:25:45 -07:00
dreis2211
e68b9e8322 Remove unnecessary parameters for String.substring
Closes gh-14661
2018-10-03 09:34:56 +02:00
Phillip Webb
d76bba5e6f Migrate from ExpectedException rule to AssertJ
Replace ExpectedException JUnit rules with AssertJ exception
assertions.

Closes gh-14336
2018-10-02 10:55:28 -07:00
Phillip Webb
11b1318cad Reduce GC pressure in JAR handler
Update the JAR `Hander` so that URL `startsWith` checks produce less
garbage. Comparisons are now performed first on the `path` rather than
the full `toString`. URL `toString` operations produce quite a lot of
garbage since a `StringBuilder` is always used.

In addition, we now also cache the JarFile URL toString to save repeated
calculation.

Closes gh-14561
2018-09-20 22:33:19 -07:00
Phillip Webb
2e2f91d4a0 Merge branch '1.5.x' into 2.0.x 2018-08-30 15:59:02 -07:00
Andy Wilkinson
29e38f4af8 Merge branch '1.5.x' into 2.0.x 2018-08-13 11:35:46 +01:00
Stephane Nicoll
21691f0b20 Merge branch '1.5.x' into 2.0.x 2018-08-08 14:46:55 +02:00