peng.jianhua created RANGER-1794:
------------------------------------

             Summary: The warning information is incorrect in 
getRangerServiceByService of ServiceMgr class
                 Key: RANGER-1794
                 URL: https://issues.apache.org/jira/browse/RANGER-1794
             Project: Ranger
          Issue Type: Bug
          Components: admin
    Affects Versions: 1.0.0, master
            Reporter: peng.jianhua
            Assignee: peng.jianhua
            Priority: Minor


{code}
if(! StringUtils.isEmpty(serviceType)) {
        RangerServiceDef serviceDef = svcStore == null ? null : 
svcStore.getServiceDefByName(serviceType);
        if(serviceDef != null) {
                Class<RangerBaseService> cls = 
getClassForServiceType(serviceDef);
                if(cls != null) {
                        ret = cls.newInstance();
                        ret.init(serviceDef, service);
                        if(ret instanceof RangerServiceTag) {
                                ((RangerServiceTag)ret).setTagStore(tagStore);
                        }
                } else {
                        LOG.warn("ServiceMgr.getRangerServiceByService(" + 
service + "): could not find service class '" + serviceDef.getImplClass() + 
"'");
                }
        } else {
                LOG.warn("ServiceMgr.getRangerServiceByService(" + service + 
"): could not find the service-type '" + serviceType + "'");
        }
} else {
        LOG.warn("ServiceMgr.getRangerServiceByService(" + service + "): could 
not find the service-type");
}
{code}
The above code should be modified as following:
{code}
if(! StringUtils.isEmpty(serviceType)) {
        RangerServiceDef serviceDef = svcStore == null ? null : 
svcStore.getServiceDefByName(serviceType);
        if(serviceDef != null) {
                Class<RangerBaseService> cls = 
getClassForServiceType(serviceDef);
                if(cls != null) {
                        ret = cls.newInstance();
                        ret.init(serviceDef, service);
                        if(ret instanceof RangerServiceTag) {
                                ((RangerServiceTag)ret).setTagStore(tagStore);
                        }
                } else {
                        LOG.warn("ServiceMgr.getRangerServiceByService(" + 
service + "): could not find service class '" + serviceDef.getImplClass() + 
"'");
                }
        } else {
                LOG.warn("ServiceMgr.getRangerServiceByService(" + service + 
"): could not find the service-def");
        }
} else {
        LOG.warn("ServiceMgr.getRangerServiceByService(" + service + "): could 
not find the service-type '" + serviceType + "'");
}
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to