Index: src/main/java/org/apache/jackrabbit/core/NodeImpl.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/NodeImpl.java	(revision 930179)
+++ src/main/java/org/apache/jackrabbit/core/NodeImpl.java	(working copy)
@@ -1381,19 +1381,19 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, true, status);
+        boolean success = false;
         try {
             if (value == null) {
                 prop.internalSetValue(null, type);
             } else {
                 prop.internalSetValue(new InternalValue[]{value}, type);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -1442,15 +1442,15 @@
             throws ValueFormatException, RepositoryException {
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, true, true, status);
+        boolean success = false;
         try {
             prop.internalSetValue(values, type);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -1657,15 +1657,15 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, true, false, status);
+        boolean success = false;
         try {
             prop.setValue(values);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -1696,6 +1696,7 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, true, true, status);
+        boolean success = false;
         try {
             if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
                     && type != PropertyType.UNDEFINED) {
@@ -1703,13 +1704,13 @@
             } else {
                 prop.setValue(values);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -1744,15 +1745,15 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2265,6 +2266,7 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, true, false, status);
+        boolean success = false;
         try {
             if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
                     && type != PropertyType.UNDEFINED) {
@@ -2272,13 +2274,12 @@
             } else {
                 prop.setValue(values);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2297,15 +2298,16 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, true, true, status);
+        boolean success = false;
+
         try {
             prop.setValue(values, type);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2329,15 +2331,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.STRING, true, false, status);
+        boolean success = false;
         try {
             prop.setValue(values);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2356,6 +2358,8 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, true, true, status);
+        boolean success = false;
+
         try {
             if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
                     && type != PropertyType.UNDEFINED) {
@@ -2363,13 +2367,12 @@
             } else {
                 prop.setValue(values);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2389,15 +2392,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.STRING, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2416,20 +2419,22 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, true, status);
+        
+        boolean success = false;
         try {
+            
             if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
                     && type != PropertyType.UNDEFINED) {
                 prop.setValue(ValueHelper.convert(value, type, session.getValueFactory()));
             } else {
                 prop.setValue(value);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2448,6 +2453,8 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, true, status);
+        boolean success = false;
+
         try {
             if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
                     && type != PropertyType.UNDEFINED) {
@@ -2455,13 +2462,12 @@
             } else {
                 prop.setValue(value);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2485,6 +2491,8 @@
 
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, false, status);
+        boolean success = false;
+
         try {
             if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
                     && type != PropertyType.UNDEFINED) {
@@ -2492,13 +2500,12 @@
             } else {
                 prop.setValue(value);
             }
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2518,15 +2525,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.BINARY, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2546,15 +2553,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.BOOLEAN, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2574,15 +2581,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.DOUBLE, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2602,15 +2609,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.LONG, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2630,15 +2637,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.DATE, false, false, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
@@ -2658,15 +2665,15 @@
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(
                 name, PropertyType.REFERENCE, false, true, status);
+        boolean success = false;
         try {
             prop.setValue(value);
-        } catch (RepositoryException re) {
-            if (status.get(CREATED)) {
+            success = true;
+        } finally {
+            if (!success && status.get(CREATED)) {
                 // setting value failed, get rid of newly created property
                 removeChildProperty(name);
             }
-            // rethrow
-            throw re;
         }
         return prop;
     }
