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; ...@@ -75,6 +75,7 @@ import org.ofbiz.entity.condition.EntityCondition;
75 import org.ofbiz.service.DispatchContext; 75 import org.ofbiz.service.DispatchContext;
76 import org.ofbiz.service.LocalDispatcher; 76 import org.ofbiz.service.LocalDispatcher;
77 import org.ofbiz.service.ModelService; 77 import org.ofbiz.service.ModelService;
78 import org.ofbiz.service.ServiceAuthException;
78 import org.ofbiz.service.ServiceContainer; 79 import org.ofbiz.service.ServiceContainer;
79 80
80 import org.apache.commons.csv.CSVFormat; 81 import org.apache.commons.csv.CSVFormat;
...@@ -247,6 +248,11 @@ public class DirectControlServlet extends HttpServlet { ...@@ -247,6 +248,11 @@ public class DirectControlServlet extends HttpServlet {
247 processRequest(); 248 processRequest();
248 } catch (IOException e) { 249 } catch (IOException e) {
249 throw e; 250 throw e;
251 } catch (ServiceAuthException e) {
252 e.printStackTrace();
253 Debug.logError(e, "ServiceAuthException", module);
254 response.setStatus(401);
255 setResponseNoCache();
250 } catch (Exception e) { 256 } catch (Exception e) {
251 e.printStackTrace(); 257 e.printStackTrace();
252 throw (IOException) new IOException(e.getMessage()).initCause(e); 258 throw (IOException) new IOException(e.getMessage()).initCause(e);
......