public static String escapeColonInString(String str){
  if (str != null) {
    if (str.indexOf(":") >= 0) {
      str=str.replaceAll(":","&#58;");
    }
  }
  return str;
}

public static String escapeColonInString ( String str ) { if ( str != null ) { if ( str . indexOf ( ":" ) >= 0 ) { str = str . replaceAll ( ":" , "&#58;" ) ; } } return str ; }
escapes colons ( " : " ) in the supplied string to " & # 58 ; " . useful mostly for the mbean names , as jdmk really doesn ' t like them .
