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 2014/11/01 11:17:26 UTC
svn commit: r1635914 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
Author: lehmi
Date: Sat Nov 1 10:17:26 2014
New Revision: 1635914
URL: http://svn.apache.org/r1635914
Log:
PDFBOX-649: log unsupported annotation types instead of throwing an exception
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java (contents, props changed)
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java?rev=1635914&r1=1635913&r2=1635914&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java Sat Nov 1 10:17:26 2014
@@ -20,12 +20,13 @@ import java.awt.Color;
import java.io.IOException;
import java.util.Calendar;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSNumber;
-
import org.apache.pdfbox.pdmodel.common.COSObjectable;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
@@ -36,11 +37,12 @@ import org.w3c.dom.Element;
/**
* This represents an FDF annotation that is part of the FDF document.
*
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.4 $
- */
+ * @author Ben Litchfield
+ *
+ * */
public abstract class FDFAnnotation implements COSObjectable
{
+ private static final Log LOG = LogFactory.getLog(FDFAnnotation.class);
/**
* Annotation dictionary.
*/
@@ -52,7 +54,7 @@ public abstract class FDFAnnotation impl
public FDFAnnotation()
{
annot = new COSDictionary();
- annot.setName( "Type", "Annot" );
+ annot.setItem( COSName.TYPE, COSName.ANNOT );
}
/**
@@ -178,17 +180,16 @@ public abstract class FDFAnnotation impl
public static FDFAnnotation create( COSDictionary fdfDic ) throws IOException
{
FDFAnnotation retval = null;
- if( fdfDic == null )
- {
- //do nothing and return null
- }
- else if( FDFAnnotationText.SUBTYPE.equals( fdfDic.getNameAsString( COSName.SUBTYPE ) ) )
+ if( fdfDic != null )
{
- retval = new FDFAnnotationText( fdfDic );
- }
- else
- {
- throw new IOException( "Unknown annotation type '" + fdfDic.getNameAsString( COSName.SUBTYPE ) + "'" );
+ if( FDFAnnotationText.SUBTYPE.equals( fdfDic.getNameAsString( COSName.SUBTYPE ) ) )
+ {
+ retval = new FDFAnnotationText( fdfDic );
+ }
+ else
+ {
+ LOG.warn("Unknown annotation type '" + fdfDic.getNameAsString( COSName.SUBTYPE ) + "'" );
+ }
}
return retval;
}
@@ -221,7 +222,7 @@ public abstract class FDFAnnotation impl
public Integer getPage()
{
Integer retval = null;
- COSNumber page = (COSNumber)annot.getDictionaryObject( "Page" );
+ COSNumber page = (COSNumber)annot.getDictionaryObject( COSName.PAGE );
if( page != null )
{
retval = new Integer( page.intValue() );
@@ -283,7 +284,7 @@ public abstract class FDFAnnotation impl
*/
public String getDate()
{
- return annot.getString( "date" );
+ return annot.getString( COSName.DATE );
}
/**
@@ -293,7 +294,7 @@ public abstract class FDFAnnotation impl
*/
public void setDate( String date )
{
- annot.setString( "date", date );
+ annot.setString( COSName.DATE, date );
}
/**
@@ -519,7 +520,6 @@ public abstract class FDFAnnotation impl
{
retval = new PDRectangle( rectArray );
}
-
return retval;
}
Propchange: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov 1 10:17:26 2014
@@ -0,0 +1 @@
+/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java:1460370,1460372,1461796,1465163,1465217,1465266,1465359-1465360,1465366,1467638,1468195,1469999,1470107,1470242,1476795,1477806,1478472,1479136,1479287,1480000,1480030,1484089,1484277,1484547,1485771,1485781,1486337,1486413,1486423,1486440,1487557,1488049,1490022-1490023,1490408,1493503,1494083,1495799,1495802-1495803,1497532,1504210,1504214,1505737,1509187,1512367,1512433,1512661,1515101,1515165,1515905,1517273,1517281,1517288,1519174,1521194,1528826,1528833,1530018,1530740,1535953,1535956,1536136,1536173,1536441,1536463,1537287,1538191,1538203,1538222,1538341,1538371,1538394-1538395,1540801,1540811,1541625,1541714,1541987,1542291,1542780,1544789,1544806,1544818,1544972,1544977,1548387,1548394,1549022,1549025,1549027,1551220,1552521,1552533,1552552,1553017,1553175,1553220,1554632,1554774,1554792,1554845,1555186,1555345,1555550,1557339,1557374,1557546,1557553,1557561,1557793,1558205,1558570,1561095,1
561191,1563199,1563210,1563215,1563426,1563429,1564846,1588736,1598655,1598885,1599016,1599656,1599786,1601144,1601451,1631169,1635911