5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-19 02:10:54 +08:00

SQOOP-2522: Sqoop2: Findbugs: Fix warning in security module

(Colin Ma via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2015-08-24 10:48:02 -07:00
parent 709dd3671b
commit d64cf21563

View File

@ -51,7 +51,7 @@ public boolean apply(T input) {
checkPrivilege(doUserName, getPrivilege(type, name, MPrivilege.ACTION.READ));
// add valid resource
return true;
} catch (Exception e) {
} catch (RuntimeException e) {
//do not add into result if invalid resource
return false;
}
@ -145,7 +145,7 @@ public boolean apply(MSubmission input) {
checkPrivilege(doUserName, getPrivilege(MResource.TYPE.JOB, jobId, MPrivilege.ACTION.READ));
// add valid submission
return true;
} catch (Exception e) {
} catch (RuntimeException e) {
//do not add into result if invalid submission
return false;
}
@ -176,12 +176,12 @@ private static void checkPrivilege(String doUserName, MPrivilege... privileges)
for (MPrivilege privilege : privileges) {
Repository repository = RepositoryManager.getInstance().getRepository();
if (MResource.TYPE.LINK.name().equalsIgnoreCase(privilege.getResource().getType())) {
MLink link = repository.findLink(Long.valueOf(privilege.getResource().getName()));
MLink link = repository.findLink(Long.parseLong(privilege.getResource().getName()));
if (!doUserName.equals(link.getCreationUser())) {
privilegesNeedCheck.add(privilege);
}
} else if (MResource.TYPE.JOB.name().equalsIgnoreCase(privilege.getResource().getType())) {
MJob job = repository.findJob(Long.valueOf(privilege.getResource().getName()));
MJob job = repository.findJob(Long.parseLong(privilege.getResource().getName()));
if (!doUserName.equals(job.getCreationUser())) {
privilegesNeedCheck.add(privilege);
}