5212166b by Adam Heath

Catch ServiceAuthException, and return HTTP 401 Unauthorized.

Refs: #7593
1 parent 4d463c3b
......@@ -75,6 +75,7 @@ import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceAuthException;
import org.ofbiz.service.ServiceContainer;
import org.apache.commons.csv.CSVFormat;
......@@ -247,6 +248,11 @@ public class DirectControlServlet extends HttpServlet {
processRequest();
} catch (IOException e) {
throw e;
} catch (ServiceAuthException e) {
e.printStackTrace();
Debug.logError(e, "ServiceAuthException", module);
response.setStatus(401);
setResponseNoCache();
} catch (Exception e) {
e.printStackTrace();
throw (IOException) new IOException(e.getMessage()).initCause(e);
......