Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2002 11:15:58 -0700 (PDT)
From:      Ranjith Mandala <Ranjith.Mandala@Sun.COM>
To:        freebsd-java@freebsd.org
Cc:        java-port@freebsd.org, Ranjith.Mandala@Sun.COM
Subject:   Re: (Review ID: 145816) Java Mail api cause the JVM to stop the operation and the program killed.
Message-ID:  <12866987.1020363127191.JavaMail.Administrator@ha2sca-mail1.sfbay.sun.com>

next in thread | raw e-mail | index | archive | help
Hi Avinash K S Holla,

This Bug Report was submitted from  http://java.sun.com/cgi-bin/bugreport.cgi and is being forwarded to you on behalf of avinashks@oyeindia.com. If you would like to respond.  Please send an e-mail to the address listed at the end of this report.

Regards,
RM.
----------------- Original Bug Report-------------------

category : hotspot
release : 1.4
subcategory : other
type : bug
synopsis : Java Mail api cause the JVM to stop the operation and the program killed.
description : FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-
b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION : FreeBSD 4.5-STABLE FreeBSD 4.5-STABLE #0:
Thu Mar 14 17:20:01 IST 2002


A DESCRIPTION OF THE PROBLEM :
I have a list of users with their password in two separate array and I login
to the pop3 server with this information.

My main objective is to
fetch the UID of the messages and then to alert the user of the arrival of new
messages after comparing with thier old UIDs

I will get the proper
result if the number of users is less that 50 and as soon as I cross, JVM sarts
to throw the error and stops the program from running.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Have a list of pop users in an array (Ex: above 75)
2. Using a loop check
for the UID of the messages
3. Compare the previous UIDs with the current
iteration and write the number of new message(s)for that user in a
hashtable or file for further processing.

EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected result is filling up of the hashtable with the number of new
messages..

But the JVM repeatedly throws up the error and my program
stops

ERROR MESSAGES/STACK TRACES THAT OCCUR :
DEBUG: getProvider() returning
javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems,
Inc]
POP3: connecting to host "10.0.3.240", port 110
S: +OK POP3 blrmail.bplmail.com v7.64
server ready
C: USER avinash.ks
S: +OK User name accepted, password please
C: PASS
welcome123
S: +OK Mailbox open, 0 messages
C: STAT
S: +OK 0 0
C: QUIT
S: +OK
Sayonara

DEBUG: getProvider() returning
javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems,
Inc]
POP3: connecting to host "10.0.3.240", port 110
S: EOF

DEBUG: getProvider()
returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy
stems, Inc]
POP3: connecting to host "10.0.3.240", port 110
Connect failed;
  nested
exception is:
        java.net.ConnectException: Connection
refused
javax.mail.MessagingException: Connect failed;
  nested exception is:
        
java.net.ConnectException: Connection refused
        at
com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:106)
        at
javax.mail.Service.connect(Service.java:234)
        at
javax.mail.Service.connect(Service.java:135)
        at
CheckMail.run(CheckMail.java:206)
Starting to check at 24-04-2002 AD at 02:44:39 PM
IST

DEBUG: getProvider() returning
javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems,
Inc]
POP3: connecting to host "10.0.3.240", port 110

Unexpected Signal : 11 occurred at
PC=0x2A0377B7
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the
function name symbol for the error
      just occurred. Please refer to release documentation for
possible
      reason and solutions.


Current Java thread:

Dynamic libraries:
Can not
get information for pid = 58311

Local Time = Wed Apr 24 14:44:59 2002
Elapsed Time =
157
#
# HotSpot Virtual Machine Error : 11
# Error ID : 4F530E43505002D3
# Please report
this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM)
Client VM (1.4.0-b92 mixed mode)
#
# An error report file has been saved as
hs_err_pid58311.log.
# Please refer to the file for further information.

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public void checkPop3(Folder folder, String user) {
	boolean flagPop3 =
false;
	POP3Folder pf = null;
	
	File file = null;
	RandomAccessFile raf =
null;
											
	Vector newMsgId = null;
	Vector oldMsgId = null;
					
	int
newMsgCnt = 0;
		
	newMsgId = new Vector();
	oldMsgId = new Vector();
		
		try
{			
			// try to open read/write and if that fails try read-only
			try
{
				folder.open(Folder.READ_WRITE);
			}
			catch (MessagingException ex)
{
				folder.open(Folder.READ_ONLY);
			}
			int totalMessages =
folder.getMessageCount();
			
			if (totalMessages == 0) {
				folder.close(false);

				// store.close();
				return;
			}
	
			// Attributes & Flags for ALL messages
..
			Message[] msgs = folder.getMessages();
						
			// Use a suitable FetchProfile

			FetchProfile fp = new FetchProfile();
			fp.add(UIDFolder.FetchProfileItem.UID);

			folder.fetch(msgs, fp);
	
			if (folder instanceof
com.sun.mail.pop3.POP3Folder) {
				flagPop3 = true;
				pf =
(com.sun.mail.pop3.POP3Folder)folder;
			}
			else {
				flagPop3 = false;
			}

					
			for (int j = 0; j < msgs.length; j++) {
				if(flagPop3) {
					String uid =
pf.getUID(msgs[j]);
					newMsgId.add(uid);
				}
				else {
					String
messageId = msgs[j].getHeader("Message-Id")[0];
					newMsgId.add(messageId);
				}

			}
			file = new File(user + ".msgid");
			raf = new RandomAccessFile(file, "rw");

				
			String readLine = "";
			while(true) {
				try {
					readLine =
raf.readUTF();
					oldMsgId.add(readLine);
				}
				catch(EOFException eofe) {

					break;
				}
			}
			
			for(int j=0; j<newMsgId.size(); j++)
{
				if(!(oldMsgId.contains(newMsgId.elementAt(j))))
{
					newMsgCnt++;
				}
			}
			if(newMsgCnt > 0 ) {
				System.out.println("No
of new msgs " + newMsgCnt);
			}
						
			raf.seek(0);
			
			for(int j=0;
j<newMsgId.size(); j++) {
				raf.writeUTF(newMsgId.elementAt(j).toString());
			}

						
			raf.close();
			folder.close(false);
			
		}
		catch(Exception e)
{
			System.out.println("Caught Exception: " +
e);
			e.printStackTrace();
		}
	}
	
    public void run() {
        while(true) {
            // fill up
users and password array
            getUserList();

            try {
                Thread.sleep(sleepTime*1000);

                
for(int i=0; i<user.length; i++) {
                    // Get a Properties object
                    props =
System.getProperties();

                    // Get a Session object
                    session =
Session.getDefaultInstance(props, null);
                    session.setDebug(true);

                    // Get a Store
object
                    store = null;

                    if (protocol != null)
                        store = session.getStore(protocol);
                    
else
                        store = session.getStore();
                    
                    // Connect
                    try {
                        
                        store.connect(host, user[i],
password[i]);
                    }
                    catch(AuthenticationFailedException ae) {
                        continue;
                    }

                    // Open
the Folder
                    folder = store.getDefaultFolder();
                    if (folder == null) {
                        
System.out.println("No default folder");
                        continue;
                    }

                    folder =
folder.getFolder(mbox);
                    if (folder == null) {
                        System.out.println("Invalid folder");
                        
continue;
                    }

                    if(protocol.equals("pop3")) {
                        checkPop3(folder);
                    }
                    
store.close();
                }
            }
            catch(InterruptedException ie) {
                System.out.println("Oops, got
exception! " + ie.getMessage());
                ie.printStackTrace();
                continue;
            }
            catch
(Exception ex) {
                System.out.println("Oops, got exception! " + ex.getMessage());
                
ex.printStackTrace();
                continue;
            }
        }
    }
---------- END SOURCE ----------
workaround : 
suggested_val : 
cust_name : Avinash K S Holla
cust_email : avinashks@oyeindia.com, avinash_holla@yahoo.com
jdcid : 
keyword : webbug
company : Wirefree Innovision Technologies (P) Ltd
hardware : x86
OSversion : Linux
bugtraqID : 0
dateCreated : 2002-04-24 03:48:07.2
dateEvaluated : 2002-05-02 12:09:17.868


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?12866987.1020363127191.JavaMail.Administrator>