Java错误java.util.zip.ZipException:打开zip文件时出错

时间:2016-11-18 20:17:07

标签: java

我有一个java类文件,其中包含以下部分:

 private static String getBusinessObjectList(String paramString)
  {
    String str1 = "";
    HashSet localHashSet = new HashSet();
    ZipFile localZipFile = null;
    try
    {
      localZipFile = new ZipFile(paramString);
      Enumeration localEnumeration = localZipFile.entries();
      while (localEnumeration.hasMoreElements())
      {
        Object localObject1 = (ZipEntry)localEnumeration.nextElement();
        String str2 = ((ZipEntry)localObject1).getName();
        String[] arrayOfString = str2.split("/");
        if ((arrayOfString != null) && (arrayOfString.length == 2)) {
          localHashSet.add(arrayOfString[0]);
        }
      }
      if (localZipFile != null) {
        try
        {
          localZipFile.close();
        }
        catch (IOException localIOException4)
        {
          localIOException4.printStackTrace();
        }
      }
      localIterator = localHashSet.iterator();
    }
    catch (IOException localIOException2)
    {
      localIOException2.printStackTrace();
    }
    finally
    {
      if (localZipFile != null) {
        try
        {
          localZipFile.close();
        }
        catch (IOException localIOException4)
        {
          localIOException4.printStackTrace();
        }
      }
    }
    Iterator localIterator;
    while (localIterator.hasNext())
    {
      Object localObject1 = localIterator.next();
      if (str1.length() > 0) {
        str1 = str1 + ",";
      }
      str1 = str1 + String.valueOf(localObject1);
    }
    return str1;
  }
}

此部分错误地用:

java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:214)
        at java.util.zip.ZipFile.<init>(ZipFile.java:144)
        at java.util.zip.ZipFile.<init>(ZipFile.java:115)
        at xcm.oracle.apps.fusion.GenericToolUpload.getBusinessObjectList(GenericToolUpload.java:277)
        at xcm.oracle.apps.fusion.GenericToolUpload.main(GenericToolUpload.java:82)

它正在挑选的文件已加密。但是这个程序应该选择它 任何人都可以帮我解决这个错误吗?

0 个答案:

没有答案