This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 315b903760 [IT] fix textfile issue (#6842)
315b903760 is described below
commit 315b90376038a992f244d582bdcd4afdda849c6d
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Mar 20 15:42:49 2026 +0100
[IT] fix textfile issue (#6842)
---
.../hop/pipeline/transforms/fileinput/text/TextFileInput.java | 2 +-
.../hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java | 4 ++--
.../hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java | 6 +++++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInput.java
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInput.java
index b7dab47c48..2d6535f587 100644
---
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInput.java
+++
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInput.java
@@ -112,7 +112,7 @@ public class TextFileInput extends
BaseFileInputTransform<TextFileInputMeta, Tex
data.enclosure = resolve(meta.getContent().getEnclosure());
data.escapeCharacter = resolve(meta.getContent().getEscapeCharacter());
// CSV without separator defined
- if (meta.getContent().getFileType().equalsIgnoreCase("CSV")
+ if (meta.getFileType().equalsIgnoreCase("CSV")
&& (Utils.isEmpty(meta.getContent().getSeparator()))) {
logError(BaseMessages.getString(PKG,
"TextFileInput.Exception.NoSeparator"));
return false;
diff --git
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
index 580be02ecb..99c9938f0d 100644
---
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
+++
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputMeta.java
@@ -95,10 +95,10 @@ public class TextFileInputMeta
@Getter
@Setter
public static class Content {
- // For some reason these 2 fields ended up in a separate file section in
the XML
+ // Stored as file_type (not "type") so it does not clash with the
transform's <type> plugin id
/** Type of file: CSV or fixed */
@HopMetadataProperty(
- key = "type",
+ key = "file_type",
injectionKey = "FILE_TYPE",
injectionKeyDescription = "TextFileInput.Injection.")
private String fileType;
diff --git
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java
index 132af84c57..53a81d4f43 100644
---
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java
+++
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/fileinput/text/TextFileInputUtils.java
@@ -870,6 +870,10 @@ public class TextFileInputUtils {
int fPos = field.getPosition();
int fLength = field.getLength();
int fPl = fPos + fLength;
+ if (fPos < 0 || fLength < 0 || fPl < fPos) {
+ strings[i] = "";
+ continue;
+ }
if (charBased) {
length = line.length();
if (fPl <= length) {
@@ -890,7 +894,7 @@ public class TextFileInputUtils {
strings[i] = new String(Arrays.copyOfRange(b, fPos, fPl), enc);
} else {
if (fPos < length) {
- strings[i] = new String(Arrays.copyOfRange(b, fPos, length -
1), enc);
+ strings[i] = new String(Arrays.copyOfRange(b, fPos, length),
enc);
} else {
strings[i] = "";
}