I discovered that the doReplace function in my utilities library had a small bug, where if the to string contained the from string it would loop forever. I also put in a guard variable to stop it doing more than a certain number of replacements, not sure about this when you’re not debugging. Definitely thinking moving to 1.4 and using the replace functions provided might have helped, but on the other hand this works with most current VMs. The changed version of the function is below, the whole utilities package (which has been debugged some more) is here:

  /**
   * Does replace in source string of all occurrences of <i>from</i> with <i>to</i>,
   * Used by the {@link #replaceStrings replaceStrings} function to do the work
   * @param source string to do substitution on
   * @param from string to replace
   * @param to string to insert
   * @param replaceAll replace all occurrences
   * @return source string with all or one occurences of from replaced with to
   */
  public static String doReplace
    ( final String source
    , final String from
    , final String to
    , final boolean replaceAll
    )
  {
    String retString = source ;
    int start = -1 ;
    final int MAX_REPLACES = 50 ;
    int iteration = 0 ;
    int offset = 0;
    while ( ( start = retString.indexOf(from, start + offset) )  != -1 )
    {
      retString = retString.substring(0,start) + to + retString.substring(start+from.length()) ;
      System.out.println(retString);
      iteration ++ ;
      offset = to.length() ;
      if ( (! replaceAll ) || iteration > MAX_REPLACES) break ;
    }
    return retString ;
  }