Merge branch 'BF-7817' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet
Showing
1 changed file
with
13 additions
and
2 deletions
... | @@ -73,6 +73,7 @@ import org.ofbiz.entity.util.EntityUtil; | ... | @@ -73,6 +73,7 @@ import org.ofbiz.entity.util.EntityUtil; |
73 | import org.ofbiz.entity.condition.EntityOperator; | 73 | import org.ofbiz.entity.condition.EntityOperator; |
74 | import org.ofbiz.entity.condition.EntityCondition; | 74 | import org.ofbiz.entity.condition.EntityCondition; |
75 | import org.ofbiz.service.DispatchContext; | 75 | import org.ofbiz.service.DispatchContext; |
76 | import org.ofbiz.service.GenericServiceException; | ||
76 | import org.ofbiz.service.LocalDispatcher; | 77 | import org.ofbiz.service.LocalDispatcher; |
77 | import org.ofbiz.service.ModelService; | 78 | import org.ofbiz.service.ModelService; |
78 | import org.ofbiz.service.ServiceAuthException; | 79 | import org.ofbiz.service.ServiceAuthException; |
... | @@ -245,13 +246,23 @@ public class DirectControlServlet extends HttpServlet { | ... | @@ -245,13 +246,23 @@ public class DirectControlServlet extends HttpServlet { |
245 | tmpOut.close(); | 246 | tmpOut.close(); |
246 | 247 | ||
247 | try { | 248 | try { |
249 | try { | ||
248 | processRequest(); | 250 | processRequest(); |
251 | } catch (GenericServiceException e) { | ||
252 | Throwable cause = e; | ||
253 | while ((cause = cause.getCause()) != null) { | ||
254 | if (cause instanceof ServiceAuthException) { | ||
255 | throw (ServiceAuthException) cause; | ||
256 | } | ||
257 | } | ||
258 | throw e; | ||
259 | } | ||
249 | } catch (IOException e) { | 260 | } catch (IOException e) { |
250 | throw e; | 261 | throw e; |
251 | } catch (ServiceAuthException e) { | 262 | } catch (ServiceAuthException e) { |
252 | e.printStackTrace(); | 263 | e.printStackTrace(); |
253 | Debug.logError(e, "ServiceAuthException", module); | 264 | Debug.logError(e, "ServiceAuthException(setting status to 401)", module); |
254 | response.setStatus(401); | 265 | response.sendError(401, e.getMessage()); |
255 | setResponseNoCache(); | 266 | setResponseNoCache(); |
256 | } catch (Exception e) { | 267 | } catch (Exception e) { |
257 | e.printStackTrace(); | 268 | e.printStackTrace(); | ... | ... |
-
Please register or sign in to post a comment