pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbaill...@apache.org
Subject svn commit: r1546750 - /pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java
Date Sat, 30 Nov 2013 16:52:04 GMT
Author: gbailleul
Date: Sat Nov 30 16:52:04 2013
New Revision: 1546750

URL: http://svn.apache.org/r1546750
Log:
PDFBOX-1642: NPE on Closed Choice
* manage closed and open Choice

Modified:
    pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java?rev=1546750&r1=1546749&r2=1546750&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java Sat Nov
30 16:52:04 2013
@@ -50,6 +50,10 @@ import org.w3c.dom.NamedNodeMap;
 public final class PdfaExtensionHelper
 {
 
+    public static final String CLOSED_CHOICE = "closed Choice of ";
+
+    public static final String OPEN_CHOICE = "open Choice of ";
+
     private PdfaExtensionHelper()
     {
     }
@@ -240,8 +244,10 @@ public final class PdfaExtensionHelper
             return TypeMapping.createPropertyType(Types.LangAlt, Cardinality.Simple);
         }
         // else all other cases
-        if ("closed Choice of Text".equals(valueType)) {
-            valueType = "Text";
+        if (valueType.startsWith(CLOSED_CHOICE)) {
+            valueType = valueType.substring(CLOSED_CHOICE.length());
+        } else if (valueType.startsWith(OPEN_CHOICE)) {
+            valueType = valueType.substring(OPEN_CHOICE.length());
         }
         int pos = valueType.indexOf(' ');
         Cardinality card = Cardinality.Simple;



Mime
View raw message