Abouts NotesException

hi, I am working on Lotus notes command line utility.I created the menu driven progrm like

NotesTool Commands

    1.Driver/Notes Configuration Information

    2.JVM Information

    3.Domino Server Session Information

    4.Authenticate to Domino Server

    5.Create Lotus Notes Test User

    6.Delete Lotus Notes User

    7.Open Lotus Notes Database

    8.Send Domino Console Command

    99.Quit

Enter Command:

6

If user select 6,it deletes the user actually,suppose user is not found in the domino directory ,i am throwing the NotesException using the following way.

try{

} catch (NotesException e) {

throw new NotesException(e.id, e.text, e.internal);

}

i am catching in the main method i am doing some other stuff overthere. for the first attempt it is working fine…

in the next attemp its giving error and its termitates the program also.

Exception in thread “main” NotesException: Notes error: User name not found in D

omino Directory

    at NotesToolTest.mainMenu(NotesToolTest.java:324)

    at NotesToolTest.main(NotesToolTest.java:449)

Why its happening this?anythig is wrong with the code like handling the exceptions?

Please suggest me.

Thanks in advance.

—sankar

Subject: Abouts NotesException

Please find the following code i have written for handling NotesException.What’s my problem is When i got exception in any of the following option,first time i am able to handle the notesException properly.But i run the same command(option) ,it is terminating the program.It should catch the properly and it displays the options again.It doesn’t happening.Please suggst me.

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import lotus.domino.AdministrationProcess;

import lotus.domino.NotesException;

import lotus.domino.NotesThread;

import lotus.domino.Registration;

import lotus.domino.Session;

public class TestNotesException {

public static void mainMenu()throws Exception{

	

	while (true) {

		BufferedReader reader = new BufferedReader(new InputStreamReader(

				System.in));

		



		System.out.println("\nNotesTool Commands");

		int option = 0;

		System.out.println("\t1.Driver/Notes Configuration Information "

				+ "\n\t2.JVM Information"

				+ " \n\t3.Domino Server Session Information"

				+ "\n\t4.Authenticate to Domino Server"

				+ " \n\t5.Create Lotus Notes Test User"

				+ "\n\t6.Delete Lotus Notes User"

				+ "\n\t7.Open Lotus Notes Database"

				+ "\n\t8.Send Domino Console Command" + "\n\t99.Quit");

		System.out.println("Enter Command:");

		

	

			option = Integer.parseInt(reader.readLine());

			switch (option) {

			case 1:

				break;



			case 2:

			

				break;

			case 3:

								break;



			case 4:

								break;

			case 5:

				break;



			case 6:

				

				System.out

						.println("\n*************** DELETE THE USER *********************\n");

				System.out

						.println("Please enter user's full name that you want delete:::");



				String userName = reader.readLine();

				System.out.println("User "

						+ deleteUser(userName)

						+ " is deleted from the domino Server "

						);

				break;



							case 99:

			

				System.out.println("");

				System.exit(0);

			default:

				System.out.println("Command not supported.Choose correct option");

			



			}

	}

}

/**

 * @param args

 * @throws Exception 

 * @throws IOException 

 */

public static void main(String[] args)   {

	// TODO Auto-generated method stub

	try{

	

	mainMenu();

			

		/*} catch (NotesException e) {

			try{

				throw new NotesException(e.id, e.text, e.internal);

			}catch(NotesException e1){

				e1.printStackTrace();

				System.out.println(e.getCause());

				System.out.println(e.getClass());

				System.out.println(e.internal);

				//throw new NotesException(e.id, e.text, e.internal);

			}*/



	}catch (NotesException e) {

			System.out.println("Command not supported.Choose correct option");

			try{

			mainMenu();

			}catch (Exception e1) {

				e1.printStackTrace();

				// TODO: handle exception

			}

			

			//throw new NotesException(e.id, e.text, e.internal);

		}	

		catch (NumberFormatException e) {

			System.out.println("Command not supported.Choose correct option");

			

			//throw new NotesException(e.id, e.text, e.internal);

		}

		catch (Exception e) {

			System.out.println("Command not supported.Choose correct option");

			

			//throw new NotesException(e.id, e.text, e.internal);

		}

}

private static String deleteUser(String userName) throws Exception{

	// TODO Auto-generated method stub

	

	

		NotesThread.sinitThread();

		Session NotesSess = lotus.domino.NotesFactory.createSession();

		

		Registration tmpNReg = NotesSess.createRegistration();

		String userName1 = tmpNReg.switchToID("C:\\Program Files\\Lotus\\Domino\\data\\admin.id", "novell");

	

	AdministrationProcess pAdminP = NotesSess

	.createAdministrationProcess("DomainA/NotesOrg");

	pAdminP.deleteUser(userName, true,

			AdministrationProcess.MAILFILE_DELETE_ALL, "");

	return userName;

}

}