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").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); }