CFMX 7 using zip files
The Situation: I am attempting to create an application that recieves information from cfhttp request containing a zip file as a java ByteArrayOutputStream object. This zip file is then written to the hard disk and unzipped. The problem is that the zip files are unreadable by the java.util.ZipFile library. Am I not writing the files correctly? I have tested these files with winZip and everything works fine there. Also I have used zip files created by winZip and application is able to unzip the files without any problem. The exact error I recieve when using one of these files is: Object Instantiation Exception. An exception occurred when instantiating a java object. The cause of this exception was that: . The error occurred in D:\ACM\CFC\mailbox.cfc: line 174 Called from D:\ACM\CONNTEST\index.cfm: line 8 Called from D:\ACM\CFC\mailbox.cfc: line 174 Called from D:\ACM\CONNTEST\index.cfm: line 8 172 : cfscript 173 : //open zip file 174 : zipFile.init(arguments.inFileName); 175 : 176 : //get file entries Stack Trace: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedConstructorAccessor79.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at coldfusion.runtime.java.JavaProxy.CreateObject(JavaProxy.java:128) at coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:56) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634) at cfmailbox2ecfc1528230210$funcUNZIP.runFunction(D:\ACM\CFC\mailbox.cfc:174) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:254) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:194) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:146) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634) at cfindex2ecfm1170876534.runPage(D:\ACM\CONNTEST\index.cfm:8) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115) at coldfusion.CfmServlet.service(CfmServlet.java:107) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) 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(ZipFile.java:111) at java.util.zip.ZipFile.init(ZipFile.java:71) The Code: Writing the zip file code cfhttp url =#prop.Url# method=POST username =#prop.user# password =#prop.pass# proxyserver =#prop.proxyServer# proxyuser =#prop.proxyUser# proxypassword =#prop.proxyPass# cfhttpparam type=url name=function value=downloadfiles cfhttpparam type=url name=filelist value=#arguments.fileList# cfhttpparam type=cookie name=SESSIONID value=#prop.sessionID# cfhttpparam type=cookie name=JSESSIONID value=#prop.sessionID# /cfhttp cffile action=write nameconflict=overwrite
Re: CFMX 7 using zip files
I have found the solution. Basically the toString method changed some of the info and I was unable to write the file in this manner. Instead, I used a file output stream and the toByteArray method and it works. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313620 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4