IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Documents Java Discussion :

Zip bomb detected


Sujet :

Documents Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Par défaut Zip bomb detected
    Salut à tous,

    Deux question concernant Java Excel :

    1 ► Quand j'ouvre un fichier xlsx de 1.06 Mo tout va bien mais de 3.23 Mo il me dit :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Caused by: java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Counter: 827392, cis.counter: 8192, ratio: 0.009900990099009901Limits: MIN_INFLATE_RATIO: 0.01
    Même erreur avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    double ratio = 0.0099900990099009901;
    ZipSecureFile.setMinInflateRatio(ratio);
    2 ► Puis-je ouvrir un fichier xls avec un XSSF, car quand j'essaye il me dit :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
     
    Exception in thread "AWT-EventQueue-0" org.apache.poi.openxml4j.exceptions.InvalidOperationException: Can't open the specified file: 'Z:\Nathan\4F_VOPS_MM_S2C_Current_Tab_2016-01-23_15-52-14.xls'
    	at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:135)
    	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:257)
    	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:202)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:302)
    	at EVENT.UtilityMethods.createTabPanel(UtilityMethods.java:110)
    	at EVENT.UtilityMethods.createJTabbed(UtilityMethods.java:74)
    	at EVENT.Events.btnLoad_click(Events.java:68)
    	at EVENT.Events.actionPerformed(Events.java:39)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
    	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
    	at javax.swing.JComponent.processKeyBindings(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.util.zip.ZipException: error in opening zip file
    	at java.util.zip.ZipFile.open(Native Method)
    	at java.util.zip.ZipFile.<init>(Unknown Source)
    	at java.util.zip.ZipFile.<init>(Unknown Source)
    	at org.apache.poi.openxml4j.util.ZipSecureFile.<init>(ZipSecureFile.java:142)
    	at org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipFile(ZipHelper.java:158)
    	at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:133)
    	... 51 more
    Merci à tous

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    tu es sur que ton xlsx n'est pas corrompu? Poste le pour vérifier.

    Pour les fichjeirs xls (aussi appelés excel 97), c'est HSSF qu'il faut utiliser.

  3. #3
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Par défaut
    J'aimerai pouvoir faire les deux, et je pensé que 'Qui peux le plus peux le moins' marcher aussi avec XSSF n'est-ce pas le cas ?

    Voici le fichier excel :
    Oups, je ne trouve pas le bouton pour insérer un fichier, et pour une image c'est 2 Mo max

  4. #4
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Par défaut
    Pour le fichier excel corrompu tu dois avoir raison car j'ai fais un copier coller du contenu de toutes les feuilles et là plus de problème pour le lire, donc ça doit venir du fichier source.
    Pour le fichier xls comment je peux faire, car le but c'est de pouvoir ouvrir n'importe quel fichier excel, c'est quand même dommage d'avoir des restrictions sur ça ?

  5. #5
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Les formats sont complètement différents. Les stratégies de lecture et de maintenance n'ont rien à voir entre eux et tous les deux ne supportent pas les même fonctionnalités. Tu as donc un objet spécifique au format xlsx (XSSFWorkbook) et un objet spécifique au format xls (HSSFWorkbook). Mais ça ne change pas grand chsoe au niveau de ton code au delà de la lecture, puisque les deux implémentent la même interface: Workbook.

  6. #6
    Membre émérite
    Avatar de Cafeinoman
    Homme Profil pro
    Couteau suisse d'une PME
    Inscrit en
    Octobre 2012
    Messages
    628
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Couteau suisse d'une PME

    Informations forums :
    Inscription : Octobre 2012
    Messages : 628
    Par défaut
    Pour être plus concret, tu fais une classe abstraite avec l'algo en n'utilisant que les interfaces (Workbook, Row,...), et des getters abstrait pour avoir les instances. Et deux classes concrètes, une pour xlsx et une xls. Et tu instancie en fonction du fichier.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. décompresser des .zip
    Par Nico65 dans le forum C++
    Réponses: 3
    Dernier message: 30/11/2004, 14h51
  2. Virus detecté au demarrage
    Par Nasky dans le forum Sécurité
    Réponses: 7
    Dernier message: 26/11/2002, 23h07
  3. [VB6] [Lecteur] Détection de disquette
    Par oazar dans le forum VB 6 et antérieur
    Réponses: 4
    Dernier message: 31/10/2002, 12h37
  4. detection de lignes
    Par the.cable.guy dans le forum Algorithmes et structures de données
    Réponses: 29
    Dernier message: 10/10/2002, 11h15
  5. Detection arret de windows
    Par philippe30 dans le forum API, COM et SDKs
    Réponses: 4
    Dernier message: 21/09/2002, 18h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo