--- old/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java	2018-01-30 14:07:31.577224362 +0530
+++ new/src/java.desktop/share/classes/javax/swing/DefaultRowSorter.java	2018-01-30 14:07:31.297084362 +0530
@@ -1033,8 +1033,10 @@
             // Not transformed, nothing to do.
             return false;
         }
-        if (!sorted || (lastRow - firstRow) > viewToModel.length / 10) {
-            // We either weren't sorted, or to much changed, sort it all
+        if (!sorted || viewToModel.length == 0 ||
+                (lastRow - firstRow) > viewToModel.length / 10) {
+            // We either weren't sorted, or to much changed, sort it all or
+            // this is the first row added and we have to update diffeent caches
             sort();
             return false;
         }
