You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by vi...@apache.org on 2018/01/04 20:33:32 UTC
[incubator-netbeans] branch master updated: [NETBEANS-210] Setting
tmp directory (#329)
This is an automated email from the ASF dual-hosted git repository.
vieiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 63897d3 [NETBEANS-210] Setting tmp directory (#329)
63897d3 is described below
commit 63897d3264efe68334d6e31bfca71867141db19e
Author: Antonio Vieiro <vi...@users.noreply.github.com>
AuthorDate: Thu Jan 4 21:33:27 2018 +0100
[NETBEANS-210] Setting tmp directory (#329)
* [NETBEANS-210] Maven index too big
To fit in /tmp in some systems.
- Modified NexusRepositoryIndexerImpl to use a directory in Places.getCacheDirectory.
---
.../maven/indexer/NexusRepositoryIndexerImpl.java | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java b/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
index ff611a7..98ecb1c 100644
--- a/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
+++ b/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java
@@ -451,9 +451,11 @@ public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementati
}
@Messages({"# {0} - folder path",
- "MSG_NoSpace=There is not enough space in your temp folder to download and unpack the index for ''{0}''.",
+ "# {1} - repository name",
+ "MSG_NoSpace=There is not enough space in {0} to download and unpack the index for ''{1}''.",
"# {0} - folder path",
- "MSG_SeemsNoSpace=It seems that there is not enough space in your temp folder to download and unpack the index for ''{0}''."})
+ "# {1} - repository name",
+ "MSG_SeemsNoSpace=It seems that there is not enough space in {0} to download and unpack the index for ''{1}''."})
private void indexLoadedRepo(final RepositoryInfo repo, boolean updateLocal) throws IOException {
Mutex mutex = getRepoMutex(repo);
assert mutex.isWriteAccess();
@@ -554,28 +556,27 @@ public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementati
if(e.getCause() instanceof ResourceDoesNotExistException) {
fireChange(repo, () -> repo.fireNoIndex());
}
-
+ File tmpFolder = Places.getCacheDirectory();
// see also issue #250365
String noSpaceLeftMsg = null;
if(e.getMessage().contains("No space left on device")) {
- noSpaceLeftMsg = Bundle.MSG_NoSpace(repo.getName());
+ noSpaceLeftMsg = Bundle.MSG_NoSpace(tmpFolder.getAbsolutePath(), repo.getName());
}
long downloaded = listener != null ? listener.getUnits() * 1024 : -1;
long usableSpace = -1;
- File tmpFolder = new File(System.getProperty("java.io.tmpdir"));
try {
FileStore store = Files.getFileStore(tmpFolder.toPath());
usableSpace = store.getUsableSpace();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
- LOGGER.log(Level.INFO, "Downloaded maven index file has size {0} (zipped). The usable space in {1} (java.io.tmpdir) is {2}.", new Object[]{downloaded, tmpFolder, usableSpace});
+ LOGGER.log(Level.INFO, "Downloaded maven index file has size {0} (zipped). The usable space in {1} is {2}.", new Object[]{downloaded, tmpFolder, usableSpace});
// still might be a problem with a too small tmp,
// let's try to figure out ...
if(noSpaceLeftMsg == null && downloaded > -1 && downloaded * 15 > usableSpace) {
- noSpaceLeftMsg = Bundle.MSG_SeemsNoSpace(repo.getName());
+ noSpaceLeftMsg = Bundle.MSG_SeemsNoSpace(tmpFolder.getAbsolutePath(), repo.getName());
}
if(noSpaceLeftMsg != null) {
@@ -695,14 +696,13 @@ public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementati
throw new IOException( "Repository directory " + repositoryDirectory + " does not exist" );
}
- // always use temporary context when reindexing
- //TODO select a location within netbeans cache directory not File.createTempFile
- final File tmpFile = File.createTempFile( context.getId() + "-tmp", "" );
- final File tmpDir = new File( tmpFile.getParentFile(), tmpFile.getName() + ".dir" );
+ // always use cache directory when reindexing
+ final File tmpDir = new File(Places.getCacheDirectory(), "tmp-" + context.getRepositoryId());
if ( !tmpDir.mkdirs() )
{
throw new IOException( "Cannot create temporary directory: " + tmpDir );
}
+ final File tmpFile = new File(tmpDir, context.getId() + "-tmp");
IndexingContext tmpContext = null;
try
--
To stop receiving notification emails like this one, please contact
['"commits@netbeans.apache.org" <co...@netbeans.apache.org>'].
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists