jDoc, possible leak on crash, new depth option
[jvcard.git] / src / be / nikiroo / jvcard / Card.java
index 0a405bee47d744e6545b3360579343fdc5466806..6d833d81f069028b21442aaa6519272a63f41f38 100644 (file)
@@ -15,7 +15,6 @@ import be.nikiroo.jvcard.parsers.Parser;
  * contacts.
  * 
  * @author niki
- * 
  */
 public class Card extends BaseClass<Contact> {
        private File file;
@@ -97,8 +96,11 @@ public class Card extends BaseClass<Contact> {
                        return false;
 
                BufferedWriter writer = new BufferedWriter(new FileWriter(file));
-               Parser.write(writer, format, this);
-               writer.close();
+               try {
+                       Parser.write(writer, format, this);
+               } finally {
+                       writer.close();
+               }
 
                if (this.file != null
                                && file.getCanonicalPath().equals(this.file.getCanonicalPath())) {