You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/03/11 13:49:06 UTC

git commit: [OLINGO-201] ODataServlet - CNF Exception - fix

Repository: incubator-olingo-odata2
Updated Branches:
  refs/heads/master 6f75e0034 -> 572f69a8f


[OLINGO-201] ODataServlet - CNF Exception - fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/572f69a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/572f69a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/572f69a8

Branch: refs/heads/master
Commit: 572f69a8f610bd6c72cdef568cff50cf9f08e61f
Parents: 6f75e00
Author: Stephan Klevenz <sk...@apache.org>
Authored: Tue Mar 11 13:48:43 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Mar 11 13:48:58 2014 +0100

----------------------------------------------------------------------
 .../olingo/odata2/core/servlet/ODataServlet.java      | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/572f69a8/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java
index a554f13..3e4a57e 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/servlet/ODataServlet.java
@@ -63,7 +63,14 @@ public class ODataServlet extends HttpServlet {
       throw new ODataRuntimeException("config missing: org.apache.olingo.odata2.processor.factory");
     }
     try {
-      serviceFactory = (ODataServiceFactory) Class.forName(factoryClassName).newInstance();
+
+      ClassLoader cl = (ClassLoader) req.getAttribute(ODataServiceFactory.FACTORY_CLASSLOADER_LABEL);
+      if (cl == null) {
+        serviceFactory = (ODataServiceFactory) Class.forName(factoryClassName).newInstance();
+      } else {
+        serviceFactory = (ODataServiceFactory) Class.forName(factoryClassName, true, cl).newInstance();
+      }
+
     } catch (Exception e) {
       throw new ODataRuntimeException(e);
     }
@@ -147,8 +154,9 @@ public class ODataServlet extends HttpServlet {
     return true;
   }
 
-  private void handleRequest(final HttpServletRequest req, final ODataHttpMethod method, final HttpServletResponse resp)
-      throws IOException {
+  private void
+      handleRequest(final HttpServletRequest req, final ODataHttpMethod method, final HttpServletResponse resp)
+          throws IOException {
     try {
       if (req.getHeader(HttpHeaders.ACCEPT) != null && req.getHeader(HttpHeaders.ACCEPT).isEmpty()) {
         createNotAcceptableResponse(req, ODataNotAcceptableException.COMMON, resp);