From 6d5f8c61e879c0385c948c054c59bccf1530889b Mon Sep 17 00:00:00 2001 From: sramazzina Date: Thu, 12 Oct 2023 10:41:24 +0200 Subject: [PATCH 1/2] fix #3293 MDI not working properly on Get Filename --- .../hop/pipeline/transforms/getfilenames/FileItem.java | 3 +-- .../transforms/getfilenames/GetFileNamesMeta.java | 9 +++++---- .../getfilenames/messages/messages_en_US.properties | 1 + .../getfilenames/messages/messages_it_IT.properties | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FileItem.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FileItem.java index 2a5574e92a5..6dd56f59d4c 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FileItem.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/FileItem.java @@ -17,11 +17,10 @@ package org.apache.hop.pipeline.transforms.getfilenames; +import java.util.Objects; import org.apache.hop.core.util.Utils; import org.apache.hop.metadata.api.HopMetadataProperty; -import java.util.Objects; - public class FileItem { private static final String NO = "N"; diff --git a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java index 12a9392095e..f70840161d7 100644 --- a/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java +++ b/plugins/transforms/getfilenames/src/main/java/org/apache/hop/pipeline/transforms/getfilenames/GetFileNamesMeta.java @@ -17,6 +17,9 @@ package org.apache.hop.pipeline.transforms.getfilenames; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.commons.vfs2.FileObject; import org.apache.hop.core.CheckResult; import org.apache.hop.core.ICheckResult; @@ -45,10 +48,6 @@ import org.apache.hop.resource.ResourceEntry.ResourceType; import org.apache.hop.resource.ResourceReference; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @Transform( id = "GetFileNames", image = "getfilenames.svg", @@ -75,6 +74,8 @@ public class GetFileNamesMeta extends BaseTransformMeta Date: Tue, 31 Oct 2023 15:52:25 +0100 Subject: [PATCH 2/2] fix #3334 StringOperations MDI not working properly --- .../StringOperationsMeta.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java b/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java index d445f9744a9..f34f3160809 100644 --- a/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java +++ b/plugins/transforms/stringoperations/src/main/java/org/apache/hop/pipeline/transforms/stringoperations/StringOperationsMeta.java @@ -17,6 +17,7 @@ package org.apache.hop.pipeline.transforms.stringoperations; +import java.util.List; import org.apache.hop.core.CheckResult; import org.apache.hop.core.Const; import org.apache.hop.core.ICheckResult; @@ -38,8 +39,6 @@ import org.apache.hop.pipeline.transform.TransformMeta; import org.w3c.dom.Node; -import java.util.List; - @Transform( id = "StringOperations", image = "stringoperations.svg", @@ -417,34 +416,34 @@ public String getXml() { retval.append(" ").append(Const.CR); retval.append(" ").append(XmlHandler.addTagValue("in_stream_name", fieldInStream[i])); - retval - .append(" ") - .append(XmlHandler.addTagValue("out_stream_name", fieldOutStream[i])); + retval + .append(" ") + .append(XmlHandler.addTagValue("out_stream_name", (fieldOutStream == null || fieldOutStream.length == 0 || fieldOutStream.length <= i) ? "" : !Utils.isEmpty(fieldOutStream[i]) ? fieldOutStream[i] : "")); retval .append(" ") - .append(XmlHandler.addTagValue("trim_type", getTrimTypeCode(trimType[i]))); + .append(XmlHandler.addTagValue("trim_type", (trimType == null || trimType.length == 0 || trimType.length <= i) ? "" : getTrimTypeCode(trimType[i]))); retval .append(" ") - .append(XmlHandler.addTagValue("lower_upper", getLowerUpperCode(lowerUpper[i]))); + .append(XmlHandler.addTagValue("lower_upper", (lowerUpper == null || lowerUpper.length == 0 || lowerUpper.length <= i) ? "" : getLowerUpperCode(lowerUpper[i]))); retval .append(" ") - .append(XmlHandler.addTagValue("padding_type", getPaddingCode(paddingType[i]))); - retval.append(" ").append(XmlHandler.addTagValue("pad_char", lPadChar)); - retval.append(" ").append(XmlHandler.addTagValue("pad_len", lPadLen)); + .append(XmlHandler.addTagValue("padding_type", (paddingType == null || paddingType.length == 0 || paddingType.length <= i) ? "" : getPaddingCode(paddingType[i]))); + retval.append(" ").append(XmlHandler.addTagValue("pad_char", (padChar == null || padChar.length == 0 || padChar.length <= i) ? "" : padChar[i])); + retval.append(" ").append(XmlHandler.addTagValue("pad_len", (padLen == null || padLen.length == 0 || padLen.length <= i) ? "" : padLen[i])); retval .append(" ") - .append(XmlHandler.addTagValue("init_cap", getInitCapCode(initCap[i]))); + .append(XmlHandler.addTagValue("init_cap", (initCap == null || initCap.length == 0 || initCap.length <= i) ? "" : getInitCapCode(initCap[i]))); retval .append(" ") - .append(XmlHandler.addTagValue("mask_xml", getMaskXMLCode(maskXML[i]))); - retval.append(" ").append(XmlHandler.addTagValue("digits", getDigitsCode(digits[i]))); + .append(XmlHandler.addTagValue("mask_xml", (maskXML == null || maskXML.length == 0 || maskXML.length <= i) ? "" : getMaskXMLCode(maskXML[i]))); + retval.append(" ").append(XmlHandler.addTagValue("digits", (digits == null || digits.length == 0 || digits.length <= i) ? "" : getDigitsCode(digits[i]))); retval .append(" ") .append( XmlHandler.addTagValue( "remove_special_characters", - getRemoveSpecialCharactersCode(remove_special_characters[i]))); + (remove_special_characters == null || remove_special_characters.length == 0 || remove_special_characters.length <= i) ? "" : getRemoveSpecialCharactersCode(remove_special_characters[i]))); retval.append(" ").append(Const.CR); }