You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by pg...@apache.org on 2002/08/08 01:23:37 UTC
cvs commit: jakarta-james/src/java/org/apache/james/util SqlResources.java
pgoldstein 2002/08/07 16:23:37
Modified: src/java/org/apache/james/util SqlResources.java
Log:
Part of the String=>StringBuffer changes. Includes some additional
commenting, formatting fixes, and wrapping of logging calls in log
level checks. Also converted equalsIgnoreCase paradigm as discussed on
mailing list. Locale issue for both toUpperCase() and toLowerCase() was
addressed as well.
Revision Changes Path
1.3 +25 -10 jakarta-james/src/java/org/apache/james/util/SqlResources.java
Index: SqlResources.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/util/SqlResources.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SqlResources.java 18 Jan 2002 02:48:39 -0000 1.2
+++ SqlResources.java 7 Aug 2002 23:23:37 -0000 1.3
@@ -80,9 +80,13 @@
}
if ( sectionElement == null ) {
- throw new RuntimeException("Error loading sql definition file. " +
- "The element named \'" + sqlDefsSection +
- "\' does not exist.");
+ StringBuffer exceptionBuffer =
+ new StringBuffer(64)
+ .append("Error loading sql definition file. ")
+ .append("The element named \'")
+ .append(sqlDefsSection)
+ .append("\' does not exist.");
+ throw new RuntimeException(exceptionBuffer.toString());
}
// Get parameters defined within the file as defaults,
@@ -146,8 +150,12 @@
String paramName = (String)paramNames.next();
String paramValue = (String)parameters.get(paramName);
- String replace = "${" + paramName + "}";
- sqlString = substituteSubString(sqlString, replace, paramValue);
+ StringBuffer replaceBuffer =
+ new StringBuffer(64)
+ .append("${")
+ .append(paramName)
+ .append("}");
+ sqlString = substituteSubString(sqlString, replaceBuffer.toString(), paramValue);
}
// Add to the sqlMap - either the "default" or the "product" map
@@ -179,12 +187,15 @@
// Get the values for this matcher element.
Element dbMatcher = (Element)dbMatchers.item(i);
String dbMatchName = dbMatcher.getAttribute("db");
- String dbProductPattern = dbMatcher.getAttribute("databaseProductName");
- dbProductPattern = "/" + dbProductPattern + "/i";
+ StringBuffer dbProductPatternBuffer =
+ new StringBuffer(64)
+ .append("/")
+ .append(dbMatcher.getAttribute("databaseProductName"))
+ .append("/i");
// If the connection databaseProcuctName matches the pattern,
// use the match name from this matcher.
- if ( m_perl5Util.match(dbProductPattern, dbProductName) ) {
+ if ( m_perl5Util.match(dbProductPatternBuffer.toString(), dbProductName) ) {
return dbMatchName;
}
}
@@ -247,8 +258,12 @@
String sql = getSqlString(name);
if ( sql == null ) {
- throw new RuntimeException("Required SQL resource: '" + name +
- "' was not found.");
+ StringBuffer exceptionBuffer =
+ new StringBuffer(64)
+ .append("Required SQL resource: '")
+ .append(name)
+ .append("' was not found.");
+ throw new RuntimeException(exceptionBuffer.toString());
}
return sql;
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>