#vulnerable code 
                                public List<String> getWorkspaceNames() {
        RESTWorkspaceList list = getWorkspaces();
        List<String> names = new ArrayList<String>(list.size());
        for (RESTWorkspaceList.RESTShortWorkspace item : list) {
            names.add(item.getName());
        }
        return names;
    } 
                            #location 3 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public List<String> getWorkspaceNames() {
        RESTWorkspaceList list = getWorkspaces();
        if(list==null){
        	return Collections.emptyList();
        }
        List<String> names = new ArrayList<String>(list.size());
        for (RESTWorkspaceList.RESTShortWorkspace item : list) {
            names.add(item.getName());
        }
        return names;
    }