# HG changeset patch # User Vladimir Kvashin # Date 1490557943 -10800 # Sun Mar 26 22:52:23 2017 +0300 # Branch release82 # Node ID 6121e70370e024fb8be834df6b6bbc6db8d4ed07 # Parent d79b0b1713107cc9763cc1f77b479cbdbc07adf7 fixing #269778 In new project a Import into Subversion Repository menu item commits empty nbproject and src directories diff -r d79b0b171310 -r 6121e70370e0 dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/DirectoryStorage.java --- a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/DirectoryStorage.java Fri Mar 24 14:52:05 2017 +0300 +++ b/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/DirectoryStorage.java Sun Mar 26 22:52:23 2017 +0300 @@ -166,38 +166,42 @@ RemoteLogger.assertTrueInConsole(false, "Storage has been unexpectedly deleted: " + cacheFile.getAbsolutePath()); //NOI18N } } - + + static void store(File cacheFile, Collection entries) throws IOException { + BufferedWriter wr = null; + try { + wr = Files.newBufferedWriter(cacheFile.toPath(), Charset.forName("UTF-8")); //NOI18N + wr.write("VERSION=" + VERSION + "\n"); //NOI18N + Collection invalid = new ArrayList<>(); + Collection valid = new ArrayList<>(); + for (DirEntry entry : entries) { + if (entry.isValid()) { + valid.add(entry); + } else { + invalid.add(entry); + } + } + wr.write("dummies=" + invalid.size() + '\n'); //NOI18N + for (DirEntry entry: invalid) { + wr.write(entry.toExternalForm()); + wr.write('\n'); + } + for (DirEntry entry : valid) { + wr.write(entry.toExternalForm()); + wr.write('\n'); + } + wr.close(); + wr = null; + } finally { + if (wr != null) { + wr.close(); + } + } + } + public void store() throws IOException { - BufferedWriter wr = null; synchronized (this) { - try { - wr = Files.newBufferedWriter(cacheFile.toPath(), Charset.forName("UTF-8")); //NOI18N - wr.write("VERSION=" + VERSION + "\n"); //NOI18N - Collection invalid = new ArrayList<>(); - Collection valid = new ArrayList<>(); - for (DirEntry entry : entries.values()) { - if (entry.isValid()) { - valid.add(entry); - } else { - invalid.add(entry); - } - } - wr.write("dummies=" + invalid.size() + '\n'); //NOI18N - for (DirEntry entry: invalid) { - wr.write(entry.toExternalForm()); - wr.write('\n'); - } - for (DirEntry entry : valid) { - wr.write(entry.toExternalForm()); - wr.write('\n'); - } - wr.close(); - wr = null; - } finally { - if (wr != null) { - wr.close(); - } - } + store(cacheFile, entries.values()); } } diff -r d79b0b171310 -r 6121e70370e0 dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteDirectory.java --- a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteDirectory.java Fri Mar 24 14:52:05 2017 +0300 +++ b/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteDirectory.java Sun Mar 26 22:52:23 2017 +0300 @@ -1568,12 +1568,15 @@ } } } - uploadAndUnzip(zipFile); + uploadAndUnzip(zipFile); } finally { zipFile.delete(); this.refresh(true); } } finally { + for (RemoteFileObjectBase fo : suspendInfo.getAllSuspended()) { + fo.setFlag(MASK_SUSPENDED_DUMMY, false); + } suspendInfo.dispose(); } } @@ -1635,10 +1638,17 @@ } getCache().mkdirs(); try (InputStream is = new FileInputStream(localZipFile)) { - RemoteFileSystemUtils.unpackZipFile(is, getCache()); + Set dirs = new HashSet<>(); + RemoteFileSystemUtils.unpackZipFile(is, getCache(), dirs); + for (File dir : dirs) { + File cache = new File(dir, RemoteFileSystem.CACHE_FILE_NAME); + if (!cache.exists()) { + DirectoryStorage.store(cache, Collections.emptyList()); + }; + } } try { - refreshImpl(trace, null, true, RefreshMode.DEFAULT, 0); + refreshImpl(true, null, true, RefreshMode.DEFAULT, 0); } catch (TimeoutException ex) { RemoteFileSystemUtils.reportUnexpectedTimeout(ex, this); } catch (ExecutionException ex) { diff -r d79b0b171310 -r 6121e70370e0 dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileSystemUtils.java --- a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileSystemUtils.java Fri Mar 24 14:52:05 2017 +0300 +++ b/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteFileSystemUtils.java Sun Mar 26 22:52:23 2017 +0300 @@ -50,6 +50,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.logging.Level; @@ -400,7 +401,7 @@ * @param dir the base directory in which to unpack (need not yet exist) * @throws IOException in case of problems */ - public static void unpackZipFile(InputStream zipStream, File dir) throws IOException { + public static void unpackZipFile(InputStream zipStream, File dir, Set createdDirs) throws IOException { byte[] buf = new byte[8192]; ZipInputStream zis = new ZipInputStream(zipStream); ZipEntry entry; @@ -412,6 +413,9 @@ if (!baseDir.isDirectory() && !baseDir.mkdirs()) { throw new IOException("could not make " + baseDir); // NOI18N } + if (createdDirs != null) { + createdDirs.add(baseDir); + } } if (slash != name.length() - 1) { File f = new File(dir, name.replace('/', File.separatorChar));