Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=44312
Log an error if there is a conflict between Host and Alias names.

This also includes the following:

1. Implemented exactFind() methods that combine find() with a check that an exact match was found.
This allows to simplify the code.

2. Fixed behaviour of Mapper.removeHost() in case if the host is not found. Now it won't throw an NPE.

3. Fixed error logging of various Mapper.removeXxx() methods, where only "(pos<0)" case was logged as "not found". The change is that now it logs in wrong-match-found case as well.
I did not introduce i18n there, as I do not see a real use case for those messages.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604066 13f79535-47bb-0310-9956-ffa450edef68
Fix bug in StandardContext.removeApplicationListener() introduced by the fix for BZ 56588.
This was noted by FindBugs as "Calling String[].equals(String)".

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604163 13f79535-47bb-0310-9956-ffa450edef68
Correct copy-pasted comments

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604165 13f79535-47bb-0310-9956-ffa450edef68
Mode test for adding duplicates from setUp() into a test method.
Add two additional tests.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604217 13f79535-47bb-0310-9956-ffa450edef68
For https://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Test for concurrency issue with Mapper$ContextList.nesting field.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604309 13f79535-47bb-0310-9956-ffa450edef68
Fix http://issues.apache.org/bugzilla/show_bug.cgi?id=56653
Fix concurrency issue with Mapper$ContextList when removeContextVersion() is called.

Followup improvement to http://issues.apache.org/bugzilla/show_bug.cgi?id=44312
Make the removeHost(), removeHostAlias() methods more strict. They now check whether type of the mapping that they are removing.

ContextList class is made immutable.
Added HostMapping class. It allows to update ContextList instances in MappedHost.
The HostMapping.alias flag allows to discern whether it is the primary mapping or an alias.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604319 13f79535-47bb-0310-9956-ffa450edef68
Mapper improvements
- Mark MappedContext.versions field as volatile, because it is updated when a Context is started or stopped.
- Mark MapElement fields as final and add them to constructors.
- Change super class of MappedContext from MapElement<Context> to MapElement<Void>. It does not wrap any real object, its "object" field is always null.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604320 13f79535-47bb-0310-9956-ffa450edef68
Assert that MappingData object is empty before performing mapping work.
The old code just skipped all work in that case, but I do not see why that would be useful,
and it may return inconsistent results.
The comet and async examples do work successfully with this change.

This allows to simplify the code in Mapper.internalMap() by removing a number of checks.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604434 13f79535-47bb-0310-9956-ffa450edef68
Make sure that context.versions array always has at least 1 element.
Do not assign 0-length array to this field.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604435 13f79535-47bb-0310-9956-ffa450edef68
Small improvements, no functional change.
Save contexts[pos] is a local variable.
Skip versions lookup when there is the only version available.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604437 13f79535-47bb-0310-9956-ffa450edef68
Remove fields "context" and "wrapper" and their setters from Catalina Request object.
This information is available from MappingData object.

A pair of (context == null) checks removed, as such checks are already done earlier in the same method.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604472 13f79535-47bb-0310-9956-ffa450edef68
Simplify code, no functional change.

This makes it clear that setting "mapRequired = true;" and "getMappingData().recycle();" call are always performed together.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604484 13f79535-47bb-0310-9956-ffa450edef68
Correct comments

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604496 13f79535-47bb-0310-9956-ffa450edef68
Rename constructor argument, to align with actual usage.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604591 13f79535-47bb-0310-9956-ffa450edef68
https://issues.apache.org/bugzilla/show_bug.cgi?id=56657
If sessionid belongs to the latest version of webapp, use the latest version.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604605 13f79535-47bb-0310-9956-ffa450edef68
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56657#c2
Ensure that re-mapping selects the context version that we expect.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604661 13f79535-47bb-0310-9956-ffa450edef68
Simplify. No need for a local variable that is read once.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604676 13f79535-47bb-0310-9956-ffa450edef68
Simplify. No need for a local variable that is read once.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604678 13f79535-47bb-0310-9956-ffa450edef68
Simplify. No need for a local variable that is read once.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1604682 13f79535-47bb-0310-9956-ffa450edef68