james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgoldst...@apache.org
Subject cvs commit: jakarta-james/src/java/org/apache/james/util SqlResources.java
Date Wed, 07 Aug 2002 23:23:37 GMT
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:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message