libbluray | branch: master | hpi1 <[email protected]> | Sun Nov 23 14:32:42 2014 +0200| [dd1ce017e14e60888531e107ea85be2a93a07c70] | committer: hpi1
FontFactory: fix exceptions to match GEM specification > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=dd1ce017e14e60888531e107ea85be2a93a07c70 --- src/libbluray/bdj/java/org/dvb/ui/FontFactory.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java b/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java index 94fa2ef..426c065 100644 --- a/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java +++ b/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java @@ -21,7 +21,6 @@ package org.dvb.ui; import java.awt.Font; -import java.awt.FontFormatException; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; @@ -79,11 +78,11 @@ public class FontFactory { logger.error("didn't load any fonts !"); throw ex; } - } catch (FontFormatException ex) { + } catch (java.awt.FontFormatException ex) { logger.error("Failed reading font " + data.getName() + " from " + data.getFileName() + ": " + ex); if (i == fontIndexData.length - 1 && fonts.size() < 1) { logger.error("didn't load any fonts !"); - throw ex; + throw new FontFormatException(); } } } @@ -111,9 +110,9 @@ public class FontFactory { } catch (IOException ex) { logger.error("Failed reading font from " + u.getPath() + ": " + ex); throw ex; - } catch (FontFormatException ex) { + } catch (java.awt.FontFormatException ex) { logger.error("Failed reading font from " + u.getPath() + ": " + ex); - throw ex; + throw new FontFormatException(); } finally { if (inStream != null) { inStream.close(); @@ -136,6 +135,10 @@ public class FontFactory { throws FontNotAvailableException, FontFormatException, IOException { logger.info("Creating font: " + name + " " + style + " " + size); + if (style < 0 || size <= 0 || (style & ~3) != 0) { + throw new IllegalArgumentException(); + } + /* Factory created only for single font ? */ if (urlFont != null) { if (name.equals(urlFont.getName()) && style == urlFont.getStyle()) { _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
