Reduce NPath complexity in ReferencedUrlFinder

Also got rid of pointless catch of OutOfBoundsException and a paranoid
check for a situation that should never occur.

Change-Id: I07b1d2b1e36f74c62bcc0d532a464603afa32349
Merge "Reduce NPath complexity in ReferencedUrlFinder"