/** * In a string, replace block comment marks with /++ .. ++/. * * @param sql the string * @return the resulting string */ public static String quoteRemarkSQL(String sql) { sql = replaceAll(sql, "*/", "++/"); return replaceAll(sql, "/*", "/++"); }
/** * Set the qualified method name after removing whitespace. * * @param method the qualified method name */ public void setJavaClassMethod(String method) { this.javaClassMethod = StringUtils.replaceAll(method, " ", ""); }
/** * Escape table or schema patterns used for DatabaseMetaData functions. * * @param pattern the pattern * @return the escaped pattern */ public static String escapeMetaDataPattern(String pattern) { if (pattern == null || pattern.length() == 0) { return pattern; } return replaceAll(pattern, "\\", "\\\\"); }
private String[] tokenize() { ArrayList<String> list = New.arrayList(); syntax = StringUtils.replaceAll(syntax, "yyyy-MM-dd", "@ymd@"); syntax = StringUtils.replaceAll(syntax, "hh:mm:ss", "@hms@"); syntax = StringUtils.replaceAll(syntax, "nnnnnnnnn", "@nanos@"); syntax = StringUtils.replaceAll(syntax, "function", "@func@"); syntax = StringUtils.replaceAll(syntax, "0x", "@hexStart@"); syntax = StringUtils.replaceAll(syntax, ",...", "@commaDots@"); syntax = StringUtils.replaceAll(syntax, "...", "@dots@"); syntax = StringUtils.replaceAll(syntax, "||", "@concat@"); syntax = StringUtils.replaceAll(syntax, "a-z|_", "@az_@"); syntax = StringUtils.replaceAll(syntax, "A-Z|_", "@az_@"); syntax = StringUtils.replaceAll(syntax, "A-F", "@af@"); syntax = StringUtils.replaceAll(syntax, "0-9", "@digit@"); syntax = StringUtils.replaceAll(syntax, "'['", "@openBracket@"); syntax = StringUtils.replaceAll(syntax, "']'", "@closeBracket@"); StringTokenizer tokenizer = getTokenizer(syntax); while (tokenizer.hasMoreTokens()) { String s = tokenizer.nextToken(); // avoid duplicate strings s = StringUtils.cache(s); if (s.length() == 1) { if (" \r\n".indexOf(s.charAt(0)) >= 0) { continue; } } list.add(s); } return list.toArray(new String[0]); }
private static void handleSyntaxError(String output) { boolean syntaxError = false; final BufferedReader reader = new BufferedReader(new StringReader(output)); try { for (String line; (line = reader.readLine()) != null;) { if (line.endsWith("warning")) { // ignore summary line } else if (line.startsWith("Note:") || line.startsWith("warning:")) { // just a warning (e.g. unchecked or unsafe operations) } else { syntaxError = true; break; } } } catch (IOException ignored) { // exception ignored } if (syntaxError) { output = StringUtils.replaceAll(output, COMPILE_DIR, ""); throw DbException.get(ErrorCode.SYNTAX_ERROR_1, output); } }
String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException( "Unexpected output for:\n" + sql.trim() +
stackTrace = linkToSource(stackTrace); stackTrace = StringUtils.replaceAll(stackTrace, "\t", " "); String message = PageParser.escapeHtml(e.getMessage());
String[] args = StringUtils.arraySplit(browser, ',', false); for (int i = 0; i < args.length; i++) { args[i] = StringUtils.replaceAll(args[i], "%url", url);
s = StringUtils.replaceAll(s, "\n", lineSeparatorString);
s2 = ""; result = ValueString.get(StringUtils.replaceAll(s0, s1, s2), database.getMode().treatEmptyStringsAsNull);
/** * Set the qualified method name after removing whitespace. * * @param method the qualified method name */ public void setJavaClassMethod(String method) { this.javaClassMethod = StringUtils.replaceAll(method, " ", ""); }
/** * In a string, replace block comment marks with /++ .. ++/. * * @param sql the string * @return the resulting string */ public static String quoteRemarkSQL(String sql) { sql = replaceAll(sql, "*/", "++/"); return replaceAll(sql, "/*", "/++"); }
/** * In a string, replace block comment marks with /++ .. ++/. * * @param sql the string * @return the resulting string */ public static String quoteRemarkSQL(String sql) { sql = replaceAll(sql, "*/", "++/"); return replaceAll(sql, "/*", "/++"); }
/** * Set the qualified method name after removing whitespace. * * @param method the qualified method name */ public void setJavaClassMethod(String method) { this.javaClassMethod = StringUtils.replaceAll(method, " ", ""); }
text = StringUtils.replaceAll(text, "\\\\", "\\"); read(); r = ValueExpression.get(ValueString.get(text));
/** * Escape table or schema patterns used for DatabaseMetaData functions. * * @param pattern the pattern * @return the escaped pattern */ public static String escapeMetaDataPattern(String pattern) { if (pattern == null || pattern.length() == 0) { return pattern; } return replaceAll(pattern, "\\", "\\\\"); }
/** * Escape table or schema patterns used for DatabaseMetaData functions. * * @param pattern the pattern * @return the escaped pattern */ public static String escapeMetaDataPattern(String pattern) { if (pattern == null || pattern.length() == 0) { return pattern; } return replaceAll(pattern, "\\", "\\\\"); }
private static void handleSyntaxError(String output) { boolean syntaxError = false; final BufferedReader reader = new BufferedReader(new StringReader(output)); try { for (String line; (line = reader.readLine()) != null;) { if (line.startsWith("Note:") || line.startsWith("warning:")) { // just a warning (e.g. unchecked or unsafe operations) } else { syntaxError = true; break; } } } catch (IOException ignored) { // exception ignored } if (syntaxError) { output = StringUtils.replaceAll(output, COMPILE_DIR, ""); throw DbException.get(ErrorCode.SYNTAX_ERROR_1, output); } }
private static void handleSyntaxError(String output) { boolean syntaxError = false; final BufferedReader reader = new BufferedReader(new StringReader(output)); try { for (String line; (line = reader.readLine()) != null;) { if (line.endsWith("warning")) { // ignore summary line } else if (line.startsWith("Note:") || line.startsWith("warning:")) { // just a warning (e.g. unchecked or unsafe operations) } else { syntaxError = true; break; } } } catch (IOException ignored) { // exception ignored } if (syntaxError) { output = StringUtils.replaceAll(output, COMPILE_DIR, ""); throw DbException.get(ErrorCode.SYNTAX_ERROR_1, output); } }
private String getStackTrace(int id, Throwable e, boolean isH2) { try { StringWriter writer = new StringWriter(); e.printStackTrace(new PrintWriter(writer)); String stackTrace = writer.toString(); stackTrace = PageParser.escapeHtml(stackTrace); if (isH2) { stackTrace = linkToSource(stackTrace); } stackTrace = StringUtils.replaceAll(stackTrace, "\t", " "); String message = PageParser.escapeHtml(e.getMessage()); String error = "<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('st" + id + "').style;x.display=x.display==''?'none':'';\">" + message + "</a>"; if (e instanceof SQLException) { SQLException se = (SQLException) e; error += " " + se.getSQLState() + "/" + se.getErrorCode(); if (isH2) { int code = se.getErrorCode(); error += " <a href=\"http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c" + code + "\">(${text.a.help})</a>"; } } error += "<span style=\"display: none;\" id=\"st" + id + "\"><br />" + stackTrace + "</span>"; error = formatAsError(error); return error; } catch (OutOfMemoryError e2) { e.printStackTrace(); return e.toString(); } }