LPS-47692 - general source formatting and removal of unused variables

Hi @jonmak08 ,

this pull replaces the last pull: https://github.com/jonmak08/liferay-portal/pull/944

I've applied the source formatting changes suggested in your comments, as well as a few others I found (e.g. unused variables, eqeqeq).

Let me know if you have any questions ^_^