|
18 | 18 |
|
19 | 19 | import java.io.IOException;
|
20 | 20 | import java.io.InputStream;
|
| 21 | +import java.util.ArrayList; |
21 | 22 | import java.util.Collections;
|
22 | 23 | import java.util.List;
|
23 | 24 | import java.util.Set;
|
24 | 25 |
|
25 | 26 | import org.apache.fontbox.afm.AFMParser;
|
26 |
| -import org.apache.fontbox.afm.FontMetric; |
| 27 | +import org.apache.fontbox.afm.FontMetrics; |
27 | 28 | import org.apache.tika.exception.TikaException;
|
28 | 29 | import org.apache.tika.metadata.Metadata;
|
29 | 30 | import org.apache.tika.metadata.Property;
|
@@ -67,16 +68,19 @@ public Set<MediaType> getSupportedTypes( ParseContext context ) {
|
67 | 68 | public void parse(InputStream stream, ContentHandler handler,
|
68 | 69 | Metadata metadata, ParseContext context)
|
69 | 70 | throws IOException, SAXException, TikaException {
|
70 |
| - FontMetric fontMetrics; |
| 71 | + FontMetrics fontMetrics; |
71 | 72 | AFMParser parser = new AFMParser( stream );
|
72 | 73 |
|
73 | 74 | // Have FontBox process the file
|
74 |
| - parser.parse(); |
75 |
| - fontMetrics = parser.getResult(); |
| 75 | + fontMetrics = parser.parse(); |
76 | 76 |
|
77 | 77 | // Get the comments in the file to display in xhtml
|
78 |
| - List<String> comments = fontMetrics.getComments(); |
79 |
| - |
| 78 | + List<String> unModifiableComments = fontMetrics.getComments(); |
| 79 | + //have to copy because we modify list in extractCreationDate |
| 80 | + List<String> comments = new ArrayList<>(); |
| 81 | + for (String comment : unModifiableComments) { |
| 82 | + comments.add(comment); |
| 83 | + } |
80 | 84 | // Get the creation date
|
81 | 85 | extractCreationDate( metadata, comments );
|
82 | 86 |
|
|
0 commit comments