Index: trunk/src/org/openstreetmap/josm/data/osm/Node.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 11374)
+++ trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 11383)
@@ -238,4 +238,6 @@
     @Override
     public void cloneFrom(OsmPrimitive osm) {
+        if (!(osm instanceof Node))
+            throw new IllegalArgumentException("Not a node: " + osm);
         boolean locked = writeLock();
         try {
@@ -260,4 +262,6 @@
     @Override
     public void mergeFrom(OsmPrimitive other) {
+        if (!(other instanceof Node))
+            throw new IllegalArgumentException("Not a node: " + other);
         boolean locked = writeLock();
         try {
@@ -271,5 +275,8 @@
     }
 
-    @Override public void load(PrimitiveData data) {
+    @Override
+    public void load(PrimitiveData data) {
+        if (!(data instanceof NodeData))
+            throw new IllegalArgumentException("Not a node data: " + data);
         boolean locked = writeLock();
         try {
@@ -281,5 +288,6 @@
     }
 
-    @Override public NodeData save() {
+    @Override
+    public NodeData save() {
         NodeData data = new NodeData();
         saveCommonAttributes(data);
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 11374)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 11383)
@@ -1088,5 +1088,5 @@
      *
      * Both this and other must be new, or both must be assigned an OSM ID. If both this and <code>other</code>
-     * have an assigend OSM id, the IDs have to be the same.
+     * have an assigned OSM id, the IDs have to be the same.
      *
      * @param other the other primitive. Must not be null.
Index: trunk/src/org/openstreetmap/josm/data/osm/Relation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 11374)
+++ trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 11383)
@@ -240,4 +240,6 @@
     @Override
     public void cloneFrom(OsmPrimitive osm) {
+        if (!(osm instanceof Relation))
+            throw new IllegalArgumentException("Not a relation: " + osm);
         boolean locked = writeLock();
         try {
@@ -252,4 +254,6 @@
     @Override
     public void load(PrimitiveData data) {
+        if (!(data instanceof RelationData))
+            throw new IllegalArgumentException("Not a relation data: " + data);
         boolean locked = writeLock();
         try {
@@ -271,5 +275,6 @@
     }
 
-    @Override public RelationData save() {
+    @Override
+    public RelationData save() {
         RelationData data = new RelationData();
         saveCommonAttributes(data);
Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 11374)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 11383)
@@ -277,4 +277,6 @@
     @Override
     public void load(PrimitiveData data) {
+        if (!(data instanceof WayData))
+            throw new IllegalArgumentException("Not a way data: " + data);
         boolean locked = writeLock();
         try {
@@ -314,4 +316,6 @@
     @Override
     public void cloneFrom(OsmPrimitive osm) {
+        if (!(osm instanceof Way))
+            throw new IllegalArgumentException("Not a way: " + osm);
         boolean locked = writeLock();
         try {
@@ -326,5 +330,5 @@
     @Override
     public String toString() {
-        String nodesDesc = isIncomplete() ? "(incomplete)" : "nodes=" + Arrays.toString(nodes);
+        String nodesDesc = isIncomplete() ? "(incomplete)" : ("nodes=" + Arrays.toString(nodes));
         return "{Way id=" + getUniqueId() + " version=" + getVersion()+ ' ' + getFlagsAsString() + ' ' + nodesDesc + '}';
     }
