You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2015/02/19 17:26:53 UTC
svn commit: r1660927 - in
/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal:
dispatch/Dispatcher.java whiteboard/ContextHandler.java
whiteboard/WhiteboardHttpService.java
Author: cziegeler
Date: Thu Feb 19 16:26:53 2015
New Revision: 1660927
URL: http://svn.apache.org/r1660927
Log:
Add some additional null checks for shutdown, make sure requestURI is never null
Modified:
felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java
felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardHttpService.java
Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java?rev=1660927&r1=1660926&r2=1660927&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java Thu Feb 19 16:26:53 2015
@@ -568,6 +568,10 @@ public final class Dispatcher implements
this.whiteboardService.sessionDestroyed(session, ids);
}
String requestURI = getRequestURI(req);
+ if ( requestURI == null )
+ {
+ requestURI = "";
+ }
// Determine which servlets we should forward the request to...
final ServletHandler servletHandler = this.handlerRegistry.getServletHander(requestURI);
@@ -641,6 +645,10 @@ public final class Dispatcher implements
}
// TODO remove path parameters...
String requestURI = decodePath(removeDotSegments(path));
+ if ( requestURI == null )
+ {
+ requestURI = "";
+ }
ServletHandler handler = this.handlerRegistry.getServletHander(requestURI);
if (handler == null)
Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java?rev=1660927&r1=1660926&r2=1660927&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ContextHandler.java Thu Feb 19 16:26:53 2015
@@ -203,13 +203,23 @@ public final class ContextHandler implem
if ( holder != null )
{
holder.counter--;
- if ( holder.counter <= 0 )
+ if ( holder.counter == 0 )
{
this.perBundleContextMap.remove(key);
- final ServiceObjects<ServletContextHelper> so = bundle.getBundleContext().getServiceObjects(this.info.getServiceReference());
- if ( so != null )
+ if ( holder.servletContextHelper != null )
{
- so.ungetService(holder.servletContextHelper);
+ final ServiceObjects<ServletContextHelper> so = bundle.getBundleContext().getServiceObjects(this.info.getServiceReference());
+ if ( so != null )
+ {
+ try
+ {
+ so.ungetService(holder.servletContextHelper);
+ }
+ catch ( final IllegalArgumentException iae)
+ {
+ // this seems to be thrown sometimes on shutdown; we have to evaluate
+ }
+ }
}
}
}
Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardHttpService.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardHttpService.java?rev=1660927&r1=1660926&r2=1660927&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardHttpService.java (original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardHttpService.java Thu Feb 19 16:26:53 2015
@@ -327,12 +327,16 @@ public final class WhiteboardHttpService
{
for(final Long contextId : contextIds)
{
- final ContextHandler handler = this.contextManager.getContextHandler(contextId);
- if ( handler != null )
+ // TODO - on shutdown context manager is already NULL which shouldn't be the case
+ if ( this.contextManager != null )
{
- final ExtServletContext context = handler.getServletContext(this.bundleContext.getBundle());
- new HttpSessionWrapper(contextId, session, context, true).invalidate();
- handler.ungetServletContext(this.bundleContext.getBundle());
+ final ContextHandler handler = this.contextManager.getContextHandler(contextId);
+ if ( handler != null )
+ {
+ final ExtServletContext context = handler.getServletContext(this.bundleContext.getBundle());
+ new HttpSessionWrapper(contextId, session, context, true).invalidate();
+ handler.ungetServletContext(this.bundleContext.getBundle());
+ }
}
}
}