diff --git a/pom.xml b/pom.xml
index 7c990956d18d17f90bbd903fa1433ee94b938beb..6440113d80b7a1b21f8bd6c538aadaf5e0cd3efd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1184,12 +1184,12 @@
 			<groupId>org.mnode.ical4j</groupId>
 			<artifactId>ical4j</artifactId>
 			<version>1.0.2</version>
-		</dependency>
+		</dependency><!-- 
 		<dependency>
 			<groupId>javassist</groupId>
 			<artifactId>javassist</artifactId>
 			<version>3.8.0.GA</version>
-		</dependency>
+		</dependency> -->
 		<dependency><!-- Velocity dependency -->
 			<groupId>oro</groupId>
 			<artifactId>oro</artifactId>
@@ -1439,6 +1439,10 @@
 					<groupId>xerces</groupId>
 					<artifactId>xmlParserAPIs</artifactId>
 				</exclusion>
+				<exclusion>
+					<groupId>org.apache.ant</groupId>
+					<artifactId>ant</artifactId>
+				</exclusion>
 			</exclusions>
 		</dependency>
 		<dependency>
diff --git a/src/main/java/org/olat/search/service/document/file/TextDocument.java b/src/main/java/org/olat/search/service/document/file/TextDocument.java
index acd704355b03d86c420fc1a7a1c4e1420b6d27b3..28d16db1297f8bd7ed7fd2371c0d04454acb2eaf 100644
--- a/src/main/java/org/olat/search/service/document/file/TextDocument.java
+++ b/src/main/java/org/olat/search/service/document/file/TextDocument.java
@@ -25,13 +25,15 @@
 
 package org.olat.search.service.document.file;
 
-import java.io.BufferedInputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
 
 import org.apache.lucene.document.Document;
 import org.olat.core.logging.OLog;
 import org.olat.core.logging.Tracing;
-import org.olat.core.util.FileUtils;
 import org.olat.core.util.vfs.VFSLeaf;
 import org.olat.search.service.SearchResourceContext;
 
@@ -44,6 +46,10 @@ public class TextDocument extends FileDocument {
 	private static final OLog log = Tracing.createLoggerFor(TextDocument.class);
 
 	public final static String FILE_TYPE = "type.file.text";
+	/**
+	 * Limit the maximal size of the content read to index.
+	 */
+	public static int MAX_SIZE = 200000;
 
 	public TextDocument() {
 		//
@@ -60,9 +66,28 @@ public class TextDocument extends FileDocument {
 	
 	@Override
 	protected FileContent readContent(VFSLeaf leaf) throws IOException {
-  	BufferedInputStream bis = new BufferedInputStream(leaf.getInputStream());
-		String content = FileUtils.load(bis, "utf-8");
-		bis.close();
-  	return new FileContent(content);
+    StringWriter out = new StringWriter();
+    InputStreamReader in = new InputStreamReader(leaf.getInputStream());
+		try {
+			copy(in, out);
+		} catch (Exception e) {
+			log.error("", e);
+		}
+  	return new FileContent(out.toString());
+	}
+	
+	private void copy(Reader input, Writer output)
+	throws IOException {
+		char[] buffer = new char[4096];
+		
+		int count = 0;
+    int n = 0;
+    while (-1 != (n = input.read(buffer))) {
+        output.write(buffer, 0, n);
+        count += n;
+        if(count >= MAX_SIZE) {
+        	break;
+        }
+    }
 	}
 }