sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1636283 - /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
Date Mon, 03 Nov 2014 07:18:54 GMT
Author: cziegeler
Date: Mon Nov  3 07:18:53 2014
New Revision: 1636283

URL: http://svn.apache.org/r1636283
Log:
SLING-4122 : Folders might be created concurrently resulting in SNS nodes

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java?rev=1636283&r1=1636282&r2=1636283&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
Mon Nov  3 07:18:53 2014
@@ -252,14 +252,22 @@ public abstract class Utility {
 
         @Override
         public int compare(final Resource o1, final Resource o2) {
-            final int value1 = Integer.valueOf(o1.getName());
-            final int value2 = Integer.valueOf(o2.getName());
-            if ( value1 < value2 ) {
-                return -1;
-            } else if ( value1 > value2 ) {
-                return 1;
+            Integer value1 = null;
+            try {
+                value1 = Integer.valueOf(o1.getName());
+            } catch ( final NumberFormatException nfe) {
+                // ignore
             }
-            return 0;
+            Integer value2 = null;
+            try {
+                value2 = Integer.valueOf(o2.getName());
+            } catch ( final NumberFormatException nfe) {
+                // ignore
+            }
+            if ( value1 != null && value2 != null ) {
+                return value1.compareTo(value2);
+            }
+            return o1.getName().compareTo(o2.getName());
         }
     };
 



Mime
View raw message