Folder.getMessage(i) throws an ArrayIndexOutOfBoundsException

I'm trying to keep a cache for messages stored in a folder. the number of messages is around 18.000. I creeated a class that have a method that returns a message by its "Message-ID" header. Because i'd encoutered an out of memory exception when i was keeping all messages in memory i'm keeping only 1000 messages, if the message i'm looking for is not in this 1000 messages it fetches the next 1000 messages (so in memory is stored at a moment only 1000). This method is called in a loop(i'm parsing all messages). after i get the message i verify if the message really exists on the folder :
nr = msg.getMessageNumber();//msg is the message found
javax.mail.Message msgCurr = msg.getFolder().getMessage(nr);
String idver = msgCurr.getHeader("Message-ID")[0];
if(id.equals(idver)) return msgCurr;//idver is the String representation of the Message-ID header.
after a number of messages(last time around 10000) the line msg.getFolder().getMessage(nr); throwed a java.lang.ArrayIndexOutOfBoundsException: 9971 >= 1443
like the folder contains only 1443 messages.
Between calls the folder is open(READ_ONLY) and closed.
is it possible that repeted open/close operation on this folder to lead to the corruption of this folder instance? or the problem is in my code...

the database ideea is a good one but it will not work for me, this is a part of an IMAP connector, so it has to be able to retrieve messages from an IMAP account.
i've thought to stop open and close the folder (i belive this is the cause),try open a folder when a connection is made to the IMAP server and leave it open until the connection is dropped but in this way I risk to leave some open connections to the IMAP server (if application crashes) and this might cause the server to fail...
this case (18000 messages in one folder) is not the most usual use case, but what if in some account i'll find 100.000 or a million documents.
i hesitated to start changing the code (no more open close at each fetch/query) because i thought maybe i'm wrong and the server is capable to manage a lot of open/close operation...(and it seems like for a time at least it can .... almost 10000 mails were processed).

Similar Messages

  • Only 2000 mails fetched with folder.getMessages()

    Hi all,
    I am trying to fetch messages using Folder folder = store.getDefaultFolder();
    but i found out that it can fetch only 2000 mails at a time although there are more.. is there a limit on fetching number of mails ? or I am missing somethng?
    Please help me as its urgent,
    Thanks in advance
    Venky

    If there's a limit, it's being imposed by your server, not JavaMail.
    As I tell everyone... Turn on session debugging and examine the
    protocol trace and it might provide some clues as to what is going
    wrong. If you can't figure it out, post the protocol trace or send it
    to [email protected] and we'll help you figure it out.
    Oh, and please read the FAQ.

  • Error with either GMail or getMessages()

    Hi everybody,
    I've written a program to backup files to my gmail account. Each of the individual pieces seems to be working, but for some reason, the getMessages() function doesn't get the messages that the program itself has sent. It recognizes email from other clients, but if my program sends it, getMessages() will ignore it. It's there, 'cause I can log in to gmail and view it. Is this a problem with gmail, with getMessages(), or with me?
    Below is a simple program to demonstrate the problem. You'll need mail.jar, activation.jar, and pop3.jar in your classpath. It's usage is:
    java gmailTest userName password subjectLine
    It reads your gmail acct., lists the message subjects, looks for a message with the subject you entered on the command line, then sends a new message with that subject, then checks again for a message with that subject. It should always get a match on the second run, but it doesn't.
    I've got gmail invites for anybody who thinks he or she can help.
    import java.util.Properties;
    import java.util.StringTokenizer;
    import java.io.File;
    import com.sun.mail.pop3.POP3SSLStore;
    import java.security.Security;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class gmailTest
    public static String usage = "Usage: java gmailTest user password subject";
    public static void main(String[] args)
      if(args.length != 3)
       System.out.println(usage);
       System.exit(0);
      Properties pop3Props = new Properties();
      pop3Props.setProperty("mail.pop3.user", args[0]);
      pop3Props.setProperty("mail.pop3.passwd", args[1]);
      pop3Props.setProperty("mail.pop3.ssl", "true");
      pop3Props.setProperty("mail.pop3.host", "pop.gmail.com");
      Properties smtpProps = new Properties();
      smtpProps.setProperty("mail.smtp.user", args[0]);
      smtpProps.setProperty("mail.smtp.passwd", args[1]);
      smtpProps.setProperty("mail.smtp.ssl", "true");
      smtpProps.setProperty("mail.smtp.host", "smtp.gmail.com");
      String toAndFromAddress = pop3Props.getProperty("mail.pop3.user") + "@gmail.com";
      try
       checkForMessage(pop3Props, args[2]);
       sendMail(smtpProps, args[2], null, toAndFromAddress, null, null, toAndFromAddress, null, true);
       checkForMessage(pop3Props, args[2]);
      catch(Exception e)
       e.printStackTrace();
    public static  boolean checkForMessage(Properties props, String msgSubject)
            throws NoSuchProviderException, MessagingException
      Session session = null;
      Store store = null;
      String user = ((props.getProperty("mail.pop3.user") != null) ? props.getProperty("mail.pop3.user") : props.getProperty("mail.user"));
      String passwd = ((props.getProperty("mail.pop3.passwd") != null) ? props.getProperty("mail.pop3.passwd") : props.getProperty("mail.passwd"));
      String host = ((props.getProperty("mail.pop3.host") != null) ? props.getProperty("mail.pop3.host") : props.getProperty("mail.host"));
      if((props.getProperty("mail.pop3.ssl") != null) && (props.getProperty("mail.pop3.ssl").equalsIgnoreCase("true")))
       String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
       props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
       props.setProperty("mail.pop3.socketFactory.fallback", "false");
       String portStr = ((props.getProperty("mail.pop3.port") != null) ? props.getProperty("mail.pop3.port") : "995");
       props.setProperty("mail.pop3.port",  portStr);
       props.setProperty("mail.pop3.socketFactory.port", portStr);
       URLName url = new URLName("pop3://"+user+":"+passwd+"@"+host+":"+portStr);
       session = Session.getInstance(props, null);
       store = new POP3SSLStore(session, url);
      else
       session = Session.getInstance(props, null);
       store = session.getStore("pop3");
    //session.setDebug(true);
      store.connect(host, user, passwd);
      Folder folder = store.getFolder("INBOX");
      folder.open(Folder.READ_WRITE);
      Message[] allMsgs = folder.getMessages();
      boolean msgFound = false;
      for(int i = 0; i < allMsgs.length; i++)
       System.out.println(allMsgs.getSubject());
    if(allMsgs[i].getSubject().equals(msgSubject))
    msgFound = true;
    if(msgFound)
    System.out.println("-----------!!!A Matching Message was found!!!------------");
    else
    System.out.println("------------------No Matching Messages were found :{--------------------");
    folder.close(true);
    store.close();
    return msgFound;
    public static int sendMail(final Properties props, String subject, String body, String to, String cc, String bcc, String from, File[] attachments, boolean toStdOut)
         throws javax.mail.internet.AddressException, javax.mail.MessagingException, javax.mail.NoSuchProviderException
    Session sess;
    //props.setProperty("mail.debug", "true");
    if(props.getProperty("mail.smtp.ssl") != null && props.getProperty("mail.smtp.ssl").equalsIgnoreCase("true"))
    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    String portStr = ((props.getProperty("mail.smtp.port") != null) ? (props.getProperty("mail.smtp.port")) : "465");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.socketFactory.port", portStr);
    props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.put("mail.smtp.socketFactory.fallback", "false");
    sess = Session.getDefaultInstance(props,
    new javax.mail.Authenticator()
    protected PasswordAuthentication getPasswordAuthentication()
         String userName = ((props.getProperty("mail.smtp.user") != null) ? props.getProperty("mail.smtp.user") : props.getProperty("mail.user"));
         String passwd = ((props.getProperty("mail.smtp.passwd") != null) ? props.getProperty("mail.smtp.passwd") : props.getProperty("mail.passwd"));
    if(userName == null || passwd == null)
    return null;
    return new PasswordAuthentication(userName , passwd);
    else
    String portStr = ((props.getProperty("mail.smtp.port") != null) ? (props.getProperty("mail.smtp.port")) : "25");
    sess = Session.getInstance(props, null);
    //sess.setDebug(true);
    MimeMessage mess = new MimeMessage(sess);
    mess.setSubject(subject);
    StringTokenizer toST = new StringTokenizer(to, ",;");
    while(toST.hasMoreTokens())
    Address addr = new InternetAddress(toST.nextToken());
    mess.addRecipient(Message.RecipientType.TO, addr);
    if(from != null)
    StringTokenizer fromST = new StringTokenizer(from, ",;");
    InternetAddress[] fromAddrs = new InternetAddress[fromST.countTokens()];
    for(int i = 0; fromST.hasMoreTokens(); i++)
    fromAddrs[i] = new InternetAddress(fromST.nextToken());
    mess.addFrom(fromAddrs);
    if(cc != null)
    StringTokenizer ccST = new StringTokenizer(cc, ",;");
    while(ccST.hasMoreTokens())
    Address addr = new InternetAddress(ccST.nextToken());
    mess.addRecipient(Message.RecipientType.CC, addr);
    if(bcc != null)
    StringTokenizer bccST = new StringTokenizer(bcc, ",;");
    while(bccST.hasMoreTokens())
    Address addr = new InternetAddress(bccST.nextToken());
    mess.addRecipient(Message.RecipientType.BCC, addr);
    BodyPart messageBodyPart = new MimeBodyPart();
    Multipart multipart = new MimeMultipart();
    if(body != null)
    messageBodyPart.setText(body);
    multipart.addBodyPart(messageBodyPart);
    if(attachments != null)
    for(int i = 0; i < attachments.length; i++)
    messageBodyPart = new MimeBodyPart();
    DataSource source = new FileDataSource(attachments[i]);
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName(attachments[i].getName());
    multipart.addBodyPart(messageBodyPart);
    mess.setContent(multipart);
    Address[] allRecips = mess.getAllRecipients();
    if(toStdOut)
    System.out.println("done.");
    //System.out.println("Sending message (\"" + mess.getSubject().substring(0,10) + "...\") to :");
    System.out.println("Sending message (\"" + mess.getSubject() + "...\") to :");
    for(int i = 0; i < allRecips.length; i++)
    System.out.print(allRecips[i] + ";");
    System.out.println("...");
    Transport.send(mess);
    if(toStdOut)
    System.out.println("done.");
    return 0;

    In first place, sorry about my English (I'm spanish).
    I think the code is good. I have got a similar problem and I think the problem is from GMAIL.
    When I log in in one of my GMAIL accounts and put POP3 enabled (in Settings / Forwarding and Pop ) and don�t logout of the account , I can getmessages without problems, but if I try get the messages when I've logout , getmessages() don�t return messages.
    I think the problem is: when you put pop3 enabled in the account say "POP is enabled for all mail that has arrived since", and say the time when you log in and enabled it. When you do a new log in say the new time, it mean, the account don�t remenber that you have set pop enabled and then, when you logout and try getMessages POP is not enabled.
    In another account (I have one more old GMAIL account), when I enabled POP3, it remain enabled and i can getMessages from this account without problems.
    In resume, log in in your account, PUT enable POP in "Settings / Forwarding and Pop" in the GMAIL account, and without logout try you code.
    If you can get the messages, the problems is the same that I had, and it�s caused by that account. Try to get another GMAIL account that remenber the POP enabled selection when you logout.

  • How to change the folder name in KM

    Hi All,
    As a Enduser I have a got a role who can create His/Her own folder to dump the documents.
    Now my requirement is to change the folder which i have created before......
    It may be root folder or Mid folder.
    Please throw some light on this issue.
    Higher points will be rewarded for the valuable input.
    Thanks in Advance,
    Dharani

    Hi Dharani,
    You can change the folder name using "Rename" option from the context menu of the folder. You can also change the name by selecting Folder -> Details->Actions->Rename.
    Regards,
    Vaishali

  • Querying items in folder doesn't work in SharePoint 2013 (Cloud)

    Hi,
    I have 2 folders in a SharePoint List. Every folder contains 2555 items. There is only one column "Title" . I have indexed the "Title" column. The title field contains same values as "Hello" for each and every record. 
    I am querying the first folder and it throws following exception that 
    "An unhandled exception of type 'Microsoft.SharePoint.Client.ServerException' occurred in Microsoft.SharePoint.Client.Runtime.dll
    Additional information: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator."
    But If I add a new item with "Title"="World" in both the folders, and query the first folder, putting the condition that get count where "Title" = "World", it works fine and the count returned is "1".
    Can anybody please tell me, why I get the exception and what is the fix for that.

    Hey Ravi,
    Threshold can not be modified in
    Office 365/SharePoint Online. Have below link for more details and workarounds.
    http://support.microsoft.com/kb/2759051
    SharePoint Online 2010 List View Threshold
    http://community.office365.com/en-us/f/148/t/79787.aspx
    Thanks.

  • Resize JTable caused ArrayIndexOutOfBoundsException

    I have called setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN) for my JTable. If I resize the right bound of the last column, I received the following exception. Does anyone know if it is my problem? Thanks!
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException: 5 >= 5
    at java.util.Vector.elementAt(Vector.java:412)
    at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColum
    nModel.java:271)
    at javax.swing.JTable.accommodateDelta(JTable.java:2185)
    at javax.swing.JTable.columnMarginChanged(JTable.java:2904)
    at javax.swing.table.DefaultTableColumnModel.fireColumnMarginChanged(Def
    aultTableColumnModel.java:576)
    at javax.swing.table.DefaultTableColumnModel.propertyChange(DefaultTable
    ColumnModel.java:615)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Swing
    PropertyChangeSupport.java:156)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Swing
    PropertyChangeSupport.java:125)
    at javax.swing.table.TableColumn.firePropertyChange(TableColumn.java:237
    at javax.swing.table.TableColumn.firePropertyChange(TableColumn.java:243
    at javax.swing.table.TableColumn.setWidth(TableColumn.java:470)
    at javax.swing.plaf.basic.BasicTableHeaderUI$MouseInputHandler.mouseDrag
    ged(BasicTableHeaderUI.java:128)
    at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:25
    5)
    at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:25
    5)
    at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:25
    5)
    at java.awt.Component.processMouseMotionEvent(Component.java:3754)
    at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2294)
    at java.awt.Component.processEvent(Component.java:3543)
    at java.awt.Container.processEvent(Container.java:1159)
    at java.awt.Component.dispatchEventImpl(Component.java:2588)
    at java.awt.Container.dispatchEventImpl(Container.java:1208)
    at java.awt.Component.dispatchEvent(Component.java:2492)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2446
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2200)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2120)
    at java.awt.Container.dispatchEventImpl(Container.java:1195)
    at java.awt.Window.dispatchEventImpl(Window.java:921)
    at java.awt.Component.dispatchEvent(Component.java:2492)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:126)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:93)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)

    The only thing I can think is that because there is no "NEXT COLUMN" to the one you are trying to resize it throws the ArrayIndexOutOfBoundsException. If you have 4 columns and you tell it to resize next column, and then you try to resize the right side of the 4 column it is trying to resize the next column, column 5, which does not exist and therefore throws the exception.

  • Error ArrayIndexOutOfBoundsException while performing VO substitution.

    Hi,
    We are getting ArrayIndexOutOfBoundsException while performing substitution against one standard oracle VO (oracle.apps.csf.portal.task.server.MaterialInstallEOVO).
    Following are the steps which we have performed:
    1. Created a new XXVO by Extending standard oracle VO (oracle.apps.csf.portal.task.server.MaterialInstallEOVO).
    2. Added 2 additional transient attributes to this new XXVO.
    3. define substitution and upload jpx (having substitution definition) to mobile server.
    4. Bounce OC4J and Apache Server.
    Results:
    -- Successfully able to access new attributes and old attributes with no issues.
    Issue:
    Issue facing while copying this new XXVO, means while creating duplicate install line. User can select one record and can create duplicate record by clicking a "duplicate button". But Its throwing exception ArrayIndexOutOfBoundsException.
    Note:If We remove our additional transient attributes from new XXVO then duplicate functionality works fine. A new records get successfully created as per the selected record.
    More information:
    There are 2 standard VOs (MaterialInstallEOVO and DebriefHeadersEOVO) and one standard View Link is defined as CsfMaterialVL using these 2 standard VOs. We need to substitute MaterialInstallEOVO by our new XXMaterialInstallEOVO.
    Hope I am able to explain things but if any question please let me know.
    Any Ideas or suggestion will be great help.
    Thank you!!
    Thanks n Regards
    Ravinder

    Hi elcaro
    Would you pls share the EBS version you are working on .As you said that you are just trying to check the substitution whether it works or not ,so it means there should be no new view attributes in extended VO ,so transient attribute (PackingSlip) must not be included in extended VO, I am not sure that this may be a cause of error but better you remove this and test again ,you can remove this view attribute using shuttle window of attribute list (double clik on VO go to attributes there u can use movement icons remove the PackingSlip view attribute ),but i would suggest that please extend the VO once again from scratch one more time.
    thanks
    Pratap

  • In Finder, when making a new folder, it always goes "loose" in the window

    If I'm looking at a finder window with, say 10 folders in it - okay...I click on one folder and hit "new folder" and it throws a "untitled" folder, usually at the bottom of the list (u is near the end of the alphabet, duh).
    Then I have to go find this untitled folder, rename it, and physically move it into the location.
    Isn't there a better way?
    If I am in a folder, and want to add another one in the same spot, is there any way? Seems like wasted time and steps for this basic function....
    anyone know how?

    It all depends on the sort of view the containing folder has. In List or Column view the new folder will come to life in alphabetical order in the "untitled" position (assuming you have List view set for name) of the folder you have open--so if you want a new folder in a sub-folder, you'll have open that sub-folder. When you create a new folder the window should jump so that your new untitled folder is visible and selected. Icon view can be somewhat more problematic. If you have the View Options for that particular folder set to Keep Arranged by Name then the new folder will appear in the right place, it will be selected, and if necessary the Finder will move the window so it is visible. But if you have a custom "by hand" arrangement of folders and files inside an icon view folder and simply create a new folder using the keyboard shortcut the results are variable. I usually control click the spot where I want the new folder to be and select New Folder from the contextual menu. It appears at the spot I've clicked.
    BTW, if you want to add a new folder to a sub-folder of a window in List view, but don't want to lose your "place" you can open the sub-folder by holding down the Command key, double click it, and it will open as a new window. Add your folder then close it. You can also just double click it, add the folder, then click the back button in the toolbar to return. You can customize the toolbar from the View menu.
    Francine
    Francine
    Schwieder

  • ArrayIndexOutOfBoundsException when setting visibility to the caret

    Hi all,
    I made a JTextPane and run into some problems. I get an ArrayIndexOutOfBoundsException when I'm setting it's caret visibility to true and false:
            JEditorPane textPane = new JTextPane;
            // add the textPane to a frame's ContentPane   
         public void test() {
              for(int i = 0; i<100;  i++) {
                   testVisibility(true);
                   testVisibility(false);
         private void testVisibility(boolean b) {
              // This is were the exception will be thrown if the text pane is visible
              // when making these calls.
              textPane.setEditable(b);
              textPane.getCaret().setVisible(b);
         }The snippet throws an ArrayIndexOutOfBoundsException:
    java.lang.ArrayIndexOutOfBoundsException
         at java.lang.System.arraycopy(Native Method)
         at javax.swing.text.BoxView.updateLayoutArray(BoxView.java:197)
         at javax.swing.text.BoxView.replace(BoxView.java:168)
         at javax.swing.text.View.append(View.java:432)
         at javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:412)
         at javax.swing.text.FlowView.layout(FlowView.java:184)
         at javax.swing.text.BoxView.setSize(BoxView.java:379)
         at javax.swing.text.BoxView.updateChildSizes(BoxView.java:348)
         at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:330)
         at javax.swing.text.BoxView.layout(BoxView.java:682)
         at javax.swing.text.BoxView.setSize(BoxView.java:379)
         at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1618)
         at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:946)
         at javax.swing.text.DefaultCaret.setVisible(DefaultCaret.java:952)
         at org.seba.JTextPaneTest.testVisibility(JTextPaneTest.java:38)
         at org.seba.JTextPaneTest.test(JTextPaneTest.java:29)
         at org.seba.JTextPaneTest.main(JTextPaneTest.java:24)

    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    public class JTextPaneTest {
         JFrame mainFrame;
         JEditorPane textPanel;
         public JTextPaneTest() {
              textPanel = new JTextPane();
            mainFrame = new JFrame("Test Frame.");
            mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            mainFrame.setSize(640, 480);
              mainFrame.getContentPane().add(textPanel);
              mainFrame.setVisible(true);
         public static void main(String[] args) {
              JTextPaneTest textPaneTest = new JTextPaneTest();
              textPaneTest.test();
         public void test() {
              for(int i = 0; i<100;  i++) {
                   testVisibility(false);
                   testVisibility(true);
         private void testVisibility(boolean b) {
              // This is were the exception will be thrown if the text panel is visible
              // when making these calls.
              textPanel.setEditable(b);
              textPanel.getCaret().setVisible(b);
    }I hope it's ok. You'll have to use Java 5 (1.5.0.11) to compile and run it.
    I run into the problem when I made the text pane not editable and the caret was still visible. I needed the caret to hide away too when making the text pane not editable. If I use the setEnabled(boolean) to disable the text pane, all the text is made grey.(I know that there are some methods to make this not happen). I just don't know why this simple test is not working as I would expect.

  • JTable ArrayIndexOutOfBoundsException

    Hi all,
    Pleaaase help me solve this problem...
    I get ArrayIndexOutOfBoundsException when I try to set some data in a JTable. I shall describe the scenario in detail.
    There are 2 lines in a JTable. One with data, and one without data(which means a blank row, where the user is supposed to enter data).
    The user clicks on a button(refresh). This clears off the empty rows, which leaves the JTable with only one row, the one with valid data.
    Now the user clicks on another button(Save). This tries to position the cursor in the first row with the statement
    editCellAt(0,0). Since the Jtable is having a valid entry here, I expect it to behave normally and proceed, after placing the mouse caret in the first row, first column.
    But it throws a ArrayIndexOutOfBoundsException saying java.lang.ArrayIndexOutOfBoundsException: 2 >= 2.
    I tried searching in this forum, posted also..but no help...
    I am in jdk1.3.
    Some postings here mention of something like reload() etc. in the tablemodel, but none of them are specific.
    Any help will be HIGHLY appreciated,
    Thanks...

    Here is the stackTrace
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
    at java.util.Vector.elementAt(Vector.java:417)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:674)
    at javax.swing.JTable.setValueAt(JTable.java:1734)
    at javax.swing.JTable.editingStopped(JTable.java:2989)
    at javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:112)
    at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:242)
    at javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:176)
    at javax.swing.JTable.editCellAt(JTable.java:2359)
    at javax.swing.JTable.editCellAt(JTable.java:2340)
    at SOFrame.save(SOFrame.java:843)
    at SOFrame.SaveButtonActionPerformed(SOFrame.java:815)
    at SOFrame.access$7(SOFrame.java:814)
    at SOFrame$6.actionPerformed(SOFrame.java:244)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
    at java.awt.Component.processMouseEvent(Component.java:3717)
    at java.awt.Component.processEvent(Component.java:3546)
    at java.awt.Container.processEvent(Container.java:1164)
    at java.awt.Component.dispatchEventImpl(Component.java:2595)
    at java.awt.Container.dispatchEventImpl(Container.java:1213)
    at java.awt.Component.dispatchEvent(Component.java:2499)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
    at java.awt.Container.dispatchEventImpl(Container.java:1200)
    at java.awt.Window.dispatchEventImpl(Window.java:912)
    at java.awt.Component.dispatchEvent(Component.java:2499)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
    at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
    Line number 843 where this error occurs
    if(ItemTable.isEditing()){
    ItemTable.editCellAt(0,0);
    ---the line which is executed for deleting the table rows(after which this exception occurs) has also been posted in my previous message in the same topic.

  • PreparedStatements ArrayIndexOutOfBoundsException

    We are running our application on a WebLogic 5.1(sp 9)server using JDK
    1.2.2 on an HP Unix box. We use a weblogic.jdbc.oci.Driver to access
    an Oracle 8.1.5 database. The issue we have is with creating a
    dynamic prepared statement. The prepared statement is a select
    statement generated from a selection of account numbers on a web page.
    First the prepared statement is dynamically built based on the number
    of account numbers selected. For example, 'Select * from tablename
    where accountnbr IN (?,?,?.......)'. In a while loop, a '?' is added
    for each accountnbr selected. Next, in another while loop, a
    variable is bound to each parameter by using a while loop (ie:
    ps.setString(i++, accountnbrArray). The prepared statement is then
    executed. This works fine so long as there is under 512 accounts
    selected. However, once 512 or more accounts are selected, we get an
    error. While looping through and binding the variables using the
    setString method, the application throws an
    ArrayIndexOutOfBoundsException in this method on the 512th parameter
    every time. Can anyone help me out with what/why this is happening?
    Thanks for your help.

    Hi Don,
    Could you post a stacktrace of the exception you're getting?
    FYI, SP9 had a problem with PreparedStatement cache, so you
    may want to try turning it off by putting STATEMENT_CACHE=0
    in the connection pool properties.
    Regards,
    Slava Imeshev
    "Don" <[email protected]> wrote in message
    news:[email protected]..
    We are running our application on a WebLogic 5.1(sp 9)server using JDK
    1.2.2 on an HP Unix box. We use a weblogic.jdbc.oci.Driver to access
    an Oracle 8.1.5 database. The issue we have is with creating a
    dynamic prepared statement. The prepared statement is a select
    statement generated from a selection of account numbers on a web page.
    First the prepared statement is dynamically built based on the number
    of account numbers selected. For example, 'Select * from tablename
    where accountnbr IN (?,?,?.......)'. In a while loop, a '?' is added
    for each accountnbr selected. Next, in another while loop, a
    variable is bound to each parameter by using a while loop (ie:
    ps.setString(i++, accountnbrArray). The prepared statement is then
    executed. This works fine so long as there is under 512 accounts
    selected. However, once 512 or more accounts are selected, we get an
    error. While looping through and binding the variables using the
    setString method, the application throws an
    ArrayIndexOutOfBoundsException in this method on the 512th parameter
    every time. Can anyone help me out with what/why this is happening?
    Thanks for your help.

  • Can't erase messages in POP3 folder

    Hello,
    For some reason, the following code doesn't erase (expunge) the messages in the folder. Has anyone else had this experience? Is there something I'm overlooking? Thanks,
    Robert Douglass
    Folder folder = store.getFolder("INBOX");
    folder.open(Folder.READ_WRITE);
    Message[] messages = folder.getMessages();
    folder.close(true);
    store.close();

    messages.setFlag(Flags.Flag.DELETED,true);
    found it myself!

  • Problem deleting e-mail (folder return newest messages first, older last)

    I made a program, using javamail, to accomplish a quite sofisticated mail forward.
    I read a specific mailbox, I read each message in the INBOX, and in some conditions (I read the content, get a predefined field containing a product ID, read a database and check if the price is high) I forward the e-mail.
    Then I delete the forwarded email from the inbox.<br>
    I am using pop3 & smtp, and I have First Class from Centrinity as Mail Server.
    The problem I have is the following:
    1) in the messages array filled with Message[] messages = folder.getMessages() I get the newest messages first, the older last.
    2) I scan the array, and, based on the Item price (as explained before) I delete some messages: messages(i).setFlag(Flags.Flag.DELETED,true)
    3) messages are phisically deleted only when the folder INBOX is closed: folder.close(true)
    4) if new messages arrives before closing the INBOX, THE WRONG MESSAGES ARE DELETED!.
    Example:
    - I have 3 messages in the inbox;
    - the program start;
    - I process the message number 1, I forward it, I delete it;
    - I process the message number 2, no forward, no delete;
    - (a new message "NEW" arrive now);
    - I process the message number 3, no forward, no delete;
    - I close the folder
    - THE NEW MESSAGE IS DELETED!!!!!!
    I am sure this is because of the ordering of the messages, but I cannot figure out a safe deletion while new messages arrives (and I cannot think I can't solve this problem: no pop3 client should exists!!)
    Thanks in advance for the help
    Paolo Rossetto

    Please take a look at : http://java.sun.com/developer/onlineTraining/JavaMail/contents.html
    and you will find the answer

  • Save incoming msg from pop3 store folder to folder on pc

    hello everyone,
    I have a problem which in theory should be simple to solve but in practise I can't really seem to figure out how to do it.
    Here's the code of how I get the messages to handle each one. What i want to do is put them in a folder on my desktop so I can handle them from there.
    (what i do now is get the attachment and save that file alone and deal with it but i'ld like to have the full msg so i can have details on who it's from and who i want to send it to and any other details i might want to process)
    Can anyone guide me of how I could do this please?
    thanks in advance
    Code to connect and get messages:
    java.util.Properties props = System.getProperties();
    javax.mail.Session session = javax.mail.Session.getInstance(System.getProperties(), null);
    javax.mail.Store store = session.getStore("pop3");
    store.connect(host, username, password);
    javax.mail.Folder folder = store.getFolder("INBOX");
    folder.open(javax.mail.Folder.READ_WRITE);
    // Get directory
    javax.mail.Message messages[] = folder.getMessages();

    thanks for replying
    ok I guess my reply to make it more clear didn't actually help at all so i'll give it one more go and put it in more of a codetelling fashion (meaning it shows what my intentions are but i really don't think it works like this) 
    previous reply to clarify things:
    [basically what I want to do is copy the messages from the javax.mail.Folder to a folder on my desktop as .msg .eml files or whatever they are supposed to be (i don't exactly know but i hope that won't be hard to figure out) so that i can just call for example getFrom on the message file that's been stored in the folder on my desktop.
    what i am doing now is getting all the attachments of each message and stick them in a folder on my desktop but most of them need to be replied to and some times more (automatically) and i can't get the details i need just from the attachment and i also don't want to do it one by one while connected to the server cause if the message is big it times out or something, so in order to avoid such problems i want to be able to fully process it on my pc.]
    2nd try to make things clearer hehe:
    Code to connect and get messages:
    java.util.Properties props = System.getProperties();
    javax.mail.Session session = javax.mail.Session.getInstance(System.getProperties(), null);
    javax.mail.Store store = session.getStore("pop3");
    store.connect(host, username, password);
    javax.mail.Folder folder = store.getFolder("INBOX");
    folder.open(javax.mail.Folder.READ_WRITE);
    // Get directory
    javax.mail.Message messages[] = folder.getMessages();
    now i was thinking of writing 2 loops (one already exists) one that goes through messages[] and the other other that for each messages<i> i create
    File f = new File("temp/" + messages<i>.toString());
    and then through some form of reader read from messages<i> somehow and with a writter write it to f.
    [i know that it doesn't make sense to read from an array but i can't really think of a better way to demonstrate what i want to do ]
    i hope that clears it out a bit let me know if you any other information would be helpful, thanks again for trying
    Message was edited by:
            Alex Stamatopoulos

  • GetMessages and outlook

    Hi,
    I've the following strange (maybe) thing:
    - I have a pop-enabled gmail account, which contains about 500 emails
    - I use the msgshow demo from javamail 1.4 to play with that account
    I started outlook 2003, which begin to download the first 200 emails. Then I started msgshow and when the Folder.getMessages method is invoked, the first 200 emails are retrieved (the response for the pop stat command said "S: +OK 200 ...").
    The first thing that seems strange to me is: why only 200 messages ? I've 500 email on the mail server!
    At a certain point outlook finish to download the 200 emails. I press the send/receive button and the subsequent 300 mails start downloading. In the meantime I started msgshow and the same 300 emails start downloading!
    Can someone help me to figure out what happened and how to solve my problem (indeed: retrieving all the emails from the account) ? Any help will be really really appreciated.
    Pietro

    Your gmail account settings control which messages are visible to POP clients.
    And your Outlook settings control what it does with messages that it downloads
    (e.g., delete them, leave on the server, etc.).
    If changing those settings don't give you what you want, you probably need to
    talk to Google.

Maybe you are looking for

  • Wi-Fi disabled on startup after installing 10.7.3

    I have a late 2008 Aluminium Unibody MacBook (5,1) and installed 10.7.3 via software update without problems. But when I turned the machine on next morning, Wi-Fi was disabled and could not be activated via the menu bar control or network pref pane.

  • Change Filename using XSLT mapping without variable subtitution

    Hi, My scenario is IDOC to file...i am using XSLT mapping, i want to change the filename format to OUT_<Purchase Number>_<DDMMYYYYhhmmss>_KKKK.txt, i cannot use UDF function as i do XSLT mapping i also i cannot use variable substitution as the target

  • Insert Flash Video Hangs

    I took a quicktime movie, used video encoder, no sound, then tried to import into dreamweaver. Dreamweaver hangs and I have to eventually forced quit. On one occasion, after 20 minutes (520 kb flv), it did import and I had multiple skin controls only

  • Embedding items from Square into Tabbed Panels

    Is it possible to make the tabbed panels scroll? Also, does anyone have any experience or suggestions embedding the item code that Square supplies making it easy to add items directly to your website.

  • Okay, I have read some of the issues here

    Okay, I have read some of the issues here and I am scratching my head. I have my PC hard wired to a Linksys WRT G router and my Mac is connected wirelessly to it just fine. Now, my computers don't seem to see each other on the network. Pretend I am a