Fix for OPENAM-2764 and OPENAM-2765, review CR-2140.

git-svn-id: https://svn.forgerock.org/openam/trunk/openam@6251 0f4defcf-c51a-4c67-9f44-6fb5eba73c5d