Version 1.4.2: bugfixes (unhtml, deltree) nikiroo-utils-1.4.2
authorNiki Roo <niki@nikiroo.be>
Thu, 20 Apr 2017 17:57:39 +0000 (19:57 +0200)
committerNiki Roo <niki@nikiroo.be>
Thu, 20 Apr 2017 17:57:39 +0000 (19:57 +0200)
VERSION
changelog
src/be/nikiroo/utils/IOUtils.java
src/be/nikiroo/utils/StringUtils.java

diff --git a/VERSION b/VERSION
index 347f5833ee6db7495cce808040501bf2c96269a9..9df886c42a1e2082f1471383d986fea4d531f8ac 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.4.1
+1.4.2
index 3cc63adee60c4aa1160bb5a5f43f356541aeb2ef..e0bb0a462d9c4f0f09bfc2af826cf1d1f20caa74 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,12 @@
+Version 1.4.2
+-------------
+
+Bugfix: Deltree
+       Deltree was not OK for files...
+
+Bugfix: unhtml
+       Also replace non-breakable spaces by normal spaces
+
 Version 1.4.1
 -------------
 
index eb105e2698535e325ed602fc0b3ed50f7e0b16b4..4a185c6386ba31b84a474540f82d78aa25d691dc 100644 (file)
@@ -202,20 +202,15 @@ public class IOUtils {
         *            the target to delete
         */
        public static void deltree(File target) {
-               for (File file : target.listFiles()) {
-                       if (file.isDirectory()) {
+               File[] files = target.listFiles();
+               if (files != null) {
+                       for (File file : files) {
                                deltree(file);
-                       } else {
-                               if (!file.delete()) {
-                                       System.err.println("Cannot delete file: "
-                                                       + file.getAbsolutePath());
-                               }
                        }
                }
 
                if (!target.delete()) {
-                       System.err.println("Cannot delete file: "
-                                       + target.getAbsolutePath());
+                       System.err.println("Cannot delete: " + target.getAbsolutePath());
                }
        }
 
index cd9a46307202860ded01ec73054973e97f9eec3a..adebd7a50022b3f9d838a3b5e5d68345cea6e048 100644 (file)
@@ -325,7 +325,9 @@ public class StringUtils {
                        }
                }
 
-               return HtmlEscape.unescapeHtml(builder.toString());
+               char nbsp = ' '; // non-breakable space (a special char)
+               char space = ' ';
+               return HtmlEscape.unescapeHtml(builder.toString()).replace(nbsp, space);
        }
 
        /**