Commit Graph

28 Commits

Author SHA1 Message Date
Andy Wilkinson ce77f48c3f Fall back to JVM's class path when TCCL is not a URLClassLoader
Previously, DevTools assumed that the TCCL was a URLClassLoader
when trying to determine the URLs that it should examine to determine
the locations that should be watched for triggering a restart. This
fails on Java 9 as the TCCL is not a URLClassLoader.

This commit updates the logic that determines the changeable URLs to
fall back to examining the JVM's class path when the TCCL is not a
URLClassLoader, typically because the application is running on Java
9. This fall back isn't a direct equivalent of the behaviour on Java 8
as the class path of the TCCL and the class path with which the JVM
was launched may not be the same. However, I consider the fix to be
reasonable for two reasons:

1. In reality, the class path of the TCCL and the class path with
   which the JVM was launched are the same.
2. There appears to be now to get the URLs on the class path of the
   TCCL on Java 9. There is a URLClassPath field, however Java 9's
   access restrictions prevent us from using it even if we resort to
   reflection.

Closes gh-10454
2017-09-29 12:17:26 +01:00
Andy Wilkinson b152b98f84 Improve diagnostics in DevTools integration tests
See gh-10454
2017-09-29 12:06:05 +01:00
Stephane Nicoll 8f8b1371b7 Disable devtools integration tests on Java 9
See gh-10454
2017-09-29 11:39:48 +02:00
Andy Wilkinson c3bc32db02 Polish and reinstate usage of FileSystemUtils.deleteRecursively
Closes gh-9942
2017-09-21 12:03:51 +01:00
Phillip Webb 2c97d3a5e9 Polish 2017-08-29 15:59:32 -07:00
Andy Wilkinson 09b41a33e8 Wait for process to exit when stopping DevTools integration test apps 2017-08-03 21:00:22 +01:00
Andy Wilkinson 53e8ade4d3 Improve diagnostics for delete failures in DevTools integration tests 2017-08-03 12:07:22 +01:00
Andy Wilkinson f7e9ec5f42 Minimise our usage of SocketUtils.findAvailableTcpPort
Closes gh-9382
2017-06-09 14:45:09 +01:00
Phillip Webb 425dbc3e52 Update copyright header for edited files 2017-03-06 15:04:07 -08:00
Phillip Webb 2a592103f0 Polish formatting 2017-03-06 15:03:43 -08:00
Andy Wilkinson 8f201d6de5 Merge branch '1.5.x' 2017-01-16 20:42:42 +00:00
Andy Wilkinson 69e7e31b1c Merge branch '1.4.x' into 1.5.x 2017-01-16 20:42:40 +00:00
Andy Wilkinson 7c2664f959 Ensure that jar entry names use forward slashes, even on Windows
Previously, in the DevTools integration tests, portions of a File's
path were used to create the name of a jar entry. On Windows this
resulted in the entry containing \ characters. As a result the
directory structure was incorrect and the classes could not be loaded
from the jar.

This commit ensures that any \ characters are replaced with /
characters.

See gh-7782
2017-01-16 20:42:04 +00:00
Spring Buildmaster 9057f9ae1f Next development version 2016-12-23 00:15:23 +00:00
Stephane Nicoll a86678cc31 Merge branch '1.5.x' 2016-12-14 19:33:34 +01:00
Johnny Lim 6d1b752ffe Polish
Closes gh-7552
2016-12-14 19:14:24 +01:00
Andy Wilkinson 3c873b08fc Merge branch '1.5.x' 2016-12-02 13:41:22 +00:00
Andy Wilkinson b546fd1046 Merge branch '1.4.x' into 1.5.x 2016-12-02 13:41:15 +00:00
Andy Wilkinson 6061dd492e Increase timeout in DevTools integration tests and improve diagnostics 2016-12-02 13:40:22 +00:00
Phillip Webb 20d7dd5747 Merge branch '1.5.x' 2016-11-18 17:30:03 -08:00
Phillip Webb 9e18021e8c Merge branch '1.4.x' into 1.5.x 2016-11-18 15:59:05 -08:00
Phillip Webb fce17ca6d9 Polish 2016-11-18 15:50:19 -08:00
Andy Wilkinson b0d0ddfcb6 Merge branch '1.5.x' 2016-11-17 20:43:15 +00:00
Andy Wilkinson cd3f951d35 Merge branch '1.4.x' into 1.5.x 2016-11-17 20:43:06 +00:00
Andy Wilkinson 5dea4c5a03 Wait for server port to be written in a more robust manner
Previously, we just waited for the file to exist before trying to read
the port from it. This left a window where the file existed but its
contents had not be written which could result in a
NumberFormatException.

This commit now waits for the file to have a length that is greater
than zero.

See gh-7379
2016-11-17 20:41:25 +00:00
Andy Wilkinson 971e5e834c Merge branch '1.5.x' 2016-11-17 19:28:31 +00:00
Andy Wilkinson eff0fc0221 Merge branch '1.4.x' into 1.5.x 2016-11-17 19:28:01 +00:00
Andy Wilkinson 918e122ddc Fix remote DevTools' support for adding and removing classes
Previously, remote DevTools only correctly supported modifying
existing classes. New classes that were added would be missed, and
deleted classes could cause a failure as they would be found by
component scanning but hidden by RestartClassLoader.

This commit introduces a DevTools-specific ResourcePatternResolver
that is installed as the application context's resource loader. This
custom resolver is aware of the files that have been added and
deleted and modifies the result returned from getResource and
getResources accordingly.

New intergration tests have been introduced to verify DevTools'
behaviour. The tests cover four scenarios:

- Adding a new controller
- Removing an existing controller
- Adding a request mapping to a controller
- Removing a request mapping from a controller

These four scenarios are tested with:

- DevTools updating a local application
- DevTools updating a remote application packaged in a jar file
- DevTools updating a remote application that's been exploded

Closes gh-7379
2016-11-17 19:19:54 +00:00