Author: dbkr
Date: 2006-05-07 12:15:08 +0000 (Sun, 07 May 2006)
New Revision: 8641

Modified:
   trunk/freenet/src/freenet/clients/http/PageMaker.java
Log:
* Correctly escape pipe character in replacement pattern for windows file URLs.
* Add condition to prevent NPE if no themes are detected.


Modified: trunk/freenet/src/freenet/clients/http/PageMaker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PageMaker.java       2006-05-07 
12:03:44 UTC (rev 8640)
+++ trunk/freenet/src/freenet/clients/http/PageMaker.java       2006-05-07 
12:15:08 UTC (rev 8641)
@@ -98,9 +98,9 @@
                        URLConnection urlConnection = url.openConnection();
                        if (url.getProtocol().equals("file")) {
                                try{
-                                       File themesDirectory = new 
File(URLDecoder.decode(url.getPath(), "ISO-8859-1").replaceAll("|", ":"));
+                                       File themesDirectory = new 
File(URLDecoder.decode(url.getPath(), "ISO-8859-1").replaceAll("\\|", ":"));
                                        File[] themeDirectories = 
themesDirectory.listFiles();
-                                       for (int themeIndex = 0; themeIndex < 
themeDirectories.length; themeIndex++) {
+                                       for (int themeIndex = 0; 
themeDirectories != null && themeIndex < themeDirectories.length; themeIndex++) 
{
                                                File themeDirectory = 
themeDirectories[themeIndex];
                                                if 
(themeDirectory.isDirectory() && !themeDirectory.getName().startsWith(".")) {
                                                        
themes.add(themeDirectory.getName());


Reply via email to