donaldp 02/01/26 03:59:31
Modified:
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer
DefaultObjectConfigurer.java
Log:
Make sure loop counter not misused
Removing a Audit violation
Revision Changes Path
1.5 +16 -8
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java
Index: DefaultObjectConfigurer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultObjectConfigurer.java 22 Jan 2002 11:15:25 -0000 1.4
+++ DefaultObjectConfigurer.java 26 Jan 2002 11:59:31 -0000 1.5
@@ -26,7 +26,7 @@
* of a class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
- * @version $Revision: 1.4 $ $Date: 2002/01/22 11:15:25 $
+ * @version $Revision: 1.5 $ $Date: 2002/01/26 11:59:31 $
*/
public class DefaultObjectConfigurer
implements ObjectConfigurer
@@ -309,7 +309,8 @@
{
// Make sure there are no pending created objects
final DefaultConfigurationState defState =
(DefaultConfigurationState)state;
- for( int i = 0; i < m_allProps.size(); i++ )
+ final int size = m_allProps.size();
+ for( int i = 0; i < size; i++ )
{
if( defState.getCreatedObject( i ) != null )
{
@@ -362,18 +363,25 @@
{
final StringBuffer sb = new StringBuffer( methodName );
sb.delete( 0, prefixLen );
- for( int i = 0; i < sb.length(); i++ )
+
+ //Contains the index that we are up to in string buffer.
+ //May not be equal to i as length of string buffer may change
+ int index = 0;
+
+ final int size = sb.length();
+ for( int i = 0; i < size; i++ )
{
- char ch = sb.charAt( i );
+ char ch = sb.charAt( index );
if( Character.isUpperCase( ch ) )
{
- if( i > 0 )
+ if( index > 0 )
{
- sb.insert( i, '-' );
- i++;
+ sb.insert( index, '-' );
+ index++;
}
- sb.setCharAt( i, Character.toLowerCase( ch ) );
+ sb.setCharAt( index, Character.toLowerCase( ch ) );
}
+ index++;
}
return sb.toString();
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>