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

Fred Hansen commented on PDFBOX-1684:
-------------------------------------

Maruan Sahyoun commented above that DateConverter "should be part of a (new) 
base module". I am proposing to do the work of populating that module.  

Hewson's comment suggests that the list of moved classes be reduced to
-    DateConverter.java
-    ResourceLoader.java
-    ExtensionFileFilter.java
-    MapUtil.java
-    StringUtil.java
-    XMLUtil.java

DateConverter needs to be in a shared utility jar for use by pdfbox, jempbox, 
and xmpbox.
ResourceLoader needs to be in a similar jar for use by pdfbox and fontbox.

The other four implement classes that each define only one or two methods.  
They could well be replaced. 
{quote} MapUtil searches a map to find the next unused integer. It could be 
replaced with a subclass of HashMap that keeps track of the needed integer 
value rather than searching for it.

 XMLUtil has 
{code}
         retval = next.getNodeValue(); 
{code}
 where it certainly wants a "+=" instead of "="
 This is only used in fdf/FDFField.java, which may well return incorrect 
results. 

 StringUtil implements getBytes by calling String.getBytes, which is only 
defined in Java 1.6 and later.

 ExtensionFileFilter is for Java 1.5; in later Java's it can be replaced with 
FileNameExtensionFilter
{quote}


> DateConverter source is in three places and has diverged
> --------------------------------------------------------
>
>                 Key: PDFBOX-1684
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1684
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.0.0
>         Environment: Win 8, maven 3.0.5, svn 1.7.8 (r1419691), javac 1.7.0_25
>            Reporter: Fred Hansen
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> Versions of DateConverter,java are in three (3) packages: jempbox.impl, 
> pdfbox.util, and xmpbox. They have diverged as updates have been made to one 
> or the other. 
> Date Converter is used in these modules:
>     jempbox.xmp.ResourceEvent.java
>     jempbox.xmp.XMPSchema.java
>     pdfbox.cos.COSDictionary.java
>     pdfbox.pdmodel.fdf.FDFAnnotation.java
>     preflight.metadata.SynchronizedMetaDataValidation.java
>     xmpbox.type.DateType.java
> The smallest library is xmpbox, so let's consider it as a home for 
> DateConverter. Preflight already imports xmpbox. Pdfbox requires jempbox, so 
> importing xmpbox into jempbox will satisfy both.  Since xmpbox defines some 
> xmp features, it seems likely that jempbox could take further advantage of 
> xmpbox.
> { incorrect: Conclusion and recommendation:  have a single copy of 
> DateConverter in xmpbox. }
> Conclusion: create another top-level pdfbox package for DateConverter and 
> other utilities that do not depend on pdfbox classes.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to