Need Java Debugging help....please!

I have the following method:

private boolean hasDebugRole(Database thisDb, String user) {

	if (trace)

		System.out.println("entering method: hasDebugRole");

	boolean result = false;

	try {

		Vector roles = thisDb.queryAccessRoles(user);

		for (int i = 0; i < roles.size(); i++) {

			if (roles.elementAt(i) == "[Debug]")

				result = true;

		}

	} catch (NotesException e) {

		System.out.println(e.id + " " + e.text);

		e.printStackTrace();

	}

	if (trace)

		System.out.println("Debugging" + result);

	return result;

}

roles.element(1) is really “[Debug]” becuase I see it in the eclipse debugger, however, the if statement just ignores it.

What am I doing wrong?

mxl

Subject: Need Java Debugging help…please!

You need to cast the Object from the Vector to a String and then use the .equals() method. Like this:

		Vector roles = thisDb.queryAccessRoles(user); 

		for (int i = 0; i < roles.size(); i++) {

		String role = (String) roles.elementAt(i) ;

		if (role.equals( "[Debug]") ) {

		result = true; 

		}

		}

Frunobulax

Subject: RE: Need Java Debugging help…please!

Thank you.

Marcus