You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2015/07/09 20:37:32 UTC

svn commit: r1690138 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java

Author: adelmelle
Date: Thu Jul  9 18:37:31 2015
New Revision: 1690138

URL: http://svn.apache.org/r1690138
Log:
Minor tweak: avoid using standard toString() for detailed diagnostics purposes

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java?rev=1690138&r1=1690137&r2=1690138&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java Thu Jul  9 18:37:31 2015
@@ -644,14 +644,6 @@ public class FontInfo {
      * Diagnostic method for logging all registered fonts to System.out.
      */
     public void dumpAllTripletsToSystemOut() {
-        System.out.print(toString());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
         SortedSet<String> entries = new TreeSet<String>();
         for (FontTriplet triplet : this.triplets.keySet()) {
             String key = getInternalFontKey(triplet);
@@ -662,6 +654,6 @@ public class FontInfo {
         for (String str : entries) {
             stringBuffer.append(str);
         }
-        return stringBuffer.toString();
+        System.out.println(stringBuffer.toString());
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: svn commit: r1690138 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java

Posted by Andreas Delmelle <an...@telenet.be>.
> On 09 Jul 2015, at 20:37, adelmelle@apache.org wrote:
> 
> Author: adelmelle
> Date: Thu Jul  9 18:37:31 2015
> New Revision: 1690138
> 
> URL: http://svn.apache.org/r1690138
> Log:
> Minor tweak: avoid using standard toString() for detailed diagnostics purposes

Some background: 
The issues related to fonts that have been reported led me to try a debug session. 
Placing a breakpoint anywhere within FontInfo causes an issue in case font auto-detection is enabled, due to the fact that my IDE (IDEA) tries to call toString() to provide more info about the 'this' reference within that context. This triggers an iteration over ALL cached font triplets, which takes quite some time if you have a significant amount of fonts installed. 
Since the dumpAllTriplets...() method was the only one using FontInfo.toString() directly, it seemed like the appropriate solution was just to move that logic from the latter into the former method.

In general, I think toString() overrides should always be kept as concise and lightweight as possible. It is not the appropriate method to generate trace info, as it is so standard and publicly visible that it is difficult to predict how (often) external tools are going to be using and calling it.

 
KR

Andreas