db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r808945 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java
Date Fri, 28 Aug 2009 16:30:49 GMT
Author: dag
Date: Fri Aug 28 16:30:49 2009
New Revision: 808945

URL: http://svn.apache.org/viewvc?rev=808945&view=rev
Log:
DERBY-4087 Clean up debug printing of the abstract syntax trees after parsing, binding and
optimization 

Reverting use of class Patter as it is not available in Foundation
1.2, so it cannot be sued in engine code. Originally committed as part
of svn 808523.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java?rev=808945&r1=808944&r2=808945&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java Fri Aug 28
16:30:49 2009
@@ -24,9 +24,6 @@
 import java.util.Locale;
 import java.util.StringTokenizer;
 
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
 /**
 	A set of public static methods for dealing with Strings
 */
@@ -519,43 +516,4 @@
 
         return buffer.toString();
     }
-
-
-	/**
-	 * Utility for formatting which bends a multi-line string into shape for
-	 * outputting it in a context where there is <i>depth</i> tabs. Trailing
-	 * newlines are discarded as well.
-	 * <p>
-	 * Replace     "^[\t]*" with "depth" number of tabs.<br>
-	 * Replace     "\n+$" with "".
-	 * Replace all "\n[\t]*" with "\n" + "depth" number of tabs.<br>
-	 * </p>
-	 * @param formatted string to sanitize
-	 * @param depth the string is to be printed at
-	 */
-	public static String ensureIndent(String formatted, int depth) {
-		StringBuffer buf = new StringBuffer();
-		StringBuffer indent = new StringBuffer();
-
-		while (depth-- > 0) {
-			indent.append("\t");
-		}
-
-
-		Pattern pat_a = Pattern.compile("\\A\\t*");
-		Matcher m_a = pat_a.matcher(formatted);
-
-		formatted = m_a.replaceFirst(indent.toString());
-
-		Pattern pat_b = Pattern.compile("\\n+\\Z");
-		Matcher m_b = pat_b.matcher(formatted);
-		formatted = m_b.replaceFirst("");
-
-		Pattern pat_c = Pattern.compile("\\n\\t*");
-		Matcher m_c = pat_c.matcher(formatted);
-		formatted = m_c.replaceAll("\n" + indent.toString());
-
-
-		return formatted;
-	}
 }



Mime
View raw message