You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by to...@apache.org on 2010/09/21 23:05:43 UTC
svn commit: r999643 - in
/uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika:
FileSystemCollectionReader.java TIKAWrapper.java
Author: tommaso
Date: Tue Sep 21 21:05:43 2010
New Revision: 999643
URL: http://svn.apache.org/viewvc?rev=999643&view=rev
Log:
[UIMA-1878] - backward compatibility reestablished
Modified:
uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/FileSystemCollectionReader.java
uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/TIKAWrapper.java
Modified: uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/FileSystemCollectionReader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/FileSystemCollectionReader.java?rev=999643&r1=999642&r2=999643&view=diff
==============================================================================
--- uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/FileSystemCollectionReader.java (original)
+++ uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/FileSystemCollectionReader.java Tue Sep 21 21:05:43 2010
@@ -96,9 +96,9 @@ public class FileSystemCollectionReader
// call Tika wrapper
try {
- tika.populateCASfromURI(aCAS, file.toURI(), this.mMIME, this.mLanguage);
+ tika.populateCASfromURL(aCAS, file.toURI().toURL(), this.mMIME, this.mLanguage);
} catch (CASException e) {
- getLogger().log(Level.WARNING,"Problem converting file : "+file.toURL()+"\t"+e.getMessage());
+ getLogger().log(Level.WARNING,"Problem converting file : "+file.toURI().toURL()+"\t"+e.getMessage());
throw new IOException(e);
//jcas.setDocumentText(" "); return;
}
Modified: uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/TIKAWrapper.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/TIKAWrapper.java?rev=999643&r1=999642&r2=999643&view=diff
==============================================================================
--- uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/TIKAWrapper.java (original)
+++ uima/sandbox/trunk/TikaAnnotator/src/main/java/org/apache/uima/tika/TIKAWrapper.java Tue Sep 21 21:05:43 2010
@@ -22,7 +22,7 @@ package org.apache.uima.tika;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URI;
+import java.net.URL;
import org.apache.tika.config.TikaConfig;
import org.apache.tika.exception.TikaException;
@@ -33,7 +33,6 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.cas.FSArray;
-import org.apache.uima.util.Level;
public class TIKAWrapper {
@@ -55,16 +54,16 @@ public class TIKAWrapper {
}
- public void populateCASfromURI(CAS cas, URI uri, String language) throws CASException{
- populateCASfromURI(cas, uri, null, language);
+ public void populateCASfromURL(CAS cas, URL uri, String language) throws CASException{
+ populateCASfromURL(cas, uri, null, language);
}
- public void populateCASfromURI(CAS cas, URI uri, String mime, String language) throws CASException{
+ public void populateCASfromURL(CAS cas, URL url, String mime, String language) throws CASException{
InputStream originalStream=null;
try {
originalStream = new BufferedInputStream(
- uri.toURL().openStream());
+ url.openStream());
} catch (IOException e1) {
new CASException(e1);
}
@@ -126,8 +125,8 @@ public class TIKAWrapper {
}
FeatureValue fv = new FeatureValue(jcas);
- fv.setName("uri");
- fv.setValue(uri.toString());
+ fv.setName("url");
+ fv.setValue(url.toString());
docAnnotation.setFeatures(i,fv);
docAnnotation.addToIndexes();