Index: /trunk/src/org/openstreetmap/josm/data/notes/Note.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/notes/Note.java	(revision 11820)
+++ /trunk/src/org/openstreetmap/josm/data/notes/Note.java	(revision 11821)
@@ -5,4 +5,5 @@
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
@@ -25,4 +26,41 @@
     }
 
+    /**
+     * Sorts notes in the following order:
+     * 1) Open notes
+     * 2) Closed notes
+     * 3) New notes
+     * Within each subgroup it sorts by ID
+     */
+    public static final Comparator<Note> DEFAULT_COMPARATOR = (n1, n2) -> {
+        if (n1.getId() < 0 && n2.getId() > 0) {
+            return 1;
+        }
+        if (n1.getId() > 0 && n2.getId() < 0) {
+            return -1;
+        }
+        if (n1.getState() == State.CLOSED && n2.getState() == State.OPEN) {
+            return 1;
+        }
+        if (n1.getState() == State.OPEN && n2.getState() == State.CLOSED) {
+            return -1;
+        }
+        return Long.compare(Math.abs(n1.getId()), Math.abs(n2.getId()));
+    };
+
+    /** Sorts notes strictly by creation date */
+    public static final Comparator<Note> DATE_COMPARATOR = (n1, n2) -> n1.createdAt.compareTo(n2.createdAt);
+
+    /** Sorts notes by user, then creation date */
+    public static final Comparator<Note> USER_COMPARATOR = (n1, n2) -> {
+        String n1User = n1.getFirstComment().getUser().getName();
+        String n2User = n2.getFirstComment().getUser().getName();
+        return n1User.equals(n2User) ? DATE_COMPARATOR.compare(n1, n2) : n1User.compareTo(n2User);
+    };
+
+    /** Sorts notes by the last modified date */
+    public static final Comparator<Note> LAST_ACTION_COMPARATOR =
+            (n1, n2) -> NoteComment.DATE_COMPARATOR.compare(n1.getLastComment(), n2.getLastComment());
+
     private long id;
     private LatLon latLon;
@@ -60,5 +98,5 @@
     /** @return Date that this note was submitted */
     public Date getCreatedAt() {
-        return createdAt;
+        return cloneDate(createdAt);
     }
 
@@ -68,10 +106,10 @@
      */
     public void setCreatedAt(Date createdAt) {
-        this.createdAt = createdAt;
+        this.createdAt = cloneDate(createdAt);
     }
 
     /** @return Date that this note was closed. Null if it is still open. */
     public Date getClosedAt() {
-        return closedAt;
+        return cloneDate(closedAt);
     }
 
@@ -81,5 +119,5 @@
      */
     public void setClosedAt(Date closedAt) {
-        this.closedAt = closedAt;
+        this.closedAt = cloneDate(closedAt);
     }
 
@@ -103,4 +141,13 @@
 
     /**
+     * Returns the last comment, or {@code null}.
+     * @return the last comment, or {@code null}
+     * @since 11821
+     */
+    public NoteComment getLastComment() {
+        return comments.isEmpty() ? null : comments.get(comments.size()-1);
+    }
+
+    /**
      * Adds a comment.
      * @param comment note comment
@@ -125,5 +172,5 @@
     public void updateWith(Note note) {
         this.comments = note.comments;
-        this.createdAt = note.createdAt;
+        this.createdAt = cloneDate(note.createdAt);
         this.id = note.id;
         this.state = note.state;
@@ -150,3 +197,12 @@
         return tr("Note") + ' ' + id + ": " + getFirstComment();
     }
+
+    /**
+     * Null-safe date cloning method.
+     * @param d date to clone, or null
+     * @return cloned date, or null
+     */
+    static Date cloneDate(Date d) {
+        return d != null ? (Date) d.clone() : null;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java	(revision 11820)
+++ /trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java	(revision 11821)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.data.notes;
 
+import java.util.Comparator;
 import java.util.Date;
 
@@ -38,4 +39,7 @@
     }
 
+    /** Sorts note comments strictly by creation date */
+    public static final Comparator<NoteComment> DATE_COMPARATOR = (n1, n2) -> n1.commentTimestamp.compareTo(n2.commentTimestamp);
+
     /**
      * @param createDate The time at which this comment was added
@@ -48,5 +52,5 @@
         this.text = commentText;
         this.user = user;
-        this.commentTimestamp = createDate;
+        this.commentTimestamp = Note.cloneDate(createDate);
         this.action = action;
         this.isNew = isNew;
@@ -65,5 +69,5 @@
     /** @return The time at which this comment was created */
     public Date getCommentTimestamp() {
-        return commentTimestamp;
+        return Note.cloneDate(commentTimestamp);
     }
 
Index: /trunk/src/org/openstreetmap/josm/data/osm/NoteData.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/NoteData.java	(revision 11820)
+++ /trunk/src/org/openstreetmap/josm/data/osm/NoteData.java	(revision 11821)
@@ -26,48 +26,5 @@
     private final Storage<Note> noteList;
     private Note selectedNote;
-    private Comparator<Note> comparator = DEFAULT_COMPARATOR;
-
-    /**
-     * Sorts notes in the following order:
-     * 1) Open notes
-     * 2) Closed notes
-     * 3) New notes
-     * Within each subgroup it sorts by ID
-     */
-    public static final Comparator<Note> DEFAULT_COMPARATOR = (n1, n2) -> {
-        if (n1.getId() < 0 && n2.getId() > 0) {
-            return 1;
-        }
-        if (n1.getId() > 0 && n2.getId() < 0) {
-            return -1;
-        }
-        if (n1.getState() == State.CLOSED && n2.getState() == State.OPEN) {
-            return 1;
-        }
-        if (n1.getState() == State.OPEN && n2.getState() == State.CLOSED) {
-            return -1;
-        }
-        return Long.compare(Math.abs(n1.getId()), Math.abs(n2.getId()));
-    };
-
-    /** Sorts notes strictly by creation date */
-    public static final Comparator<Note> DATE_COMPARATOR = (n1, n2) -> n1.getCreatedAt().compareTo(n2.getCreatedAt());
-
-    /** Sorts notes by user, then creation date */
-    public static final Comparator<Note> USER_COMPARATOR = (n1, n2) -> {
-        String n1User = n1.getFirstComment().getUser().getName();
-        String n2User = n2.getFirstComment().getUser().getName();
-        if (n1User.equals(n2User)) {
-            return n1.getCreatedAt().compareTo(n2.getCreatedAt());
-        }
-        return n1.getFirstComment().getUser().getName().compareTo(n2.getFirstComment().getUser().getName());
-    };
-
-    /** Sorts notes by the last modified date */
-    public static final Comparator<Note> LAST_ACTION_COMPARATOR = (n1, n2) -> {
-        Date n1Date = n1.getComments().get(n1.getComments().size()-1).getCommentTimestamp();
-        Date n2Date = n2.getComments().get(n2.getComments().size()-1).getCommentTimestamp();
-        return n1Date.compareTo(n2Date);
-    };
+    private Comparator<Note> comparator = Note.DEFAULT_COMPARATOR;
 
     /**
Index: /trunk/src/org/openstreetmap/josm/gui/NoteSortDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/NoteSortDialog.java	(revision 11820)
+++ /trunk/src/org/openstreetmap/josm/gui/NoteSortDialog.java	(revision 11821)
@@ -15,5 +15,4 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.notes.Note;
-import org.openstreetmap.josm.data.osm.NoteData;
 
 /**
@@ -43,11 +42,11 @@
     public void showSortDialog(Comparator<Note> currentSortMode) {
         JLabel label = new JLabel(tr("Select note sorting method"));
-        if (currentSortMode == NoteData.DEFAULT_COMPARATOR) {
+        if (currentSortMode == Note.DEFAULT_COMPARATOR) {
             defaultSort.setSelected(true);
-        } else if (currentSortMode == NoteData.DATE_COMPARATOR) {
+        } else if (currentSortMode == Note.DATE_COMPARATOR) {
             dateSort.setSelected(true);
-        } else if (currentSortMode == NoteData.USER_COMPARATOR) {
+        } else if (currentSortMode == Note.USER_COMPARATOR) {
             userSort.setSelected(true);
-        } else if (currentSortMode == NoteData.LAST_ACTION_COMPARATOR) {
+        } else if (currentSortMode == Note.LAST_ACTION_COMPARATOR) {
             lastActionSort.setSelected(true);
         } else {
@@ -77,11 +76,11 @@
     public Comparator<Note> getSelectedComparator() {
         if (dateSort.isSelected()) {
-            return NoteData.DATE_COMPARATOR;
+            return Note.DATE_COMPARATOR;
         } else if (userSort.isSelected()) {
-            return NoteData.USER_COMPARATOR;
+            return Note.USER_COMPARATOR;
         } else if (lastActionSort.isSelected()) {
-            return NoteData.LAST_ACTION_COMPARATOR;
+            return Note.LAST_ACTION_COMPARATOR;
         } else {
-            return NoteData.DEFAULT_COMPARATOR;
+            return Note.DEFAULT_COMPARATOR;
         }
     }
