[
https://issues.apache.org/jira/browse/OOZIE-1782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13965607#comment-13965607
]
Purshotam Shah commented on OOZIE-1782:
---------------------------------------
{code}
E0504(XLog.OPS, "App directory [{0}] does not exist"),
E0505(XLog.OPS, "App definition [{0}] does not exist"),
E0506(XLog.OPS, "App definition [{0}] is not a file"),
E0507(XLog.OPS, "Could not access to [{0}], {1}"),
if (!fs.exists(path)) {
throw new XException(ErrorCode.E0504, appPath);
}
Path wfXml = new Path(path, "workflow.xml");
if (!fs.exists(wfXml)) {
throw new XException(ErrorCode.E0505, appPath);
}
if (!fs.isFile(wfXml)) {
throw new XException(ErrorCode.E0506, appPath);
}
..
fs.open(appXml).close();
}
catch (org.apache.hadoop.fs.permission.AccessControlException ex) {
incrCounter(INSTR_FAILED_AUTH_COUNTER, 1);
throw new AuthorizationException(ErrorCode.E0507, appPath,
ex.getMessage(), ex);
}
}
{code}
We check parent path, wf path and if wf path is file not directory and throw
different error message.
I don't think getFileStatus throws AccessControlException. getFileStatus does
throw FileNotFoundException when path doesn't exist.
But I feel fs.exists(path) is intuitive rather then calling getfilestatus and
catching exception.
> Workflow path not found is thrown as SC_UNAUTHORIZED
> ----------------------------------------------------
>
> Key: OOZIE-1782
> URL: https://issues.apache.org/jira/browse/OOZIE-1782
> Project: Oozie
> Issue Type: Bug
> Reporter: Purshotam Shah
> Assignee: Purshotam Shah
> Attachments: OOZIE-1782-V1.patch
>
>
> {code:java}
> AuthorizationService.java
> ....
> Path path = new Path(appPath);
> try {
> if (!fs.exists(path)) {
> incrCounter(INSTR_FAILED_AUTH_COUNTER, 1);
> throw new AuthorizationException(ErrorCode.E0504, appPath);
> }
> BaseJobServlet.java
> ......
> if (wfPath != null) {
> auth.authorizeForApp(user, acl, wfPath, "workflow.xml", conf);
> }
> else if (coordPath != null){
> auth.authorizeForApp(user, acl, coordPath, "coordinator.xml",
> conf);
> }
> else if (bundlePath != null){
> auth.authorizeForApp(user, acl, bundlePath, "bundle.xml",
> conf);
> }
> }
> catch (AuthorizationException ex) {
> XLog.getLog(BaseJobServlet.class).info("AuthorizationException ",
> ex);
> throw new XServletException(HttpServletResponse.SC_UNAUTHORIZED,
> ex);
> }
> {code}
> Path not found should be a SC_BAD_REQUEST not SC_UNAUTHORIZED.
--
This message was sent by Atlassian JIRA
(v6.2#6252)