Then I would suggest find/writing a small Java ZipVerifier that will do this verification for you.
I created a quick example of a verifier and it seems to do the job. <!--- Start ZipVerifier.java ---> import java.util.zip.ZipFile; import java.util.zip.ZipException; import java.io.IOException; public class ZipVerifier { public static String EXCEPTION_STR = ""; public static boolean verifyZip(String filePath) { try { ZipFile zipFile = new ZipFile(filePath); return true; } catch( ZipException ze ) { EXCEPTION_STR = ze.getMessage(); } catch( IOException ioe ) { EXCEPTION_STR = ioe.getMessage(); } catch( SecurityException se ) { EXCEPTION_STR = se.getMessage(); } return false; } public static void main(String[] args) { if( args.length > 0 ) { System.out.println( "Valid Zip file?: " + ZipVerifier.verifyZip(args[0]) ); System.out.println( EXCEPTION_STR ); } else { System.out.println( "usage: java ZipVerifier <zipfile path>" ); } } } <!--- End ZipVerifier.java ---> On 5/18/07, AJ Mercer <[EMAIL PROTECTED]> wrote: > no, it is getting past that > > zipFile = createObject("java","java.util.zip.ZipFile"); > zipFile.init(zipFilePath); > //Get Entry Objects for Entries in the ZIP File > entryList = zipFile.entries(); > > //Create List of File Names from the ZIP File > while(entryList.hasMoreElements()) { > entry = entryList.nextElement(); > <====== dies here > if (not entry.isDirectory()) { > fileList = ListAppend(fileList,entry.getName()); > } > } > > message = invalid LOC header (bad signature) > > This kills jRun so I can't catch it in ColdFusion > > > On 5/18/07, Maximilian Nyman <[EMAIL PROTECTED]> wrote: > > > > <cftry> > > <cfset zipfile=CreateObject("java", > > "java.util.zip.ZipFile").init(zipFileName) /> > > <cfcatch type="any"> > > <cfdump var="#cfcatch#" /> > > </cfcatch> > > </cftry> > > > > That should throw a ZipException (and dump it) if the Zip file is corrupt > > > > /Max > > > > > > On 5/18/07, AJ Mercer <[EMAIL PROTECTED]> wrote: > > > cffile does not crash when using cffile with read or readbinary > > > > > > > > > > > > On 5/17/07, Jake Churchill <[EMAIL PROTECTED]> wrote: > > > > > > > > Can't you just read the file as a file object inside a try/catch and > > if it > > > > fails, the file is assumed to be corrupt > > > > > > > > _____ > > > > > > > > > > > > > > > > Jake Churchill > > > > > > > > CF Webtools > > > > > > > > 11204 Davenport, Ste. 200b > > > > > > > > Omaha, NE 68154 > > > > > > > > http://www.cfwebtools.com > > > > > > > > 402-408-3733 x103 > > > > > > > > -----Original Message----- > > > > From: AJ Mercer [mailto:[EMAIL PROTECTED] > > > > Sent: Thursday, May 17, 2007 1:32 AM > > > > To: CF-Talk > > > > Subject: java unzip :: verify file > > > > > > > > Hi, > > > > > > > > I have a cf script that is using java.util.zip.ZipFile to unzip - > > works > > > > great, except when... > > > > > > > > If the zip if corrupt it kills jRun. > > > > > > > > Does any one know if there is a way to verify / check the zip file to > > > > ensure > > > > it is not corrupt? > > > > > > > > > > > > Because it is dieing at the jRun level, I can not use cfcatch. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278548 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4