Problem with a progress bar for downloading attachment

I display the progress bar for downloading attachments and it works fine … but when I am downloading some attachments I get the exception message:
Exception in thread "main" com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed 4 valid base64 characters but only got 1 before EOF, the 10 most recent characters were: "Q3w5ilxj2P"
I found the explanation:
Certain IMAP servers do not implement the IMAP Partial FETCH
functionality properly. This problem typically manifests as corrupt
email attachments when downloading large messages from the IMAP
server. To workaround this server bug, set the
     "mail.imap.partialfetch"
property to false. You'll have to set this property in the Properties
object that you provide to your Session.
http://java.sun.com/products/javamail/NOTES113.txt
So I turned off partial fetch:
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
props.setProperty("mail.imaps.partialfetch", "false");
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("imaps");
store.connect("imap.gmail.com", "<username>","<password>");this solved the problem ….however the method getInputStream() from the Part class blocks the thread until the attachment is completely downloaded and it is impossible to get the information about the number of bytes which have been already downloaded from mailbox.
Without this information it is impossible to display the progress bar. So is there a way to obtain this information and display the progress bar?
Edited by: 911161 on 2012-01-31 10:55

Try the answer I provided to your post on stackoverflow.com:
http://stackoverflow.com/questions/9086700/how-to-displaly-progress-bar-for-downloading-attachment

Similar Messages

  • Problem with the progress bar

    I've have a problem with the progress bar of my ipod. I bought a 5th generation ipod about 8-9 months ago. Now its progress bar stuck so it only shows the 5 dots. It doesn't show both scrubber bar and song time bar. When I press the center button, the 5 dots dissappear from the screen and then reappear but it doesn't show the other bars. Do you know what is the problem and How can I fixed it?

    have you tried resetting ipod, cause as far as i know, this is sometimes just a temporary glitch, mine does this.

  • TS3681 the device displays the Apple logo with no  progress bar for 8 hours until battery run flat.

    My Iphone4 displays the Apple logo with no progress bar for 8 hours until battery went flat this was after i try to make an up date know the  i tunes dosent reconise my phone.
    Can you please help me
    Thank you.

    http://support.apple.com/kb/ht1808

  • Problem with the progress bar in swings

    Hi all,
    I need to show a progress bar till another window opens up in swings.Below is the code i used to show the progress bar.My problem is i am able to get the dialog box where i have set the progress bar but i cldnt get the progress bar.But after the specified delay,another window gets loaded.
    Plz tell me how to show a progress bar till another window loads.Any help is greatly appreciated :-)
                    //Show the progress bar till the AJScreens loads.
                    // Create a dialog that will display the progress.
                    final JDialog dlg = new JDialog(this, "Progress Dialog", true);
                    JProgressBar dpb = new JProgressBar();
                    dpb.setVisible(true);
                    dpb.setStringPainted(true);
                    dpb.setBounds(70,60,150,10);
                    dlg.getContentPane().setLayout(new BorderLayout());
                    dlg.getContentPane().add(BorderLayout.CENTER, dpb);
                    dlg.getContentPane().add(BorderLayout.NORTH, new JLabel("Progress..."));
                    dlg.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
                    dlg.setSize(300, 75);
                    dlg.setLocationRelativeTo(this);
                    // Create a new thread and call show within the thread.
                    Thread t = new Thread(new Runnable(){
                        public void run() {
    System.out.println("atleast comes here --->");
                            dlg.show();
                    // Start the thread so that the dialog will show.
    System.out.println("Gonna start the thread --> ");
                    t.start();
    System.out.println("Thread started --> ");
                    // Perform computation. Since the modal dialogs show() was called in
                    // a thread, the main thread is not blocked. We can continue with computation
                    // in the main thread.
                    for(int i =0; i<=100; i++) {
                        // Set the value that the dialog will display on the progressbar.
    System.out.println("i ----------> "+i);
                        dpb.setVisible(true);
                        dpb.setValue(i);
                        try {
                            Thread.sleep(25);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                    // Finished computation. Now hide the dialog. This will also stop the
                    // thread since the "run" method will return.
                    dlg.hide();regards,
    kani.

    Yeah i have tried that also.But no hope.
    My problem is am able to get the dialog box but not the progressbar,after the specified delay the dialog box goess off and the new window loads up.
    the progress bar is not getting displayed..that is my problem..
    can u plz help me out.

  • Hi! having problem with aam program launch for downloading

    hi can you help me having problems downloading app I can't drag and drop and if I try to install using download link it tells me to choose the aam program I want to use.  I have successfully downloaded other apps before and dont know where to find this program really need some help with this. Thanks!

    Thanks
    for quick response
    I can access the aam now that I know what it stands for by opening the application seperately from the desktop and download. What I cant do is download from the cloud site where it is unable to locate and open the aam from there. As long as I can download I dont have a problem with it Im guessing it may well be a windows or browser issue. I will try from chrome if I it doesnt work I will let the firum know I would be interested to know whether its something Im doing or its a common issue.
    Cheers
    Helen

  • Problem with "transparent" progress bar

    i am trying to implement a progress bar that monitors a long task. I used the example codes given in the swing tutorial and modified a little to make the progress bar indeterminate.
    However, when the progress bar pops up, it is transparent, except for its title! I have search the forum and tried all the solutions given for this similar problem. My codes are already threaded.
    Here's the excerpt of my codes. I used the LongTask, SwingWorker from the Swing tutorial and adapted ProgressBarDemo to ProgressBarA (only difference is indeterminate).
    uploadData();
    public boolean uploadData() {
    boolean uploadSuccess = false;
    final SomeLongTask someLongTask = new SomeLongTask(dataLoader);
    final Thread pBarThread = new Thread(new Runnable() {
    public void run() {
    JFrame pBar = new ProgressBarA(someLongTask);
    pBarThread.setPriority(Thread.MAX_PRIORITY);
    pBarThread.start();
    // this loop hopes to serve as a blocking,
    // which apparently did not help.
    while (!someLongTask.done()) {
    pBarThread.join();
    System.out.println("main thread yields and sleeps ");
    Thread.yield();
    Thread.sleep(1000);
    uploadSuccess = someLongTask.getSuccess();
    // some more post processing here.
    return uploadSuccess;
    class SomeLongTask extends LongTask {
    DataLoader loader;
    boolean success;
    boolean completed;
    public SomeLongTask(DataLoader l) {
    loader = l;
    lengthOfTask = 1000;
    indeterminate = true;
    public Object actualTask() {
    statMessage = "Loading...";
    success = loader.upload();
    stop();
    // return value is not important here.
    // Just return any dummy value.
    return new String("ok");
    public boolean getSuccess() {
    return success;
    I suspect that after the pBarThread started, the main thread proceeds so fast that the progressBar frame cannot show up properly. But i am not very sure on on to thread the post processing part that should wait for the someLongTask to finish. The blocking loop did not seem to help either. :(
    Pls kindly advise.
    Regards,
    kaikit

    have you tried resetting ipod, cause as far as i know, this is sometimes just a temporary glitch, mine does this.

  • Facing problem with posting Excel file for download - Content in browser

    I am trying to post an Excel file to download from a servlet to a JSP. The content is written properly but to the IE browser and not in an Excel. I even tried giving the ContentType as Word/CSV etc. But nothing works, the content gets displayed only in the browser.
    PLEASE HELP.
    Code snippet in calling JSP:
    DownloadServlet downServlet = new DownloadServlet();
    downServlet.download(response);
    Code in Servlet:
    public class DownloadServlet extends HttpServlet{
    public void download(HttpServletResponse response) throws IOException {
              /*PrintWriter out = response.getWriter( );
              response.setContentType("text/html");
              out.println("<H1>Hello from a Servlet</h2>"); */
         /*HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Sheet1");*/
    String strData = "This is a Test for Download";
    byte[] b = strData.getBytes();
    //response.reset();
    response.setHeader("Content-disposition", "attachment; filename=" + "Download.xls");
    response.setContentType( "application/msword" );
    //response.addHeader( "Content-Description", "Download Excel file" );
    ServletOutputStream out = response.getOutputStream();
    out.write(b);
    //out.flush();
    out.close();          
    }

    Hi Naresh,
    My thoughts on a possible solution, convert the last character value to a HEX value and check if it falls within the ASCII/Unicode CP range, Obviously this becomes easier if you are just looking at a single language character set.
    The below FM and code helps you check if the character falls within the ASCII char set.
    DATA: l_in_char TYPE string,
          l_out     TYPE xstring.
    CALL FUNCTION 'NLS_STRING_CONVERT_FROM_SYS'
      EXPORTING
        lang_used                   = sy-langu
        SOURCE                      = l_in_char
      TO_FE                       = 'MS '
    IMPORTING
       RESULT                      = l_out
      SUBSTED                     =
    EXCEPTIONS
       illegal_syst_codepage       = 1
       no_fe_codepage_found        = 2
       could_not_convert           = 3
       OTHERS                      = 4.
    IF l_out LT '0' OR l_out GT '7F'.
      WRITE: 'error'.
    ENDIF.
    Links: http://www.asciitable.com/
              http://www.utf8-chartable.de/unicode-utf8-table.pl
    Regards,
    Chen
    Edited by: Chen K V on Apr 21, 2011 11:25 AM

  • Problem with encoding and charset for downloading a file

    Hi guys, I have a problem and I beg for your help, I am 1000% frustrated at this point.
    I have a servlet which have to do something and give a file log to the final user. Coding the logic for that took me about 5 minutes, the problem is that the given file doesnt shows properly in notepad (Default app to open txt files). I have tried every way I have read over the internet and absolutely nothing works.
    After trying about 20 different ways fo doing this without success, this is my actual code:
    Charset def=Charset.defaultCharset();
    OutputStreamWriter out = new OutputStreamWriter(servletOutputStream,def);
    for (String registry:regList) {
    out.write(registry+"\n");
    out.close();
    the page gives the file to the user, I can download or open it, when I open it this is the result
    registry1registry2registry3registry4registry5registry6registry7...
    and I am expecting:
    registry1
    registry2
    registry3
    registry4
    registry5
    If I open it with wordpad or notepad++ the file looks fine, but I cant achieve that notepad reads it correctly. I have spent about 10 hours on this and at this point I just dont know what to do, i have tried Windows-1252, UTF-8, UTF-16, the Default one. I have tried to set this enconding on the response header with no luck. Any help will be very appreciated.
    Thanks in advance.

    >
    I have a servlet which have to do something and give a file log to the final user. Coding the logic for that took me about 5 minutes, the problem is that the given file doesnt shows properly in notepad (Default app to open txt files). I have tried every way I have read over the internet and absolutely nothing works.
    If I open it with wordpad or notepad++ the file looks fine, but I cant achieve that notepad reads it correctly. I have spent about 10 hours on this and at this point I just dont know what to do, i have tried Windows-1252, UTF-8, UTF-16, the Default one. I have tried to set this enconding on the response header with no luck. Any help will be very appreciated.
    >
    Your file likely uses *nix style line endings and use a single LF (0x0A) as the end of each line.
    Notepad doesn't recognize a single LF as the end of line; it expects CRLF (0x0D0A). The encoding isn't the issue.
    If you have to use Notepad you will need to add code to find all of the LF characters and insert a CR character in front of them.

  • HT201263 my iphone 3g Stops responding, showing the Apple logo with no progress bar or a stopped progress bar, for over ten minutes ..plz give me suggusition ?

    Stops responding, showing the Apple logo with no progress bar or a stopped progress bar, for over ten minutes

    First thing to try is to reset your device. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider should one appear until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.

  • HT1212 My ipad mini has been crashing a lot recently so I started a system reset. However, it's now stuck with the progress bar less than a quarter gone: this has been the case for several days now. I have tried resetting from itunes but it needs the pass

    Now it's stuck with the progress bar less than a quarter full. I have also tried resetting through itunes which works right up to the point where itunes states that it needs the passcode to be inputted into the ipad to connect to it. At which point it then sticks at the same progress bar point. HELP!! please, this ipad is really important to my work.

    Well the term "hotlined" I have never heard before. In any case many states (like NY) just passed regulatory powers to the State Public Service Commission of which it may be called something different in your state. You could file a complaint with them. Or file a complaint with your state attorney generals office, they also take on wireless providers.
    The problem here is the staff you speak to are poorly trained, in days gone by it took one call to them and they pulled up your account and see the error and had the authority to remove any errors. They did not remove legitimate account actions, but used their heads instead of putting a customer off or worse lying to the customer.
    Its a shame you have to go through what you going through.
    Good Luck

  • Mac OS Mountain Lion Shuts down at Apple logo with a progress bar appearing under it.

    Last Night there were two updates available which i downloaded and after that it asked for a restart, when i restarted the Mac, it gave me a progress bar for the updates at the middle of which it said, Installation of Updates can not be Completed and My mac book froze. After that i Shutdown my Macbook Pro by holding the Shutdown button for a little while.
    When i restarted the Macbook Pro, it gave remained at apple logo for a while then a progress bar appeared after which it shut down itself and it is doing the same since then.
    I have got windows over Boot Camp in my Macbook Pro and i can boot into Windows which is running fine and i can access all the data on my Main Partition through Windows as well but i am unable to boot into Mac os Mountain Lion.
    I have tried Repairing the Partition by going into Recovey and it Fails, I have tried Resetting the PRAM and that hasn't worked either, i have tried re-installing the Mac os Mountain Lion from Recovery but that says that all my Partitions are Locked.
    I haven't got any backup of my data through Time Machine so i was thinking as i can boot into Windows and access the data and as all this is because of the Installation of Updates Failure so there should be some way to manually edit the Boot Files to trick the Mac book into thinking that there weren't any updates or to simply clear the data from Updates.
    Can anyone please help me if you have any better suggestions.

    If it's still under warranty or with AppleCare (even if it isn't, really) take it in to an Apple store.  If you can get at your personal files from Windows, copy them to an external drive first.  That includes anything you have in Windows that you need to keep.  Sounds like the drive is going south and if it has to be replaced, you'll lose everything if you don't have it backed up.

  • My iPhone 4S got stuck on the apple logo with the progress bar!

    Afternoon. My iPhone 4S got stuck on the apple logo with the progress bar! but every time after I restore the 4S the progress bar starts again and stops at different stages of the loading process! Can anyone help with this please?
    All this started happening after I tried to download the lastest update (iOS 7.1). The 4S went and got stuck on the apple logo and progress bar!!

    Hello kuukua.b,
    Thanks for using Apple Support Communities.
    Please try to restart and reset your iPhone by following the steps below, and then resume your restore process.
    Turn your iOS device off and on (restart) and reset
    http://support.apple.com/kb/ht1430
    Take care,
    Alex H.

  • I am having a strange problem with the awesome bar

    The awesome bar/location bar is no longer as awesome as it used to be. When I start typing in an address it seems like it no longer checks through my history and gives a list of possible matches but just gives the stem of an address. For example, if I type in 'goo' it will complete this to 'google.com' if I then append this with an '/a' it will complete this to 'google.com/analytics' but that's as good as it gets, as I say, no list from the history or bookmarks.
    I've checked the options and also about:config and all the settings are as they should be, as far as I can tell (and I certainly hadn't changed any of them when it started misbehaving). I've also disabled all extensions and plug-ins.
    It's driving my slightly bonkers because I quite often use sites with long addresses and can't remember each of the components of each address. I'd switch to using Chrome but I also use Firebug a fair bit so don't really want to do this.

    Hi cowtan, <br/>Sorry you are having problems with the awesome bar.
    I imagine the new behaviour may be reversed by changing some pref but I have not looked that up.
    Regardless of the new behaviour you seem to have some fault as my awesomebar still gives bookmarked items.
    As a troubleshooting step try adding an asterisk in the awesomebar (as first character or anywhere) that should then filter the results in the dropdown list to bookmarked only items, does that work ?
    * see [[Search your bookmarks, history and tabs with the Awesome Bar#w_changing-results-on-the-fly]]_changing-results-on-the-fly
    You possibly have some extension interfering with the awesome bar, try Firefox in safe mode (but do NOT* at this stage try the Reset Firefox option)
    <nowiki>*</nowiki>'''edit''' - personal opinion, if a user; such as you; is knowledgeable enough to use ''about.config'' the easy solution of ''FirefoxReset ''is probably not the best route, as it can have unwanted side effects that are avoidable.
    * [[Troubleshoot Firefox issues using Safe Mode]]
    Do your bookmarked items appear in safe mode ?
    <u>Try a new Profile.</u><br/>The best method for troubleshooting this will be to set up a new Firefox profile, you can then: experiment, troubleshoot, alter settings or extensions installed in that profile without changing and potentially damaging your current profile.
    * http://kb.mozillazine.org/Profile_Manager#Creating_a_new_profile
    I suggest to prevent unexpected problems you
    * use a sensible name such as test 2012 for the profile name
    * ensure an empty folder is used & do not then rename or delete the new profile (instead add or delete shortcuts to it)
    * also see http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox

  • HT5312 So I have a problem with iTunes not letting me download anything without first responding to some security questions which I don't remember setting up, how can fix it? Oh, and it won't let me reset the questions either!

    So I have a problem with iTunes not letting me download anything without first responding to some security questions which I don't remember setting up, how can fix it? Oh, and it won't let me reset the questions either!

    If you mean that you aren't getting the reset link, then from the page that you posted from :
    Note: The option to send an email to reset your security questions and answers will not be available if a rescue email address is not provided. You will need to contact iTunes Store support in order to do so. 
    You can contact iTunes Support in your country via this page : http://support.apple.com/kb/HT5699
    When they've been reset you can then use the steps half-way down the HT5312 page that you posted from to add a rescue email address for potential future use

  • ITS 6.20 SP18 Problem with the top bar menus

    Hello Henning,
    we're using ITS 6.20 SP18 and experience a problem with the top bar menus in the SAPGUI for HTML (Enjoy Design) in both MSIE 6 and Moz Firefox 1.0.4.
    When clicking the dropdown menus in the top bar the menu simply won't open. This only occurs in all of our homegrown (Z*) services when dropping into SAPGUI for HTML (ITS is in mixed mode). However - When running service WEBGUI seperately (via ...scripts/wgate/WEBGUI/! ) the menus work funnily enough.
    This worked fine prior to the upgrade. Is there a new service parameter that I need to set? Have you got any more documentation? I checked out any related SAPNet notes on the SP18 documentation sheet, but couldn't find anything related.
    Kind regards,
    Michael

    > There is no known problem regarding ITS 6.20 PL 18
    > and the menu at this time. Please provide an example
    > for a service file (.srvc) of one of your Z
    > services and also the global.srvc.
    >
    <u>These are the <b>global.srvc</b> settings</u>
    ~appserver 
    ~client  010
    ~clientcert  1
    ~cookies  1
    ~exiturl 
    ~hostsecure  xxxxxxxxx
    ~hostunsecure  xxxxxxxxx
    ~language 
    ~login 
    ~logingroup  ZZZZZZZZ
    ~menu2002  0
    ~messageserver  xxxxxxxx.xx.xx.xx
    ~multiinstanceservices  1
    ~password 
    ~portsecure  443
    ~portunsecure  80
    ~routestring 
    ~runtimemode  pm
    ~systemname  XXX
    ~systemnumber  00
    ~theme  99
    ~timeout  120
    ~urlarchive  /scripts/sapawl.dll
    ~urlimage  /sap/its/graphics
    ~urlmime  /sap/its/mimes
    ~usertimeout  1
    ~webgui_theme  99
    ~xgateway  sapdiag
    ~xgateways  sapxgadm,sapdiag,sapxgwfc,sapxginet,sapxgbc,sapextauth
    ~rfctimeout     10
    ~noheaderokcode  1
    ~http_use_compression  1
    ~http_compress_level  7
    ~mysapcomnosso1cookie  1
    <u>These are the service settings for one of our <b>Z* services</b>:</u>
    ~AUTOSCROLL     0
    ~COOKIES     1
    ~GENERATEDYNPRO     1
    ~HTTP_COMPRESS_LEVEL     9
    ~HTTP_USE_COMPRESSION     1
    ~LISTSCROLLING     0
    ~LOGIN
    ~PASSWORD
    ~POPUPS     1
    ~STYLE     DHTML
    ~TRANSACTION     Zxxxxx
    ~WEBGUI
    ~WEBGUI_POPUPS     1
    ~WEBGUI_THEME     99
    Kind regards,
    Michael

Maybe you are looking for