|
From: <mor...@us...> - 2015-09-01 01:53:13
|
Revision: 1935
http://sourceforge.net/p/wrapper/code/1935
Author: mortenson
Date: 2015-09-01 01:53:11 +0000 (Tue, 01 Sep 2015)
Log Message:
-----------
Work on 3.5.27 release.
Modified Paths:
--------------
trunk/wrapper/build-tests.xml
trunk/wrapper/build.xml
trunk/wrapper/doc/revisions.txt
trunk/wrapper/src/bin/sh.script.in
trunk/wrapper/src/c/property.c
trunk/wrapper/src/c/property.h
trunk/wrapper/src/c/test_javaadditionalparam.c
trunk/wrapper/src/c/wrapper.c
trunk/wrapper/src/c/wrapper_file.c
trunk/wrapper/src/c/wrapper_unix.c
trunk/wrapper/src/c/wrapper_win.c
trunk/wrapper/src/c/wrapperinfo.c.in
Modified: trunk/wrapper/build-tests.xml
===================================================================
--- trunk/wrapper/build-tests.xml 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/build-tests.xml 2015-09-01 01:53:11 UTC (rev 1935)
@@ -9,11 +9,24 @@
<!-- Local build properties -->
<property file="${user.home}/.ant.local.properties" />
+ <!-- Java version -->
+ <condition property="is.java 1.5 or lower">
+ <or>
+ <equals arg1="${ant.java.version}" arg2="1.0" />
+ <equals arg1="${ant.java.version}" arg2="1.1" />
+ <equals arg1="${ant.java.version}" arg2="1.2" />
+ <equals arg1="${ant.java.version}" arg2="1.3" />
+ <equals arg1="${ant.java.version}" arg2="1.4" />
+ <equals arg1="${ant.java.version}" arg2="1.5" />
+ </or>
+ </condition>
+
<!-- platform -->
<property name="is.${os.name}" value="true"/>
<property name="test.dir" value="${basedir}/test"/>
<property name="src.dir" value="${basedir}/src"/>
+ <property name="external.test.dir" value="${basedir}/external/test"/>
<!-- =================================================================== -->
<!-- Help on usage -->
@@ -90,11 +103,86 @@
<!-- =================================================================== -->
<target name="init" depends="init-windows, init-linux, init-solaris, init-aix, init-hpux, init-macosx, init-osf1, init-freebsd, init-irix">
</target>
+
+ <!-- =================================================================== -->
+ <!-- Resolve Classpaths -->
+ <!-- =================================================================== -->
+ <!-- Classpath for script tests -->
+ <target name="set-classpath.scriptLibs" if="is.java 1.5 or lower">
+ <path id="classpath.scriptLibs">
+ <fileset dir="${external.test.dir}/scriptLibs/">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ </target>
+
+ <target name="default-classpath.scriptLibs" unless="is.java 1.5 or lower">
+ <!-- empty path: we don't need any additional libs because they are already included in Java 1.6 and upper -->
+ <path id="classpath.scriptLibs"/>
+ </target>
+
+ <target name="init-classpath.scriptLibs" depends="set-classpath.scriptLibs, default-classpath.scriptLibs"/>
+
+ <!-- =================================================================== -->
+ <!-- Check if the required libs exist -->
+ <!-- =================================================================== -->
+ <!-- Check libs for script tests -->
+ <target name="check-libs-exist.scriptLibs">
+ <available file="${external.test.dir}/scriptLibs/js-1.6R7.jar" property="js.exists"/>
+ <available file="${external.test.dir}/scriptLibs/bsf.jar" property="bsf.exists"/>
+ <available file="${external.test.dir}/scriptLibs/commons-logging-1.2.jar" property="cl.exists"/>
+ <condition property="libs-exist.scriptLibs">
+ <and>
+ <istrue value="${js.exists}"/>
+ <istrue value="${bsf.exists}"/>
+ <istrue value="${cl.exists}"/>
+ </and>
+ </condition>
+ </target>
+ <target name="check-script-tests-setup-common" depends="check-libs-exist.scriptLibs">
+ <condition property="script-tests-setup-common-ok">
+ <or>
+ <istrue value="${libs-exist.scriptLibs}"/>
+ <isfalse value="${is.java 1.5 or lower}"/>
+ </or>
+ </condition>
+ </target>
+
+ <target name="script-tests-setup-common-not-ok" depends="check-script-tests-setup-common" unless="script-tests-setup-common-ok">
+ <echo message="*******************************************************************"/>
+ <echo message="* WARNING"/>
+ <echo message="* The tests are being built with Java version ${ant.java.version} which doesn't"/>
+ <echo message="* include the Scripting API. "/>
+ <echo message="* Apache Commons Logging, Apache Commons BSF and Rhino are required"/>
+ <echo message="* when using a Java version older than 6 but these libraries could"/>
+ <echo message="* not be found in '${external.test.dir}/scriptLibs/'. "/>
+ <echo message="* The tests using the Scripting API will not be built."/>
+ <echo message="********************************************************************"/>
+ </target>
+
+ <target name="check-script-tests-setup-bat" depends="check-script-tests-setup-common, init">
+ <condition property="script-tests-setup-bat-ok">
+ <and>
+ <istrue value="${script-tests-setup-common-ok}"/>
+ <istrue value="${is.shell.bat}"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="check-script-tests-setup-unix" depends="check-script-tests-setup-common, init">
+ <condition property="script-tests-setup-unix-ok">
+ <and>
+ <istrue value="${script-tests-setup-common-ok}"/>
+ <istrue value="${is.Unix}"/>
+ </and>
+ </condition>
+ </target>
+
<!-- =================================================================== -->
- <!-- Test Setup target (Common) -->
+ <!-- Test Setup target (Init - Common) -->
<!-- =================================================================== -->
- <target name="test-setup-common" depends="init">
+ <target name="test-setup-common-init" depends="init">
<!-- Create a template wrapper.conf file that will be used to create the files for
each of the additional conf files for each test. -->
<delete file="${test.dir}/template.conf"/>
@@ -108,7 +196,6 @@
<replace file="${test.dir}/template.conf"
token="wrapper.logfile=../logs/wrapper.log"
value="wrapper.logfile=../test/testwrapper.log" />
-
<!-- Delete old files to help with version upgrade. -->
<delete>
@@ -117,7 +204,12 @@
<include name="TestAdditionalParameterFile-0?-*.*"/>
</fileset>
</delete>
+ </target>
+ <!-- =================================================================== -->
+ <!-- General Tests Setup target (Common) -->
+ <!-- =================================================================== -->
+ <target name="general-tests-setup-common" depends="test-setup-common-init">
<!-- Background Threads Test -->
<delete file="${test.dir}/backgroundthreads.conf"/>
<filter token="app.name" value="backgroundthreads"/>
@@ -543,72 +635,6 @@
wrapper.java.classpath.3=../lib/%WRAPPER_COMMAND_FILLER_32767%.jar
wrapper.java.classpath.missing.loglevel=NONE]]></replacevalue>
</replace>
-
- <!-- Huge Classpath Env Max Size Test -->
- <delete file="${test.dir}/hugeclasspathenvmaxsize.conf"/>
- <filter token="app.name" value="hugeclasspathenvmaxsize"/>
- <filter token="app.long.name" value="Huge Classpath Env Max Size Case" />
- <copy file="${test.dir}/template.conf"
- tofile="${test.dir}/hugeclasspathenvmaxsize.conf"
- filtering="on"/>
- <replace file="${test.dir}/hugeclasspathenvmaxsize.conf"
- token="#wrapper.java.command.loglevel=INFO"
- value="wrapper.java.command.loglevel=INFO" />
- <replace file="${test.dir}/hugeclasspathenvmaxsize.conf"
- token="wrapper.app.parameter.1=<YourMainClass>"
- value="wrapper.app.parameter.1=org.tanukisoftware.wrapper.test.QuickComplete" />
- <echo file="${test.dir}/hugeclasspathenvmaxsize-path.conf" append="false" message="#encoding=UTF-8${line.separator}"/>
- <script language="javascript">
- echo = project.createTask("echo");
- echo.setFile(new java.io.File(project.getProperty("test.dir"), "hugeclasspathenvmaxsize-path.conf"));
- echo.setAppend(true);
- for (var i = 1000; i < 2362; i++) {
- echo.setMessage("wrapper.java.classpath." + i + "=../lib/no-file-" + i + ".jar\n");
- echo.perform();
- }
- echo.setMessage("wrapper.java.classpath.2363=../lib/no-file-2363abc.jar\n");
- echo.perform();
- </script>
- <replace file="${test.dir}/hugeclasspathenvmaxsize.conf">
- <replacetoken>wrapper.java.classpath.2=../lib/wrapper.jar</replacetoken>
- <replacevalue><![CDATA[wrapper.java.classpath.2=../lib/wrapper.jar
-#include ../test/hugeclasspathenvmaxsize-path.conf
-wrapper.java.classpath.use_environment=TRUE
-wrapper.java.classpath.missing.loglevel=NONE]]></replacevalue>
- </replace>
-
- <!-- Huge Classpath Env Over Size Test -->
- <delete file="${test.dir}/hugeclasspathenvoversize.conf"/>
- <filter token="app.name" value="hugeclasspathenvoversize"/>
- <filter token="app.long.name" value="Huge Classpath Env Over Size Case" />
- <copy file="${test.dir}/template.conf"
- tofile="${test.dir}/hugeclasspathenvoversize.conf"
- filtering="on"/>
- <replace file="${test.dir}/hugeclasspathenvoversize.conf"
- token="#wrapper.java.command.loglevel=INFO"
- value="wrapper.java.command.loglevel=INFO" />
- <replace file="${test.dir}/hugeclasspathenvoversize.conf"
- token="wrapper.app.parameter.1=<YourMainClass>"
- value="wrapper.app.parameter.1=org.tanukisoftware.wrapper.test.QuickComplete" />
- <echo file="${test.dir}/hugeclasspathenvoversize-path.conf" append="false" message="#encoding=UTF-8${line.separator}"/>
- <script language="javascript">
- echo = project.createTask("echo");
- echo.setFile(new java.io.File(project.getProperty("test.dir"), "hugeclasspathenvoversize-path.conf"));
- echo.setAppend(true);
- for (var i = 1000; i < 2362; i++) {
- echo.setMessage("wrapper.java.classpath." + i + "=../lib/no-file-" + i + ".jar\n");
- echo.perform();
- }
- echo.setMessage("wrapper.java.classpath.2363=../lib/no-file-2363abcd.jar\n");
- echo.perform();
- </script>
- <replace file="${test.dir}/hugeclasspathenvoversize.conf">
- <replacetoken>wrapper.java.classpath.2=../lib/wrapper.jar</replacetoken>
- <replacevalue><![CDATA[wrapper.java.classpath.2=../lib/wrapper.jar
-#include ../test/hugeclasspathenvoversize-path.conf
-wrapper.java.classpath.use_environment=TRUE
-wrapper.java.classpath.missing.loglevel=NONE]]></replacevalue>
- </replace>
<!-- Filter Test -->
<delete file="${test.dir}/filter.conf"/>
@@ -1129,11 +1155,90 @@
token="wrapper.app.parameter.1=<YourMainClass>"
value="wrapper.app.parameter.1=org.tanukisoftware.wrapper.test.WrapperPrintParam" />
</target>
+
+ <!-- =================================================================== -->
+ <!-- Script Tests Setup target (Common) -->
+ <!-- =================================================================== -->
+ <target name="script-tests-setup-common" depends="test-setup-common-init, check-script-tests-setup-common, init-classpath.scriptLibs" if="script-tests-setup-common-ok">
+ <!-- Huge Classpath Env Max Size Test -->
+ <delete file="${test.dir}/hugeclasspathenvmaxsize.conf"/>
+ <filter token="app.name" value="hugeclasspathenvmaxsize"/>
+ <filter token="app.long.name" value="Huge Classpath Env Max Size Case" />
+ <copy file="${test.dir}/template.conf"
+ tofile="${test.dir}/hugeclasspathenvmaxsize.conf"
+ filtering="on"/>
+ <replace file="${test.dir}/hugeclasspathenvmaxsize.conf"
+ token="#wrapper.java.command.loglevel=INFO"
+ value="wrapper.java.command.loglevel=INFO" />
+ <replace file="${test.dir}/hugeclasspathenvmaxsize.conf"
+ token="wrapper.app.parameter.1=<YourMainClass>"
+ value="wrapper.app.parameter.1=org.tanukisoftware.wrapper.test.QuickComplete" />
+ <echo file="${test.dir}/hugeclasspathenvmaxsize-path.conf" append="false" message="#encoding=UTF-8${line.separator}"/>
+ <script language="javascript">
+ <classpath refid="classpath.scriptLibs" />
+ echo = project.createTask("echo");
+ echo.setFile(new java.io.File(project.getProperty("test.dir"), "hugeclasspathenvmaxsize-path.conf"));
+ echo.setAppend(true);
+ for (var i = 1000; i < 2362; i++) {
+ echo.setMessage("wrapper.java.classpath." + i + "=../lib/no-file-" + i + ".jar\n");
+ echo.perform();
+ }
+ echo.setMessage("wrapper.java.classpath.2363=../lib/no-file-2363abc.jar\n");
+ echo.perform();
+ </script>
+ <replace file="${test.dir}/hugeclasspathenvmaxsize.conf">
+ <replacetoken>wrapper.java.classpath.2=../lib/wrapper.jar</replacetoken>
+ <replacevalue><![CDATA[wrapper.java.classpath.2=../lib/wrapper.jar
+#include ../test/hugeclasspathenvmaxsize-path.conf
+wrapper.java.classpath.use_environment=TRUE
+wrapper.java.classpath.missing.loglevel=NONE]]></replacevalue>
+ </replace>
+
+ <!-- Huge Classpath Env Over Size Test -->
+ <delete file="${test.dir}/hugeclasspathenvoversize.conf"/>
+ <filter token="app.name" value="hugeclasspathenvoversize"/>
+ <filter token="app.long.name" value="Huge Classpath Env Over Size Case" />
+ <copy file="${test.dir}/template.conf"
+ tofile="${test.dir}/hugeclasspathenvoversize.conf"
+ filtering="on"/>
+ <replace file="${test.dir}/hugeclasspathenvoversize.conf"
+ token="#wrapper.java.command.loglevel=INFO"
+ value="wrapper.java.command.loglevel=INFO" />
+ <replace file="${test.dir}/hugeclasspathenvoversize.conf"
+ token="wrapper.app.parameter.1=<YourMainClass>"
+ value="wrapper.app.parameter.1=org.tanukisoftware.wrapper.test.QuickComplete" />
+ <echo file="${test.dir}/hugeclasspathenvoversize-path.conf" append="false" message="#encoding=UTF-8${line.separator}"/>
+ <script language="javascript">
+ <classpath refid="classpath.scriptLibs" />
+ echo = project.createTask("echo");
+ echo.setFile(new java.io.File(project.getProperty("test.dir"), "hugeclasspathenvoversize-path.conf"));
+ echo.setAppend(true);
+ for (var i = 1000; i < 2362; i++) {
+ echo.setMessage("wrapper.java.classpath." + i + "=../lib/no-file-" + i + ".jar\n");
+ echo.perform();
+ }
+ echo.setMessage("wrapper.java.classpath.2363=../lib/no-file-2363abcd.jar\n");
+ echo.perform();
+ </script>
+ <replace file="${test.dir}/hugeclasspathenvoversize.conf">
+ <replacetoken>wrapper.java.classpath.2=../lib/wrapper.jar</replacetoken>
+ <replacevalue><![CDATA[wrapper.java.classpath.2=../lib/wrapper.jar
+#include ../test/hugeclasspathenvoversize-path.conf
+wrapper.java.classpath.use_environment=TRUE
+wrapper.java.classpath.missing.loglevel=NONE]]></replacevalue>
+ </replace>
+ </target>
<!-- =================================================================== -->
- <!-- Test Setup target (Bat files - Windows) -->
+ <!-- Test Setup target (Common) -->
<!-- =================================================================== -->
- <target name="test-setup-bat" depends="test-setup-common" if="is.shell.bat">
+ <target name="test-setup-common" depends="general-tests-setup-common, script-tests-setup-common">
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- General Tests Setup target (Bat files - Windows) -->
+ <!-- =================================================================== -->
+ <target name="general-tests-setup-bat" depends="test-setup-common" if="is.shell.bat">
<!-- Create the test specific batch files -->
<!-- Background Threads Test -->
@@ -1147,9 +1252,6 @@
<replace file="${test.dir}/TestBackgroundThreads.bat"
token='set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"'
value='set _WRAPPER_CONF_DEFAULT=../test/backgroundthreads.conf' />
-
-
-
<!-- Long Running Background Threads Test -->
<delete file="${test.dir}/TestLongRunningBackgroundThreads.bat"/>
@@ -1524,30 +1626,6 @@
token='set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"'
value='set _WRAPPER_CONF_DEFAULT=../test/hugeclasspathoversize.conf' />
- <!-- Huge Classpath Env Max Size Test -->
- <delete file="${test.dir}/TestHugeClasspathEnvMaxSize.bat"/>
- <copy file="${src.dir}/bin/App.bat.in"
- tofile="${test.dir}/TestHugeClasspathEnvMaxSize.bat"
- filtering="on"/>
- <replace file="${test.dir}/TestHugeClasspathEnvMaxSize.bat"
- token='set _WRAPPER_BASE=wrapper'
- value='set _WRAPPER_BASE=..\bin\wrapper' />
- <replace file="${test.dir}/TestHugeClasspathEnvMaxSize.bat"
- token='set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"'
- value='set _WRAPPER_CONF_DEFAULT=../test/hugeclasspathenvmaxsize.conf' />
-
- <!-- Huge Classpath Env Over Size Test -->
- <delete file="${test.dir}/TestHugeClasspathEnvOverSize.bat"/>
- <copy file="${src.dir}/bin/App.bat.in"
- tofile="${test.dir}/TestHugeClasspathEnvOverSize.bat"
- filtering="on"/>
- <replace file="${test.dir}/TestHugeClasspathEnvOverSize.bat"
- token='set _WRAPPER_BASE=wrapper'
- value='set _WRAPPER_BASE=..\bin\wrapper' />
- <replace file="${test.dir}/TestHugeClasspathEnvOverSize.bat"
- token='set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"'
- value='set _WRAPPER_CONF_DEFAULT=../test/hugeclasspathenvoversize.conf' />
-
<!-- Filter Test -->
<delete file="${test.dir}/TestFilter.bat"/>
<copy file="${src.dir}/bin/App.bat.in"
@@ -1857,6 +1935,41 @@
</target>
<!-- =================================================================== -->
+ <!-- Script Tests Setup target (Bat files - Windows) -->
+ <!-- =================================================================== -->
+ <target name="script-tests-setup-bat" depends="test-setup-common, check-script-tests-setup-bat" if="script-tests-setup-bat-ok">
+ <!-- Huge Classpath Env Max Size Test -->
+ <delete file="${test.dir}/TestHugeClasspathEnvMaxSize.bat"/>
+ <copy file="${src.dir}/bin/App.bat.in"
+ tofile="${test.dir}/TestHugeClasspathEnvMaxSize.bat"
+ filtering="on"/>
+ <replace file="${test.dir}/TestHugeClasspathEnvMaxSize.bat"
+ token='set _WRAPPER_BASE=wrapper'
+ value='set _WRAPPER_BASE=..\bin\wrapper' />
+ <replace file="${test.dir}/TestHugeClasspathEnvMaxSize.bat"
+ token='set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"'
+ value='set _WRAPPER_CONF_DEFAULT=../test/hugeclasspathenvmaxsize.conf' />
+
+ <!-- Huge Classpath Env Over Size Test -->
+ <delete file="${test.dir}/TestHugeClasspathEnvOverSize.bat"/>
+ <copy file="${src.dir}/bin/App.bat.in"
+ tofile="${test.dir}/TestHugeClasspathEnvOverSize.bat"
+ filtering="on"/>
+ <replace file="${test.dir}/TestHugeClasspathEnvOverSize.bat"
+ token='set _WRAPPER_BASE=wrapper'
+ value='set _WRAPPER_BASE=..\bin\wrapper' />
+ <replace file="${test.dir}/TestHugeClasspathEnvOverSize.bat"
+ token='set _WRAPPER_CONF_DEFAULT="../conf/%_WRAPPER_BASE%.conf"'
+ value='set _WRAPPER_CONF_DEFAULT=../test/hugeclasspathenvoversize.conf' />
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Test Setup target (Bat files - Windows) -->
+ <!-- =================================================================== -->
+ <target name="test-setup-bat" depends="general-tests-setup-bat, script-tests-setup-bat" if="is.shell.bat">
+ </target>
+
+ <!-- =================================================================== -->
<!-- Test Setup target (sh scripts - Unix, Linux) -->
<!-- =================================================================== -->
<target name="test-setup-sh" depends="test-setup-common" if="is.shell.sh">
@@ -1870,9 +1983,9 @@
</target>
<!-- =================================================================== -->
- <!-- Test Setup target (Unix) -->
+ <!-- Test Setup target (Init - Unix) -->
<!-- =================================================================== -->
- <target name="test-setup-unix" depends="test-setup-sh" if="is.Unix">
+ <target name="test-setup-unix-init" depends="test-setup-sh" if="is.Unix">
<!-- Create the test specific script files -->
<replace file="${test.dir}/temp.script.in"
token='WRAPPER_CMD="./wrapper"'
@@ -1898,7 +2011,12 @@
<replacetoken><![CDATA[#PASS_THROUGH=]]></replacetoken>
<replacevalue><![CDATA[PASS_THROUGH=]]></replacevalue>
</replace>
-
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- General Tests Setup target (Unix) -->
+ <!-- =================================================================== -->
+ <target name="general-tests-setup-unix" depends="test-setup-unix-init" if="is.Unix">
<!-- Background Threads Test -->
<filter token="app.name" value="backgroundthreads"/>
<filter token="app.long.name" value="Background Threads Case" />
@@ -2157,22 +2275,6 @@
filtering="on"/>
<chmod file="${test.dir}/hugeclasspathoversize" perm="+x"/>
- <!-- Huge Classpath Env Max Size Test -->
- <filter token="app.name" value="hugeclasspathenvmaxsize"/>
- <filter token="app.long.name" value="Huge Classpath Env Max Size Case" />
- <copy file="${test.dir}/temp.script.in"
- tofile="${test.dir}/hugeclasspathenvmaxsize"
- filtering="on"/>
- <chmod file="${test.dir}/hugeclasspathenvmaxsize" perm="+x"/>
-
- <!-- Huge Classpath Env Over Size Test -->
- <filter token="app.name" value="hugeclasspathenvoversize"/>
- <filter token="app.long.name" value="Huge Classpath Env Over Size Case" />
- <copy file="${test.dir}/temp.script.in"
- tofile="${test.dir}/hugeclasspathenvoversize"
- filtering="on"/>
- <chmod file="${test.dir}/hugeclasspathenvoversize" perm="+x"/>
-
<!-- Filter Test -->
<filter token="app.name" value="filter"/>
<filter token="app.long.name" value="Filter Case" />
@@ -2366,17 +2468,43 @@
tofile="${test.dir}/defaultstripquotes-03-false"
filtering="on"/>
<chmod file="${test.dir}/defaultstripquotes-03-false" perm="+x"/>
-
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Script Tests Setup target (Unix) -->
+ <!-- =================================================================== -->
+ <target name="script-tests-setup-unix" depends="test-setup-unix-init, check-script-tests-setup-unix" if="script-tests-setup-unix-ok">
+ <!-- Huge Classpath Env Max Size Test -->
+ <filter token="app.name" value="hugeclasspathenvmaxsize"/>
+ <filter token="app.long.name" value="Huge Classpath Env Max Size Case" />
+ <copy file="${test.dir}/temp.script.in"
+ tofile="${test.dir}/hugeclasspathenvmaxsize"
+ filtering="on"/>
+ <chmod file="${test.dir}/hugeclasspathenvmaxsize" perm="+x"/>
+
+ <!-- Huge Classpath Env Over Size Test -->
+ <filter token="app.name" value="hugeclasspathenvoversize"/>
+ <filter token="app.long.name" value="Huge Classpath Env Over Size Case" />
+ <copy file="${test.dir}/temp.script.in"
+ tofile="${test.dir}/hugeclasspathenvoversize"
+ filtering="on"/>
+ <chmod file="${test.dir}/hugeclasspathenvoversize" perm="+x"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Test Setup target (Unix) -->
+ <!-- =================================================================== -->
+ <target name="test-setup-unix" depends="general-tests-setup-unix, script-tests-setup-unix" if="is.Unix">
<!-- Get rid of the temp script file -->
<delete file="${test.dir}/temp.script.in"/>
<delete file="${test.dir}/action.script.in"/>
</target>
-
+
<!-- =================================================================== -->
<!-- Test Setup target -->
<!-- =================================================================== -->
<target name="test-setup"
- depends="test-setup-bat, test-setup-unix">
+ depends="script-tests-setup-common-not-ok, test-setup-bat, test-setup-unix">
</target>
<!-- =================================================================== -->
Modified: trunk/wrapper/build.xml
===================================================================
--- trunk/wrapper/build.xml 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/build.xml 2015-09-01 01:53:11 UTC (rev 1935)
@@ -1224,6 +1224,7 @@
<include name="src/c/*.bmp" />
<include name="src/c/*.bin" />
<include name="src/c/*.manifest" />
+ <include name="external/**" />
<exclude name="**/CVS/*" />
</fileset>
</copy>
@@ -1418,7 +1419,6 @@
<include name="jdoc/**" />
<include name="doc/**" />
<include name="conf/demoapp.conf" />
- <include name="src/c/*.manifest" />
<exclude name="**/CVS/*" />
</fileset>
</copy>
@@ -1861,7 +1861,7 @@
<release-delta-extract-platform osname="hpux" osarch="ia" bits="64" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".so" archivetype="tar.gz"/>
<release-delta-extract-platform osname="hpux" osarch="parisc" bits="32" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".sl" archivetype="tar.gz"/>
<release-delta-extract-platform osname="hpux" osarch="parisc" bits="64" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".sl" archivetype="tar.gz"/>
-<!-- <release-delta-extract-platform osname="linux" osarch="ia" bits="64" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".so" archivetype="tar.gz"/> -->
+ <release-delta-extract-platform osname="linux" osarch="ia" bits="64" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".so" archivetype="tar.gz"/>
<release-delta-extract-platform osname="linux" osarch="ppc" bits="32" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".so" archivetype="tar.gz"/>
<release-delta-extract-platform osname="linux" osarch="ppc" bits="64" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".so" archivetype="tar.gz"/>
<release-delta-extract-platform osname="linux" osarch="x86" bits="32" wrapperbinhead="wrapper" wrapperbintail="" wrapperlibhead="libwrapper" wrapperlibtail=".so" archivetype="tar.gz"/>
Modified: trunk/wrapper/doc/revisions.txt
===================================================================
--- trunk/wrapper/doc/revisions.txt 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/doc/revisions.txt 2015-09-01 01:53:11 UTC (rev 1935)
@@ -6,7 +6,7 @@
error message on Windows.
* Handle system exit codes with descriptions (Windows only).
* Add new configuration file directives (#properties.on_overwrite.loglevel and
- #properties.on_overwrite.exit) to better control how the wrapper should
+ #properties.on_overwrite.exit) to better control how the Wrapper should
behave when detecting duplicate property definitions.
* Fix: No longer tries to resume a Windows service that is already running,
or pause a service that is already paused.
@@ -16,17 +16,17 @@
* Fix the console flicker bug. Happened when wrapper.ntservice.generate_console
was set to TRUE, which is required for thread dumping.
* Fix a problem on Windows with the consoleless version of the Wrapper. If a
- splash screen was set at launch time, and if the wrapper eventually failed to
+ splash screen was set at launch time, and if the Wrapper eventually failed to
start normally, the splash screen did not disappear and remained on the top
of the log window.
* Fix a problem on Windows platforms that caused the log window to overlap all
the other forms even when the focus was set on an other application.
-* Add the ability to define CPU affinity for the wrapper and JVM processes
+* Add the ability to define CPU affinity for the Wrapper and JVM processes
(Windows and Linux systems, professional edition).
* The wrapper can now be executed with a '--setup' option in order to install
components under elevated mode on Windows. During the installation, the
wrapper will register the application to the Windows Event Log system.
- After the wrapper is executed with the '--setup' option, the Event Viewer
+ After the Wrapper is executed with the '--setup' option, the Event Viewer
will no longer report that the installation was corrupted.
* wrapper.exe and wrapper.dll are now manifested for compatibility with newer
versions of Windows (8.1 and above).
@@ -51,14 +51,20 @@
native code prior to opening it in Java. The Wrapper worked correctly, but
a Windows issue was causing warnings in the EventLog if the port had an
existing socket in the TIME_WAIT state from a previous JVM invocation.
-* Fix a problem on AIX with OpenJRE where the wrapper failed to load the
+* Fix a problem on AIX with OpenJRE where the Wrapper failed to load the
native library. The native library now has a '.so' extension like on other
UNIX platforms.
* Fix a problem on HP-UX when listing HostIds. If several HostIds were
- available on the machine, the wrapper could only get the first one and
+ available on the machine, the Wrapper could only get the first one and
reported DLPI errors when attempting to get the others.
* Fix path to remove files when uninstalling the Wrapper daemon process on
HPUX.
+* Added Linux Itanium binaries in the "Delta Pack". It was removed since
+ version 3.5.18.
+* Fix an encoding conversion error when sending email on HP-UX.
+* On MacOSX, set the launchd KeepAlive key to "false" by default as
+ recommended by Apple. However, it is possible to set it to "true" by editing
+ the new MACOSX_KEEP_RUNNING variable in the script file.
3.5.26
* Improve the log messages when a JVM restart is requested when the Wrapper is
Modified: trunk/wrapper/src/bin/sh.script.in
===================================================================
--- trunk/wrapper/src/bin/sh.script.in 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/src/bin/sh.script.in 2015-09-01 01:53:11 UTC (rev 1935)
@@ -134,10 +134,15 @@
# OS service management tool: flag for using systemd when installing
USE_SYSTEMD=
-# When installing on On Mac OSX platforms, the following domain will be used to
+# When installing on Mac OSX platforms, the following domain will be used to
# prefix the plist file name.
PLIST_DOMAIN=org.tanukisoftware.wrapper
+# When installing on Mac OSX platforms, this parameter controls whether the daemon
+# is to be kept continuously running or to let demand and conditions control the
+# invocation.
+MACOSX_KEEP_RUNNING="false"
+
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
@@ -369,7 +374,9 @@
DIST_BITS="32"
KEY_KEEP_ALIVE="OnDemand"
else
+ # Note: "OnDemand" has been deprecated and replaced from Mac OS X 10.5 by "KeepAlive"
KEY_KEEP_ALIVE="KeepAlive"
+
if [ "X`/usr/sbin/sysctl -n hw.cpu64bit_capable`" == "X1" ]
then
DIST_BITS="64"
@@ -742,8 +749,8 @@
shift
done
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
+ # Use "runuser" if this exists.
+ # runuser should be used on RedHat in preference to su.
if test -f "/sbin/runuser"
then
/sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
@@ -755,11 +762,13 @@
# we check if the previous command has failed
if [ $RUN_AS_USER_EXITCODE -ne 0 ]
then
- eval echo `gettext 'Advice: One possible cause of failure is when the user \(\"$RUN_AS_USER\"\) has no shell. Two solutions are available:'`
- eval echo `gettext '1. you can set the shell to use with \"SU_OPTS\"'`
- eval echo `gettext 'For example, at the top of the script file you can set: SU_OPTS=\"-s /bin/bash\"'`
- eval echo `gettext '2. you can use a OS service management tool'`
- eval echo `gettext 'Supported OS service management tools are described at the top of the script file.'`
+ if [ $RUN_AS_USER_EXITCODE -eq 1 ]
+ then
+ checkForkCommand
+ else
+ eval echo `gettext 'Error executing the requested command with user \"$RUN_AS_USER\" \(error code $RUN_AS_USER_EXITCODE\).'`
+ echo ""
+ fi
fi
# Now that we are the original user again, we may need to clean up the lock file.
@@ -780,6 +789,31 @@
fi
}
+# Try to fork by executing a simple command.
+# With this function, we want to make sure we are able to fork.
+checkForkCommand() {
+
+ if test -f "/sbin/runuser"
+ then
+ /sbin/runuser - $RUN_AS_USER -c "ls \"$REALPATH\"" > /dev/null 2>&1 &
+ else
+ $SU_BIN - $RUN_AS_USER -c "ls \"$REALPATH\"" $SU_OPTS > /dev/null 2>&1 &
+ fi
+ CHECK_EXITCODE=$?
+
+ if [ $CHECK_EXITCODE -ne 0 ]
+ then
+ # clearly a problem with forking
+ eval echo `gettext 'Error: unable to create fork process.'`
+ eval echo `gettext 'Advice:'`
+ eval echo `gettext 'One possible cause of failure is when the user \(\"$RUN_AS_USER\"\) has no shell.'`
+ eval echo `gettext 'In this case, two solutions are available by editing the script file:'`
+ eval echo `gettext '1. Use \"SU_OPTS\" to set the shell for the user.'`
+ eval echo `gettext '2. Use a OS service management tool (only available on some platforms).'`
+ echo ""
+ fi
+}
+
getpid() {
pid=""
if [ -f "$PIDFILE" ]
@@ -1100,6 +1134,14 @@
eval echo `gettext '$APP_LONG_NAME is not running.'`
exit 1
else
+ if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then
+ echo ""
+ eval echo `gettext 'Daemon is set to be kept continuously running and it will be automatically restarted.'`
+ eval echo `gettext 'To stop the daemon you need to uninstall it.'`
+ eval echo `gettext 'If you want to use the \"stop\" argument, you need to find MACOSX_KEEP_RUNNING'`
+ eval echo `gettext 'at the beginning of the script file and set it to \"false\".'`
+ echo ""
+ fi
launchctl stop ${APP_PLIST_BASE}
fi
}
@@ -1114,8 +1156,14 @@
eval echo `gettext '$APP_LONG_NAME is not running.'`
exit 1
else
- launchctl unload "/Library/LaunchDaemons/${APP_PLIST}"
- launchctl load "/Library/LaunchDaemons/${APP_PLIST}"
+ if [ "$MACOSX_KEEP_RUNNING" = "true" ] ; then
+ # by stopping it, launchd will automatically restart it
+ launchctl stop ${APP_PLIST_BASE}
+ else
+ launchctl unload "/Library/LaunchDaemons/${APP_PLIST}"
+ sleep 1
+ launchctl load "/Library/LaunchDaemons/${APP_PLIST}"
+ fi
fi
startwait
@@ -1540,28 +1588,28 @@
if [ -f "${REALDIR}/${APP_PLIST}" ] ; then
ln -s "${REALDIR}/${APP_PLIST}" "/Library/LaunchDaemons/${APP_PLIST}"
else
- echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "/Library/LaunchDaemons/${APP_PLIST}"
+ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "/Library/LaunchDaemons/${APP_PLIST}"
echo "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo "<plist version=\"1.0\">" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <dict>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <key>Label</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <string>${APP_PLIST_BASE}</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <key>ProgramArguments</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <array>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <string>${REALPATH}</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <string>launchdinternal</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " </array>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <key>${KEY_KEEP_ALIVE}</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <true/>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <key>RunAtLoad</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <true/>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo "<plist version=\"1.0\">" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <dict>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <key>Label</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <string>${APP_PLIST_BASE}</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <key>ProgramArguments</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <array>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <string>${REALPATH}</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <string>launchdinternal</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " </array>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <key>${KEY_KEEP_ALIVE}</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <${MACOSX_KEEP_RUNNING}/>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <key>RunAtLoad</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <true/>" >> "/Library/LaunchDaemons/${APP_PLIST}"
if [ "X$RUN_AS_USER" != "X" ] ; then
- echo " <key>UserName</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo " <string>${RUN_AS_USER}</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <key>UserName</key>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " <string>${RUN_AS_USER}</string>" >> "/Library/LaunchDaemons/${APP_PLIST}"
fi
- echo " </dict>" >> "/Library/LaunchDaemons/${APP_PLIST}"
- echo "</plist>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo " </dict>" >> "/Library/LaunchDaemons/${APP_PLIST}"
+ echo "</plist>" >> "/Library/LaunchDaemons/${APP_PLIST}"
fi
chmod 555 "/Library/LaunchDaemons/${APP_PLIST}"
fi
@@ -1864,8 +1912,13 @@
;;
'start')
- if [ "$DIST_OS" = "macosx" -a -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
- macosxStart
+ if [ "$DIST_OS" = "macosx" ] ; then
+ if [ ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
+ # inform the user that the application was not installed
+ status
+ else
+ macosxStart
+ fi
elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then
upstartstart
elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then
@@ -1897,8 +1950,12 @@
;;
'restart')
- if [ "$DIST_OS" = "macosx" -a -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
- macosxRestart
+ if [ "$DIST_OS" = "macosx" ] ; then
+ if [ ! -f "/Library/LaunchDaemons/${APP_PLIST}" ] ; then
+ eval echo `gettext '$APP_NAME was not installed.'`
+ else
+ macosxRestart
+ fi
elif [ "$DIST_OS" = "linux" -a -f "/etc/init/${APP_NAME}.conf" ] ; then
upstartRestart
elif [ "$DIST_OS" = "linux" -a -n "$USE_SYSTEMD" -a -z "$SYSD" ] ; then
Modified: trunk/wrapper/src/c/property.c
===================================================================
--- trunk/wrapper/src/c/property.c 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/src/c/property.c 2015-09-01 01:53:11 UTC (rev 1935)
@@ -476,6 +476,11 @@
properties->exitOnOverwrite = exitOnOverwrite;
properties->logLevelOnOverwrite = logLevelOnOverwrite;
+ /* special case where the callback should only update the properties structure */
+ if ((fileName == NULL) && (lineNumber == -1) && (config == NULL)) {
+ return TRUE;
+ }
+
if (_tcsstr(config, TEXT("include")) == config) {
/* Users sometimes remove the '#' from include statements.
Add a warning to help them notice the problem. */
@@ -564,14 +569,15 @@
return LEVEL_UNKNOWN;
}
-Properties* createProperties() {
+Properties* createProperties(int debug, int logLevelOnOverwrite, int exitOnOverwrite) {
Properties *properties = malloc(sizeof(Properties));
if (!properties) {
outOfMemory(TEXT("CP"), 1);
return NULL;
}
- properties->exitOnOverwrite = FALSE;
- properties->logLevelOnOverwrite = LEVEL_NONE;
+ properties->debugProperties = debug;
+ properties->exitOnOverwrite = exitOnOverwrite;
+ properties->logLevelOnOverwrite = logLevelOnOverwrite;
properties->overwrittenPropertyCausedExit = FALSE;
properties->logWarnings = TRUE;
properties->logWarningLogLevel = LEVEL_WARN;
@@ -1168,26 +1174,40 @@
/* Insert this property at the correct location. Value will still be null. */
insertInnerProperty(properties, property);
} else {
- logLevelOnOverwrite = GetLogLevelOnOverwrite(properties);
- /* On preload the loglevel is set to NONE, then it is set by default to DEBUG on the second load.
- * We don't want to log anything nor to stop the Wrapper on preload so we test if logLevelOnOverwrite < LEVEL_NONE). */
- if (logLevelOnOverwrite < LEVEL_NONE) {
- /* The property was already set. Only change it if non final */
- if (property->internal) {
- setValue = FALSE;
- /* Logging properties were already preoloaded, so the logging system is ready. */
- log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
- TEXT("The \"%s\" property is defined by the Wrapper internally and can not be overwritten.\n Ignoring redefinition on line #%d of configuration file: %s\n Fixed Value %s=%s\n Ignored Value %s=%s"),
- propertyNameTrim, lineNum, (filename ? filename : TEXT("<NULL>")), propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
- } else if (property->finalValue) {
- setValue = FALSE;
- log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
- TEXT("The \"%s\" property was defined on the Wrapper command line and can not be overwritten.\n Ignoring redefinition on line #%d of configuration file: %s\n Fixed Value %s=%s\n Ignored Value %s=%s"),
- propertyNameTrim, lineNum, (filename ? filename : TEXT("<NULL>")), propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ /* The property was already set. Only change it if non final and non internal */
+ if (property->internal || property->finalValue) {
+ setValue = FALSE;
+ }
+
+ /* On preload we set properties->debugProperties to false as we don't want to log anything nor to stop the Wrapper at this stage. */
+ if (properties->debugProperties) {
+ /* Preload was already done so the logging system is ready. */
+ logLevelOnOverwrite = GetLogLevelOnOverwrite(properties);
+ /* From version 3.5.27, the Wrapper will also log messages if the command line contains duplicated properties or attempts to set an internal environment variable. */
+ if (finalValue) {
+ if (property->internal) {
+ log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
+ TEXT("The \"%s\" property is defined by the Wrapper internally and can not be overwritten.\n Ignoring redefinition on the Wrapper command line.\n Fixed Value %s=%s\n Ignored Value %s=%s"),
+ propertyNameTrim, propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ } else if (property->finalValue) {
+ log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
+ TEXT("The \"%s\" property was already defined on the Wrapper command line and can not be overwritten.\n Ignoring redefinition on the Wrapper command line.\n Fixed Value %s=%s\n Ignored Value %s=%s"),
+ propertyNameTrim, propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ }
} else {
- log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
- TEXT("The \"%s\" property was redefined on line #%d of configuration file: %s\n Old Value %s=%s\n New Value %s=%s"),
- propertyNameTrim, lineNum, (filename ? filename : TEXT("<NULL>")), propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ if (property->internal) {
+ log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
+ TEXT("The \"%s\" property is defined by the Wrapper internally and can not be overwritten.\n Ignoring redefinition on line #%d of configuration file: %s\n Fixed Value %s=%s\n Ignored Value %s=%s"),
+ propertyNameTrim, lineNum, (filename ? filename : TEXT("<NULL>")), propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ } else if (property->finalValue) {
+ log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
+ TEXT("The \"%s\" property was defined on the Wrapper command line and can not be overwritten.\n Ignoring redefinition on line #%d of configuration file: %s\n Fixed Value %s=%s\n Ignored Value %s=%s"),
+ propertyNameTrim, lineNum, (filename ? filename : TEXT("<NULL>")), propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ } else {
+ log_printf(WRAPPER_SOURCE_WRAPPER, logLevelOnOverwrite,
+ TEXT("The \"%s\" property was redefined on line #%d of configuration file: %s\n Old Value %s=%s\n New Value %s=%s"),
+ propertyNameTrim, lineNum, (filename ? filename : TEXT("<NULL>")), propertyNameTrim, property->value, propertyNameTrim, propertyValueTrim);
+ }
}
if (properties->exitOnOverwrite) {
Modified: trunk/wrapper/src/c/property.h
===================================================================
--- trunk/wrapper/src/c/property.h 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/src/c/property.h 2015-09-01 01:53:11 UTC (rev 1935)
@@ -75,6 +75,7 @@
typedef struct Properties Properties;
struct Properties {
+ int debugProperties; /* TRUE if debug information on Properties should be shown. */
int exitOnOverwrite; /* If TRUE, causes the wrapper to exit when any property is overwritten in the config files. */
int logLevelOnOverwrite; /* Defines the log level of the messages reported when properties are overwritten. */
int overwrittenPropertyCausedExit; /* Flag to keep trace whether at least one property was overridden */
@@ -159,7 +160,7 @@
* Create a Properties structure. Must call disposeProperties to free up
* allocated memory.
*/
-extern Properties* createProperties();
+extern Properties* createProperties(int debug, int logLevelOnOverwrite, int exitOnOverwrite);
/**
* Free all memory allocated by a Properties structure. The properties
Modified: trunk/wrapper/src/c/test_javaadditionalparam.c
===================================================================
--- trunk/wrapper/src/c/test_javaadditionalparam.c 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/src/c/test_javaadditionalparam.c 2015-09-01 01:53:11 UTC (rev 1935)
@@ -35,7 +35,7 @@
setConsoleFlush(TRUE);
setSyslogLevelInt(LEVEL_NONE);
- properties = createProperties();
+ properties = createProperties(FALSE, LEVEL_NONE, FALSE);
return properties ? 0 : 1;
}
Modified: trunk/wrapper/src/c/wrapper.c
===================================================================
--- trunk/wrapper/src/c/wrapper.c 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/src/c/wrapper.c 2015-09-01 01:53:11 UTC (rev 1935)
@@ -738,9 +738,13 @@
* This function provides a log file after proloading the properties.
* It will load all configurations related to the logging (loglevel, format, etc.).
* For standard editions, it helps us to resolve the language, if specified in the conf file.
+ *
+ * @param logLevelOnOverwriteProperties : use this parameter to keep the value of the last #properties.on_overwrite.loglevel found during the preload phase
+ * @param exitOnOverwriteProperties : use this parameter to keep the value of the last #properties.on_overwrite.exit found during the preload phase
+ *
* @return TRUE if something failed.
*/
-int wrapperPreLoadConfigurationProperties() {
+int wrapperPreLoadConfigurationProperties(int *logLevelOnOverwriteProperties, int *exitOnOverwriteProperties) {
int returnVal;
returnVal = TRUE;
@@ -759,6 +763,9 @@
returnVal = TRUE;
}
}
+
+ *logLevelOnOverwriteProperties = properties->logLevelOnOverwrite;
+ *exitOnOverwriteProperties = properties->exitOnOverwrite;
if (properties) {
disposeProperties(properties);
@@ -775,6 +782,8 @@
* Return TRUE if there were any problems.
*/
int wrapperLoadConfigurationProperties(int preload) {
+ static int logLevelOnOverwriteProperties = LEVEL_NONE;
+ static int exitOnOverwriteProperties = FALSE;
int i;
int firstCall;
#ifdef WIN32
@@ -893,14 +902,16 @@
}
/* Create a Properties structure. */
- properties = createProperties();
+ properties = createProperties(!preload && firstCall, logLevelOnOverwriteProperties, exitOnOverwriteProperties);
+ logLevelOnOverwriteProperties = LEVEL_NONE;
+ exitOnOverwriteProperties = FALSE;
if (!properties) {
return TRUE;
}
setLogPropertyWarnings(properties, !preload);
- /* Is it really useful to call again wrapperAddDefaultProperties() here? The function was already called on preload.
+ /* Not sure we need to call again wrapperAddDefaultProperties() here. The function was already called on preload.
Use properties->logLevelOnOverwrite to see the concerned properties */
wrapperAddDefaultProperties();
@@ -944,6 +955,7 @@
/* If we are in preload mode, we want to enable log warning messages here so everything below this point has propper warnings. */
setLogPropertyWarnings(properties, TRUE);
} else if (properties->overwrittenPropertyCausedExit) {
+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_FATAL, TEXT("Found duplicated properties. The wrapper will stop."));
return TRUE; /* will cause the wrapper to exit with error code 1 */
}
@@ -1026,7 +1038,7 @@
wrapperData->javaStatusFileUmask = getIntProperty(properties, TEXT("wrapper.java.statusfile.umask"), wrapperData->umask);
wrapperData->anchorFileUmask = getIntProperty(properties, TEXT("wrapper.anchorfile.umask"), wrapperData->umask);
setLogfileUmask(getIntProperty(properties, TEXT("wrapper.logfile.umask"), wrapperData->umask));
- return wrapperPreLoadConfigurationProperties();
+ return wrapperPreLoadConfigurationProperties(&logLevelOnOverwriteProperties, &exitOnOverwriteProperties);
}
#ifndef WIN32
/** If in the first call here and the wrapper will deamonize, then we don't need
@@ -6061,6 +6073,11 @@
int InQuotes = FALSE;
int Escaped = FALSE;
+ /* special case where the callback should do nothing */
+ if ((fileName == NULL) && (lineNumber == -1) && (config == NULL)) {
+ return TRUE;
+ }
+
#ifdef _DEBUG
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_NOTICE, TEXT(" : %s"), config);
#endif
Modified: trunk/wrapper/src/c/wrapper_file.c
===================================================================
--- trunk/wrapper/src/c/wrapper_file.c 2015-08-20 03:03:32 UTC (rev 1934)
+++ trunk/wrapper/src/c/wrapper_file.c 2015-09-01 01:53:11 UTC (rev 1935)
@@ -252,7 +252,7 @@
return CONFIG_FILE_READER_FAIL;
}
- if (depth == 0 && !reader->preload) {
+ if (depth == 0) {
/* At least log with LEVEL_DEBUG to help support. */
reader->logLevelOnOverwrite = LEVEL_DEBUG;
}
@@ -503,18 +503,17 @@
break;
}
}
- } else if (!reader->preload && _tcsstr(trimmedBuffer, TEXT("#properties.")) == trimmedBuffer) {
+ } else if (_tcsstr(trimmedBuffer, TEXT("#properties.")) == trimmedBuffer) {
if(_tcsstr(trimmedBuffer, TEXT("#properties.on_overwrite.exit=")) == trimmedBuffer) {
trimmedBuffer += 30;
if (_tcsicmp(trimmedBuffer, TEXT("TRUE")) == 0) {
reader->exitOnOverwrite = TRUE;
- } else {
+ } else if (_tcsicmp(trimmedBuffer, TEXT("FALSE")) == 0) {
reader->exitOnOverwrite = FALSE;
- if (_tcsicmp(trimmedBuffer, TEXT("FALSE")) != 0) {
- log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN,
- TEXT("Encountered an invalid boolean value for directive #properties.on_overwrite.exit=%s (line %d). Resolving to FALSE."),
- trimmedBuffer, lineNumber);
- }
+ } else if (!reader->preload) {
+ log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN,
+ TEXT("Encountered an invalid boolean value for directive #properties.on_overwrite.exit=%s (line %d). Ignoring this directive."),
+ trimmedBuffer, lineNumber);
}
} else if (_tcsstr(trimmedBuffer, TEXT("#properties.on_overwrite.loglevel=")) == trimmedBuffer) {
trimmedBuffer += 34;
@@ -524,7 +523,7 @@
reader->logLevelOnOverwrite = LEVEL_DEBUG;
} else if (logLevelOnOverwrite != LEVEL_UNKNOWN) {
reader->logLevelOnOverwrite = logLevelOnOverwrite;
- } else {
+ } else if (!reader->preload) {
log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_WARN,
TEXT("Encountered an invalid value for directive #properties.on_overwrite.loglevel=%s (line %d). Ignoring this directive."),
trimmedBuffer, lineNumber);
@@ -542,6 +541,15 @@
lineNumber++;
} while (c != NULL);
+ /* Call the callback after reading the file completely in order to copy reader->exitOnOverwrite & reader->logLevelOnOverwrite into the properties structure.
+ * (we want to keep these values after preload for logging potential problems on properties defined in the command line)
+ * This is needed if directives are set at the end of the file with no properties after. */
+ ...
[truncated message content] |