tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cyriel Vringer (JIRA)" <j...@apache.org>
Subject [jira] Created: (TIKA-585) AudioParser Fails with NPE on fileFormat.properties
Date Mon, 17 Jan 2011 14:47:44 GMT
AudioParser Fails with NPE on fileFormat.properties
---------------------------------------------------

                 Key: TIKA-585
                 URL: https://issues.apache.org/jira/browse/TIKA-585
             Project: Tika
          Issue Type: Bug
          Components: parser
    Affects Versions: 0.8
         Environment: ALL
            Reporter: Cyriel Vringer
            Priority: Minor


AudioParserTests fail because the AudioParser does not check for existence of properties on
the fileFormat. (In the parse method, about line 110. The code is:
                for (Entry<String, Object> entry : fileFormat.properties().entrySet())
{
                    metadata.set(entry.getKey(), entry.getValue().toString());
                }
                for (Entry<String, Object> entry : audioFormat.properties().entrySet())
{
                    metadata.set(entry.getKey(), entry.getValue().toString());
                }
Method throws NPE on fileFormat.properties().entrySet() when there are no properties.
should be something like:
            if( fileFormat.properties() != null && fileFormat.properties().size()
> 0) {
                for (Entry<String, Object> entry : fileFormat.properties().entrySet())
{
                    metadata.set(entry.getKey(), entry.getValue().toString());
                }
            }
            if( audioFormat.properties() != null && audioFormat.properties().size()
> 0) {
                for (Entry<String, Object> entry : audioFormat.properties().entrySet())
{
                    metadata.set(entry.getKey(), entry.getValue().toString());
                }
            }
Or am i missing something?



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message