Skip to content

API to iterate over properties throws NPE #42

@hakanai

Description

@hakanai

Currently, attempting to use the XMPMeta#iterator() method to provide an iterator over the XMP properties gives you back an iterator which fails as soon as you try to use it.

Stack trace:

java.lang.NullPointerException
	at com.ashampoo.xmp.XMPIterator$NodeIterator.reportNode(XMPIterator.kt:313)
	at com.ashampoo.xmp.XMPIterator$NodeIterator.hasNext(XMPIterator.kt:275)
	at com.ashampoo.xmp.XMPIterator$NodeIterator.iterateChildren(XMPIterator.kt:347)
	at com.ashampoo.xmp.XMPIterator$NodeIterator.hasNext(XMPIterator.kt:282)
	at com.ashampoo.xmp.XMPIterator$NodeIterator.reportNode(XMPIterator.kt:316)
	at com.ashampoo.xmp.XMPIterator$NodeIterator.hasNext(XMPIterator.kt:275)
	at com.ashampoo.xmp.XMPIterator.hasNext(XMPIterator.kt:192)

Sample code:

        val xmp = """
            <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
                <rdf:Description rdf:about="">
                    <dc:subject>
                        <rdf:Bag>
                            <rdf:li>XMP</rdf:li>
                            <rdf:li>metadata</rdf:li>
                            <rdf:li>ISO standard</rdf:li>
                        </rdf:Bag>
                    </dc:subject>
                </rdf:Description>
            </rdf:RDF>
        """.trimIndent()

        val meta = XMPMetaFactory.parseFromString(xmp)

        val iterator = meta.iterator()
        while (iterator.hasNext()) {
            // ...
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions