branch feature/1221 created (now 67c379a)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1221 in repository lima. See http://git.chorem.org/lima.git at 67c379a refs #1221: Erreur à l'annulation des import/export This branch includes the following new commits: new 67c379a refs #1221: Erreur à l'annulation des import/export The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 67c379aae93cd88005ae2c51580ece66a4a05f6f Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 8 09:30:34 2015 +0200 refs #1221: Erreur à l'annulation des import/export -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1221 in repository lima. See http://git.chorem.org/lima.git commit 67c379aae93cd88005ae2c51580ece66a4a05f6f Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 8 09:30:34 2015 +0200 refs #1221: Erreur à l'annulation des import/export --- .../chorem/lima/ui/importexport/ImportExport.java | 55 ++++++++++++---------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java index d0c4de2..8ab4506 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java @@ -140,15 +140,17 @@ public class ImportExport { final Charset defaultCharset = Charsets.UTF_8; if (Strings.isNullOrEmpty(exportPath) && importUrl == null) { exportPath = chooseFile(importExportChoice.getImportMode(), importExportChoice); - File file = new File(exportPath); - if (file.exists()) { - try { - importUrl = file.toURI().toURL(); - } catch (MalformedURLException e) { - throw new LimaTechnicalException("Can't open file " + exportPath); + if (exportPath != null) { // if null ==> cancel import/export + File file = new File(exportPath); + if (file.exists()) { + try { + importUrl = file.toURI().toURL(); + } catch (MalformedURLException e) { + throw new LimaTechnicalException("Can't open file " + exportPath); + } + } else { + throw new LimaTechnicalException("Can't open file from path" + exportPath); } - } else { - throw new LimaTechnicalException("Can't open file from path" + exportPath); } } processImportExport(verbose, importExportChoice, defaultCharset, exportPath, importUrl); @@ -189,27 +191,32 @@ public class ImportExport { final Charset defaultCharset = Charsets.UTF_8; URL importFileUrl; String importFilePath = chooseFile(importExportChoice.getImportMode(), importExportChoice); - File file = new File(importFilePath); - if (file.exists()) { - try { - importFileUrl = file.toURI().toURL(); - } catch (MalformedURLException e) { - throw new LimaTechnicalException("Can't open file " + importFilePath); + if (importFilePath != null) { // if null ==> cancel import + File file = new File(importFilePath); + if (file.exists()) { + try { + importFileUrl = file.toURI().toURL(); + } catch (MalformedURLException e) { + throw new LimaTechnicalException("Can't open file " + importFilePath); + } + } else { + throw new LimaTechnicalException("Can't open file from path" + importFilePath); } - } else { - throw new LimaTechnicalException("Can't open file from path" + importFilePath); + log.info("Precessing import:" + importFileUrl.getPath() + " " + importFilePath + " " + importFileUrl.getFile()); + processImportExport(verbose, importExportChoice, defaultCharset, null, importFileUrl); } - log.info("Precessing import:" + importFileUrl.getPath() + " " + importFilePath + " " + importFileUrl.getFile()); - processImportExport(verbose, importExportChoice, defaultCharset, null, importFileUrl); } protected void processExport(final ImportExportEnum importExportChoice, boolean verbose) { String exportFilePath = chooseFile(importExportChoice.getImportMode(), importExportChoice); - if (StringUtils.isNotBlank(exportFilePath)) { - log.info("Precessing export:" + exportFilePath); - processImportExport(verbose, importExportChoice, Charsets.UTF_8, exportFilePath, null); - } else { - throw new LimaTechnicalException("Targeted directory can not be found."); + if (exportFilePath != null) { // if null ==> cancel export + File file = new File(exportFilePath); + if (file.exists()) { + log.info("Precessing export:" + exportFilePath); + processImportExport(verbose, importExportChoice, Charsets.UTF_8, exportFilePath, null); + } else { + throw new LimaTechnicalException("Targeted directory can not be found."); + } } } @@ -500,7 +507,7 @@ public class ImportExport { * @return the targeted file path */ public String chooseFile(Boolean importMode, ImportExportEnum importExportMethod) { - String filePath = ""; + String filePath = null; JFileChooser chooser = new JFileChooser(); //Encoding option -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm