#vulnerable code 
                                @Test
    public void userStatusTest() throws Exception {
        AccessKey key = new AccessKey();
        ADMIN.setStatus(UserStatus.DISABLED);
        key.setUser(ADMIN);
        HiveSecurityContext hiveSecurityContext = new HiveSecurityContext();
        hiveSecurityContext.setHivePrincipal(new HivePrincipal(null, null, key));
        AccessKeyInterceptor interceptor = new AccessKeyInterceptor();
        interceptor.setHiveSecurityContext(hiveSecurityContext);
        Exception thrown = null;
        try {
            interceptor.checkPermissions(null);
        } catch (Exception e) {
            thrown = e;
            if (e instanceof HiveException) {
                HiveException hiveException = (HiveException) e;
                assertEquals(401, hiveException.getCode().intValue());
            } else {
                fail("Hive exception expected");
            }
        }
        if (thrown == null) {
            fail("Hive exception expected");
        }

        key = new AccessKey();
        ADMIN.setStatus(UserStatus.LOCKED_OUT);
        key.setUser(ADMIN);
        hiveSecurityContext = new HiveSecurityContext();
        hiveSecurityContext.setHivePrincipal(new HivePrincipal(null, null, key));
        interceptor = new AccessKeyInterceptor();
        interceptor.setHiveSecurityContext(hiveSecurityContext);
        thrown = null;
        try {
            interceptor.checkPermissions(null);
        } catch (Exception e) {
            thrown = e;
            if (e instanceof HiveException) {
                HiveException hiveException = (HiveException) e;
                assertEquals(401, hiveException.getCode().intValue());
            } else {
                fail("Hive exception expected");
            }
        }
        if (thrown == null) {
            fail("Hive exception expected");
        }

        key = new AccessKey();
        ADMIN.setStatus(UserStatus.DELETED);
        key.setUser(ADMIN);
        hiveSecurityContext = new HiveSecurityContext();
        hiveSecurityContext.setHivePrincipal(new HivePrincipal(null, null, key));
        interceptor = new AccessKeyInterceptor();
        interceptor.setHiveSecurityContext(hiveSecurityContext);
        thrown = null;
        try {
            interceptor.checkPermissions(null);
        } catch (Exception e) {
            thrown = e;
            if (e instanceof HiveException) {
                HiveException hiveException = (HiveException) e;
                assertEquals(401, hiveException.getCode().intValue());
            } else {
                fail("Hive exception expected");
            }
        }
        if (thrown == null) {
            fail("Hive exception expected");
        }
    } 
                            #location 12 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Test
    public void userStatusTest() throws Exception {
        AccessKey key = new AccessKey();
        ADMIN.setStatus(UserStatus.DISABLED);
        key.setUser(ADMIN);
        HiveSecurityContext hiveSecurityContext = new HiveSecurityContext();
        hiveSecurityContext.setHivePrincipal(new HivePrincipal(null, null, key));
        RequestInterceptor interceptor = new RequestInterceptor();
        interceptor.setHiveSecurityContext(hiveSecurityContext);
        Exception thrown = null;
        try {
            interceptor.checkPermissions(null);
        } catch (Exception e) {
            thrown = e;
            if (e instanceof HiveException) {
                HiveException hiveException = (HiveException) e;
                assertEquals(401, hiveException.getCode().intValue());
            } else {
                fail("Hive exception expected");
            }
        }
        if (thrown == null) {
            fail("Hive exception expected");
        }

        key = new AccessKey();
        ADMIN.setStatus(UserStatus.LOCKED_OUT);
        key.setUser(ADMIN);
        hiveSecurityContext = new HiveSecurityContext();
        hiveSecurityContext.setHivePrincipal(new HivePrincipal(null, null, key));
        interceptor = new RequestInterceptor();
        interceptor.setHiveSecurityContext(hiveSecurityContext);
        thrown = null;
        try {
            interceptor.checkPermissions(null);
        } catch (Exception e) {
            thrown = e;
            if (e instanceof HiveException) {
                HiveException hiveException = (HiveException) e;
                assertEquals(401, hiveException.getCode().intValue());
            } else {
                fail("Hive exception expected");
            }
        }
        if (thrown == null) {
            fail("Hive exception expected");
        }

        key = new AccessKey();
        ADMIN.setStatus(UserStatus.DELETED);
        key.setUser(ADMIN);
        hiveSecurityContext = new HiveSecurityContext();
        hiveSecurityContext.setHivePrincipal(new HivePrincipal(null, null, key));
        interceptor = new RequestInterceptor();
        interceptor.setHiveSecurityContext(hiveSecurityContext);
        thrown = null;
        try {
            interceptor.checkPermissions(null);
        } catch (Exception e) {
            thrown = e;
            if (e instanceof HiveException) {
                HiveException hiveException = (HiveException) e;
                assertEquals(401, hiveException.getCode().intValue());
            } else {
                fail("Hive exception expected");
            }
        }
        if (thrown == null) {
            fail("Hive exception expected");
        }
    }