Corrupted files are downloaded

Hi,
I have written a code to download .pdf docs contained in a zipped file. The code works fine mostly, but sometimes the zip file contains pdf of size 75KB only (although the size should be more than this).
Could anybody please suggest what can be the probably cause? Is it an error in pdf creation or zipping?
Thanks,
Amit

Amit,
I think the getPdf will get just the file name, I am not sure we have to define a static size byte array and write, See my below code to .zip the output log file,
Which is working fine,
String zipout = pageContext.getParameter("ZIPOUT");
if(zipout!=null && zipout.equals("Y"))
try
DataObject sessionDictionary = (DataObject) pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponse response = (HttpServletResponse) sessionDictionary.selectValue(null, "HttpServletResponse");
HttpServletRequest request = (HttpServletRequest) sessionDictionary.selectValue(null, "HttpServletRequest");
String requestID = pageContext.getParameter("REQUESTID");
response.setHeader("Content-Disposition","p; filename=CatExtract"+requestID+".zip");
response.setContentType("application/x-zip-compressed");
ZipOutputStream zip = new ZipOutputStream(response.getOutputStream());
try
byte[] buffer = new byte[1024];
int bytesRead;
//to get the value of output directory
String logDir = pageContext.getProfile("XNC_DEBUG_LOG_DIRECTORY");
logDir = logDir.replaceFirst("log","out");
String fileName = logDir+"/o"+requestID+".out";
try
FileInputStream file = new FileInputStream(fileName);
try
ZipEntry entry = new ZipEntry(fileName);
zip.putNextEntry(entry);
while ((bytesRead = file.read(buffer)) != -1)
zip.write(buffer, 0, bytesRead);
zip.closeEntry();
pageContext.writeDiagnostics(entry.getName(), " added.",1);
catch (Exception ex)
pageContext.writeDiagnostics(this.getClass().getName(),"Exception "+ex,1);
finally {
file.close();
catch (IOException ex)
pageContext.writeDiagnostics(this.getClass().getName(),"Exception "+ex,1);
finally {
zip.close();
zip.flush();
}catch(Exception ex)
pageContext.writeDiagnostics(this.getClass().getName(),"Exception "+ex,1);
Thanks,
With regards,
Kali.
OSSI.

Similar Messages

  • Is there a way to block Firefox from closing while files are downloading? I don't want to accidentally quit the program and cut off current downloads.

    Basically, I was downloading a game from Game Agent and I accidentally quit Firefox. This stopped the download and I was not allowed to resume it, forcing me to spend $30 to buy the same game AGAIN to get a new download file. Is there a way to add a warning box to Firefox that says something like: "Are you sure you want to quit Firefox? Files are downloading" when I try to quit?

    Untested, but according to http://www.phil.im/2011/04/27/how-to-enable-firefox-download-warning-on-quit/ set browser.download.manager.quitBehavior to 2 in about:config

  • Corrupted files in downloading Oracle9 for Solaris

    Hi all,
    I've experienced in the last three days some problems in downloading Oracle 9.2 for Sun Solaris 8 SPARC/64. I get all the times the three files corrupted (bad crc when I unzip them).
    These are the lengths of files I've downloaded (I've tryed it many times, and I always get the same result, so maybe the original files are corrupted):
    solaris64_9.2.0.1.0.Disk1.cpio.gz: 583.760.199 bytes (instead of 583,756,222 bytes);
    solaris64_9.2.0.1.0.Disk2.cpio.gz: 603.564.525 bytes (instead of 603,567,380 bytes);
    solaris64_9.2.0.1.0.Disk3.cpio.gz: 334.966.194 bytes (instead of 334,964,265 bytes).
    Any idea?

    Sorry, the message was 'invalid compressed data--format violated' and not 'bad crc'...

  • Corrupt files in downloaded zip

    I have just downloaded Oracle 9i Lite over a 56K modem link, and as you can imagine it took quite a while. Unfortunately, it turned out that some of the files included in the ZIP file is corrupt. Now I really don't want to download the zip file again, and I am wondering if someone could be kind enough to email me the corrupt files.
    The ones I am looking are:
    zht.0.0.jar
    de.0.0.jar - I suspect I won't need it since I am running an English Language OS
    zhs.0.0.jar
    schema.0.0.jar
    mesg.0.1.jar
    embase.2.0.jar
    baseclasses.0.0.jar
    wtgsdk.0.0.jar
    I am going to install 9iLite just to see how Oracle compares with other database engines, such as SQL Server and DB2. I don't particularly want to download the standard edition over a 56K link (the company I work for is an MS partner, and so it wouldn't take very kindly to anyone who downloads huge files from Oracle using corporate internet connection). If you guys think that I am wasting my time, and I really wouldn't get much out of looking at the Lite version, I would appreciate a straight answer as well.
    Thanks in advance.
    My email address is [email protected]
    remove the nospam. part.

    Yes Colour profile?
    http://en.wikipedia.org/wiki/Color_management
    iPhoto supports RGB. If these are CYMK you'll get the symptoms you describe.
    Regards
    TD

  • I am having problems downloading files from the web. After a number of files are downloaded, the system become sluggish, and then hangs. I traced the problem to the download history file: downloads.sqlite.

    After downloading a number of 1.0 MB files, the system became very sluggish, and I started to get lots of (Not Responding) messages when trying to download or just use Firefox for browsing. Using Performance Monitor, I observed that the Firefox executable was growing larger and larger - up to as large as 1.2 GB on a system with 2.0 GB memory. Page faults were off the chart.
    Looking for a similar problem, I found one that discussed the downloads.sqlite file becoming corrupted. I first noticed that this file was over 600 MB in size, so I deleted it. I then downloaded additional files, and observed that the new downloads.sqlite file would increase in size by about 150% of the size of each file that was downloaded. Once it would get up to 500 MB in size, the system started slowing down again.
    I don't know the purpose of this file, but it appears that it keeps a full copy of every file downloaded, which may be the function of a download history file, but it does not seem correct that the file should grow in size without limit, and thus impact the system.
    I would also appear that the Firefox executable is trying to read the entire contents of this file each time a new file is downloaded, which does not seem right.
    Temporary fix is to periodically delete the downloads.sqlite file when it gets too large and starts impacting performance.. Apparently it is smart enough to open a new file if the old one is not found. I am not sure what the correct behavior for this file should be. Apparently is does not re-initialize when a new Firefox session is initiated.
    Please feel free to contact me if more information is desired. I'm not sure what details you might need to troubleshoot this type of problem.

    Hi Katy, and a warm welcome to the forums!
    What is the exact name of the file?
    Is it aim.bin?
    Which requires either Stuffit Expander, or the Unarchiver to deflate.
    http://www.apple.com/downloads/macosx/systemdiskutilities/theunarchiver.html

  • Can I get a notice when the files are downloaded by the recipient? And other issues...

    The older SendNow app notifies me by email whenever I have successfully sent a file, and another email when the recipient has downloaded the file.
    With Adobe Send, I get only an email notice that the recipient has "viewed my shared files" which is kind of vague. I would like to know for certain that the client has actually downloaded the file. I know that I can log into the Acrobat site and "View Full Activity" for each file transfer, but it would be great to get an email notice or a text message.
    I hate to say it, but I still feel like we have taken a step backwards with this app, compared to SendNow. It is nice that the recipient can preview the file before downloading it. That seems to be the only benefit so far that I can see. But not having a memorized email address book can make the process very tedious.
    Another minor frustration: Whenever I log in to the Acrobat or SendNow site, there is a box that asks if I want to 'Stay signed in'. I click it every time since this is my own private computer, but I always have to log in anyway.
    When the Adobe Send app first launched, I had problems with it failing. It was VERY frustrating because the status bar would seem normal until the very end before kicking out a fail notice. It happened mostly with larger files or with multiple files. So, I would wait a long time only to have to do it all over again. the entire process would fail.  For example, if I sent six large files, and only one of the files was problematic, the entire transaction failed. The app would not identify the specific failed file. Why couldn't the app allow the good files to go through? I have no idea if this is resolved, but because of this, I have only used the SendNow app.
    well, is anyone there??

    Is working on FCE projects while all the video files are saved on an external drive a bad idea?
    Not at all. This is the correct way to work with a laptop.

  • Developer class files are downloaded every time

    The jinit jar files are being cached. However the developer class files are being downloaded everytime. I’ve written other web aps where classes were downloaded only once - there is a way for classes to only download once and then automatically download when changed / added – similar to jinitiator – that is critical – just can’t expect a user to repetitively wait a few minutes to use an ap.
    Installed versions are:
    Java 2 Runtime SE v1.4.1_07
    Java 2 SDK, SE v1.4.1_05
    Microsoft IE 6 SP1
    Oracle JInitiator 1.3.1.17
    Microsoft Windows 2000 [Version 5.00.2195]
    Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    Forms server 6i patch 16
    Web server 9iAS rel 1

    George,
    Forms files (jar) are cached and only checked for its timestamp. There are a few classes that are accessed directly and I don't know why - I think one of the EWT classes if i remember well. So 99.99 % of all files are cached.
    Frank

  • Firefox PDF viewer (plugin) corrupts files upon download

    This is a bug report. We have found that PDF files opened in the Firefox built-in viewer (plug-in) can become corrupted when downloaded using the 'Download' icon on the upper right-hand corner of the screen. When we attempt to open one of these damaged files using Acrobat, this error message is displayed:
    'There was an error opening this document. The file is damaged and could not be repaired.'
    If we instead download the file by right-clicking in the viewer plug-in and select 'Save Page As...' the file is downloaded undamaged.
    One example where this behavior occurred is with the the file labeled: Butterfish Fishery Information Document
    on the page:
    http://www.mafmc.org/ssc-meetings/2013/april-may

    Someone should agitate for uplifting the fix to Firefox 25. I've probably saved dozens of PDFs this way, some of which may be dynamically generated during a transaction and now unrecoverable. !!
    ''Note: I'm aware of one such unrecoverable corrupted file so far, because I forwarded it to someone for uploading into a document management system and they send the error message back to me. How many were not reported back to me? Hmmm...''

  • I need help with corrupted file iTunes download

    I purchased a song and the download is corrupted.  I erased it and when I went to download again it does it from the same corrupted file that is in My Cloud.  How can I delete it from the cloud and get a fresh new version?  Thanks!

    Anyone ?

  • JWS application jar-files are downloaded almost every time

    hey,
    how can i debug the situation, where my application is downloaded very often (even if i havent updated all of the jar-files, they are all downloaded again)?
    can it be that they expire after a certain time? how can i check that?
    thanks,
    Mait

    There are jnlp parameters that can be specified that define when jars are downloaded. This information is in the JWS documentation.

  • Creative Cloud Enterprise: Is there a way to choose where the package temp files are downloaded?

    I am an Enterprise Admin and have to use a Windows computer to download and create different Creative Cloud packages. The temp package files first download to the C:\ (system drive) and then the actual package in the location you specified; usually on another drive/partition. I have to make the C:\ partition (by re-partitioning) much larger than normal size in order to make temp package files to fit if I don't the C:\ drive fills up and the package creation just stops/fails with no messages displayed. Could an option be made to direct where you want the the temp package files to be held such as selecting a different hard drive/partition to store them?
    I create both 32 and 64 bit CC packages.

    Hi JohnBNO,
    You can change the CC cache location. Please refer the article: http://helpx.adobe.com/creative-cloud/packager/creating-packages.html.
    Regards,
    Romit Sinha

  • Corrupt file when Downloading iTunes+Quicktime

    Im on my sisters laptop and when I try to install iTunes, it says there is a corrupt file. Im sorry if someone else has had this problem and Im just repeating it. But, she has had iTunes before, but had her pc wiped out. Could that have something to do with it? And is anyone else having this problem

    There is a very comprehensive post on the subject at this link: "What to do if Windows displays an "iTunes.exe - Corrupt File" message" http://discussions.apple.com/message.jspa?messageID=1726580#1726580

  • In some web pages, pdf files are downloaded in very small kb and not opening despite I have Adobe reader, Pro and plug in

    I have Firefox 3.6.6, downgraded from higher versions since I have this problem below.
    At some web pages (mostly professional academic sites like Oxford Journals), when I am clicking to get pdf of an article, Firefox start downloading ridiculously small size and cannot open it as it gives the message "Acrobat could not open 'filename.pdf' because it is either not a supported file type or because the file has been damaged ..."
    I know the file is not damaged, because I can open them in explorer. And some websites are also working properly in Firefox. I do not care if it opens in firefox or pops up separately.
    I have reloaded Acrobat and Firefox but problem continues.

    hello vijayabhaskarv, that sounds as if you're using the pdf viewer built into firefox per default, which might not work in all situations. please see the following article in order to select a different plugin to render pdf files: [[How to disable the built-in PDF viewer and use another viewer]]

  • When pdf files are downloaded from the net they show up in different fonts like its encrypted?

    when we try to download pdf files from the internet the document shows up weird like the file is encrypted. the files show up with lots of spaces and numbers and letters mixed together. what can we do to fix this problem?

    I'm adding more information:
    in Finder, my iMovie folders are all visible and accessible.  When I click on a clip from iMovie Events folder, Quicktime opens and plays the clip.  ALL my video is not missing - it just isn't showing up in the Event Library!
    This happened all of a sudden, while I was working on iMovie project (on both computers).
    All my Projects are intact, and play when I open them. 

  • When downloading and opening a file through Firefox 5 on a Windows 7 machine, files are downloading and opening as read-only.

    I am trying to download an attachment from gMail. When I select download, I can open or save as the document. If I select "open", it opens the file, but makes it read only.
    If I do this exact action in IE8, it opens the document normally.

    Unfortunately, I have not found a solution for this problem yet.
    But I did find out, that Safari only crashes, when I choose a "custom" location to save the file at. When I simply click on Download to "Safari Downloads", it keeps working perfectly.
    So it seems to be a problem with the choosing of a file location.
    Does this give anyone an idea what else I could try?

Maybe you are looking for