You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ni...@apache.org on 2010/11/25 12:22:59 UTC
svn commit: r1039005 -
/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/WriteOutContentHandler.java
Author: nick
Date: Thu Nov 25 11:22:59 2010
New Revision: 1039005
URL: http://svn.apache.org/viewvc?rev=1039005&view=rev
Log:
If we hit the write limit, give a helpful error message in case you hadn't been expecting it (TIKA-557)
Modified:
tika/trunk/tika-core/src/main/java/org/apache/tika/sax/WriteOutContentHandler.java
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/WriteOutContentHandler.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/WriteOutContentHandler.java?rev=1039005&r1=1039004&r2=1039005&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/sax/WriteOutContentHandler.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/sax/WriteOutContentHandler.java Thu Nov 25 11:22:59 2010
@@ -117,7 +117,13 @@ public class WriteOutContentHandler exte
} else {
writer.write(ch, start, writeLimit - writeCount);
writeCount = writeLimit;
- throw new WriteLimitReachedException();
+ throw new WriteLimitReachedException(
+ "Your document contained more than " + writeLimit + " " +
+ "characters, and so your requested limit has been " +
+ "reached. To receive the full text of the document, " +
+ "increase your limit. " +
+ "(Text up to the limit is however available)."
+ );
}
} catch (IOException e) {
throw new SAXException("Error writing out character content", e);
@@ -183,6 +189,9 @@ public class WriteOutContentHandler exte
* The exception used as a signal when the write limit has been reached.
*/
private class WriteLimitReachedException extends SAXException {
+ public WriteLimitReachedException(String message) {
+ super(message);
+ }
public WriteOutContentHandler getSource() {
return WriteOutContentHandler.this;