Source:
public void parse() throws CTFReaderException { CTFReaderException tempException = null; FileInputStream fis = null; FileChannel metadataFileChannel = null; Reader metadataTextInput = null; try { fis = new FileInputStream(metadataFile); metadataFileChannel = fis.getChannel(); if (isPacketBased(metadataFileChannel)) { StringBuffer metadataText = new StringBuffer(); MetadataPacketHeader packetHeader = readMetadataPacket( metadataFileChannel, metadataText); while (packetHeader != null) { packetHeader = readMetadataPacket(metadataFileChannel, metadataText); } metadataTextInput = new StringReader(metadataText.toString()); } else { metadataTextInput = new FileReader(metadataFile); } CommonTree tree = createAST(metadataTextInput); IOStructGen gen = new IOStructGen(tree, trace); gen.generate(); } catch (FileNotFoundException e) { tempException = new CTFReaderException("Cannot find metadata file!"); } catch (IOException e) { tempException = new CTFReaderException(e); } catch (ParseException e) { tempException = new CTFReaderException(e); } catch (MismatchedTokenException e) { tempException = new CtfAntlrException(e); } catch (RecognitionException e) { tempException = new CtfAntlrException(e); } catch (RewriteEmptyStreamException e){ tempException = new CtfAntlrException(e); } catch (RewriteEarlyExitException e){ tempException = new CtfAntlrException(e); } catch (RewriteCardinalityException e){ tempException = new CtfAntlrException(e); } if (metadataTextInput != null) { try { metadataTextInput.close(); } catch (IOException e) { } } if (metadataFileChannel != null) { try { metadataFileChannel.close(); } catch (IOException e) { } } if (fis != null) { try { fis.close(); } catch (IOException e) { } } if (tempException != null) { throw tempException; } }

Target:
public void parse() throws CTFReaderException { CTFReaderException tempException = null; FileInputStream fis = null; FileChannel metadataFileChannel = null; Reader metadataTextInput = null; try { fis = new FileInputStream(metadataFile); metadataFileChannel = fis.getChannel(); if (isPacketBased(metadataFileChannel)) { StringBuffer metadataText = new StringBuffer(); MetadataPacketHeader packetHeader = readMetadataPacket( metadataFileChannel, metadataText); while (packetHeader != null) { packetHeader = readMetadataPacket(metadataFileChannel, metadataText); } metadataTextInput = new StringReader(metadataText.toString()); } else { metadataTextInput = new FileReader(metadataFile); } CommonTree tree = createAST(metadataTextInput); IOStructGen gen = new IOStructGen(tree, trace); gen.generate(); } catch (FileNotFoundException e) { tempException = new CTFReaderException("Cannot find metadata file!"); } catch (IOException e) { tempException = new CTFReaderException(e); } catch (ParseException e) { tempException = new CTFReaderException(e); } catch (RecognitionException e) { tempException = new CtfAntlrException(e); } catch (RewriteCardinalityException e){ tempException = new CtfAntlrException(e); } if (metadataTextInput != null) { try { metadataTextInput.close(); } catch (IOException e) { } } if (metadataFileChannel != null) { try { metadataFileChannel.close(); } catch (IOException e) { } } if (fis != null) { try { fis.close(); } catch (IOException e) { } } if (tempException != null) { throw tempException; } }