List of usage examples for org.apache.commons.vfs FileType FILE
FileType FILE
To view the source code for org.apache.commons.vfs FileType FILE.
Click Source Link
From source file:org.pentaho.di.trans.steps.script.ScriptAddedFunctions.java
public static double getFileSize(ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext) { try {//from w w w . java 2 s. c o m if (ArgList.length == 1 && !isNull(ArgList[0]) && !isUndefined(ArgList[0])) { if (ArgList[0].equals(null)) { return 0; } FileObject file = null; try { // Source file file = KettleVFS.getFileObject((String) ArgList[0]); long filesize = 0; if (file.exists()) { if (file.getType().equals(FileType.FILE)) { filesize = file.getContent().getSize(); } else { new RuntimeException("[" + (String) ArgList[0] + "] is not a file!"); } } else { new RuntimeException("file [" + (String) ArgList[0] + "] can not be found!"); } return filesize; } catch (IOException e) { throw new RuntimeException("The function call getFileSize throw an error : " + e.toString()); } finally { if (file != null) { try { file.close(); } catch (Exception e) { // Ignore errors } } } } else { throw new RuntimeException("The function call getFileSize is not valid."); } } catch (Exception e) { throw new RuntimeException(e.toString()); } }
From source file:org.pentaho.di.trans.steps.script.ScriptAddedFunctions.java
public static boolean isFile(ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext) { try {/*from w w w.j a va 2 s. c o m*/ if (ArgList.length == 1 && !isNull(ArgList[0]) && !isUndefined(ArgList[0])) { if (ArgList[0].equals(null)) { return false; } FileObject file = null; try { // Source file file = KettleVFS.getFileObject((String) ArgList[0]); boolean isafile = false; if (file.exists()) { if (file.getType().equals(FileType.FILE)) { isafile = true; } else { new RuntimeException("[" + (String) ArgList[0] + "] is not a file!"); } } else { new RuntimeException("file [" + (String) ArgList[0] + "] can not be found!"); } return isafile; } catch (IOException e) { throw new RuntimeException("The function call is File throw an error : " + e.toString()); } finally { if (file != null) { try { file.close(); } catch (Exception e) { // Ignore errors } } } } else { throw new RuntimeException("The function call isFile is not valid."); } } catch (Exception e) { throw new RuntimeException(e.toString()); } }
From source file:org.pentaho.di.trans.steps.script.ScriptAddedFunctions.java
public static void moveFile(ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext) { try {//from ww w .j ava 2s . c om if (ArgList.length == 3 && !isNull(ArgList[0]) && !isNull(ArgList[1]) && !isUndefined(ArgList[0]) && !isUndefined(ArgList[1])) { FileObject fileSource = null, fileDestination = null; try { // Source file to move fileSource = KettleVFS.getFileObject((String) ArgList[0]); // Destination filename fileDestination = KettleVFS.getFileObject((String) ArgList[1]); if (fileSource.exists()) { // Source file exists... if (fileSource.getType() == FileType.FILE) { // Great..source is a file ... boolean overwrite = false; if (!ArgList[1].equals(null)) { overwrite = (Boolean) ArgList[2]; } boolean destinationExists = fileDestination.exists(); // Let's move the file... if ((destinationExists && overwrite) || !destinationExists) { fileSource.moveTo(fileDestination); } } } else { new RuntimeException("file to move [" + (String) ArgList[0] + "] can not be found!"); } } catch (IOException e) { throw new RuntimeException("The function call moveFile throw an error : " + e.toString()); } finally { if (fileSource != null) { try { fileSource.close(); } catch (Exception e) { // Ignore errors } } if (fileDestination != null) { try { fileDestination.close(); } catch (Exception e) { // Ignore errors } } } } else { throw new RuntimeException("The function call copyFile is not valid."); } } catch (Exception e) { throw new RuntimeException(e.toString()); } }
From source file:org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java
public static void deleteFile(Context actualContext, Scriptable actualObject, Object[] ArgList, Function FunctionContext) { try {/*from w w w. j a v a 2 s .c om*/ if (ArgList.length == 1 && !isNull(ArgList[0]) && !isUndefined(ArgList[0])) { // Object act = actualObject.get("_step_", actualObject); // ScriptValuesMod act = (ScriptValuesMod)Context.toType(scm_delete, ScriptValuesMod.class); FileObject fileObject = null; try { fileObject = KettleVFS.getFileObject(Context.toString(ArgList[0])); if (fileObject.exists()) { if (fileObject.getType() == FileType.FILE) { if (!fileObject.delete()) { Context.reportRuntimeError( "We can not delete file [" + Context.toString(ArgList[0]) + "]!"); } } } else { Context.reportRuntimeError("file [" + Context.toString(ArgList[0]) + "] can not be found!"); } } catch (IOException e) { throw Context.reportRuntimeError("The function call deleteFile is not valid."); } finally { if (fileObject != null) { try { fileObject.close(); } catch (Exception e) { // Ignore errors } } } } else { throw Context.reportRuntimeError("The function call deleteFile is not valid."); } } catch (Exception e) { throw Context.reportRuntimeError(e.toString()); } }
From source file:org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java
public static void copyFile(Context actualContext, Scriptable actualObject, Object[] ArgList, Function FunctionContext) { try {// ww w.j a va 2 s . c o m if (ArgList.length == 3 && !isNull(ArgList[0]) && !isNull(ArgList[1]) && !isUndefined(ArgList[0]) && !isUndefined(ArgList[1])) { FileObject fileSource = null, fileDestination = null; try { // Source file to copy fileSource = KettleVFS.getFileObject(Context.toString(ArgList[0])); // Destination filename fileDestination = KettleVFS.getFileObject(Context.toString(ArgList[1])); if (fileSource.exists()) { // Source file exists... if (fileSource.getType() == FileType.FILE) { // Great..source is a file ... boolean overwrite = false; if (!ArgList[1].equals(null)) { overwrite = Context.toBoolean(ArgList[2]); } boolean destinationExists = fileDestination.exists(); // Let's copy the file... if ((destinationExists && overwrite) || !destinationExists) { FileUtil.copyContent(fileSource, fileDestination); } } } else { Context.reportRuntimeError( "file to copy [" + Context.toString(ArgList[0]) + "] can not be found!"); } } catch (IOException e) { throw Context.reportRuntimeError("The function call copyFile throw an error : " + e.toString()); } finally { if (fileSource != null) { try { fileSource.close(); } catch (Exception e) { // Ignore errors } } if (fileDestination != null) { try { fileDestination.close(); } catch (Exception e) { // Ignore errors } } } } else { throw Context.reportRuntimeError("The function call copyFileis not valid."); } } catch (Exception e) { throw Context.reportRuntimeError(e.toString()); } }
From source file:org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java
public static double getFileSize(Context actualContext, Scriptable actualObject, Object[] ArgList, Function FunctionContext) { try {/*from w w w . j a v a 2 s .c om*/ if (ArgList.length == 1 && !isNull(ArgList[0]) && !isUndefined(ArgList[0])) { if (ArgList[0].equals(null)) { return 0; } FileObject file = null; try { // Source file file = KettleVFS.getFileObject(Context.toString(ArgList[0])); long filesize = 0; if (file.exists()) { if (file.getType().equals(FileType.FILE)) { filesize = file.getContent().getSize(); } else { Context.reportRuntimeError("[" + Context.toString(ArgList[0]) + "] is not a file!"); } } else { Context.reportRuntimeError("file [" + Context.toString(ArgList[0]) + "] can not be found!"); } return filesize; } catch (IOException e) { throw Context .reportRuntimeError("The function call getFileSize throw an error : " + e.toString()); } finally { if (file != null) { try { file.close(); } catch (Exception e) { // Ignore close errors } } } } else { throw Context.reportRuntimeError("The function call getFileSize is not valid."); } } catch (Exception e) { throw Context.reportRuntimeError(e.toString()); } }
From source file:org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java
public static boolean isFile(Context actualContext, Scriptable actualObject, Object[] ArgList, Function FunctionContext) { try {/* w w w . j ava 2 s.co m*/ if (ArgList.length == 1 && !isNull(ArgList[0]) && !isUndefined(ArgList[0])) { if (ArgList[0].equals(null)) { return false; } FileObject file = null; try { // Source file file = KettleVFS.getFileObject(Context.toString(ArgList[0])); boolean isafile = false; if (file.exists()) { if (file.getType().equals(FileType.FILE)) { isafile = true; } else { Context.reportRuntimeError("[" + Context.toString(ArgList[0]) + "] is not a file!"); } } else { Context.reportRuntimeError("file [" + Context.toString(ArgList[0]) + "] can not be found!"); } return isafile; } catch (IOException e) { throw Context.reportRuntimeError("The function call is File throw an error : " + e.toString()); } finally { if (file != null) { try { file.close(); } catch (Exception e) { // Ignore errors } } } } else { throw Context.reportRuntimeError("The function call isFile is not valid."); } } catch (Exception e) { throw Context.reportRuntimeError(e.toString()); } }
From source file:org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesAddedFunctions.java
public static void moveFile(Context actualContext, Scriptable actualObject, Object[] ArgList, Function FunctionContext) { try {/*from www . j a va 2 s . co m*/ if (ArgList.length == 3 && !isNull(ArgList[0]) && !isNull(ArgList[1]) && !isUndefined(ArgList[0]) && !isUndefined(ArgList[1])) { FileObject fileSource = null, fileDestination = null; try { // Source file to move fileSource = KettleVFS.getFileObject(Context.toString(ArgList[0])); // Destination filename fileDestination = KettleVFS.getFileObject(Context.toString(ArgList[1])); if (fileSource.exists()) { // Source file exists... if (fileSource.getType() == FileType.FILE) { // Great..source is a file ... boolean overwrite = false; if (!ArgList[1].equals(null)) { overwrite = Context.toBoolean(ArgList[2]); } boolean destinationExists = fileDestination.exists(); // Let's move the file... if ((destinationExists && overwrite) || !destinationExists) { fileSource.moveTo(fileDestination); } } } else { Context.reportRuntimeError( "file to move [" + Context.toString(ArgList[0]) + "] can not be found!"); } } catch (IOException e) { throw Context.reportRuntimeError("The function call moveFile throw an error : " + e.toString()); } finally { if (fileSource != null) { try { fileSource.close(); } catch (Exception e) { // Ignore errors } } if (fileDestination != null) { try { fileDestination.close(); } catch (Exception e) { // Ignore errors } } } } else { throw Context.reportRuntimeError("The function call copyFile is not valid."); } } catch (Exception e) { throw Context.reportRuntimeError(e.toString()); } }
From source file:org.pentaho.di.trans.steps.xslt.Xslt.java
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { meta = (XsltMeta) smi;/*from w ww. java 2s. c om*/ data = (XsltData) sdi; Object[] row = getRow(); if (row == null) { // no more input to be expected... setOutputDone(); return false; } if (first) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields(data.outputRowMeta, getStepname(), null, null, this, repository, metaStore); // Check if The result field is given if (Const.isEmpty(meta.getResultfieldname())) { // Result Field is missing ! logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorResultFieldMissing")); throw new KettleStepException( BaseMessages.getString(PKG, "Xslt.Exception.ErrorResultFieldMissing")); } // Check if The XML field is given if (Const.isEmpty(meta.getFieldname())) { // Result Field is missing ! logError(BaseMessages.getString(PKG, "Xslt.Exception.ErrorXMLFieldMissing")); throw new KettleStepException(BaseMessages.getString(PKG, "Xslt.Exception.ErrorXMLFieldMissing")); } // Try to get XML Field index data.fieldposition = getInputRowMeta().indexOfValue(meta.getFieldname()); // Let's check the Field if (data.fieldposition < 0) { // The field is unreachable ! logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorFindingField") + "[" + meta.getFieldname() + "]"); throw new KettleStepException( BaseMessages.getString(PKG, "Xslt.Exception.CouldnotFindField", meta.getFieldname())); } // Check if the XSL Filename is contained in a column if (meta.useXSLField()) { if (Const.isEmpty(meta.getXSLFileField())) { // The field is missing // Result field is missing ! logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorXSLFileFieldMissing")); throw new KettleStepException( BaseMessages.getString(PKG, "Xslt.Exception.ErrorXSLFileFieldMissing")); } // Try to get Field index data.fielxslfiledposition = getInputRowMeta().indexOfValue(meta.getXSLFileField()); // Let's check the Field if (data.fielxslfiledposition < 0) { // The field is unreachable ! logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorXSLFileFieldFinding") + "[" + meta.getXSLFileField() + "]"); throw new KettleStepException(BaseMessages.getString(PKG, "Xslt.Exception.ErrorXSLFileFieldFinding", meta.getXSLFileField())); } } else { if (Const.isEmpty(meta.getXslFilename())) { logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorXSLFile")); throw new KettleStepException(BaseMessages.getString(PKG, "Xslt.Exception.ErrorXSLFile")); } // Check if XSL File exists! data.xslfilename = environmentSubstitute(meta.getXslFilename()); FileObject file = null; try { file = KettleVFS.getFileObject(data.xslfilename); if (!file.exists()) { logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorXSLFileNotExists", data.xslfilename)); throw new KettleStepException(BaseMessages.getString(PKG, "Xslt.Exception.ErrorXSLFileNotExists", data.xslfilename)); } if (file.getType() != FileType.FILE) { logError(BaseMessages.getString(PKG, "Xslt.Log.ErrorXSLNotAFile", data.xslfilename)); throw new KettleStepException( BaseMessages.getString(PKG, "Xslt.Exception.ErrorXSLNotAFile", data.xslfilename)); } } catch (Exception e) { throw new KettleStepException(e); } finally { try { if (file != null) { file.close(); } } catch (Exception e) { /* Ignore */ } } } // Check output parameters int nrOutputProps = meta.getOutputPropertyName() == null ? 0 : meta.getOutputPropertyName().length; if (nrOutputProps > 0) { data.outputProperties = new Properties(); for (int i = 0; i < nrOutputProps; i++) { data.outputProperties.put(meta.getOutputPropertyName()[i], environmentSubstitute(meta.getOutputPropertyValue()[i])); } data.setOutputProperties = true; } // Check parameters data.nrParams = meta.getParameterField() == null ? 0 : meta.getParameterField().length; if (data.nrParams > 0) { data.indexOfParams = new int[data.nrParams]; data.nameOfParams = new String[data.nrParams]; for (int i = 0; i < data.nrParams; i++) { String name = environmentSubstitute(meta.getParameterName()[i]); String field = environmentSubstitute(meta.getParameterField()[i]); if (Const.isEmpty(field)) { throw new KettleStepException( BaseMessages.getString(PKG, "Xslt.Exception.ParameterFieldMissing", name, i)); } data.indexOfParams[i] = getInputRowMeta().indexOfValue(field); if (data.indexOfParams[i] < 0) { throw new KettleStepException( BaseMessages.getString(PKG, "Xslt.Exception.ParameterFieldNotFound", name)); } data.nameOfParams[i] = name; } data.useParameters = true; } data.factory = TransformerFactory.newInstance(); if (meta.getXSLFactory().equals("SAXON")) { // Set the TransformerFactory to the SAXON implementation. data.factory = new net.sf.saxon.TransformerFactoryImpl(); } } // end if first // Get the field value String xmlValue = getInputRowMeta().getString(row, data.fieldposition); if (meta.useXSLField()) { // Get the value data.xslfilename = getInputRowMeta().getString(row, data.fielxslfiledposition); if (log.isDetailed()) { logDetailed(BaseMessages.getString(PKG, "Xslt.Log.XslfileNameFromFied", data.xslfilename, meta.getXSLFileField())); } } try { if (log.isDetailed()) { if (meta.isXSLFieldIsAFile()) { logDetailed(BaseMessages.getString(PKG, "Xslt.Log.Filexsl") + data.xslfilename); } else { logDetailed(BaseMessages.getString(PKG, "Xslt.Log.XslStream", data.xslfilename)); } } // Get the template from the cache Transformer transformer = data.getTemplate(data.xslfilename, data.xslIsAfile); // Do we need to set output properties? if (data.setOutputProperties) { transformer.setOutputProperties(data.outputProperties); } // Do we need to pass parameters? if (data.useParameters) { for (int i = 0; i < data.nrParams; i++) { transformer.setParameter(data.nameOfParams[i], row[data.indexOfParams[i]]); } } Source source = new StreamSource(new StringReader(xmlValue)); // Prepare output stream StreamResult result = new StreamResult(new StringWriter()); // transform xml source transformer.transform(source, result); String xmlString = result.getWriter().toString(); if (log.isDetailed()) { logDetailed(BaseMessages.getString(PKG, "Xslt.Log.FileResult")); logDetailed(xmlString); } Object[] outputRowData = RowDataUtil.addValueData(row, getInputRowMeta().size(), xmlString); if (log.isRowLevel()) { logRowlevel( BaseMessages.getString(PKG, "Xslt.Log.ReadRow") + " " + getInputRowMeta().getString(row)); } // add new values to the row. putRow(data.outputRowMeta, outputRowData); // copy row to output rowset(s); } catch (Exception e) { String errorMessage = e.getMessage(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); DefaultErrorHandler.printLocation(pw, e); pw.close(); errorMessage = sw.toString() + "\n" + errorMessage; if (getStepMeta().isDoingErrorHandling()) { // Simply add this row to the error row putError(getInputRowMeta(), row, 1, errorMessage, meta.getResultfieldname(), "XSLT01"); } else { logError(BaseMessages.getString(PKG, "Xslt.ErrorProcesing" + " : " + errorMessage)); throw new KettleStepException(BaseMessages.getString(PKG, "Xslt.ErrorProcesing"), e); } } return true; }
From source file:org.pentaho.di.trans.steps.zipfile.ZipFile.java
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { meta = (ZipFileMeta) smi;// ww w. ja v a2 s . c o m data = (ZipFileData) sdi; Object[] r = getRow(); // Get row from input rowset & set row busy! if (r == null) { // no more input to be expected... setOutputDone(); return false; } if (first) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields(data.outputRowMeta, getStepname(), null, null, this, getTrans().getRepository(), getTrans().getMetaStore()); // Check is source filename field is provided if (Const.isEmpty(meta.getDynamicSourceFileNameField())) { throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Error.SourceFilenameFieldMissing")); } // Check is target filename field is provided if (Const.isEmpty(meta.getDynamicTargetFileNameField())) { throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Error.TargetFilenameFieldMissing")); } // cache the position of the source filename field if (data.indexOfSourceFilename < 0) { data.indexOfSourceFilename = getInputRowMeta().indexOfValue(meta.getDynamicSourceFileNameField()); if (data.indexOfSourceFilename < 0) { // The field is unreachable ! throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Exception.CouldnotFindField", meta.getDynamicSourceFileNameField())); } } data.indexOfZipFilename = getInputRowMeta().indexOfValue(meta.getDynamicTargetFileNameField()); if (data.indexOfZipFilename < 0) { // The field is unreachable ! throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Exception.CouldnotFindField", meta.getDynamicTargetFileNameField())); } if (meta.isKeepSouceFolder()) { if (!Const.isEmpty(meta.getBaseFolderField())) { // cache the position of the source filename field data.indexOfBaseFolder = getInputRowMeta().indexOfValue(meta.getBaseFolderField()); if (data.indexOfBaseFolder < 0) { // The field is unreachable ! throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Exception.CouldnotFindField", meta.getBaseFolderField())); } } } // Move to folder if (meta.getOperationType() == ZipFileMeta.OPERATION_TYPE_MOVE) { if (Const.isEmpty(meta.getMoveToFolderField())) { throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Exception.EmptyMovetoFolder")); } data.indexOfMoveToFolder = getInputRowMeta().indexOfValue(meta.getMoveToFolderField()); if (data.indexOfMoveToFolder < 0) { // The field is unreachable ! throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Exception.CouldnotFindField", meta.getMoveToFolderField())); } } } // End If first boolean sendToErrorRow = false; String errorMessage = null; try { // get source filename String sourceFilename = getInputRowMeta().getString(r, data.indexOfSourceFilename); if (Const.isEmpty(sourceFilename)) { log.logError(toString(), BaseMessages.getString(PKG, "ZipFile.Error.SourceFileEmpty")); throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Error.SourceFileEmpty")); } data.sourceFile = KettleVFS.getFileObject(sourceFilename); // Check sourcefile boolean skip = false; if (!data.sourceFile.exists()) { log.logError(toString(), BaseMessages.getString(PKG, "ZipFile.Error.SourceFileNotExist", sourceFilename)); throw new KettleException( BaseMessages.getString(PKG, "ZipFile.Error.SourceFileNotExist", sourceFilename)); } else { if (data.sourceFile.getType() != FileType.FILE) { log.logError(toString(), BaseMessages.getString(PKG, "ZipFile.Error.SourceFileNotFile", sourceFilename)); throw new KettleException( BaseMessages.getString(PKG, "ZipFile.Error.SourceFileNotFile", sourceFilename)); } } // get basefolder if (data.indexOfBaseFolder > -1) { data.baseFolder = getInputRowMeta().getString(r, data.indexOfBaseFolder); } // get destination folder String moveToFolder = null; if (data.indexOfMoveToFolder > -1) { moveToFolder = getInputRowMeta().getString(r, data.indexOfMoveToFolder); if (Const.isEmpty(moveToFolder)) { throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Error.EmptyMoveToFolder")); } } if (!skip) { // get value for target filename String targetFilename = getInputRowMeta().getString(r, data.indexOfZipFilename); if (Const.isEmpty(targetFilename)) { log.logError(toString(), BaseMessages.getString(PKG, "ZipFile.Error.TargetFileEmpty")); throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Error.TargetFileEmpty")); } data.zipFile = KettleVFS.getFileObject(targetFilename); if (data.zipFile.exists()) { if (log.isDetailed()) { log.logDetailed(toString(), BaseMessages.getString(PKG, "ZipFile.Log.TargetFileExists", targetFilename)); } } else { // let's check parent folder FileObject parentFolder = data.zipFile.getParent(); if (!parentFolder.exists()) { if (!meta.isCreateParentFolder()) { // Parent folder not exist // So we will fail throw new KettleException(BaseMessages.getString(PKG, "ZipFile.Error.TargetParentFolderNotExists", parentFolder.toString())); } else { // Create parent folder parentFolder.createFolder(); } } if (parentFolder != null) { parentFolder.close(); } } // Let's zip zipFile(); // file was zipped, let's see if we need to move or delete it processFile(moveToFolder); // add filename to result filenames? addFilenameToResult(); } getLinesInput(); putRow(data.outputRowMeta, r); // copy row to output rowset(s); if (checkFeedback(getLinesRead())) { if (log.isDetailed()) { logDetailed(BaseMessages.getString(PKG, "ZipFile.LineNumber", "" + getLinesRead())); } } } catch (Exception e) { if (getStepMeta().isDoingErrorHandling()) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError(BaseMessages.getString(PKG, "ZipFile.ErrorInStepRunning") + e.getMessage()); setErrors(1); stopAll(); setOutputDone(); // signal end to receiver(s) return false; } if (sendToErrorRow) { // Simply add this row to the error row putError(getInputRowMeta(), r, 1, errorMessage, null, "ZipFile001"); } } finally { try { if (data.sourceFile != null) { data.sourceFile.close(); } if (data.zipFile != null) { data.zipFile.close(); } } catch (Exception e) { /* Ignore */ } } return true; }