From 0065739435718d2d3fe68040e06432d1fa8c1b4d Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Wed, 24 Aug 2016 14:37:00 +0000 Subject: [PATCH] Remove tabs found during investigation git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129834 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../executer/ImporterActionExecuter.java | 212 +++++++++--------- 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java b/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java index 92301306f9..e6a1bf84dd 100644 --- a/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java @@ -89,7 +89,7 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase * The importer service */ private ImporterService importerService; - + /** * The node service */ @@ -110,10 +110,10 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase * * @param importerService The ImporterService */ - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } + public void setImporterService(ImporterService importerService) + { + this.importerService = importerService; + } /** * Sets the NodeService to use @@ -213,14 +213,14 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase String encoding = (String) ruleAction.getParameterValue(PARAM_ENCODING); if (encoding == null) { - encoding = "UTF-8"; + encoding = "UTF-8"; } else { - if (encoding.equalsIgnoreCase("default")) - { - encoding = null; - } + if (encoding.equalsIgnoreCase("default")) + { + encoding = null; + } } zipFile = new ZipFile(tempFile, encoding, true); // build a temp dir name based on the ID of the noderef we are importing @@ -331,108 +331,108 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase } } - /** + /** * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - protected void addParameterDefinitions(List paramList) - { + */ + protected void addParameterDefinitions(List paramList) + { paramList.add(new ParameterDefinitionImpl(PARAM_DESTINATION_FOLDER, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PARAM_DESTINATION_FOLDER))); paramList.add(new ParameterDefinitionImpl(PARAM_ENCODING, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_ENCODING))); - } - - /** - * Extract the file and folder structure of a ZIP file into the specified directory - * - * @param archive The ZIP archive to extract - * @param extractDir The directory to extract into - */ - public static void extractFile(ZipFile archive, String extractDir) - { - String fileName; - String destFileName; - byte[] buffer = new byte[BUFFER_SIZE]; - extractDir = extractDir + File.separator; - try - { - for (Enumeration e = archive.getEntries(); e.hasMoreElements();) - { - ZipArchiveEntry entry = (ZipArchiveEntry) e.nextElement(); - if (!entry.isDirectory()) - { - fileName = entry.getName(); - fileName = fileName.replace('/', File.separatorChar); + } + + /** + * Extract the file and folder structure of a ZIP file into the specified directory + * + * @param archive The ZIP archive to extract + * @param extractDir The directory to extract into + */ + public static void extractFile(ZipFile archive, String extractDir) + { + String fileName; + String destFileName; + byte[] buffer = new byte[BUFFER_SIZE]; + extractDir = extractDir + File.separator; + try + { + for (Enumeration e = archive.getEntries(); e.hasMoreElements();) + { + ZipArchiveEntry entry = (ZipArchiveEntry) e.nextElement(); + if (!entry.isDirectory()) + { + fileName = entry.getName(); + fileName = fileName.replace('/', File.separatorChar); - if (fileName.startsWith("/") || fileName.indexOf(":" + File.separator) == 1 || fileName.contains(".." + File.separator)) - { - throw new AlfrescoRuntimeException(ARCHIVE_CONTAINS_SUSPICIOUS_PATHS_ERROR); - } + if (fileName.startsWith("/") || fileName.indexOf(":" + File.separator) == 1 || fileName.contains(".." + File.separator)) + { + throw new AlfrescoRuntimeException(ARCHIVE_CONTAINS_SUSPICIOUS_PATHS_ERROR); + } - destFileName = extractDir + fileName; - File destFile = new File(destFileName); - String parent = destFile.getParent(); - if (parent != null) - { - File parentFile = new File(parent); - if (!parentFile.exists()) parentFile.mkdirs(); - } - InputStream in = new BufferedInputStream(archive.getInputStream(entry), BUFFER_SIZE); - OutputStream out = new BufferedOutputStream(new FileOutputStream(destFileName), BUFFER_SIZE); - int count; - while ((count = in.read(buffer)) != -1) - { - out.write(buffer, 0, count); - } - in.close(); - out.close(); - } - else - { - File newdir = new File(extractDir + entry.getName()); - newdir.mkdirs(); - } - } - } - catch (ZipException e) - { - throw new AlfrescoRuntimeException("Failed to process ZIP file.", e); - } - catch (FileNotFoundException e) - { - throw new AlfrescoRuntimeException("Failed to process ZIP file.", e); - } - catch (IOException e) - { - throw new AlfrescoRuntimeException("Failed to process ZIP file.", e); - } - } + destFileName = extractDir + fileName; + File destFile = new File(destFileName); + String parent = destFile.getParent(); + if (parent != null) + { + File parentFile = new File(parent); + if (!parentFile.exists()) parentFile.mkdirs(); + } + InputStream in = new BufferedInputStream(archive.getInputStream(entry), BUFFER_SIZE); + OutputStream out = new BufferedOutputStream(new FileOutputStream(destFileName), BUFFER_SIZE); + int count; + while ((count = in.read(buffer)) != -1) + { + out.write(buffer, 0, count); + } + in.close(); + out.close(); + } + else + { + File newdir = new File(extractDir + entry.getName()); + newdir.mkdirs(); + } + } + } + catch (ZipException e) + { + throw new AlfrescoRuntimeException("Failed to process ZIP file.", e); + } + catch (FileNotFoundException e) + { + throw new AlfrescoRuntimeException("Failed to process ZIP file.", e); + } + catch (IOException e) + { + throw new AlfrescoRuntimeException("Failed to process ZIP file.", e); + } + } - /** - * Recursively delete a dir of files and directories - * - * @param dir directory to delete - */ - public static void deleteDir(File dir) - { - if (dir != null) - { - File elenco = new File(dir.getPath()); - - // listFiles can return null if the path is invalid i.e. already been deleted, - // therefore check for null before using in loop - File[] files = elenco.listFiles(); - if (files != null) - { - for (File file : files) - { - if (file.isFile()) file.delete(); - else deleteDir(file); - } - } - - // delete provided directory - dir.delete(); - } - } + /** + * Recursively delete a dir of files and directories + * + * @param dir directory to delete + */ + public static void deleteDir(File dir) + { + if (dir != null) + { + File elenco = new File(dir.getPath()); + + // listFiles can return null if the path is invalid i.e. already been deleted, + // therefore check for null before using in loop + File[] files = elenco.listFiles(); + if (files != null) + { + for (File file : files) + { + if (file.isFile()) file.delete(); + else deleteDir(file); + } + } + + // delete provided directory + dir.delete(); + } + } }