[ 
https://issues.apache.org/jira/browse/PDFBOX-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13067081#comment-13067081
 ] 

Philip Helger commented on PDFBOX-1055:
---------------------------------------

    public List<XMPSchema> getSchemasByNamespaceURI(String namespaceURI)
            throws IOException
    {

        List<XMPSchema> result = new LinkedList<XMPSchema>();

        Class<?> schemaClass = nsMappings.get(namespaceURI);
        if (schemaClass == null)
        {
            return result;
        }

        List<XMPSchema> l = getSchemas();
        Iterator<XMPSchema> i = l.iterator();
        while (i.hasNext())
        {
            XMPSchema schema = i.next();

            if (schemaClass.isAssignableFrom(schema.getClass()))
            {
                result.add(schema);
            }
        }
        return result;
    }


> XMPMetadata.getSchemasByNamespaceURI() implementation inefficient
> -----------------------------------------------------------------
>
>                 Key: PDFBOX-1055
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1055
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: JempBox
>    Affects Versions: 1.5.0
>            Reporter: Philip Helger
>            Priority: Minor
>
> The implementation of getSchemasByNamespaceURI is inefficient, if no 
> namespace mapping is present.
> You may consider to call "List<XMPSchema> l = getSchemas();" just before the 
> iterator is retrieved.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to