ArrayIndexOutOfBoundsException within Javamail code?

Hello,
I have working code that downloads messages from Gmail accounts, and I seem to have run across a specific message that causes an ArrayIndexOutOfBoundsException within the java mail code. I am using javamail 1.42 and here is the relevant part of the stack trace,
Jul 8 11:07:23 localhost java.lang.ArrayIndexOutOfBoundsException: 256
Jul 8 11:07:23 localhost at com.sun.mail.iap.Response.parseString(Response.java:391)
Jul 8 11:07:23 localhost at com.sun.mail.iap.Response.readString(Response.java:320)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.ENVELOPE.<init>(ENVELOPE.java:96)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.FetchResponse.parse(FetchResponse.java:127)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.FetchResponse.<init>(FetchResponse.java:63)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.IMAPResponse.readResponse(IMAPResponse.java:132)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:260)
Jul 8 11:07:23 localhost at com.sun.mail.iap.Protocol.command(Protocol.java:319)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.IMAPProtocol.fetch(IMAPProtocol.java:1313)
Jul 8 11:07:23 localhost at com.sun.mail.imap.protocol.IMAPProtocol.fetch(IMAPProtocol.java:1294)
Jul 8 11:07:23 localhost at com.sun.mail.imap.IMAPMessage.fetch(IMAPMessage.java:1026)
Jul 8 11:07:23 localhost at com.sun.mail.imap.IMAPFolder.fetch(IMAPFolder.java:1020)
My code is making a call to folder.fetch(msgs, fp); , were folder is an instance of an IMAPFolder, and msgs is a non empty and non null Messages[], and fp is a non null FetchProfile.
Any ideas? I can provide the actual message that seems to be causing this problem, if necessary.
Thanks,
Rom

Bill, here's the full response from the gmail server for the problematic message for the pre fetch request:
* 4586 FETCH (RFC822.SIZE 5721 INTERNALDATE "01-Jul-2009 12:45:53 +0000" ENVELOPE ("Wed, 01 Jul 2009 12:42:34 GMT" "How to Successfully Market Your Women's Healthcare Program and Build Com
as you can see, it is an incomplete response. for example, here is the full (and complete) response for the previous message, which is fine:
* 4594 FETCH (RFC822.SIZE 2342 INTERNALDATE "08-Jul-2009 21:01:32 +0000" FLAGS () ENVELOPE ("Wed, 8 Jul 2009 21:01:30 +0000 (UTC)" "timing tonight" ((NIL NIL "kristin_goldman" "hotmail.com")) ((NIL NIL "kristin_goldman" "hotmail.com")) ((NIL NIL "kristin_goldman" "hotmail.com")) ((NIL NIL "rgoldman" "gmail.com")) NIL NIL NIL "<[email protected]>") BODY[HEADER.FIELDS (X-Mailer Message-ID Message-Id Date)] {106}
Message-ID: <[email protected]>
Date: Wed, 8 Jul 2009 21:01:30 +0000 (UTC)
The other issue the problematic message surfaced is that when one message is bad (for whatever reason) the whole folder.fetch(Messages[], FetchProfile) fails for all the messages in the array. In order to be able to process the other messages, I also had to modify the "while (!done)" loop on line 317 in Protocol.java. I basically added a "catch (Exception e) {
continue;
}" to the loop. Do you have a better suggestion on how to handle this? Maybe catching a less generic exception than Exception?
Thanks,
Rom

Similar Messages

  • Possible to have if statement within filters code?

    Hi
    I have some filters set up, and have assigned some global vars to them, which I then use in my Filters code to display the filters:
    myText:Filters [globals.data.glow1, globals.data.stroke1, globals.data.shad1]
    Works perfectly.
    Now I want to assign a global var to each global filter var to determine if it should be shown or not.  So...
    globals.data.glow1On = true;
    globals.data.stroke1On = true;
    globals.data.shadOn = true;
    ... and then somehow incorporate these new vars into an if conditional to determine if the filter global vars get included in the myText:Filters code.
    However, I cannot seem to code the if conditional into the myText:Filters code correctly.
    I even tried seperating it out like so:
    if (globals.data.glow1On = true) {myText:Filters [globals.data.glow1];
    if (globals.data.stroke1On = true) {myText:Filters [globals.data.stroke1];
    if (globals.data.shad1On = true) {myText:Filters [globals.data.shad1];
    But Flash only makes the last filter true (kinda makes sense to me now why).
    Is there a way to do it without having to make an if conditional with 7 permutations?
    Cheers
    Shaun

A: Possible to have if statement within filters code?

You are not coding the conditional properly.  "=" is for assignment, "==" is for comparing equality.
if (globals.data.glow1On == true) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On == true) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On == true) {myText:Filters [globals.data.shad1];
Also, a conditional evaluates whether or not something is true, so for Boolean values you do not need to explicitly compare them...
if (globals.data.glow1On) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) {myText:Filters [globals.data.shad1];
Lastly, for what I see that you showed, the conditionals are all missing their closing brackets, and while you can use them, the brackets are not needed for single command conditionals...
if (globals.data.glow1On){ myText:Filters [globals.data.glow1]; }
if (globals.data.stroke1On){ myText:Filters [globals.data.stroke1]; }
if (globals.data.shad1On){ myText:Filters [globals.data.shad1]; }
OR
if (globals.data.glow1On) myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) myText:Filters [globals.data.shad1];

You are not coding the conditional properly.  "=" is for assignment, "==" is for comparing equality.
if (globals.data.glow1On == true) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On == true) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On == true) {myText:Filters [globals.data.shad1];
Also, a conditional evaluates whether or not something is true, so for Boolean values you do not need to explicitly compare them...
if (globals.data.glow1On) {myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) {myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) {myText:Filters [globals.data.shad1];
Lastly, for what I see that you showed, the conditionals are all missing their closing brackets, and while you can use them, the brackets are not needed for single command conditionals...
if (globals.data.glow1On){ myText:Filters [globals.data.glow1]; }
if (globals.data.stroke1On){ myText:Filters [globals.data.stroke1]; }
if (globals.data.shad1On){ myText:Filters [globals.data.shad1]; }
OR
if (globals.data.glow1On) myText:Filters [globals.data.glow1];
if (globals.data.stroke1On) myText:Filters [globals.data.stroke1];
if (globals.data.shad1On) myText:Filters [globals.data.shad1];

  • SO Wait causes exception occurred within external code called by call library node

    when trying to run some old code that used to work ok, i now get this error message:
    exception occurred within external code called by call library node
    and the vi flagged as calling the exception is SO Wait. the error occurs with different soundcards. does anyone know what is causing this problem?

    Hi Kreuters
    It sounds as if you have a case of memory corruption. Which version of LabVIEW and DAQ (traditonal or DAQmx) are you running and also on which operating system?
    would it be possible for you to post your VI on this thread? in some cases there are ways to fix the problem
    Regards
    YatinM
    NIUK

  • Need to start JINI registrar instance from within the code

    HI All,
    I need to write JUnits for our app using JINI for which we need to start JINI registrar from within the code and then publish some services to it.
    Any idea how we could be starting the JINI registrar from Java Code ? Any thoughts/suggestions/pointers would be highly appreciated.
    Thanks in advance
    Vikram

    Hi Senthil,
    You can directly call the outer class method. Otherwise use the following way MyDialog.this.close(); (But there is no close() method in Dialog!!)
    If this is not you expected, give me more details about problem.
    (Siva E.)

  • Can JSTL tags be used within scriptlet code?

    This may be a very basic question, I have only just started experimenting with JSTL in JSPs.
    I am trying to let the user save the content of the OutputStream to a file, and that works with the following code:
    <%
    String file_out = request.getParameter("file_content");
    out.write(file_out);
    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition","attachment;filename=�ble�en.txt"); %>Both Firefox and IE display a dialog that lets the user save as a file, and I can use characters from any character set as the file name (JSPs are all in UTF8).
    I would like to pull the suggested file name from a resource bundle instead of fhardcoding it, however, so that I can display an appropriate suggestion for various languages. I can't figure out how to use a JSTL formatting tag for the file name with the scriptlet code, however, without getting a compilation error:
    <fmt:message key="file_save_as" />
    I can display localized messages just fine, as long as I don't try to do it within scriptlet code. I have tried to split the scriptlet code above, with the JSTL tag in between, but I can't find a way that works. Any pointers would be appreciated.

    am trying to let the user save the content of the OutputStream to a fileThis is something better done in a servlet than a JSP.
    A jsp can add extra carriage returns into your output stream, which might corrupt your data.
    I can't figure out how to use a JSTL formatting tag No, you can't mix scriptlet code and tag code.
    The JSTL tags are written for JSPs to eliminate scriptlet code from the page. If you are doing this in scriptlet code anyway, I suggest you use the ResourceBundle classes as you normally would in java code. Thats what the fmt:message tag is doing behind the scenes anyway.
    ResourceBundle bundle = ResourceBundle.getBundle("myApp.properties");
    String filename = bundle.getString("file_save_as");Cheers,
    evnafets

  • Is it possible, when i call a vi from within my code, to pass to it parameters as input and to return some values too?

    Hi There!
    I am currently calling a vi from within my code. However, what i would like to do, is to pass it 2 int values when i call it and for it to return 2 int values when it is done!
    Any advice on how i can do this please.
    Thanks.
    Regards,

    Hi Matrix,
    is there a reason you do it this way? By Ref (it is called dynamically loading)
    If you place the VI directly on the BD of a VI you can just wire things up.
    Now if you need dynamically loading. hoover the open VI-ref function and right click on the type specifier and select create constant. Then right click browse, browse to your VI. Now you have the connector pane.
    But if I were you I just use VI directly, because you'll keep connections active between the two VI's
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Setting Windows Envirnoment variables within Java code!!

    Hello All,
    How to setup Windows envirnoment variables within Java code dynamically.
    int customer = jList1.getSelectedIndex();
    System.out.println(customer);
    switch (customer)
    case 0:
    System.out.println("HOME1");
    break;
    case 1:
    System.out.println("HOME2");
    break;
    case 2:
    System.out.println("HOME3");
    break;
    case 3:
    System.out.println("HOME4");
    break;
    default:
    System.out.println("HOME5");
    break;
    }

    set windows %HOME% variableWhat is it?
    A system-wide resource? Something pertinent to the processes of a given user? Or does it apply only to your Java process?

  • Start weblogic server within java code

    From edoc.bea.com, I got:
    ====
    The following sections describe alternate ways to start an Administration Server:
    Starting an Administration Server from the Windows Start Menu
    Starting an Administration Server When the Host Computer Boots
    Starting an Administration Server With the java weblogic.Server Command
    ====
    Could we start weblogic server within java code?
    (like ServerLoader provided by JBoss?)
    Thanks in advance.
    -Kevin

    The follwoing code:
    //====
    import weblogic.*;
    public class MyTest
    public static void main(String[] args)
              String[] myArgs = new String[6];
              myArgs[0] = "-Dweblogic.home=C:\\bea";
              myArgs[1] = "-Dweblogic.RootDirectory=C:\\bea\\weblogic81\\samples\\domains\\examples";
              myArgs[2] = "-Dweblogic.ConfigFile=C:\\bea\\weblogic81\\samples\\domains\\examples\\config.xml";
              myArgs[3] = "-Dweblogic.Name=examplesServer";
              myArgs[4] = "-Dweblogic.management.username=weblogic";
              myArgs[5] = "-Dweblogic.management.password=weblogic";
              Server.main( myArgs );
    //====
    Seems that did not feed the arguments in:
    C:\myTest>java -cp .;%CLASSPATH% MyTest
    <Sep 22, 2005 6:08:40 PM EDT> <Info> <Security> <BEA-090065> <Getting boot ident
    ity from user.>
    Enter username to boot WebLogic server:

  • How to get the Weblogic Server Id from within java code

    I would like to log which server (among a cluster) a certain job is running on. Is there a way to get the server id from within Java code (this code is in a session bean if that is relevant.)
    By server id I mean the "Name" column in the summary of servers on the weblogic console.
    Thanks,
    ken

    Use the two entries close to the bottom of the page: "list WebLogic
    MBeans:listMBeans.jsp
    display MBean attributes and operations:showMBean.jsp"
    Nils
    Anatoly wrote:
    >
    Cameron,
    That page has these items on it:
    which one do you think helps with my issue?
    Misc WebLogic examples
    LongRunningTask
    Execute tasks in parallel using WebLogic Execute Threads
    Weblogic stats (5.1)
    Reload Servlet(s) programmatically (5.1)
    Network classload from WebLogic:using reflection,or the launcher
    Weblogic 5.1 debugging properties
    Seppuku pattern readme
    Using dynamic proxies to intercept EJB invocations (6.1)
    list WebLogic MBeans:listMBeans.jsp
    display MBean attributes and operations:showMBean
    Thanks to Marcelo Caldas for filter by type option and nice UI!
    Using com.sun.jdmk.comm.HtmlAdaptorServer with WebLogic 6.1
    Cool
    EJBGen
    Dimitri
    back
    "Cameron Purdy" <[email protected]> wrote in message news:<3c7a745d$[email protected]>...
    JMX ... see http://dima.dhs.org/misc/ for some info on JMX in Weblogic.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "Anatoly" <[email protected]> wrote in message
    news:[email protected]..
    Does anyone know who to get the managing server URL's port
    from within the EJB code running on Weblogic 6.1?
    The URL port is not default (not 7001), but when creating
    initial context, I am not specifying the URL in properties.
    Due to that, trying to the the PROVIDER_URL property from
    environment does not return anything.
    Appreciate any responses.
    -Anatoly
    ============================
    [email protected]

  • Crop and Resize photo within the COD service in ESS

    Anyway to crop and resize photo within the COD webdynpro java component in ESS?

    No what i mean is how to allow the user to upload a photo using the COD service but also allow them to crop and resize the image as documented here:
    [How to Add Image Crop and Resize Capabilities in Web-Based Applications|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10ab79a4-1fc2-2b10-29bb-ef9ff6771e72]
    The solution above does not use the webdynpro COD service in ESS, it is a portal component with embedded JavaScript which also only stores the photo on portal only (not the infotype in ECC).  I guess I need to figure out how to add these javascript files to the webdynpro COD service in ESS.  Although I don't think Webdynpro Java allows you to add javascript.

  • Is it possible to open a Jar within Java code

    Hey
    I am just wondering if it is at all possible to get java to run a Jar within the code. So the Jar is my update to my program and I have got it downloading from my site using the java code but now i want the code to open it for the user so they don't have to double click in on. Is this possible?
    Thanks

    Sure. The java.util.jar package.
    You might want to take a look at service providers:
    http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider

  • Error in Return STO Process(Plant to Plant within company code)

    Hi All,
    I am doing the return STO Process(Plant to Plant within same company code) .
    Scenario:
    STO from Plant 1300 to 1400
    STO Process: ME21N->VL10B->PGI-> VF01(Proforma)->MIGO
    Return STO from Plant 1400 to 1300
    STO Return Process: ME21N(item with return indicator)->MB01(MT 101 w.r.t Return STO PO)->VL10B->PGR(Error)
    It is giving me the following error.
    Deficit of PU GR quantity 5 KG : 20027183 1330 2000 16
    Message no. M7021
    Kindly help me
    with regards
    Azeez.Mohd

    Dear,
       Please go through this link,
        [Deficit of PL Stock in transfer 10 EA : 100100051 IBM2;
        [Accept material in MIRO without any limitation?;
        [migo-return delivery-credit memo;
    Regards,
    Sandip

  • Supress authentication check from within ABAP code

    Hi,
    we want all users to update their email-address in their own sap profile. (a self service)
    By default, in the screen "System"->"User Profile"->"Own Data", he can update all except his email-id.
    For this, we have written an abap report.
    DATA: p_smtp TYPE TABLE OF bapiadsmtp WITH HEADER LINE,
          p_return TYPE TABLE OF bapiret2 WITH HEADER LINE,
          p_addressx TYPE bapiaddr3x.
    data: p_uname TYPE xubname.
    PARAMETERS:   p_email TYPE ad_smtpadr OBLIGATORY.
          p_uname = sy-uname. "logged in user
          p_smtp-e_mail = p_email.
          p_smtp-std_no = 'X'.
          p_smtp-home_flag = 'X'.
          p_smtp-consnumber = '001'.
        p_addressx-e_mail = 'X'.
        CALL FUNCTION 'BAPI_USER_CHANGE'
          EXPORTING
            username = p_uname
            addressx = p_addressx
          TABLES
            return   = p_return
            addsmtp  = p_smtp.
    when we execute this report, with all rights, it works fine.
    but a normal user when he executes, he is getting this error:
    "You are not authorized to change users in group"
    the su53 screen shows:
       Authorization check failed
      Object Class BC_A Basis: Administration
        Authorization Obj. S_USER_GRP User Master Maintenance: User Groups
          Authorization Field ACTVT Activity
                                                                                    02
          Authorization Field CLASS User group in user master maintenance
                                                                                    <Dummy>
    the point here is we cannot add User Maintenance rights to all our normal users.
    is there any way, within the report (code) we can suppress the authentication check, programatically just while calling 'BAPI_USER_CHANGE', so that the user will be able to update his email-id.
    thanks in advance,
    Madhu_1980

    Here are 2 useful links:
    http://www.sapdev.co.uk/fmodules/fms_updateaddress.htm
    Updating email address in SU1/SU3
    If these don't help the noly thing I can suggest is that you write your own bdc program.
    Regards,
    Warren.

  • Error message: Exception error within external code

    Hi
    I am getting an error message on running one of my vi's that uses DAQ.mx that causes labview to close it reads:
    An exception occurred within the external code called by call library node.  This might have corrupted LabVIEW's memory.  Save any work to a new location and restart LabVIEW.  "VI ......." was stopped at node OX19E4 DAQmx Start Task.vi.
    The odd thing is if I put execution highlighting on the vi runs ok and then continues to run OK untill I close Labview and restart it.
    Is anybody familiar with this error.
    Many Thanks.
    Ashley

    I've never come across this error before but looks to be a problem with the NI-DAQmx driver. As a first step, I would recommend unisntalling the driver and then re-installing (i would also install the latest version 8.0).
    Funny how slowing the code down doesn't present the problem. let me know how you get on with the above.

  • Stock Transfer Report from Plants within company code

    Dear SAP Experts,
    We have posted nearly 50 MIGO of stock transfer from our different plants within the same co. code since last 45 days. Now we want to take report of all stock tranfer receipt in our plant. (Like MIGO No. date, material code qty supplying plant etc.)
    Is there any standard T-code like MB51 which can give us the desired information. As in T-code MB51 there is no option to select supplying plant.
    Full Points if helped.
    Thanks in Advance.
    Ishu

    Hi Ishu,
              Go to SE16 enter the table EKKO or EKPO press enter it will take you to selection screen there you click on settings --> Format list --> Chooge fields , system will take you to all the fields avail in EKKO or EKPO there you click on deselect icon then you select fields Purchase doc,date ,Material,Qty and supplying plant then click on copy, system will take you to the previous screen there you click on excute icon.
    I hope it will full fills your requirement
    Regards,
    Murali.

  • Maybe you are looking for

    • DidSelectRowAtIndexPath causes my app to crash

      Hi, I'm just learning Cocoa. I've implemented a tab bar, and the first view (a UIViewController) contains a table view. I've implemented a separate class as the tableview datasource and delegate. Everything works fine, until I add either didSelectRow

    • Array of references to references to objects? Skip lists...

      I'm trying to hammer out a SkipList ADT by tomorrow night. The structure of my SkipList is basically: A Skip list has a reference to the first SkipListNode. Each SkipListNode has an array of links, where a link of level 1 links to the next node that

    • Html attachment issue

      Hi all I have a problem using mail on 10.4 The mail client is set to send messages in rich text format. If I send a mail to another user (windows based with outlook) without attachments the content is received in the body of the email with formatting

    • Stock Report incl. Reservations and Deliveries

      Hi experts My client requires a stock report which includes all reservations (e.g. material for production orders) and all open deliveries in one view. Do you know of such a report? Or how can I easily create one? Many thanks for your help. Best rega

    • MSS Java webdynpro - Employee performance management

      Hi all, I am looking for the RFC function module used to access the list of templates in the ECC backend ABAP. The iview used is in MSS Java web dynpro. Regards, Uday