#vulnerable code 
                                @Test
    public void testComplexCoreFields()
    {
        User carter = DataGenerator.carter();
        carter.getFavoriteArtists().add( DataGenerator.neutralMilkHotel() );
        carter.getFavoriteArtists().add( DataGenerator.arcadeFire() );
        ResultTraverser traverser = new ResultTraverser();
        MapSelector selector = new MapSelector();
        selector.register( User.class, "id", "favoriteArtists" );

        Map<String, Object> objectTree = doTraverse( carter, traverser, _simpleContext, new CompositeSelector( selector, new CoreSelector() ) );
        Assert.assertTrue( objectTree.size() >= 2 );
        Assert.assertEquals( carter.getId(), objectTree.get( "id" ) );
        Assert.assertEquals( carter.getName(), objectTree.get( "name" ) );

        List<Map<String, Object>> favoriteArtists = getList( objectTree, "favoriteArtists" );
        Assert.assertNotNull( favoriteArtists );
        Assert.assertEquals( 2, favoriteArtists.size() );
        Map<String, Object> neutralMap = findItem( favoriteArtists, "name", "Neutral Milk Hotel" );
        Assert.assertEquals( DataGenerator.neutralMilkHotel().getId(), neutralMap.get( "id" ) );
        Map<String, Object> arcadeMap = findItem( favoriteArtists, "name", "Arcade Fire" );
        Assert.assertEquals( DataGenerator.arcadeFire().getId(), arcadeMap.get( "id" ) );
    } 
                            #location 20 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Test
    public void testComplexCoreFields()
    {
        User carter = DataGenerator.carter();
        carter.getFavoriteArtists().add( DataGenerator.neutralMilkHotel() );
        carter.getFavoriteArtists().add( DataGenerator.arcadeFire() );
        ResultTraverser traverser = new ResultTraverser();
        traverser.getFieldPopulatorRegistry().register( new UserFieldPopulatorWithArtistCoreField() );

        Map<String, Object> objectTree = doTraverse( carter, ":", traverser, _simpleContext );
        Assert.assertEquals( 3, objectTree.size() );
        Assert.assertEquals( carter.getId(), objectTree.get( "id" ) );
        Assert.assertEquals( carter.getName(), objectTree.get( "name" ) );

        List<Map<String, Object>> favoriteArtists = getList( objectTree, "favoriteArtists" );
        Assert.assertNotNull( favoriteArtists );
        Assert.assertEquals( 2, favoriteArtists.size() );
        Map<String, Object> neutralMap = findItem( favoriteArtists, "name", "Neutral Milk Hotel" );
        Assert.assertEquals( DataGenerator.neutralMilkHotel().getId(), neutralMap.get( "id" ) );
        Map<String, Object> arcadeMap = findItem( favoriteArtists, "name", "Arcade Fire" );
        Assert.assertEquals( DataGenerator.arcadeFire().getId(), arcadeMap.get( "id" ) );
    }