diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-08-29 12:39:04 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-08-29 12:39:04 +1200 |
commit | 51a0046d026d0e4273413e2e8c84ef9e26f0a4cf (patch) | |
tree | 260134e338c1c7f2cee0c716d07a64c0b0ea79a0 | |
parent | 9ab536ca8c4e1ad850cb5fa08bbe99f14676b535 (diff) | |
parent | 7644abe2e8aeb27de803b35bea772e2fe0a94c72 (diff) | |
download | trackermap-server-51a0046d026d0e4273413e2e8c84ef9e26f0a4cf.tar.gz trackermap-server-51a0046d026d0e4273413e2e8c84ef9e26f0a4cf.tar.bz2 trackermap-server-51a0046d026d0e4273413e2e8c84ef9e26f0a4cf.zip |
Merge branch master from github
-rw-r--r-- | pom.xml | 12 | ||||
-rwxr-xr-x | setup/package.sh | 1 | ||||
-rw-r--r-- | setup/windows/traccar.iss | 1 | ||||
-rw-r--r-- | src/org/traccar/helper/Log.java | 14 | ||||
-rw-r--r-- | test/org/traccar/web/WebServerInitialContextTest.java | 27 |
5 files changed, 47 insertions, 8 deletions
@@ -9,6 +9,10 @@ <name>traccar</name> <url>https://www.traccar.org</url> + <properties> + <jetty.version>9.2.13.v20150730</jetty.version> + </properties> + <dependencies> <dependency> <groupId>junit</groupId> @@ -71,22 +75,22 @@ <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> - <version>9.2.13.v20150730</version> + <version>${jetty.version}</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> - <version>9.2.13.v20150730</version> + <version>${jetty.version}</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-webapp</artifactId> - <version>9.2.13.v20150730</version> + <version>${jetty.version}</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-jndi</artifactId> - <version>9.2.13.v20150730</version> + <version>${jetty.version}</version> </dependency> </dependencies> diff --git a/setup/package.sh b/setup/package.sh index 45facba5a..5199e972c 100755 --- a/setup/package.sh +++ b/setup/package.sh @@ -120,6 +120,7 @@ package_unix () { sed -i '/wrapper.java.classpath.1/i\wrapper.java.classpath.2=../tracker-server.jar' out/conf/wrapper.conf sed -i '/wrapper.app.parameter.1/i\wrapper.app.parameter.2=../conf/traccar.xml' out/conf/wrapper.conf + sed -i 's/wrapper.java.additional.1=/wrapper.java.additional.1=-Dfile.encoding=UTF-8/g' out/conf/wrapper.conf sed -i 's/<YourMainClass>/org.traccar.Main/g' out/conf/wrapper.conf sed -i 's/@app.name@/traccar/g' out/conf/wrapper.conf sed -i 's/@app.long.name@/traccar/g' out/conf/wrapper.conf diff --git a/setup/windows/traccar.iss b/setup/windows/traccar.iss index 933b12b58..2c0dac5e6 100644 --- a/setup/windows/traccar.iss +++ b/setup/windows/traccar.iss @@ -65,6 +65,7 @@ begin LoadStringFromFile(ExpandConstant(CurrentFileName), S);
Insert('wrapper.java.classpath.2=../tracker-server.jar' + #13#10, S, Pos('wrapper.java.classpath.1', S));
Insert(ExpandConstant('wrapper.app.parameter.2="{app}\conf\traccar.xml"') + #13#10, S, Pos('wrapper.app.parameter.1', S));
+ StringChangeEx(S, 'wrapper.java.additional.1=', 'wrapper.java.additional.1=-Dfile.encoding=UTF-8', true);
StringChangeEx(S, '<YourMainClass>', 'org.traccar.Main', true);
StringChangeEx(S, '@app.name@', 'Traccar', true);
StringChangeEx(S, '@app.long.name@', 'Traccar', true);
diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java index e4b0168a9..d5d5a6cda 100644 --- a/src/org/traccar/helper/Log.java +++ b/src/org/traccar/helper/Log.java @@ -20,6 +20,8 @@ import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; import java.lang.management.OperatingSystemMXBean; import java.lang.management.RuntimeMXBean; +import java.nio.charset.Charset; + import org.apache.log4j.Appender; import org.apache.log4j.DailyRollingFileAppender; import org.apache.log4j.Layout; @@ -79,22 +81,26 @@ public class Log { public static void logSystemInfo() { try { OperatingSystemMXBean operatingSystemBean = ManagementFactory.getOperatingSystemMXBean(); - Log.info("Operating System" + + Log.info("Operating system" + " name: " + operatingSystemBean.getName() + " version: " + operatingSystemBean.getVersion() + " architecture: " + operatingSystemBean.getArch()); RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); - Log.info("Java Runtime" + + Log.info("Java runtime" + " name: " + runtimeBean.getVmName() + " vendor: " + runtimeBean.getVmVendor() + " version: " + runtimeBean.getVmVersion()); MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); - Log.info("Memory Limit" + + Log.info("Memory limit" + " heap: " + memoryBean.getHeapMemoryUsage().getMax() / (1024 * 1024) + "mb" + " non-heap: " + memoryBean.getNonHeapMemoryUsage().getMax() / (1024 * 1024) + "mb"); - } catch (Exception e) { + + Log.info("Character encoding: " + + System.getProperty("file.encoding") + " charset: " + Charset.defaultCharset()); + + } catch (Exception error) { Log.warning("Failed to get system info"); } } diff --git a/test/org/traccar/web/WebServerInitialContextTest.java b/test/org/traccar/web/WebServerInitialContextTest.java new file mode 100644 index 000000000..dd072863c --- /dev/null +++ b/test/org/traccar/web/WebServerInitialContextTest.java @@ -0,0 +1,27 @@ +package org.traccar.web; + +import org.junit.Test; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +public class WebServerInitialContextTest { + @Test + public void smokeTest() throws NamingException { + DataSource mockDataSource = (DataSource) Proxy.newProxyInstance(getClass().getClassLoader(), + new Class[]{DataSource.class}, new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + return null; + } + }); + + Context context = new InitialContext(); + context.bind("java:/DefaultDS", mockDataSource); + } +} |