Fixed ClassCastException.

Cannot cast Handler[] down to ContextHandlerCollection[].

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-04-07 11:05:26 +02:00
parent 36700bec50
commit 3eda16988c
1 changed files with 7 additions and 4 deletions

View File

@ -1605,10 +1605,13 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
if (getServer() != null && (getServer().isStarting() || getServer().isStarted()))
{
ContextHandlerCollection[] contextCollections =
(ContextHandlerCollection[])getServer().getChildHandlersByClass(ContextHandlerCollection.class);
for (int h = 0; contextCollections != null && h < contextCollections.length; h++)
contextCollections[h].mapContexts();
Class<ContextHandlerCollection> handlerClass = ContextHandlerCollection.class;
Handler[] contextCollections = getServer().getChildHandlersByClass(handlerClass);
if (contextCollections != null)
{
for (Handler contextCollection : contextCollections)
handlerClass.cast(contextCollection).mapContexts();
}
}
}