Author: jukka
Date: Tue Mar 9 22:55:31 2010
New Revision: 921182
URL: http://svn.apache.org/viewvc?rev=921182&view=rev
Log:
TIKA-386: Tika relies on X11
Capture the reported NoClassDefFoundError and wrap it into a more appropriate
TikaException
Modified:
lucene/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/rtf/RTFParser.java
Modified:
lucene/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/rtf/RTFParser.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/rtf/RTFParser.java?rev=921182&r1=921181&r2=921182&view=diff
==============================================================================
---
lucene/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/rtf/RTFParser.java
(original)
+++
lucene/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/rtf/RTFParser.java
Tue Mar 9 22:55:31 2010
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -64,6 +64,16 @@ public class RTFParser implements Parser
} catch (InternalError e) {
throw new TikaException(
"Internal error parsing an RTF document, see TIKA-282", e);
+ } catch (NoClassDefFoundError e) {
+ if (Boolean.getBoolean("java.awt.headless")) {
+ throw new TikaException(
+ "Unexpected RTF parsing error in headless mode", e);
+ } else {
+ throw new TikaException(
+ "GUI environment expected by the javax.swing.text.rtf"
+ + " package is not available, see JCR-386;"
+ + " try running with -Djava.awt.headless=true", e);
+ }
}
}