Commit Graph

642 Commits

Author SHA1 Message Date
Spring Buildmaster
376bbe68d8 Next Development Version 2016-05-06 11:23:57 +00:00
Stephane Nicoll
4ccc7dc554 Ignore invalid accessors
Previously, if a void method with a single argument was named "set", the
annotation processor wrongly considered it was a setter candidate. This
commit updates the condition to ignore it.

Closes gh-5826
2016-05-02 10:38:19 +02:00
Phillip Webb
af2483816b Fix JarFileTests to work on Windows
See gh-5287
2016-04-10 12:12:19 -07:00
Andy Wilkinson
74e27db486 Polish contribution 2016-04-06 17:04:10 +01:00
Vladimir Tsanev
a0f76eab47 Update JarURLConnection to support jar:file://… URLs
Previously, JarURLConnection would fail when created with a URL that
began with jar:file:// as the double-slash is not included in jarFile.getUrl().getFile().

This commit updates JarURLConnection to normalise the value return from
url.getFile() to remove a double-slash when present.

Fixes gh-5287
Closes gh-5289
2016-04-06 17:02:59 +01:00
Christian Brunotte
677080b8e2 Update launch.script so popd does not print directory name to stdout
Closes gh-5394
2016-04-06 11:46:36 +01:00
Phillip Webb
39140945b5 Polish 2016-03-29 21:45:11 -07:00
Andy Wilkinson
1043239de0 Ignore non-JavaExec run task when finding application's main class
Previously, FindMainClassTask would look for a property named main
on any class named run. This was based on the assumption that the
run task would be a JavaExec task (typically provided by the
application plugin). If the run task was not a JavaExec task (more
accurately, if it did not have a main property) this would result in
a build failure due to trying to read a non-existent property.

This commit updates FindMainClassTask to only use the main property
of the run task if the task is a JavaExec task. This guarantees that
the property will exist on the task, and unlike using any property
named main on a task named run, also guarantee that its value will
refer to a Java class with a main method.

Closes gh-5501
2016-03-29 11:03:47 +01:00
Phillip Webb
5e722dae6a Polish 2016-03-08 09:37:13 -08:00
Stephane Nicoll
a83dae0e10 Polish contribution
Closes gh-5335
2016-03-08 10:01:14 +01:00
Eric Bottard
79cd01eb7a Fix configuration property name when group is empty
See gh-5335
2016-03-08 09:48:26 +01:00
Stephane Nicoll
c6c001457a Fix description of classifier attribute
See gh-5258
2016-03-01 11:15:10 +01:00
Andy Wilkinson
bb473c32e2 Enable Animal Sniffer checking of spring-boot-loader-tools
Previously, Animal Sniffer checking of spring-boot-loader-tools
was disabled as it failed with an NPE. This has been fixed in
Animal Sniffer 1.15.

This commit upgrades Animal Sniffer to 1.15 and adds the necessary
annotations to suppress failures for safe usage of sun.* and Java 7
APIs.

Note that UsesUnsafeJava has been copied from spring-boot and made
package-private. This retains the clearer intent of the custom
annotation (versus @IgnoreJRERequirement) while avoiding the change
in the build order that would be necessary for
spring-boot-loader-tools to use the annotation from spring-boot.

Closes gh-5284
2016-02-29 14:44:27 +00:00
Spring Buildmaster
225d877ab9 Next Development Version 2016-02-26 01:06:16 -08:00
Spring Buildmaster
504d3e97ba Next development version 2016-01-21 18:41:30 -08:00
Phillip Webb
93c3b22bb4 Merge branch '1.2.x' 2016-01-21 11:14:20 -08:00
Phillip Webb
c71aa32fbb Polish 2016-01-21 10:53:25 -08:00
Andy Wilkinson
9dc858cdf5 Add missing properties to RepackageTask and improve test coverage
Closes gh-4978
2016-01-21 17:04:25 +00:00
Andy Wilkinson
854cacdb4f Fix useStartStopDaemon in launch script and allow config via conf file
Commit 5a1ee6eb added support for disabling use of start-stop-daemon
via a placeholder in the default launch script. Unfortunately, that
placeholder was subsequently broken in 81a47639.

This commit reinstates the placeholder and adds tests to verify that all
of the placeholders in the launch script can be replaced and that they
have the required default values. Furthermore, it also allows the use of
start-stop-daemon to be configured via USE_START_STOP_DAEMON in an
app’s .conf file. This allows the configuration to be changed after the
app has been built.

Closes gh-4985
2016-01-21 14:58:51 +00:00
Andy Wilkinson
2dc3660a32 Align launcher exception handling with direct invocation of main method
Previously, if an application’s main method threw an exception,
MainMethodRunner would catch the exception and call System.exit(1).
This meant that the JVM would exit, irrespective of whether or not
any non-daemon threads were running. In contrast, when an application’s
main method was invoked directly (in an IDE, for example) the JVM
would not exit if one or more non-daemon threads were running. This
is standard JVM behaviour that we should be consistent with in the
launcher.

This commit updates MainMethodRunner to wrap any exception thrown by an
application’s main method in a RuntimeException and rethrow it. This
alllows the JVM to handle the exception and use its normal rules for
deciding whether or not it should exit.

Closes gh-4984
2016-01-21 09:57:13 +00:00
Stephane Nicoll
7842f50e30 Add property to skip integration tests
Generalize the `skip` property to start and stop goals so that one
can control if the Spring Boot app is starting via a configuration
property.

Note that this only controls the Spring Boot Maven plugin and the
failsafe maven plugin should be updated accordingly.

Closes gh-4922
2016-01-18 09:45:06 +01:00
Andy Wilkinson
93ef795159 More use entrySet() rather than using keySet() and get(key)
This commit replaces some more occurrances of keySet() and get(key)
with more efficient usage of the map's entry set.

See gh-4813
2016-01-15 17:02:42 +00:00
Andy Wilkinson
89beef4099 Merge branch '1.2.x' 2016-01-14 17:09:40 +00:00
Andy Wilkinson
681a866cce Exclude Java agents from class loader created by PropertiesLauncher
PropertiesLauncher creates a ClassLoader that is used by the Launcher
to load an application’s classes. During the creation of this
ClassLoader URLs from its ClassLoader. This resulted resulting in Java
agents that are added to the system class loader via the -javaagent
launch option being available on both the system class loader and the
created class loader. Java agents are intended to always be loaded by
the system class loader. Making them available on another class loader
breaks this model.

This is the same problem that was in ExecutableArchiveLauncher and
that was fixed in ee08667e (see gh-863).

This commit updates PropertiesLauncher so that it skips the URLs of
any Java agents (found by examining the JVM’s input arguments) when
copying URLs over to the new ClassLoader, thereby ensuring that Java
agents are only ever loaded by the system class loader.

Closes gh-4911
2016-01-14 17:05:08 +00:00
Andy Wilkinson
487a66a75f Resend SIGTERM if app is still running 30 seconds after first attempt
Previously, the default launch script would send SIGTERM once and then
wait for up to 60 seconds for the app to have stopped. If the service
was stopped immediately after being started the first SIGTERM would
occasionally be ignored (presumably because the JVM was not yet in a
state to handle it) causing the service stop request to fail.

This commit updates the launch script to resend SIGTERM to the process
if it's still running 30 seconds after the first SIGTERM was sent.

Closes gh-4941
2016-01-14 10:37:45 +00:00
Andy Wilkinson
3afd0c7b3b Address Shellcheck warning (SC2086) for $arguments in launch script
$arguments needs to be split on spaces so it can’t just be wrapped
in quotes. This commit updates arguments to be an array that is then
expanded ("{arguments[@]}"). The use of @ and double quotes means that
it is expanded into all elements individually quoted.

See gh-4866
2016-01-14 10:37:37 +00:00
Andy Wilkinson
27a81e1463 Complete static final logger changes that were started in ec2f33f9
This commit completes the changes to consistently used static final
fields for Log instances that were started in ec2f33f9. Specifically it:

 - Removes this. when accessing logger fields that are now static
 - Renames some fields from log to logger
 - Makes some logger fields static

See gh-4784
2016-01-13 16:22:35 +00:00
Andy Wilkinson
c39a55a270 Fix quoting of start-stop-daemon RUN_ARGS and JAVA_OPTS in launch script
81a4763 introduced a regression when multiple RUN_ARGS or JAVA_OPTS were
configured. Rather than the JVM being launched with multiple arguments
all of the RUN_ARGS or JAVA_OPTS were passed as a single argument. This
caused unexpected behaviour and typically caused the application to fail
to start.

This commit updates the quoting of the arguments the are supplied when
launching the app using start-stop-daemon so that space-separated
entries in RUN_ARGS and JAVA_OPTS remain separate.

Closes gh-4866
2016-01-13 13:28:14 +00:00
Andy Wilkinson
04fe55a2ab Improve portability by using type instead of which in the launch script
Previously, the launch script used which to determine the availability
of start-stop-daemon. which isn’t available by default on all OSs.
For example, it’s not available by default on CentOS 5.

This commit updates the launch script to use type when determining if
start-stop-daemon is available. This improves the portability of the
script and makes the use of type consistent throughout the script.

Closes gh-4925
2016-01-13 13:28:14 +00:00
Andy Wilkinson
a1e0f2f5f0 Update launch script to wait for pid to be written to pid file
Previously, the launch script would wait for the pid file to exist
before continuing. This didn’t work 100% of the time as it left a 
window where the file had been created but the PID had not been written
to it that could result in an incorrect report of the app failing to
start.

This commit updates the script to wait for the file to have a size
greater than zero before continuing. This ensures that the pid has
been written to the file before the pid is read from the file and used
to check that the process is running.

Closes gh-4923
2016-01-13 13:28:14 +00:00
Phillip Webb
7397dbaf57 Allow ExitCodeGenerator to be used on Exceptions
Update exit code support to allow the ExitCodeGenerator interface to
be placed on an Exception. Any uncaught exception implementing the
interface and returning a non `0` status will now trigger a System.exit
with the code.

Fixes gh-4803
2016-01-13 12:31:37 +00:00
Andy Wilkinson
2aff82bb64 Merge branch '1.2.x' 2016-01-12 10:19:36 +00:00
Andy Wilkinson
6117b6c5c8 Consistent use of tabs for indentation in pom files 2016-01-12 10:16:40 +00:00
Johannes Edmeier
832ad2fe85 Change redirect in initscript to support old bash
`&>>` syntax is bash version 4. This fix allows to support older
versions.

Fixes gh-4820
Closes gh-4829
2015-12-24 11:44:55 +01:00
Spring Buildmaster
8db59059a5 Next Development Version 2015-12-18 05:43:02 -08:00
Stephane Nicoll
bb736e255b Fix SNAPSHOT version 2015-12-17 14:15:14 +01:00
Kirill Vlasov
ec2f33f986 Make loggers private static final
Apply consistency across all static loggers.

Closes gh-4784
2015-12-16 21:02:53 +00:00
Kirill Vlasov
786aacf2e9 Use Collections.isEmpty() instead of .size() == 0
Ensure that Collections.isEmpty() is used to check if there are no
elements in a collections. This is more explicit and can be faster than
calling .size().

Closes gh-4783
2015-12-16 20:59:33 +00:00
Michitomo Nakahara
2b5b7cd81e Update launch.script to append to $log_file rather than overwriting it
Closes gh-4506
2015-12-16 17:05:29 +00:00
Andy Wilkinson
02e1d669df Exit with a value of 1 when cd fails in the init script
Exiting with 0 when cd fails is likely to be incorrectly interpreted
as success so we should exit with a non-zero value. Ideally, the init
script status action would exit with 4 but, at the point when
the cd is performed, we don’t even know if we’re running as an init
script. Exiting with 1 seems to be a reasonable compromise as it’s
fine for the non init-script case as well as being correct for all
init script actions other than status.

See gh-4653
2015-12-16 13:53:26 +00:00
Andy Wilkinson
81a4763940 Address problems in launch.script reported by Shellcheck 0.4.1
Closes gh-4653
2015-12-16 13:24:28 +00:00
Phillip Webb
5a1ee6ebe8 Allow easy opt-out of using start-stop-daemon
Allow users to easily opt-opt of using the start-stop-daemon in the
launch script. This may be required on distros that include older
versions.

Fixes gh-4732
2015-12-15 20:37:43 +00:00
Phillip Webb
34b31f1abc Protect against null description
Update `removeLineBreaks` to also work with `null`.

See gh-4703
2015-12-11 17:40:28 +00:00
Robert Thornton
8e0b8750c0 Cleanup description new-lines for launch script
Replace all new-line characters in multi-line pom descriptions before
inserting into the launcher script. Prior to this commit the shell would
attempt to execut the extra lines, for example:

	<description>
		A multi-line pom description that could do something terrible:
		rm -r foo
	</description>

Closes gh-4703
2015-12-11 13:57:14 +00:00
Phillip Webb
2d2e4eea82 Merge branch '1.2.x' 2015-12-10 15:01:29 +00:00
Phillip Webb
2694605a4d Polish 2015-12-10 14:43:00 +00:00
mnhock
7348ef5ef1 Remove double instantiation of Manifest
Closes gh-4701
2015-12-08 11:05:40 +01:00
Johnny Lim
ec7fed1ecc Polish
Closes gh-4677
2015-12-07 20:46:36 +01:00
Andy Wilkinson
46edee2e45 Only make bootRun depend on findMainClass and not all java exec tasks
Closes gh-4639
2015-12-04 14:36:07 +00:00
Vladimir Tsanev
939b66f4ee Use fast exceptions in findResource(s)
Some libraries like aspectj are using findResource to see the raw
bytecode of a class. It will even call findResource for every method of
every class of beans that are post processed. This can be significant
performance hit on startup when LaunchedURLClassLoader and there are a
lot of nested jars.

See gh-3640
Fixes gh-4557
2015-12-03 09:57:30 +00:00