You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by dl...@apache.org on 2001/08/21 02:43:08 UTC

cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model GlobalNameGenerator.java

dlr         01/08/20 17:43:08

  Modified:    src/java/org/apache/torque/engine/database/model
                        GlobalNameGenerator.java
  Log:
  * Add JavaDoc.
  
  * Lessened maxBodyLength to account for element separator character.
  
  * StringBuffer's replace() with more characters than the region to
  replace apparently lengthens the buffer.  In this case, that isn't
  what we want.  Do a substring() and append() that value instead.
  
  Revision  Changes    Path
  1.2       +8 -5      jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/GlobalNameGenerator.java
  
  Index: GlobalNameGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/GlobalNameGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- GlobalNameGenerator.java	2001/08/21 00:04:15	1.1
  +++ GlobalNameGenerator.java	2001/08/21 00:43:08	1.2
  @@ -66,11 +66,14 @@
    * configured <code>DB</code> adapter.
    *
    * @author <a href="mailto:dlr@finemaltcoding.com>Daniel Rall</a>
  - * @version $Id: GlobalNameGenerator.java,v 1.1 2001/08/21 00:04:15 dlr Exp $
  + * @version $Id: GlobalNameGenerator.java,v 1.2 2001/08/21 00:43:08 dlr Exp $
    */
   public class GlobalNameGenerator implements NameGenerator
   {
  -    private static final boolean DEBUG = true;
  +    /**
  +     * Conditional compilation flag.
  +     */
  +    private static final boolean DEBUG = false;
   
       /**
        * First element of <code>inputs</code> should be {@link
  @@ -109,7 +112,7 @@
           try
           {
               maxBodyLength = (Torque.getDB().getMaxColumnNameLength() -
  -                             globalNameType.length());
  +                             globalNameType.length() - 1);
           }
           catch (Exception e)
           {
  @@ -139,8 +142,8 @@
           {
               // Remove one character from trimmable section to make
               // room for value to add to ensure uniqueness.
  -            buf.setLength(--maxBodyLength);
  -            buf.replace(0, maxBodyLength, trimmable);
  +            buf.setLength(0);
  +            buf.append(trimmable.substring(0, --maxBodyLength));
               buf.append(STD_SEPARATOR_CHAR).append(globalNameType);
   
               String baseName = buf.toString();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org