Changeset 18921

Show
Ignore:
Timestamp:
05/30/06 16:02:26 (3 years ago)
Author:
dshipton
Message:

Fixes a string indexing bug where multiple environment variables could not be expanded.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/EnvironmentServiceImpl.java

    r18824 r18921  
    168168      while ( (index = new_str.indexOf("$")) != -1 ) 
    169169      { 
    170          if ( inputStr.substring(index, index + 2).equals("$(") ) 
    171          { 
    172             end_index = inputStr.indexOf(")"); 
    173          } 
    174          else if ( inputStr.substring(index, index + 2).equals("${") ) 
    175          { 
    176             end_index = inputStr.indexOf("}"); 
     170         if ( new_str.substring(index, index + 2).equals("$(") ) 
     171         { 
     172            end_index = new_str.indexOf(")"); 
     173         } 
     174         else if ( new_str.substring(index, index + 2).equals("${") ) 
     175         { 
     176            end_index = new_str.indexOf("}"); 
    177177         } 
    178178         else 
     
    181181         } 
    182182 
    183          env_var  = inputStr.substring(index + 2, end_index); 
     183         env_var  = new_str.substring(index + 2, end_index); 
    184184 
    185185         // Treat $HOME as a special case since we can actually get its value 
     
    196196         if ( value != null ) 
    197197         { 
    198             new_str = inputStr.substring(0, index) + value + 
    199                       inputStr.substring(end_index + 1); 
     198            new_str = new_str.substring(0, index) + value + 
     199                      new_str.substring(end_index + 1); 
    200200         } 
    201201         else 
     
    203203            System.err.println("WARNING: Environment variable " + env_var + 
    204204                               " has no value"); 
    205             new_str = inputStr.substring(0, index) + 
    206                       inputStr.substring(end_index + 1); 
     205            new_str = new_str.substring(0, index) + 
     206                      new_str.substring(end_index + 1); 
    207207         } 
    208208      } 
  • juggler/trunk/modules/tweek/java/org/vrjuggler/tweek/beans/BeanAttributes.java

    r18824 r18921  
    2525 *************** <auto-copyright.pl END do not edit this line> ***************/ 
    2626package org.vrjuggler.tweek.beans; 
     27 
     28import org.vrjuggler.tweek.services.*; 
    2729 
    2830import java.util.ArrayList; 
     
    212214   protected static String expandEnvVars (String name) 
    213215   { 
     216      EnvironmentService service = new EnvironmentServiceProxy(); 
     217      return service.expandEnvVars(name); 
     218/* 
    214219      String new_name = name; 
    215220      int index, end_index; 
     
    248253 
    249254      return new_name; 
     255      */ 
    250256   } 
    251257