tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Allison (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (TIKA-1233) PDFBox can throw StringIndexOutOfBoundsException on some dates
Date Mon, 10 Feb 2014 01:09:19 GMT

     [ https://issues.apache.org/jira/browse/TIKA-1233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tim Allison updated TIKA-1233:
------------------------------

    Description: 
PDFBOX's date parser can throw a StringIndexOutOfBoundsException if a date string for parsing
is empty or contains only spaces.  A few of my test pdfs have this "feature."

Until PDFBOX-1803 is resolved, we can add an extra catch to prevent this from causing problems
in TIKA

{noformat}
@@ -171,6 +171,9 @@
             addMetadata(metadata, TikaCoreProperties.CREATED, info.getCreationDate());
         } catch (IOException e) {
             // Invalid date format, just ignore
+        } catch (StringIndexOutOfBoundsException e){
+            //remove after PDFBOX-1883 is fixed
+            // Invalid date format, just ignore
         }
         try {
             Calendar modified = info.getModificationDate();
@@ -178,6 +181,9 @@
             addMetadata(metadata, TikaCoreProperties.MODIFIED, modified);
         } catch (IOException e) {
             // Invalid date format, just ignore
+        } catch (StringIndexOutOfBoundsException e){
+            //remove after PDFBOX-1883 is fixed
+            // Invalid date format, just ignore
         }

{noformat}


  was:
PDFBOX's date parser can throw a StringIndexOutOfBoundsException if a date string for parsing
is empty or contains only spaces.  A few of my test pdfs have this "feature."

I've raised PDFBOX-1883.  Until that is resolved, we can add an extra catch to prevent this
from causing problems in TIKA

{noformat}
@@ -171,6 +171,9 @@
             addMetadata(metadata, TikaCoreProperties.CREATED, info.getCreationDate());
         } catch (IOException e) {
             // Invalid date format, just ignore
+        } catch (StringIndexOutOfBoundsException e){
+            //remove after PDFBOX-1883 is fixed
+            // Invalid date format, just ignore
         }
         try {
             Calendar modified = info.getModificationDate();
@@ -178,6 +181,9 @@
             addMetadata(metadata, TikaCoreProperties.MODIFIED, modified);
         } catch (IOException e) {
             // Invalid date format, just ignore
+        } catch (StringIndexOutOfBoundsException e){
+            //remove after PDFBOX-1883 is fixed
+            // Invalid date format, just ignore
         }

{noformat}

I'd commit now, but I don't want to interfere with cutting of 1.5.  Let me know if I should
commit, or please do it for me if appropriate.


> PDFBox can throw StringIndexOutOfBoundsException on some dates
> --------------------------------------------------------------
>
>                 Key: TIKA-1233
>                 URL: https://issues.apache.org/jira/browse/TIKA-1233
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.5
>            Reporter: Tim Allison
>            Priority: Trivial
>              Labels: easyfix
>             Fix For: 1.6
>
>
> PDFBOX's date parser can throw a StringIndexOutOfBoundsException if a date string for
parsing is empty or contains only spaces.  A few of my test pdfs have this "feature."
> Until PDFBOX-1803 is resolved, we can add an extra catch to prevent this from causing
problems in TIKA
> {noformat}
> @@ -171,6 +171,9 @@
>              addMetadata(metadata, TikaCoreProperties.CREATED, info.getCreationDate());
>          } catch (IOException e) {
>              // Invalid date format, just ignore
> +        } catch (StringIndexOutOfBoundsException e){
> +            //remove after PDFBOX-1883 is fixed
> +            // Invalid date format, just ignore
>          }
>          try {
>              Calendar modified = info.getModificationDate();
> @@ -178,6 +181,9 @@
>              addMetadata(metadata, TikaCoreProperties.MODIFIED, modified);
>          } catch (IOException e) {
>              // Invalid date format, just ignore
> +        } catch (StringIndexOutOfBoundsException e){
> +            //remove after PDFBOX-1883 is fixed
> +            // Invalid date format, just ignore
>          }
> {noformat}



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

Mime
View raw message