Buggy code:
} else if ( chordFormat . equals ( "3" ) ) { ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$As" , "$Ab" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Ais" , "$A#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$as" , "$Abm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$ais" , "$A#m" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$a" , "$Am" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Bes" , "$A" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Bis" , "$B" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$bes" , "$Am" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$bis" , "$Bm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$B" , "$Bb" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$b" , "$Bbm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Hs" , "$Bb" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$His" , "$C" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$hs" , "$Bbm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$his" , "$Cm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$H" , "$B" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$h" , "$Bm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Ces" , "$B" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Cis" , "$C#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$ces" , "$Bm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$cis" , "$C#m" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$c" , "$Cm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Des" , "$Db" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Dis" , "$D#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$des" , "$Dbm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$dis" , "$D#m" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$d" , "$Dm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Es" , "$Eb" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Eis" , "$F" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$es" , "$Ebm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$eis" , "$Fm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$e" , "$Em" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Fes" , "$E" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Fis" , "$F#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$fes" , "$Em" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$fis" , "$F#m" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$f" , "$Fm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Ges" , "$Gb" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Gis" , "$G#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$ges" , "$Gbm" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$gis" , "$G#m" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$g" , "$Gm" ) ; } <START_BUG> ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$B" , "$C" ) ; <END_BUG> ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Cb" , "$B" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$E#" , "$F" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$Fb" , "$E" ) ; if ( ChordDirectory . chordtoworkon . endsWith ( "maj" ) ) { ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "maj" , "" ) ; } else if ( ChordDirectory . chordtoworkon . endsWith ( "major" ) ) { ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "major" , "" ) ; } ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "min" , "m" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "Ab" , "G#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "Bb" , "A#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "Db" , "C#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "Eb" , "D#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "Gb" , "F#" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "sus4" , "sus" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "sus2" , "2" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "add2" , "2" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "sus9" , "9" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "dim7" , "dim" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "m7//b5" , "m7b5" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "#5" , "aug" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "+" , "aug" ) ; ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "//A#" , "" ) ;

Fix:
ChordDirectory . chordtoworkon = ChordDirectory . chordtoworkon . replace ( "$B#" , "$C" ) ;