This is an automated email from the ASF dual-hosted git repository.

tballison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new a1e1649263 TIKA-4986: remove ISArchiveParser(String location) (#3375)
a1e1649263 is described below

commit a1e16492631e7722b5cd111f1f6bdabc90e85f48
Author: Tim Allison <[email protected]>
AuthorDate: Wed Oct 21 05:43:01 2026 -0400

    TIKA-4986: remove ISArchiveParser(String location) (#3375)
    
    The ISA-Tab directory is always the study file's parent directory.
      Add CHANGES rows for the per-parse location fix (#3374) and the removal.
    
      Co-Authored-By: Claude Opus 5.5 <[email protected]
---
 CHANGES.txt                                        |  8 +++++++
 .../apache/tika/parser/isatab/ISArchiveParser.java | 26 +---------------------
 .../tika/parser/isatab/ISArchiveParserTest.java    | 15 ++++++-------
 3 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 24423f0dc6..f09d0be37b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,13 @@
 Release 4.2.0 - unreleased
 
+   * ISArchiveParser no longer reads every ISA-Tab document's investigation 
and assay files
+     from the directory of the first document it parsed; concurrent parses no 
longer share
+     the study file name (TIKA-4986).
+
+   * ISArchiveParser(String location) is removed: the ISA-Tab directory is 
always the
+     parent directory of the study file, so pass a file-backed TikaInputStream
+     (TikaInputStream.get(Path)) (TIKA-4986).
+
   BREAKING CHANGES AND DEPRECATIONS
 
    * Unpack output is a Frictionless Data Package by default on tika-server 
/unpack,
diff --git 
a/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java
 
b/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java
index 0a363c1ad8..f7581f018e 100644
--- 
a/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java
+++ 
b/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java
@@ -50,26 +50,6 @@ public class ISArchiveParser implements Parser {
     private static String studyAssayFileNameField = 
ISATabUtils.ISATAB.key("Study Assay File Name");
     private final Set<MediaType> SUPPORTED_TYPES =
             Collections.singleton(MediaType.application("x-isatab"));
-    private final String location;
-
-    /**
-     * Default constructor.
-     */
-    public ISArchiveParser() {
-        this(null);
-    }
-
-    /**
-     * Constructor that accepts the pathname of ISArchive folder.
-     *
-     * @param location pathname of ISArchive folder including ISA-Tab files
-     */
-    public ISArchiveParser(String location) {
-        if (location != null && !location.endsWith(File.separator)) {
-            location += File.separator;
-        }
-        this.location = location;
-    }
 
     @Override
     public Set<MediaType> getSupportedTypes(ParseContext context) {
@@ -83,11 +63,7 @@ public class ISArchiveParser implements Parser {
         TemporaryResources tmp = null;
 
         try {
-            // the parser is shared across parses: resolve the directory per 
document
-            String location = this.location;
-            if (location == null) {
-                location = tis.getFile().getParent() + File.separator;
-            }
+            String location = tis.getFile().getParent() + File.separator;
             // Use resource name from metadata if available, fall back to file 
name
             String resourceName = 
metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY);
             String studyFileName = resourceName != null ? resourceName : 
tis.getFile().getName();
diff --git 
a/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/test/java/org/apache/tika/parser/isatab/ISArchiveParserTest.java
 
b/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/test/java/org/apache/tika/parser/isatab/ISArchiveParserTest.java
index 8d20ee20b9..02308159e0 100644
--- 
a/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/test/java/org/apache/tika/parser/isatab/ISArchiveParserTest.java
+++ 
b/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/test/java/org/apache/tika/parser/isatab/ISArchiveParserTest.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
@@ -41,18 +42,16 @@ public class ISArchiveParserTest extends TikaTest {
 
     @Test
     public void testParseArchive() throws Exception {
-        String path = "/test-documents/testISATab_BII-I-1/s_BII-S-1.txt";
-
-        Parser parser = new ISArchiveParser(
-                
ISArchiveParserTest.class.getResource("/test-documents/testISATab_BII-I-1/").toURI()
-                        .getPath());
-        //Parser parser = new AutoDetectParser();
+        // the parser reads the investigation file next to the study, so open 
the file itself
+        Path study = Paths.get(ISArchiveParserTest.class
+                
.getResource("/test-documents/testISATab_BII-I-1/s_BII-S-1.txt").toURI());
+        Parser parser = new ISArchiveParser();
 
         ContentHandler handler = new BodyContentHandler();
         Metadata metadata = new Metadata();
         metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, "s_BII-S-1.txt");
         ParseContext context = new ParseContext();
-        try (TikaInputStream tis = getResourceAsStream(path)) {
+        try (TikaInputStream tis = TikaInputStream.get(study)) {
             parser.parse(tis, handler, metadata, context);
         }
 
@@ -95,7 +94,7 @@ public class ISArchiveParserTest extends TikaTest {
         Path study = isaDir.resolve("s_test.txt");
         Files.write(study, "\"Source 
Name\"\n\"culture1\"\n".getBytes(StandardCharsets.UTF_8));
 
-        Parser parser = new ISArchiveParser(isaDir.toString());
+        Parser parser = new ISArchiveParser();
         ContentHandler handler = new BodyContentHandler();
         Metadata metadata = new Metadata();
         metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, "s_test.txt");

Reply via email to