You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Philip Helger (JIRA)" <ji...@apache.org> on 2011/06/27 14:16:47 UTC

[jira] [Created] (PDFBOX-1055) XMPMetadata.getSchemasByNamespaceURI() implementation inefficient

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
             Fix For: 1.6.0


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

        

[jira] [Commented] (PDFBOX-1055) XMPMetadata.getSchemasByNamespaceURI() implementation inefficient

Posted by "Philip Helger (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Updated] (PDFBOX-1055) XMPMetadata.getSchemasByNamespaceURI() implementation inefficient

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler updated PDFBOX-1055:
---------------------------------------

    Fix Version/s:     (was: 1.6.0)

Please provide a patch as diff so that it'll be easier to apply it to the codebase.

> 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