< prev index next >

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

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

@@ -398,14 +398,12 @@
         if (subtableFormat < 8) {
             subtableLength = buffer.getChar(offset+2);
         } else {
             subtableLength = buffer.getInt(offset+4) & INTMASK;
         }
-        if (offset+subtableLength > buffer.capacity()) {
-            if (FontUtilities.isLogging()) {
-                FontUtilities.getLogger().warning("Cmap subtable overflows buffer.");
-            }
+        if (FontUtilities.isLogging() && offset+subtableLength > buffer.capacity()) {
+            FontUtilities.logWarning("Cmap subtable overflows buffer.");
         }
         switch (subtableFormat) {
         case 0:  return new CMapFormat0(buffer, offset);
         case 2:  return new CMapFormat2(buffer, offset, xlat);
         case 4:  return new CMapFormat4(buffer, offset, xlat);

@@ -420,15 +418,12 @@
 
     private void createUVS(ByteBuffer buffer, int offset) {
         int subtableFormat = buffer.getChar(offset);
         if (subtableFormat == 14) {
             long subtableLength = buffer.getInt(offset + 2) & INTMASK;
-            if (offset + subtableLength > buffer.capacity()) {
-                if (FontUtilities.isLogging()) {
-                    FontUtilities.getLogger()
-                            .warning("Cmap UVS subtable overflows buffer.");
-                }
+            if (FontUtilities.isLogging() && offset + subtableLength > buffer.capacity()) {
+                FontUtilities.logWarning("Cmap UVS subtable overflows buffer.");
             }
             try {
                 this.uvs = new UVS(buffer, offset);
             } catch (Throwable t) {
                 t.printStackTrace();
< prev index next >