mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
ensure resource closing in deckimport from clipboard
This commit is contained in:
parent
338e9833cc
commit
1ec5a3fb4d
1 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
|||
package mage.client.deckeditor;
|
||||
|
||||
import mage.util.StreamUtils;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.BufferedWriter;
|
||||
|
@ -39,15 +41,16 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
|||
}
|
||||
|
||||
private void onOK() {
|
||||
BufferedWriter bw = null;
|
||||
try {
|
||||
File temp = File.createTempFile("cbimportdeck", ".txt");
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
|
||||
bw = new BufferedWriter(new FileWriter(temp));
|
||||
bw.write(txtDeckList.getText());
|
||||
bw.close();
|
||||
|
||||
tmpPath = temp.getPath();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
StreamUtils.closeQuietly(bw);
|
||||
}
|
||||
|
||||
dispose();
|
||||
|
|
Loading…
Reference in a new issue