You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/11/06 22:26:33 UTC

[jira] [Commented] (PDFBOX-2485) IllegalArgumentException in TypeMapping.instanciateSimpleProperty

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

Tilman Hausherr commented on PDFBOX-2485:
-----------------------------------------

The second file 009272.pdf doesn't make preflight fail; the exception is a bit different and it is swallowed, here's an excerpt of DomXmpParser:
{code}
try
{
    AbstractSimpleProperty sp = tm.instanciateSimpleProperty(namespace, schema.getPrefix(),
            attr.getLocalName(), attr.getValue(), type.type());
    container.addProperty(sp);
}
catch( IllegalArgumentException exception)
{
    //Swallow, and continue adding additional properties
    LOG.warn("Unable to add property: "+ attr.getLocalName() + " value: "+attr.getValue(),exception);
}
{code}
the xmp segment is also different:
{code}
<rdf:Description rdf:about='uuid:cbfe66a4-4a32-4e8d-9c03-4873ad4c8115' xmlns:xap='http://ns.adobe.com/xap/1.0/' xap:CreateDate='0-01-01T00:00:00Z' xap:ModifyDate='2005-03-08T09:42:18-05:00' xap:MetadataDate='2005-03-08T09:42:18-05:00' xap:CreatorTool='Microsoft Word '></rdf:Description>
{code}

IMHO it is not ok that the same problem is sometimes swallowed and sometimes not.

> IllegalArgumentException in TypeMapping.instanciateSimpleProperty
> -----------------------------------------------------------------
>
>                 Key: PDFBOX-2485
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2485
>             Project: PDFBox
>          Issue Type: Bug
>          Components: XmpBox
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>         Attachments: 004144_unc.pdf, 009272.pdf
>
>
> I get this with the attached file:
> {code}
> 004144.pdf preflight fail: java.lang.IllegalArgumentException: Failed to instanciate property
> 	at org.apache.xmpbox.type.TypeMapping.instanciateSimpleProperty(TypeMapping.java:204)
> 	at org.apache.xmpbox.xml.DomXmpParser.manageSimpleType(DomXmpParser.java:399)
> 	at org.apache.xmpbox.xml.DomXmpParser.createProperty(DomXmpParser.java:338)
> 	at org.apache.xmpbox.xml.DomXmpParser.parseDescriptionRoot(DomXmpParser.java:292)
> 	at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:206)
> 	at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:114)
> 	at org.apache.pdfbox.preflight.process.MetadataValidationProcess.validate(MetadataValidationProcess.java:67)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
> 	at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:88)
> 	at org.apache.pdfbox.preflight.PreflightDocument.validate(PreflightDocument.java:168)
> 	at pdfboxpageimageextraction.PreflightTest.main(PreflightTest.java:41)
> Caused by: java.lang.reflect.InvocationTargetException
> 	at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> 	at org.apache.xmpbox.type.TypeMapping.instanciateSimpleProperty(TypeMapping.java:184)
> 	... 10 more
> Caused by: java.lang.IllegalArgumentException: Value given is not allowed for the Date type : class java.lang.String
> 	at org.apache.xmpbox.type.DateType.setValue(DateType.java:110)
> 	at org.apache.xmpbox.type.AbstractSimpleProperty.<init>(AbstractSimpleProperty.java:50)
> 	at org.apache.xmpbox.type.DateType.<init>(DateType.java:50)
> 	... 14 more
> {code}
> The cause is this line in the XMP:
> {code}
> <xap:CreateDate>0-01-01T00:00:00Z</xap:CreateDate>
> {code}
> The cause is the "Z".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)