#vulnerable code 
                                @SuppressWarnings("unchecked")
	@Test
    // Add the MetadataLinkListener to the listener chain. The output will render an href to view the metadata
    // for the album object.
    public void testMetadataHref()
    {
        String prefixUrl = "/metadata/";
        String fileExtension = "test";
        Album signOfTheTimes = DataGenerator.signOfTheTimes();

        DefaultMetaDataRegistry service = new DefaultMetaDataRegistry();
        service.setRootMetaDataUrl( prefixUrl );
        service.setCoreSelector( new CoreSelector( populatorRegistry ) );

        Map<String,Class<?>> typeMappings = new HashMap<String, Class<?>>();
        typeMappings.put( "album", Album.class );
        service.setTypeMappings( typeMappings );

        MetadataLinkListener metadataLinkListener = new MetadataLinkListener();
        metadataLinkListener.setMetaDataRegistry( service );

        ResultTraverser traverser = new ResultTraverser();
        YogaRequestContext requestContext = new YogaRequestContext( fileExtension,
                new DummyHttpServletRequest(), new DummyHttpServletResponse(), metadataLinkListener );
        Map<String, Object> objectTree = doTraverse( signOfTheTimes, ":", traverser, requestContext );

        Map<String,String> metadataMap = (Map<String,String>) objectTree.get( "metadata" );
        String metadataHref = prefixUrl + "album." + fileExtension;
        Assert.assertEquals( metadataHref, metadataMap.get( "href" ) );
    } 
                            #location 27 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @SuppressWarnings("unchecked")
	@Test
    // Add the MetadataLinkListener to the listener chain. The output will render an href to view the metadata
    // for the album object.
    public void testMetadataHref()
    {
        String prefixUrl = "/metadata/";
        String fileExtension = "test";
        Album signOfTheTimes = DataGenerator.signOfTheTimes();

        DefaultMetaDataRegistry service = new DefaultMetaDataRegistry();
        service.setRootMetaDataUrl( prefixUrl );
        service.setCoreSelector( new CoreSelector( populatorRegistry ) );

        Map<String,Class<?>> typeMappings = new HashMap<String, Class<?>>();
        typeMappings.put( "album", Album.class );
        service.setTypeMappings( typeMappings );

        MetadataLinkListener metadataLinkListener = new MetadataLinkListener();
        metadataLinkListener.setMetaDataRegistry( service );

        ResultTraverser traverser = new ResultTraverser();
        YogaRequestContext requestContext = new YogaRequestContext( fileExtension, new GDataSelectorParser(),
                new DummyHttpServletRequest(), new DummyHttpServletResponse(), metadataLinkListener );
        Map<String, Object> objectTree = doTraverse( signOfTheTimes, "", traverser, requestContext );

        Map<String,String> metadataMap = (Map<String,String>) objectTree.get( "metadata" );
        String metadataHref = prefixUrl + "album." + fileExtension;
        Assert.assertEquals( metadataHref, metadataMap.get( "href" ) );
    }