JENA-1247: Create debug string safely.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ddcd45c8
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ddcd45c8
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ddcd45c8

Branch: refs/heads/master
Commit: ddcd45c8e9285c08aadee2da006e1c3fe050b315
Parents: be13685
Author: Andy Seaborne <a...@apache.org>
Authored: Tue Oct 18 09:51:19 2016 +0100
Committer: Andy Seaborne <a...@apache.org>
Committed: Tue Oct 18 09:51:19 2016 +0100

----------------------------------------------------------------------
 .../ReorderTransformationSubstitution.java      | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/ddcd45c8/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/reorder/ReorderTransformationSubstitution.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/reorder/ReorderTransformationSubstitution.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/reorder/ReorderTransformationSubstitution.java
index d4caa80..1f74c9c 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/reorder/ReorderTransformationSubstitution.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/reorder/ReorderTransformationSubstitution.java
@@ -42,7 +42,9 @@ import org.slf4j.LoggerFactory ;
 public abstract class ReorderTransformationSubstitution implements 
ReorderTransformation
 {
     static public final Logger log = 
LoggerFactory.getLogger(ReorderTransformationSubstitution.class) ;
-    private final boolean DEBUG = log.isDebugEnabled() ;  
+    static private final boolean DEBUG = false ;  
+    
+    public ReorderTransformationSubstitution() {}
     
     @Override
     public BasicPattern reorder(BasicPattern pattern)
@@ -75,6 +77,15 @@ public abstract class ReorderTransformationSubstitution 
implements ReorderTransf
         return components ;
     }
 
+    private AccString<PatternTriple> formatter() { 
+        return new AccString<PatternTriple>() { 
+            @Override
+            protected String toString(PatternTriple pt) {
+                return "(" + printAbbrev(pt.toString()) + ")" ;
+            }
+        } ;
+    }
+    
     protected ReorderProc reorder(List<Triple> triples, List<PatternTriple> 
components)
     {
         int N = components.size() ;
@@ -82,7 +93,7 @@ public abstract class ReorderTransformationSubstitution 
implements ReorderTransf
         int indexes[] = new int[N] ;
 
         if ( DEBUG )
-            log.debug("Reorder: "+Iter.asString(components, formatter)) ;
+            log.debug("Reorder: "+Iter.asString(components, formatter())) ;
         
         int idx = 0 ;
         for ( ; idx < numReorder ; idx++ )
@@ -289,12 +300,4 @@ public abstract class ReorderTransformationSubstitution 
implements ReorderTransf
         if ( var.equals(elt.object.getNode()) )
             elt.object = Item.createNode(value) ;
     }
-    
-    private AccString<PatternTriple> formatter = 
-        new AccString<PatternTriple>() { 
-            @Override
-            protected String toString(PatternTriple pt) {
-                return "(" + printAbbrev(pt.toString()) + ")" ;
-        }
-    } ;
 }

Reply via email to