Skip to content

Commit 14f6f47

Browse files
committed
PDFBOX-6055: catch and rethrow NoSuchElementException, as suggested by Tim Allison
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928067 13f79535-47bb-0310-9956-ffa450edef68
1 parent 88086f5 commit 14f6f47

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

fontbox/src/main/java/org/apache/fontbox/afm/AFMParser.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.IOException;
2020
import java.io.InputStream;
2121
import java.nio.charset.StandardCharsets;
22+
import java.util.NoSuchElementException;
2223
import java.util.StringTokenizer;
2324

2425
import org.apache.fontbox.util.BoundingBox;
@@ -308,7 +309,7 @@ public AFMParser( InputStream in )
308309
*/
309310
public FontMetrics parse() throws IOException
310311
{
311-
return parseFontMetric(false);
312+
return parse(false);
312313
}
313314

314315
/**
@@ -322,8 +323,16 @@ public FontMetrics parse() throws IOException
322323
*/
323324
public FontMetrics parse(boolean reducedDataset) throws IOException
324325
{
325-
return parseFontMetric(reducedDataset);
326+
try
327+
{
328+
return parseFontMetric(reducedDataset);
329+
}
330+
catch (NoSuchElementException ex)
331+
{
332+
throw new IOException(ex);
333+
}
326334
}
335+
327336
/**
328337
* This will parse a font metrics item.
329338
*

0 commit comments

Comments
 (0)