jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r720533 - in /jackrabbit/trunk/jackrabbit-text-extractors/src: main/java/org/apache/jackrabbit/extractor/RTFTextExtractor.java test/java/org/apache/jackrabbit/extractor/RTFTextExtractorTest.java
Date Tue, 25 Nov 2008 16:38:14 GMT
Author: jukka
Date: Tue Nov 25 08:38:14 2008
New Revision: 720533

URL: http://svn.apache.org/viewvc?rev=720533&view=rev
Log:
JCR-1881: RTF text extractor fails on Java 1.4 in some environments

Catch and log all errors in RTFTextExtractor.

Guard the test case against unhelpful environments.

Modified:
    jackrabbit/trunk/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/RTFTextExtractor.java
    jackrabbit/trunk/jackrabbit-text-extractors/src/test/java/org/apache/jackrabbit/extractor/RTFTextExtractorTest.java

Modified: jackrabbit/trunk/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/RTFTextExtractor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/RTFTextExtractor.java?rev=720533&r1=720532&r2=720533&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/RTFTextExtractor.java
(original)
+++ jackrabbit/trunk/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/RTFTextExtractor.java
Tue Nov 25 08:38:14 2008
@@ -61,8 +61,8 @@
             rek.read(stream, doc, 0);
             String text = doc.getText(0, doc.getLength());
             return new StringReader(text);
-        } catch (BadLocationException e) {
-            logger.warn("Failed to extract RTF text content", e);
+        } catch (Throwable t) {
+            logger.warn("Failed to extract RTF text content", t);
             return new StringReader("");
         } finally {
             stream.close();

Modified: jackrabbit/trunk/jackrabbit-text-extractors/src/test/java/org/apache/jackrabbit/extractor/RTFTextExtractorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-text-extractors/src/test/java/org/apache/jackrabbit/extractor/RTFTextExtractorTest.java?rev=720533&r1=720532&r2=720533&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-text-extractors/src/test/java/org/apache/jackrabbit/extractor/RTFTextExtractorTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-text-extractors/src/test/java/org/apache/jackrabbit/extractor/RTFTextExtractorTest.java
Tue Nov 25 08:38:14 2008
@@ -21,6 +21,8 @@
 import java.io.Reader;
 import java.io.StringWriter;
 
+import javax.swing.text.DefaultStyledDocument;
+
 import junit.framework.TestCase;
 
 /**
@@ -30,6 +32,13 @@
 public class RTFTextExtractorTest extends TestCase {
 
     public void testExtractor() throws IOException {
+        // JCR-1881: Only run the test if the underlying libraries work
+        try {
+            new DefaultStyledDocument();
+        } catch (Throwable t) {
+            return;
+        }
+
         TextExtractor extractor = new RTFTextExtractor();
         InputStream in = getClass().getResourceAsStream("test.rtf");
         Reader r = extractor.extractText(in, "application/rtf", null);



Mime
View raw message