As part of NTNU's increased focus on security, all users are now forced to enable and use Two-factor authentication.

Commit 2becb7f4 authored by Arne Styve's avatar Arne Styve
Browse files

Minor fixes: Removed synchronized from iterator() in...

Minor fixes: Removed synchronized from iterator() in Updated constructor of to make use of the set-methods instead of setting the fields directly. Ready for bugfix release.
parent f3822ce1
......@@ -10,6 +10,8 @@
<setting name="validation-enabled" value="true" />
<factory-entry name="contacts-localdb-pu" />
<factory-entry name="contacts-mysql-pu" />
<factory-entry name="contacts-pu" />
<naming-strategy-map />
......@@ -12,6 +12,7 @@ The project was developed for use in teaching in the course "IDATx2001 Programme
**Version** | **Description**
v0.5.1 | Some minor adjustments: removed *synchronized* from the iterator()-method of ContactDetails (not needed). Updated the ContactDetails-constructor to make use of the set-methods of the class.
v0.5 | Added support for MySQL-DB at IDI ( through a separate *persistence unit (PU)* in the persistence.xml-file. NOTE: You must set your own **username**, **password** and **database name**. Also support has been added for a locally installed Apache Derby Server.
v0.4.1 | Renamed the class AddressBookDAO to AddressBookDBHandler, since DAO is a general term that also could be used for the AddressBookFileHandler. Also altered slightly the use of EntityManager.
v0.4 | Added Relational Database support, using the embedded Apache Derby server. For details of the changes made, se below.
......@@ -116,7 +116,7 @@ public class AddressBookDBHandler implements AddressBook {
public synchronized Iterator<ContactDetails> iterator() {
public Iterator<ContactDetails> iterator() {
return getAllContacts().iterator();
......@@ -29,21 +29,17 @@ public class ContactDetails implements Comparable<ContactDetails>, Serializable
* @param name The name.
* @param phone The phone number.
* @param address The address.
* @throws IllegalArgumentException if any of the parameters are invalid.
public ContactDetails(String name, String phone, String address) {
// Use blank strings if any of the arguments is null.
if (name == null) {
name = "";
if (phone == null) {
phone = "";
if (address == null) {
address = "";
} = name.trim(); = phone.trim();
this.address = address.trim();
public ContactDetails(String name, String phone, String address) throws IllegalArgumentException{
// A good recommended practice is to always use set-methods in the
// constructors, and to make sure that the set-methods performs the
// necessary validity-checks on the parameter.
// This puts the cheks in one place, and one place only, which is
// important especially if multiple constructors are being implemented.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment