]> git.mxchange.org Git - jfinancials-swing.git/commitdiff
Introduced addContactToList() + used writeBytes() instead of writeCharacters() as...
authorRoland Haeder <roland@mxchange.org>
Mon, 20 Jul 2015 12:54:36 +0000 (14:54 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 20 Jul 2015 12:54:36 +0000 (14:54 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

Addressbook/src/org/mxchange/addressbook/database/backend/csv/CsvDatabaseBackend.java

index e191b31dcb3d762d22df6a9b3eca31cfb9fed29a..750d60ec2a5ed511f5260a4bd649ea34de9537c7 100644 (file)
@@ -155,7 +155,33 @@ public class CsvDatabaseBackend extends BaseDatabaseBackend implements CsvBacken
        this.getLogger().debug(MessageFormat.format("str({0})={1}", str.length(), str));\r
 \r
        // The string is now a valid CSV string\r
-       this.storageFile.writeChars(str);\r
+       this.storageFile.writeBytes(str);\r
+    }\r
+\r
+    /**\r
+     * Adds given contact to list\r
+     * \r
+     * @param contact Contact instance to add\r
+     * @param list List instance\r
+     */\r
+    private void addContactToList (final Contact contact, final List<Contact> list) {\r
+       // Debug message\r
+       this.getLogger().debug(MessageFormat.format("contact={0}", contact));\r
+\r
+       // Is the contact read?\r
+       if (contact instanceof Contact) {\r
+           // Then add it\r
+           boolean added = list.add(contact);\r
+\r
+           // Debug message\r
+           this.getLogger().debug(MessageFormat.format("contact={0} added={1}", contact, added));\r
+\r
+           // Has it been added?\r
+           if (!added) {\r
+               // Not added\r
+               this.getLogger().warn("Contact object has not been added.");\r
+           }\r
+       }\r
     }\r
 \r
     /**\r
@@ -422,23 +448,8 @@ public class CsvDatabaseBackend extends BaseDatabaseBackend implements CsvBacken
                count++;\r
            }\r
 \r
-           // Debug message\r
-           this.getLogger().debug(MessageFormat.format("contact={0}", contact));\r
-\r
-           // Is the contact read?\r
-           if (contact instanceof Contact) {\r
-               // Then add it\r
-               boolean added = list.add(contact);\r
-\r
-               // Debug message\r
-               this.getLogger().debug(MessageFormat.format("contact={0} added={1}", contact, added));\r
-\r
-               // Has it been added?\r
-               if (!added) {\r
-                   // Not added\r
-                   this.getLogger().warn("Contact object has not been added.");\r
-               }\r
-           }\r
+           // Add contact\r
+           this.addContactToList(contact, list);\r
        }\r
 \r
        // Return finished list\r