You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2010/02/28 17:10:12 UTC
svn commit: r917194 - in /pdfbox/jempbox/trunk/src:
main/java/org/apache/jempbox/xmp/XMPSchema.java
test/java/org/apache/jempbox/xmp/XMPSchemaTest.java
Author: lehmi
Date: Sun Feb 28 16:10:12 2010
New Revision: 917194
URL: http://svn.apache.org/viewvc?rev=917194&view=rev
Log:
PDFBOX-621: return correct integer property. Patch by Guillaume Bailleul (guillaume dot bailleul at atosorigin dot com)
Modified:
pdfbox/jempbox/trunk/src/main/java/org/apache/jempbox/xmp/XMPSchema.java
pdfbox/jempbox/trunk/src/test/java/org/apache/jempbox/xmp/XMPSchemaTest.java
Modified: pdfbox/jempbox/trunk/src/main/java/org/apache/jempbox/xmp/XMPSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/jempbox/trunk/src/main/java/org/apache/jempbox/xmp/XMPSchema.java?rev=917194&r1=917193&r2=917194&view=diff
==============================================================================
--- pdfbox/jempbox/trunk/src/main/java/org/apache/jempbox/xmp/XMPSchema.java (original)
+++ pdfbox/jempbox/trunk/src/main/java/org/apache/jempbox/xmp/XMPSchema.java Sun Feb 28 16:10:12 2010
@@ -298,7 +298,7 @@
{
Integer retval = null;
String intProperty = getTextProperty(propertyName);
- if (intProperty.equals(""))
+ if (intProperty != null && intProperty.length() > 0)
{
retval = new Integer(intProperty);
}
Modified: pdfbox/jempbox/trunk/src/test/java/org/apache/jempbox/xmp/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/jempbox/trunk/src/test/java/org/apache/jempbox/xmp/XMPSchemaTest.java?rev=917194&r1=917193&r2=917194&view=diff
==============================================================================
--- pdfbox/jempbox/trunk/src/test/java/org/apache/jempbox/xmp/XMPSchemaTest.java (original)
+++ pdfbox/jempbox/trunk/src/test/java/org/apache/jempbox/xmp/XMPSchemaTest.java Sun Feb 28 16:10:12 2010
@@ -110,6 +110,31 @@
}
/**
+ * Test that integer properties are correctly handled.
+ *
+ * @throws IOException Signals an error with the XMP processing.
+ */
+ public void testIntegerProperty() throws IOException
+ {
+ XMPMetadata xmp = new XMPMetadata();
+ XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");
+
+ schema.setIntegerProperty("test:intvalue", new Integer(14));
+
+ Element e = schema.getElement();
+ assertEquals("14", e.getAttribute("test:intvalue"));
+
+ assertEquals(new Integer(14),schema.getIntegerProperty("test:intvalue"));
+
+ schema.setIntegerProperty("test:intvalue",new Integer(16));
+
+ e = schema.getElement();
+ assertEquals("16", e.getAttribute("test:intvalue"));
+
+ assertEquals(new Integer(16), schema.getIntegerProperty("test:intvalue"));
+ }
+
+ /**
* Check bag properties.
*
* @throws IOException Signals an error with the XMP processing.