diff --git a/.travis.yml b/.travis.yml
index 6fbc77b..26af1df 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,3 +4,11 @@ jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
+before_install:
+ # override default MAVEN_OPTS
+ - echo "MAVEN_OPTS='-Xms1g -Xmx2g -XX:MaxPermSize=512m'" > ~/.mavenrc
+ # Fix OpenJDK buffer overflow
+ - cat /etc/hosts # optionally check the content *before*
+ - sudo hostname "$(hostname | cut -c1-63)"
+ - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
+ - cat /etc/hosts # optionally check the content *after*
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 08d0b7d..99e0212 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,6 +72,16 @@
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.19.1
+
+
+ 1
+ ${surefire.jvm.params}
+
+
diff --git a/src/main/java/com/logentries/net/AsyncLogger.java b/src/main/java/com/logentries/net/AsyncLogger.java
index d767297..5676b05 100644
--- a/src/main/java/com/logentries/net/AsyncLogger.java
+++ b/src/main/java/com/logentries/net/AsyncLogger.java
@@ -270,8 +270,8 @@ public int getDataHubPort() {
*
* @param logHostName
*/
- public void setLogHostName(boolean logHostName) {
- this.logHostName = logHostName;
+ public void setLogHostName(boolean logHostName) {
+ this.logHostName = logHostName;
}
/**
@@ -279,8 +279,8 @@ public void setLogHostName(boolean logHostName) {
*
* @return logHostName switch value
*/
- public boolean getLogHostName() {
- return this.logHostName;
+ public boolean getLogHostName() {
+ return this.logHostName;
}
/**
@@ -288,8 +288,8 @@ public boolean getLogHostName() {
*
* @param hostName
*/
- public void setHostName(String hostName) {
- this.hostName = hostName;
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
}
/**
@@ -297,8 +297,8 @@ public void setHostName(String hostName) {
*
* @return Host name field value
*/
- public String getHostName() {
- return this.hostName;
+ public String getHostName() {
+ return this.hostName;
}
/**
@@ -306,8 +306,8 @@ public String getHostName() {
*
* @param logID
*/
- public void setLogID(String logID) {
- this.logID = logID;
+ public void setLogID(String logID) {
+ this.logID = logID;
}
/**
@@ -315,8 +315,8 @@ public void setLogID(String logID) {
*
* @return logID field value
*/
- public String getLogID() {
- return this.logID;
+ public String getLogID() {
+ return this.logID;
}
/**
@@ -419,7 +419,9 @@ public void addLineToQueue(String line) {
}
private void addLineToQueue (String line, int limit) {
- if (limit == 0) { throw new LogTooLongException(); }
+ if (limit == 0) {
+ dbg("Message longer than " + RECURSION_LIMIT);
+ return; }
//// Check credentials only if logs are sent to LE directly.
// Check that we have all parameters set and socket appender running.
diff --git a/src/main/java/com/logentries/net/LogTooLongException.java b/src/main/java/com/logentries/net/LogTooLongException.java
deleted file mode 100644
index 80bbf8a..0000000
--- a/src/main/java/com/logentries/net/LogTooLongException.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.logentries.net;
-
-/**
- * Thrown when a log + timestamps etc. is longer than {@link com.logentries.net.AsyncLogger#LOG_LENGTH_LIMIT} chars.
- */
-public class LogTooLongException extends RuntimeException {
-}
diff --git a/src/test/java/com/logentries/net/AsyncLoggerTest.java b/src/test/java/com/logentries/net/AsyncLoggerTest.java
index 61ac859..b829d7c 100644
--- a/src/test/java/com/logentries/net/AsyncLoggerTest.java
+++ b/src/test/java/com/logentries/net/AsyncLoggerTest.java
@@ -1,6 +1,9 @@
package com.logentries.net;
import org.junit.Test;
+
+import java.util.Random;
+
import static org.junit.Assert.*;
public class AsyncLoggerTest {
@@ -17,6 +20,21 @@ public void testGetAndSetToken()
}
@Test
+ public void testOversizeMessage()
+ {
+ AsyncLogger async = new AsyncLogger();
+ char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
+ StringBuilder sb = new StringBuilder();
+ Random random = new Random();
+ for (int i = 0; i < 2100000; i++) {
+ char c = chars[random.nextInt(chars.length)];
+ sb.append(c);
+ }
+ String output = sb.toString();
+ async.addLineToQueue(output);
+ }
+
+ @Test
public void testGetAndSetHttpPut()
{
AsyncLogger async = new AsyncLogger();