#vulnerable code 
                                private Session getSession(Object adaptable) {
        return getResourceResolver(adaptable).adaptTo(Session.class);
    } 
                            #location 2 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                private Session getSession(Object adaptable) {
        ResourceResolver resolver = getResourceResolver(adaptable);

        return resolver != null ?  resolver.adaptTo(Session.class) : null;
    }