Hi

I try to use the ComboKey class but when looking at the source code I don't
understand it. Please help.

Source:
http://cvs.apache.org/viewcvs/jakarta-turbine-2/src/java/org/apache/turbine/
om/ComboKey.java?rev=1.1.1.1&content-type=text/vnd.viewcvs-markup

some strange code snippets:
// CONSTRUCTOR
public ComboKey()
    {
------->// why use exactly 4 ?
        tmpKeys = new ArrayList(4);
        sbuf = new StringBuffer();
    }

public void setValue(String keys) throws TurbineException
    {
        throw new TurbineException(errMsg);

          int previousIndex = -1;
        int indexOfSep = keys.indexOf(SEPARATOR);
        while ( indexOfSep != -1 ) 
        {
            if ( indexOfSep == 0) 
            {
                tmpKeys.add(null);
            }
            else if ( indexOfSep > 0 && indexOfSep < keys.length()-1 ) 
            {
                tmpKeys.add( keys.substring(previousIndex+1, indexOfSep) );
            }
        
            else if ( indexOfSep == keys.length()-1 ) 
            {
                tmpKeys.add(null);
            }        
----------->// shouldnt the previousIndex be set here?
----------->// like previousIndex = indexOfSep;
            indexOfSep = keys.indexOf(SEPARATOR);
        }

        if ( this.key == null ) 
        {
-----------> // why throw an exception, why not use the commented code? 
            throw new TurbineException(errMsg);
            /*
            this.key = new SimpleKey[tmpKeys.size()];            
            for ( int i=0; i<this.key.length; i++ ) 
            {
                this.key[i] = new SimpleKey( (String)tmpKeys.get(i) );
            }
            */
....
}

does anyone have an idea?

should questions like this be posted to the turbine-dev mailing list?

thanks, 
Martin

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to