From: <bma...@us...> - 2011-10-17 08:39:31
|
Revision: 6536 http://fudaa.svn.sourceforge.net/fudaa/?rev=6536&view=rev Author: bmarchan Date: 2011-10-17 08:39:21 +0000 (Mon, 17 Oct 2011) Log Message: ----------- Fix : Pb de dezippe *.lspiv.zip depuis compression 7Zip. Modified Paths: -------------- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/metier/PivProject.java Modified: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java 2011-10-17 08:36:51 UTC (rev 6535) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java 2011-10-17 08:39:21 UTC (rev 6536) @@ -65,8 +65,8 @@ protected static BuInformationsSoftware isPIV_ = new BuInformationsSoftware(); static { isPIV_.name = "LSPIV"; - isPIV_.version = "1.1_b20111013"; - isPIV_.date = "2011-10-13"; + isPIV_.version = "1.1_b20111017"; + isPIV_.date = "2011-10-17"; isPIV_.rights = PivResource.getS("Tous droits r\xE9serv\xE9s")+". CETMEF (c)1999-2011"; isPIV_.license = "GPL2"; isPIV_.languages = "fr"; @@ -473,7 +473,7 @@ public void run() { diProgress.dispose(); if (!b2) { - error(PivResource.getS("Le fichier ne semble pas \xEAtre un projet Fudaa-LSPIV\n(Pas de pr\xE9sence du r\xE9pertoire '{0}' )", PivProject.OUTPUT_DIR)); + error(PivResource.getS("Le fichier ne semble pas \xEAtre un projet Fudaa-LSPIV.\nCauses possibles:\n- Le fichier n'est pas dans un format ZIP\n- Il ne contient pas le r\xE9pertoire '{0}'", PivProject.OUTPUT_DIR)); project=null; } else { Modified: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/metier/PivProject.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/metier/PivProject.java 2011-10-17 08:36:51 UTC (rev 6535) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/metier/PivProject.java 2011-10-17 08:39:21 UTC (rev 6536) @@ -6,8 +6,10 @@ import java.io.File; import java.io.FileFilter; import java.io.IOException; +import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; +import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import javax.imageio.ImageIO; import javax.imageio.ImageReader; @@ -433,23 +435,44 @@ if (_prog!=null) _prog.setDesc(PivResource.getS("Chargement du projet")); - // Controle que le fichier archive est bien un fichier PIV. + // Controle que le fichier archive est bien un fichier PIV par recherche + // d'un repertoire OUTPUT_DIR dans toutes les entries. Suivant le zippeur, + // il se peut que le r\xE9pertoire en tant qu'entry n'existe pas. On recherche + // donc ce nom dans toutes les entries. try { + boolean bfound=false; ZipFile zf=new ZipFile(_prjFile); - if (zf.getEntry(OUTPUT_DIR)==null) return false; + + FuLog.debug("Fichiers dans le ZIP:"); + NEXT_ENTRY: + for (Enumeration<? extends ZipEntry> e=zf.entries(); e.hasMoreElements();) { + File f=new File(e.nextElement().getName()); + FuLog.debug(f.getPath()); + while (f!=null) { + if (OUTPUT_DIR.equals(f.getPath())) { + bfound=true; + break NEXT_ENTRY; + } + f=f.getParentFile(); + } + } + if (!bfound) return false; + zf.close(); } catch (IOException ex) { + FuLog.debug(ex.getMessage()); return false; } - // Cr\xE9ation du r\xE9pertoire temporaire de travail pour le unzip. + // Cr\xE9ation du r\xE9pertoire temporaire de travail pour le unzip... init(); - // Unzip + // ... puis unzip try { CtuluLibFile.unzip(_prjFile, rootPath, _prog); } catch (IOException ex) { + FuLog.debug(ex.getMessage()); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |