Buggy code:
@ SuppressWarnings ( "serial" ) public class GBATrackerFrame extends JFrame { private static final String APPLICATION_TITLE = "GBA<seq2seq4repair_space>Tracker" ; private static final String FILE_EXTENSION = "gbt" ; private static final String VERSION = "1.1.0" ; private GBATrackerControlPanel controlPanel ; private GBATrackerNoteEditorPanel noteEditorPanel ; private GBATrackerSimulationPanel simulationPanel ; private JLabel tooltipLabel = new JLabel ( "<seq2seq4repair_space>" ) ; private File openFile = null ; private boolean modification = false ; private String songTitle = "untitled" ; private int usageHintNum = 0 ; private static ArrayList < String > usageHints = new ArrayList < > ( ) ; public void displayNextUsageHint ( ) { } private void warningMessage ( String msg ) { } public boolean validateBPM ( ) { } public void loadFile ( ) { } public void saveFile ( ) { } public void saveFileAs ( ) { } public void exportFile ( ) { if ( ! ( validName ( songTitle ) ) ) { warningMessage ( "Song<seq2seq4repair_space>title<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>C<seq2seq4repair_space>identifier" ) ; return ; } if ( ! ( validateBPM ( ) ) ) { warningMessage ( "BPM<seq2seq4repair_space>is<seq2seq4repair_space>invalid;<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>positive<seq2seq4repair_space>number" ) ; return ; } JFileChooser chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; int returnVal = chooser . showSaveDialog ( this ) ; if ( returnVal == ( JFileChooser . APPROVE_OPTION ) ) { File outFileC = new File ( chooser . getSelectedFile ( ) , ( ( songTitle ) + ".c" ) ) ; File outFileH = new File ( chooser . getSelectedFile ( ) , ( ( songTitle ) + ".h" ) ) ; String existFiles = null ; if ( outFileC . exists ( ) ) { if ( outFileH . exists ( ) ) { existFiles = ( ( ( songTitle ) + ".c<seq2seq4repair_space>and<seq2seq4repair_space>" ) + ( songTitle ) ) + ".h" ; } else { existFiles = ( songTitle ) + ".c" ; } } else if ( outFileH . exists ( ) ) { existFiles = ( songTitle ) + ".h" ; } if ( existFiles != null ) { if ( ( JOptionPane . showConfirmDialog ( this , ( ( "File<seq2seq4repair_space>" + existFiles ) + "<seq2seq4repair_space>already<seq2seq4repair_space>exists.<seq2seq4repair_space>Overwrite?" ) , "Overwrite" , JOptionPane . OK_CANCEL_OPTION , JOptionPane . WARNING_MESSAGE ) ) != ( JOptionPane . OK_OPTION ) ) { return ; } } InputStream is = GBATrackerFrame . class . getResourceAsStream ( "res//ExportTemplateC" ) ; Scanner sc = new Scanner ( is , "UTF-8" ) ; sc . useDelimiter ( "\\A" ) ; String textC = sc . next ( ) ; sc . close ( ) ; is = GBATrackerFrame . class . getResourceAsStream ( "res//ExportTemplateH" ) ; sc = new Scanner ( is , "UTF-8" ) ; sc . useDelimiter ( "\\A" ) ; String textH = sc . next ( ) ; sc . close ( ) ; textC = textC . replaceAll ( "\\$SONGTITLE" , songTitle ) ; textC = textC . replaceAll ( "\\$FILENAME" , ( ( openFile ) == null ? "(blank)" : openFile . getName ( ) ) ) ; textC = textC . replaceAll ( "\\$APPTITLE" , GBATrackerFrame . APPLICATION_TITLE ) ; textC = textC . replaceAll ( "\\$DATE" , new Date ( ) . toString ( ) ) ; textC = textC . replaceAll ( "\\$BPM" , noteEditorPanel . getBPM ( ) ) ; textC = textC . replaceAll ( "\\$LENGTH" , ( "" + ( simulationPanel . getDataLength ( ) ) ) ) ; textC = textC . replaceAll ( "\\$NOTEDATA" , ( "" + ( simulationPanel . getNoteData ( ) ) ) ) ; <START_BUG> textC = textC . replaceAll ( "\\$LOOP" , ( "" + ( simulationPanel . getLoop ( ) ) ) ) ; <END_BUG> textC = textC . replaceAll ( "\\$ALLOWLOOPING" , ( noteEditorPanel . getLooping ( ) ? "1" : "0" ) ) ; textH = textH . replaceAll ( "\\$SONGTITLE" , songTitle ) ; textH = textH . replaceAll ( "\\$FILENAME" , ( ( openFile ) == null ? "(blank)" : openFile . getName ( ) ) ) ; textH = textH . replaceAll ( "\\$APPTITLE" , GBATrackerFrame . APPLICATION_TITLE ) ; textH = textH . replaceAll ( "\\$DATE" , new Date ( ) . toString ( ) ) ; try { PrintWriter pw = new PrintWriter ( outFileC ) ; pw . write ( textC ) ; pw . close ( ) ; pw = new PrintWriter ( outFileH ) ; pw . write ( textH ) ; pw . close ( ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } JOptionPane . showMessageDialog ( this , ( ( ( ( "Exported:\n" + ( songTitle ) ) + ".c\n" ) + ( songTitle ) ) + ".h" ) , "Export<seq2seq4repair_space>successful" , JOptionPane . INFORMATION_MESSAGE ) ; } } public void play ( ) { } public void playHere ( ) { } public void stop ( ) { } public void setModified ( ) { } public void setModifiedTitle ( String newTitle ) { } public double zoomIn ( ) { } public double zoomOut ( ) { } public double moveLeft ( ) { } public double moveRight ( ) { } public void setTooltipText ( String text ) { } public void setQuantization ( int quantization ) { } public Note getNoteFromUI ( boolean isSqaure ) { } public void updateUIFromNote ( Note note ) { } public void updateSelectedNote ( Note note ) { } public void setLoopingEnabled ( boolean enable ) { } private boolean validName ( String name ) { } public int getBPM ( ) { } public void clearAll ( ) { } public void about ( ) { } public void exitConfirmation ( ) { } public void updateAnimation ( double animPercentage ) { } public GBATrackerFrame ( ) { } public static void main ( String [ ] args ) { } }

Fix:
textC = textC . replaceAll ( "\\$LOOP" , ( "" + ( simulationPanel . getDataLoop ( ) ) ) ) ;