tika-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1224675 - in /tika/trunk/tika-core/src/main/java/org/apache/tika: fork/ForkParser.java io/TikaInputStream.java
Date Mon, 26 Dec 2011 04:04:54 GMT
Author: nick
Date: Mon Dec 26 04:04:54 2011
New Revision: 1224675

URL: http://svn.apache.org/viewvc?rev=1224675&view=rev
Log:
TIKA-829 Validate inputs to the ForkParser constructor (must not be another ForkParser) and
TikaInputStream get (must not be null) - patch from Jerome Lacoste

Modified:
    tika/trunk/tika-core/src/main/java/org/apache/tika/fork/ForkParser.java
    tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java

Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/fork/ForkParser.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/fork/ForkParser.java?rev=1224675&r1=1224674&r2=1224675&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/fork/ForkParser.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/fork/ForkParser.java Mon Dec 26 04:04:54
2011
@@ -52,7 +52,14 @@ public class ForkParser extends Abstract
     private final Queue<ForkClient> pool =
         new LinkedList<ForkClient>();
 
+    /**
+     * @param loader The ClassLoader to use 
+     * @param parser the parser to delegate to. This one cannot be another ForkParser
+     */
     public ForkParser(ClassLoader loader, Parser parser) {
+        if (parser instanceof ForkParser) {
+            throw new IllegalArgumentException("The underlying parser of a ForkParser should
not be a ForkParser, but a specific implementation.");
+        }
         this.loader = loader;
         this.parser = parser;
     }
@@ -112,6 +119,10 @@ public class ForkParser extends Abstract
             InputStream stream, ContentHandler handler,
             Metadata metadata, ParseContext context)
             throws IOException, SAXException, TikaException {
+        if (stream == null) {
+            throw new NullPointerException("null stream");
+        }
+
         Throwable t;
 
         boolean alive = false;

Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java?rev=1224675&r1=1224674&r2=1224675&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java Mon Dec 26
04:04:54 2011
@@ -105,6 +105,9 @@ public class TikaInputStream extends Tag
      */
     public static TikaInputStream get(
             InputStream stream, TemporaryResources tmp) {
+        if (stream == null) {
+            throw new NullPointerException("The Stream must not be null");
+        }
         if (stream instanceof TikaInputStream) {
             return (TikaInputStream) stream;
         } else {



Mime
View raw message