From 749450f5a3a5207da053686c6c392b08551cc71f Mon Sep 17 00:00:00 2001 From: Gisli Magnusson Date: Sat, 7 Feb 2026 14:18:30 +0000 Subject: [PATCH] fix(ENGKNOW-2947): Fix update meta data for non existing folders. --- gortools/src/test/java/gorsat/UTestGorif.java | 1 + gortools/src/test/java/gorsat/UTestNorif.java | 1 + model/src/main/java/org/gorpipe/gor/model/FileReader.java | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gortools/src/test/java/gorsat/UTestGorif.java b/gortools/src/test/java/gorsat/UTestGorif.java index 630c14c6..85677119 100644 --- a/gortools/src/test/java/gorsat/UTestGorif.java +++ b/gortools/src/test/java/gorsat/UTestGorif.java @@ -118,6 +118,7 @@ public static Collection data() throws IOException { {"Invalid file path missing -dh", "gorif not_exists.gor", null, GorParsingException.class}, {"Empty file missing -dh", "gorif " + testEmptyFile, null, GorParsingException.class}, {"Invalid file path with -dh", "gorif -dh col1,col2 not_exists.gor", "col1\tcol2\n", null}, + {"Invalid nested file path with -dh", "gorif -dh col1,col2 some/not_exists.gor", "col1\tcol2\n", null}, {"Invalid file path with invalid -dh value", "gorif -dh col1 not_exists.gor", null, GorParsingException.class}, {"Both invalid and valid file path", "gorif " + testFileGor1 + " not_exists.gor", """ diff --git a/gortools/src/test/java/gorsat/UTestNorif.java b/gortools/src/test/java/gorsat/UTestNorif.java index e08e2de6..184dad15 100644 --- a/gortools/src/test/java/gorsat/UTestNorif.java +++ b/gortools/src/test/java/gorsat/UTestNorif.java @@ -80,6 +80,7 @@ public static Collection data() throws IOException { {"Nested query started with norif", "norif <(nor " + testTsvFile1 + ")", expectedHeader + "chrN\t0\tA\t1\tA\n", null}, {"Invalid file path", "norif -dh col1,col2 not_exists.tsv", HEADER_PREFIX+ "col1\tcol2\n", null}, + {"Invalid nested file path", "norif -dh col1,col2 some/not_exists.tsv", HEADER_PREFIX+ "col1\tcol2\n", null}, {"Invalid file path missing -dh", "norif not_exists.tsv", null, GorParsingException.class}, {"Empty file missing -dh", "norif " + testEmptyFile, null, GorParsingException.class}, {"Invalid file path with invalid -dh value", "norif -dh col1 not_exists.tsv", null, GorParsingException.class}, diff --git a/model/src/main/java/org/gorpipe/gor/model/FileReader.java b/model/src/main/java/org/gorpipe/gor/model/FileReader.java index 87a8214d..09e407a6 100644 --- a/model/src/main/java/org/gorpipe/gor/model/FileReader.java +++ b/model/src/main/java/org/gorpipe/gor/model/FileReader.java @@ -23,6 +23,7 @@ package org.gorpipe.gor.model; import com.google.common.base.Strings; +import org.gorpipe.exceptions.GorException; import org.gorpipe.exceptions.GorSystemException; import org.gorpipe.gor.driver.DataSource; import org.gorpipe.gor.driver.meta.SourceReference; @@ -364,7 +365,6 @@ public Stream prepareSources(Stream sources) { * NOTE: This can be expensive, so it should be used with care. This is only needed for * (shared)filesystems (not object storage). * @param path - * @throws IOException */ public void updateFileSystemMetaData(String path) throws IOException { if (PathUtils.isLocal(path)) { @@ -389,7 +389,7 @@ public boolean existsWithMetaDataUpdate(String path) { try { // If the file does not exist, we try to update the metadata. updateFileSystemMetaData(path); - } catch (IOException e) { + } catch (IOException | GorException e) { log.warn("Could not update file system metadata for path: {}", path, e); return false; }