Results 1 to 2 of 2
- 10-04-2011, 09:21 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 3
- Rep Power
- 0
The below program fails and throws an exception
The below program fails and throws an exception "Error in opening retrieved zip file". This is only a part of program. I am very new to java. What could be the possiblities to fail and get to catch .
public void unzip_file (String file, String dir, LiblfrEventManager manager) throws LiblfrException {
Enumeration entries;
ZipFile zipFile;
try {
zipFile = new ZipFile(file);
entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry)entries.nextElement();
if (entry.isDirectory()) {
// Assume directories are stored parents first then children
//@ TODO manager.progress_notification("Extracting directory: "+entry.getName(), 0);
(new File(entry.getName())).mkdirs();
}
}
entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry)entries.nextElement();
if (!entry.isDirectory()) {
//@ TODO manager.progress_notification("Extracting file: "+entry.getName(), 0);
copyInputStream(zipFile.getInputStream(entry), new BufferedOutputStream(new FileOutputStream(dir+"/"+entry.getName())));
}
}
zipFile.close();
} catch (IOException ioe) {
throw new LiblfrException("Error in opening retrieved zip file");
}
- 10-04-2011, 10:41 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: The below program fails and throws an exception
Build a wall around Donald Trump; I'll pay for it.
Similar Threads
-
throws exception
By simorgh in forum New To JavaReplies: 1Last Post: 07-30-2010, 01:24 AM -
Applet throws exception while recording
By Basit56 in forum Java AppletsReplies: 1Last Post: 08-20-2009, 02:42 PM -
Exception throws when I read File
By Juggler in forum New To JavaReplies: 11Last Post: 08-18-2008, 07:09 PM -
Main method with throws Exception
By bugger in forum New To JavaReplies: 3Last Post: 01-07-2008, 03:48 PM -
throws Exception
By javaplus in forum New To JavaReplies: 1Last Post: 11-06-2007, 08:32 PM
Bookmarks