< prev index next >

src/java.desktop/share/classes/sun/font/TrueTypeFont.java

Print this page
rev 60064 : 8248802: Add log helper methods to FontUtilities.java

*** 242,252 **** */ private synchronized FileChannel open(boolean usePool) throws FontFormatException { if (disposerRecord.channel == null) { if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().info("open TTF: " + platName); } try { RandomAccessFile raf = AccessController.doPrivileged( new PrivilegedExceptionAction<RandomAccessFile>() { public RandomAccessFile run() throws FileNotFoundException { --- 242,252 ---- */ private synchronized FileChannel open(boolean usePool) throws FontFormatException { if (disposerRecord.channel == null) { if (FontUtilities.isLogging()) { ! FontUtilities.logInfo("open TTF: " + platName); } try { RandomAccessFile raf = AccessController.doPrivileged( new PrivilegedExceptionAction<RandomAccessFile>() { public RandomAccessFile run() throws FileNotFoundException {
*** 310,320 **** */ if (FontUtilities.isLogging()) { String msg = "Read offset is " + offset + " file size is " + fileSize+ " file is " + platName; ! FontUtilities.getLogger().severe(msg); } return -1; } else { length = fileSize - offset; } --- 310,320 ---- */ if (FontUtilities.isLogging()) { String msg = "Read offset is " + offset + " file size is " + fileSize+ " file is " + platName; ! FontUtilities.logSevere(msg); } return -1; } else { length = fileSize - offset; }
*** 329,339 **** if (currSize != fileSize) { msg += " File size was " + fileSize + " and now is " + currSize; } if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().severe(msg); } // We could still flip() the buffer here because // it's possible that we did read some data in // an earlier loop, and we probably should // return that to the caller. Although if --- 329,339 ---- if (currSize != fileSize) { msg += " File size was " + fileSize + " and now is " + currSize; } if (FontUtilities.isLogging()) { ! FontUtilities.logSevere(msg); } // We could still flip() the buffer here because // it's possible that we did read some data in // an earlier loop, and we probably should // return that to the caller. Although if
*** 344,356 **** // but is meant to allow cases where enough // data was read to probably continue. if (bread > length/2 || bread > 16384) { buffer.flip(); if (FontUtilities.isLogging()) { ! msg = "Returning " + bread + ! " bytes instead of " + length; ! FontUtilities.getLogger().severe(msg); } } else { bread = -1; } throw new IOException(msg); --- 344,355 ---- // but is meant to allow cases where enough // data was read to probably continue. if (bread > length/2 || bread > 16384) { buffer.flip(); if (FontUtilities.isLogging()) { ! msg = "Returning " + bread + " bytes instead of " + length; ! FontUtilities.logSevere(msg); } } else { bread = -1; } throw new IOException(msg);
*** 362,373 **** bread = length; } } } catch (FontFormatException e) { if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().severe( ! "While reading " + platName, e); } bread = -1; // signal EOF deregisterFontAndClearStrikeCache(); } catch (ClosedChannelException e) { /* NIO I/O is interruptible, recurse to retry operation. --- 361,371 ---- bread = length; } } } catch (FontFormatException e) { if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().severe("While reading " + platName, e); } bread = -1; // signal EOF deregisterFontAndClearStrikeCache(); } catch (ClosedChannelException e) { /* NIO I/O is interruptible, recurse to retry operation.
*** 383,394 **** * Other than an attempt to read past the end of the file it * seems unlikely this would occur as problems opening the * file are handled as a FontFormatException. */ if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().severe( ! "While reading " + platName, e); } if (bread == 0) { bread = -1; // signal EOF deregisterFontAndClearStrikeCache(); } --- 381,391 ---- * Other than an attempt to read past the end of the file it * seems unlikely this would occur as problems opening the * file are handled as a FontFormatException. */ if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().severe("While reading " + platName, e); } if (bread == 0) { bread = -1; // signal EOF deregisterFontAndClearStrikeCache(); }
*** 521,531 **** throw new FontFormatException("missing hhea table"); } initNames(); } catch (Exception e) { if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().severe(e.toString()); } if (e instanceof FontFormatException) { throw (FontFormatException)e; } else { throw new FontFormatException(e.toString()); --- 518,528 ---- throw new FontFormatException("missing hhea table"); } initNames(); } catch (Exception e) { if (FontUtilities.isLogging()) { ! FontUtilities.logSevere(e.toString()); } if (e instanceof FontFormatException) { throw (FontFormatException)e; } else { throw new FontFormatException(e.toString());
*** 1071,1081 **** try { return new String(bytes, 0, len, charset); } catch (UnsupportedEncodingException e) { if (FontUtilities.isLogging()) { ! FontUtilities.getLogger().warning(e + " EncodingID=" + encoding); } return new String(bytes, 0, len); } catch (Throwable t) { return null; } --- 1068,1078 ---- try { return new String(bytes, 0, len, charset); } catch (UnsupportedEncodingException e) { if (FontUtilities.isLogging()) { ! FontUtilities.logWarning(e + " EncodingID=" + encoding); } return new String(bytes, 0, len); } catch (Throwable t) { return null; }
< prev index next >