mirror of https://github.com/apache/poi.git
[github-578] allow any non-fatal exception when setting up fonts to indicate that the fonts are probably not installed. This closes #578
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b7f10e657
commit
274a7e24f3
|
@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.RichTextString;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.util.ExceptionUtil;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,12 +352,13 @@ public class SheetUtil {
|
||||||
try {
|
try {
|
||||||
TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext);
|
TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext);
|
||||||
return layout.getAdvance();
|
return layout.getAdvance();
|
||||||
} catch (UnsatisfiedLinkError | NoClassDefFoundError | InternalError e) {
|
} catch (Throwable t) {
|
||||||
if (ignoreMissingFontSystem) {
|
// fatal exceptions will always be rethrown
|
||||||
|
if (!ExceptionUtil.isFatal(t) && ignoreMissingFontSystem) {
|
||||||
return DEFAULT_CHAR_WIDTH;
|
return DEFAULT_CHAR_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue