Preventing "ZIP file must have at least one entry" problem.
1.1 --- a/remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java Mon Sep 12 19:28:00 2011 +0200
1.2 +++ b/remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java Mon Sep 26 14:05:06 2011 +0200
1.3 @@ -211,7 +211,7 @@
1.4 out.write(("{ \"displayName\": \"" + categoryName + "\" }").getBytes("UTF-8"));
1.5
1.6 for (FileObject s : cacheFolder.getChildren()) {
1.7 - if (!s.isFolder() || !s.getNameExt().startsWith("s")) continue;
1.8 + if (!s.isFolder() || !s.getNameExt().startsWith("s") || !containsAFile(s)) continue;
1.9
1.10 JarOutputStream local = null;
1.11 try {
1.12 @@ -343,4 +343,14 @@
1.13
1.14 relPath.delete(len, relPath.length());
1.15 }
1.16 +
1.17 + private static boolean containsAFile(FileObject root) {
1.18 + if (root.isData()) return true;
1.19 +
1.20 + for (FileObject c : root.getChildren()) {
1.21 + if (containsAFile(c)) return true;
1.22 + }
1.23 +
1.24 + return false;
1.25 + }
1.26 }