Skip to content

Commit d7ef0dd

Browse files
committed
PDFBOX-6119: remove unused
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930465 13f79535-47bb-0310-9956-ffa450edef68
1 parent a2a6adb commit d7ef0dd

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@
2222
package org.apache.xmpbox;
2323

2424
import java.io.IOException;
25-
import java.text.ParseException;
26-
import java.text.SimpleDateFormat;
2725
import java.time.LocalDateTime;
2826
import java.time.ZoneId;
2927
import java.time.ZonedDateTime;
3028
import java.time.format.DateTimeFormatter;
3129
import java.time.format.DateTimeFormatterBuilder;
3230
import java.time.format.DateTimeParseException;
3331
import java.util.Calendar;
34-
import java.util.Date;
3532
import java.util.GregorianCalendar;
3633
import java.util.Locale;
3734
import java.util.SimpleTimeZone;
@@ -58,19 +55,6 @@ public final class DateConverter
5855
.append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).parseLenient().appendOffset("+HH:MM", "Z").parseStrict()
5956
.toFormatter();
6057

61-
// The Date format is supposed to be the PDF_DATE_FORMAT, but not all PDF
62-
// documents
63-
// will use that date, so I have added a couple other potential formats
64-
// to try if the original one does not work.
65-
private static final SimpleDateFormat[] POTENTIAL_FORMATS = {
66-
new SimpleDateFormat("EEEE, dd MMM yyyy hh:mm:ss a"),
67-
new SimpleDateFormat("EEEE, MMM dd, yyyy hh:mm:ss a"),
68-
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"),
69-
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"),
70-
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"),
71-
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S")
72-
};
73-
7458
/**
7559
* According to check-style, Utility classes should not have a public or default constructor.
7660
*/
@@ -202,32 +186,7 @@ public static Calendar toCalendar(String date) throws IOException
202186
}
203187
catch (NumberFormatException e)
204188
{
205-
206-
// remove the arbitrary : in the timezone. SimpleDateFormat can't handle it
207-
if (date.charAt(date.length() - 3) == ':' &&
208-
(date.charAt(date.length() - 6) == '+' || date.charAt(date.length() - 6) == '-'))
209-
{
210-
// that's a timezone string, remove the :
211-
date = date.substring(0, date.length() - 3) + date.substring(date.length() - 2);
212-
}
213-
for (int i = 0; (retval == null) && (i < POTENTIAL_FORMATS.length); i++)
214-
{
215-
try
216-
{
217-
Date utilDate = POTENTIAL_FORMATS[i].parse(date);
218-
retval = new GregorianCalendar();
219-
retval.setTime(utilDate);
220-
}
221-
catch (ParseException pe)
222-
{
223-
// ignore and move to next potential format
224-
}
225-
}
226-
if (retval == null)
227-
{
228-
// we didn't find a valid date format so throw an exception
229-
throw new IOException("Error converting date:" + date, e);
230-
}
189+
throw new IOException("Error converting date:" + date, e);
231190
}
232191
}
233192
return retval;

0 commit comments

Comments
 (0)