1696b6ea by Ean Schuessler

Merge branch 'BF-7817' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet

2 parents d58580c3 082deae3
......@@ -73,6 +73,7 @@ import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceAuthException;
......@@ -245,13 +246,23 @@ public class DirectControlServlet extends HttpServlet {
tmpOut.close();
try {
try {
processRequest();
} catch (GenericServiceException e) {
Throwable cause = e;
while ((cause = cause.getCause()) != null) {
if (cause instanceof ServiceAuthException) {
throw (ServiceAuthException) cause;
}
}
throw e;
}
} catch (IOException e) {
throw e;
} catch (ServiceAuthException e) {
e.printStackTrace();
Debug.logError(e, "ServiceAuthException", module);
response.setStatus(401);
Debug.logError(e, "ServiceAuthException(setting status to 401)", module);
response.sendError(401, e.getMessage());
setResponseNoCache();
} catch (Exception e) {
e.printStackTrace();
......