Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 57798
Collapse All | Expand All

(-)a/apisupport.ant/nbproject/project.xml (-1 / +1 lines)
 Lines 261-267    Link Here 
261
                    <build-prerequisite/>
261
                    <build-prerequisite/>
262
                    <compile-dependency/>
262
                    <compile-dependency/>
263
                    <run-dependency>
263
                    <run-dependency>
264
                        <specification-version>7.22</specification-version>
264
                        <specification-version>7.25</specification-version>
265
                    </run-dependency>
265
                    </run-dependency>
266
                </dependency>
266
                </dependency>
267
                <dependency>
267
                <dependency>
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/PlatformLayersCacheManager.java (-6 / +3 lines)
 Lines 79-84    Link Here 
79
import org.netbeans.modules.apisupport.project.universe.PlatformLayersCacheManager.PLFSCacheEntry;
79
import org.netbeans.modules.apisupport.project.universe.PlatformLayersCacheManager.PLFSCacheEntry;
80
import org.openide.filesystems.FileObject;
80
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileSystem;
81
import org.openide.filesystems.FileSystem;
82
import org.openide.modules.Places;
82
import org.openide.util.NbBundle.Messages;
83
import org.openide.util.NbBundle.Messages;
83
import org.openide.util.Parameters;
84
import org.openide.util.Parameters;
84
import org.openide.util.RequestProcessor;
85
import org.openide.util.RequestProcessor;
 Lines 88-94    Link Here 
88
 * @author Richard Michalsky
89
 * @author Richard Michalsky
89
 */
90
 */
90
public class PlatformLayersCacheManager {
91
public class PlatformLayersCacheManager {
91
    static final String CACHE_PATH = "var/cache/nbplfsc";
92
    static final String CACHE_PATH = "nbplfsc";
92
93
93
    static class PLFSCacheEntry {
94
    static class PLFSCacheEntry {
94
        private File jarFile;
95
        private File jarFile;
 Lines 182-192    Link Here 
182
    }
183
    }
183
184
184
    private static void resetCacheLocation() {
185
    private static void resetCacheLocation() {
185
        cacheLocation = new File(System.getProperty("netbeans.user"),CACHE_PATH);
186
        cacheLocation = Places.getCacheSubdirectory(CACHE_PATH);
186
        if (! cacheLocation.exists()) {
187
            if (! cacheLocation.mkdirs())
188
                throw new RuntimeException("Cannot create cache dir " + System.getProperty("netbeans.user") + CACHE_PATH);
189
        }
190
    }
187
    }
191
188
192
    /**
189
    /**
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/universe/PlatformLayersCacheManagerTest.java (-2 / +2 lines)
 Lines 54-59    Link Here 
54
import org.netbeans.modules.apisupport.project.TestBase;
54
import org.netbeans.modules.apisupport.project.TestBase;
55
import org.openide.filesystems.FileSystem;
55
import org.openide.filesystems.FileSystem;
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.modules.Places;
57
58
58
/**
59
/**
59
 *
60
 *
 Lines 73-80    Link Here 
73
    protected void setUp() throws Exception {
74
    protected void setUp() throws Exception {
74
75
75
        super.setUp();
76
        super.setUp();
76
        File userdir = new File(System.getProperty("netbeans.user"));
77
        cacheDir = new File(Places.getCacheDirectory(), PlatformLayersCacheManager.CACHE_PATH);
77
        cacheDir = new File(userdir, PlatformLayersCacheManager.CACHE_PATH);
78
        assertFalse("Cache not yet saved", cacheDir.isDirectory());
78
        assertFalse("Cache not yet saved", cacheDir.isDirectory());
79
        plaf = NbPlatform.getDefaultPlatform();
79
        plaf = NbPlatform.getDefaultPlatform();
80
        jarNames = new HashSet<String>();
80
        jarNames = new HashSet<String>();
(-)a/autoupdate.services/nbproject/project.xml (-1 / +1 lines)
 Lines 45-51    Link Here 
45
                    <build-prerequisite/>
45
                    <build-prerequisite/>
46
                    <compile-dependency/>
46
                    <compile-dependency/>
47
                    <run-dependency>
47
                    <run-dependency>
48
                        <specification-version>7.15</specification-version>
48
                        <specification-version>7.25</specification-version>
49
                    </run-dependency>
49
                    </run-dependency>
50
                </dependency>
50
                </dependency>
51
                <dependency>
51
                <dependency>
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/services/Utilities.java (-10 / +2 lines)
 Lines 98-103    Link Here 
98
import org.openide.modules.Dependency;
98
import org.openide.modules.Dependency;
99
import org.openide.modules.InstalledFileLocator;
99
import org.openide.modules.InstalledFileLocator;
100
import org.openide.modules.ModuleInfo;
100
import org.openide.modules.ModuleInfo;
101
import org.openide.modules.Places;
101
import org.openide.modules.SpecificationVersion;
102
import org.openide.modules.SpecificationVersion;
102
import org.openide.util.Exceptions;
103
import org.openide.util.Exceptions;
103
import org.openide.util.Lookup;
104
import org.openide.util.Lookup;
 Lines 1274-1289    Link Here 
1274
    }
1275
    }
1275
1276
1276
    private static File getCacheDirectory () {
1277
    private static File getCacheDirectory () {
1277
        File cacheDir = null;
1278
        return Places.getCacheSubdirectory("catalogcache");
1278
        String userDir = System.getProperty ("netbeans.user"); // NOI18N
1279
        if (userDir != null) {
1280
            cacheDir = new File (new File (new File (userDir, "var"), "cache"), "catalogcache"); // NOI18N
1281
        } else {
1282
            File dir = FileUtil.toFile (FileUtil.getConfigRoot());
1283
            cacheDir = new File (dir, "catalogcache"); // NOI18N
1284
        }
1285
        cacheDir.mkdirs();
1286
        return cacheDir;
1287
    }
1279
    }
1288
    
1280
    
1289
    private static Preferences getPreferences() {
1281
    private static Preferences getPreferences() {
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateCatalogCache.java (-10 / +2 lines)
 Lines 55-61    Link Here 
55
import java.util.logging.Logger;
55
import java.util.logging.Logger;
56
import org.netbeans.modules.autoupdate.services.AutoupdateSettings;
56
import org.netbeans.modules.autoupdate.services.AutoupdateSettings;
57
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.FileUtil;
58
import org.openide.util.Exceptions;
58
import org.openide.modules.Places;
59
59
60
/**
60
/**
61
 *
61
 *
 Lines 85-99    Link Here 
85
    
85
    
86
    private void initCacheDirectory () {
86
    private void initCacheDirectory () {
87
        assert cacheDir == null : "Do initCacheDirectory only once!";
87
        assert cacheDir == null : "Do initCacheDirectory only once!";
88
        String userDir = System.getProperty("netbeans.user"); // NOI18N
88
        cacheDir = Places.getCacheSubdirectory("catalogcache"); // NOI18N
89
        if (userDir != null) {
90
            cacheDir = new File (new File (new File (userDir, "var"), "cache"), "catalogcache"); // NOI18N
91
        } else {
92
            File dir = FileUtil.toFile (FileUtil.getConfigRoot());
93
            assert dir != null : "Provide netbeans.user so we know where to store catalogcache!";
94
            cacheDir = new File(dir, "catalogcache"); // NOI18N
95
        }
96
        cacheDir.mkdirs();
97
        getLicenseDir().mkdirs();
89
        getLicenseDir().mkdirs();
98
        err.log (Level.FINE, "getCacheDirectory: {0}", cacheDir.getPath ());
90
        err.log (Level.FINE, "getCacheDirectory: {0}", cacheDir.getPath ());
99
        return;
91
        return;
(-)a/cnd.completion/nbproject/project.xml (+8 lines)
 Lines 213-218    Link Here 
213
                    </run-dependency>
213
                    </run-dependency>
214
                </dependency>
214
                </dependency>
215
                <dependency>
215
                <dependency>
216
                    <code-name-base>org.openide.modules</code-name-base>
217
                    <build-prerequisite/>
218
                    <compile-dependency/>
219
                    <run-dependency>
220
                        <specification-version>7.25</specification-version>
221
                    </run-dependency>
222
                </dependency>
223
                <dependency>
216
                    <code-name-base>org.openide.nodes</code-name-base>
224
                    <code-name-base>org.openide.nodes</code-name-base>
217
                    <build-prerequisite/>
225
                    <build-prerequisite/>
218
                    <compile-dependency/>
226
                    <compile-dependency/>
(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/doxygensupport/ManDocumentation.java (-10 / +2 lines)
 Lines 69-74    Link Here 
69
import org.netbeans.modules.cnd.api.project.NativeProject;
69
import org.netbeans.modules.cnd.api.project.NativeProject;
70
import org.netbeans.spi.editor.completion.CompletionDocumentation;
70
import org.netbeans.spi.editor.completion.CompletionDocumentation;
71
import org.openide.filesystems.FileUtil;
71
import org.openide.filesystems.FileUtil;
72
import org.openide.modules.Places;
72
import org.openide.util.Exceptions;
73
import org.openide.util.Exceptions;
73
import org.openide.util.NbBundle;
74
import org.openide.util.NbBundle;
74
75
 Lines 179-193    Link Here 
179
//
180
//
180
//        return "";
181
//        return "";
181
//    }
182
//    }
182
    private static File getCacheDir() {
183
        String nbuser = System.getProperty("netbeans.user"); //XXX // NOI18N
184
        File cache = new File(nbuser, "var/cache/cnd/manpages"); // NOI18N
185
186
        cache.mkdirs();
187
188
        return cache;
189
    }
190
191
    private static File getCacheFile(String name, int chapter, String platformName) {
183
    private static File getCacheFile(String name, int chapter, String platformName) {
192
        // name might look like "operator /=", so we need to escape it
184
        // name might look like "operator /=", so we need to escape it
193
        String safeName;
185
        String safeName;
 Lines 197-203    Link Here 
197
            // UTF-8 should always be supported, but anyway...
189
            // UTF-8 should always be supported, but anyway...
198
            safeName = name;
190
            safeName = name;
199
        }
191
        }
200
        return new File(getCacheDir(), safeName + "." + platformName + "." + chapter); // NOI18N
192
        return Places.getCacheSubfile("cnd/manpages/" + safeName + "." + platformName + "." + chapter); // NOI18N
201
    }
193
    }
202
194
203
    static NativeProject getNativeProject(CsmFile csmFile) {
195
    static NativeProject getNativeProject(CsmFile csmFile) {
(-)a/cnd.repository/nbproject/project.xml (+8 lines)
 Lines 23-28    Link Here 
23
                    </run-dependency>
23
                    </run-dependency>
24
                </dependency>
24
                </dependency>
25
                <dependency>
25
                <dependency>
26
                    <code-name-base>org.openide.modules</code-name-base>
27
                    <build-prerequisite/>
28
                    <compile-dependency/>
29
                    <run-dependency>
30
                        <specification-version>7.25</specification-version>
31
                    </run-dependency>
32
                </dependency>
33
                <dependency>
26
                    <code-name-base>org.openide.util</code-name-base>
34
                    <code-name-base>org.openide.util</code-name-base>
27
                    <build-prerequisite/>
35
                    <build-prerequisite/>
28
                    <compile-dependency/>
36
                    <compile-dependency/>
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/disk/StorageAllocator.java (-23 / +12 lines)
 Lines 50-55    Link Here 
50
import java.util.Map;
50
import java.util.Map;
51
import java.util.concurrent.ConcurrentHashMap;
51
import java.util.concurrent.ConcurrentHashMap;
52
import org.netbeans.modules.cnd.repository.testbench.Stats;
52
import org.netbeans.modules.cnd.repository.testbench.Stats;
53
import org.openide.modules.Places;
53
54
54
/**
55
/**
55
 *
56
 *
 Lines 57-76    Link Here 
57
 */
58
 */
58
public class StorageAllocator {
59
public class StorageAllocator {
59
    private final static StorageAllocator instance = new StorageAllocator();
60
    private final static StorageAllocator instance = new StorageAllocator();
60
    private String diskRepositoryPath;
61
    private final File diskRepository;
61
    
62
    
62
    private StorageAllocator() {
63
    private StorageAllocator() {
63
        diskRepositoryPath = System.getProperty("cnd.repository.cache.path");
64
        String diskRepositoryPath = System.getProperty("cnd.repository.cache.path");
64
        if (diskRepositoryPath == null) {
65
        if (diskRepositoryPath != null) {
65
            diskRepositoryPath = System.getProperty("netbeans.user") + //NOI18N
66
            diskRepository = new File(diskRepositoryPath);
66
                                 File.separator + "var" + File.separator + "cache" +  //NOI18N
67
        } else {
67
                                 File.separator + "cnd" + File.separator + "model";  //NOI18N
68
            diskRepository = Places.getCacheSubdirectory("cnd/model"); // NOI18N
68
            // create directory if needed
69
            File diskRepositoryFile = new File(diskRepositoryPath);
70
            if (!diskRepositoryFile.exists()) {
71
                diskRepositoryFile.mkdirs();
72
            }
73
            diskRepositoryPath = diskRepositoryFile.getAbsolutePath();
74
        }
69
        }
75
    };
70
    };
76
    
71
    
 Lines 80-89    Link Here 
80
    
75
    
81
    private Map<CharSequence, String> unit2path = new ConcurrentHashMap<CharSequence, String>();
76
    private Map<CharSequence, String> unit2path = new ConcurrentHashMap<CharSequence, String>();
82
    
77
    
83
    public String getCachePath() {
84
        return diskRepositoryPath;
85
    }
86
    
87
    public String reduceString (String name) {
78
    public String reduceString (String name) {
88
        if (name.length() > 128) {
79
        if (name.length() > 128) {
89
            int hashCode = name.hashCode();
80
            int hashCode = name.hashCode();
 Lines 105-113    Link Here 
105
            
96
            
106
            prefix = reduceString(prefix);
97
            prefix = reduceString(prefix);
107
            
98
            
108
            path = getCachePath() + File.separator + prefix + File.separator; // NOI18N
99
            File pathFile = new File(diskRepository, prefix);
109
            
100
110
            File pathFile = new File (path);
101
            path = pathFile + File.separator;
111
            
102
            
112
            if (!pathFile.exists()) {
103
            if (!pathFile.exists()) {
113
                pathFile.mkdirs();
104
                pathFile.mkdirs();
 Lines 151-158    Link Here 
151
        }
142
        }
152
    }
143
    }
153
    public void cleanRepositoryCaches() {
144
    public void cleanRepositoryCaches() {
154
        File repositoryPath = new File(diskRepositoryPath);
145
        deleteDirectory(diskRepository, false);
155
        deleteDirectory(repositoryPath, false);
156
    }
146
    }
157
147
158
    /**
148
    /**
 Lines 160-167    Link Here 
160
     * have not been modified within last 2 weeks are considered outdated.
150
     * have not been modified within last 2 weeks are considered outdated.
161
     */
151
     */
162
    public void purgeCaches() {
152
    public void purgeCaches() {
163
        File repositoryDir = new File(diskRepositoryPath);
153
        File[] unitDirs = diskRepository.listFiles();
164
        File[] unitDirs = repositoryDir.listFiles();
165
        if (unitDirs != null && 0 < unitDirs.length) {
154
        if (unitDirs != null && 0 < unitDirs.length) {
166
            long now = System.currentTimeMillis();
155
            long now = System.currentTimeMillis();
167
            for (File unitDir : unitDirs) {
156
            for (File unitDir : unitDirs) {
(-)a/cnd.repository/src/org/netbeans/modules/cnd/repository/translator/RepositoryTranslatorImpl.java (-6 / +4 lines)
 Lines 68-73    Link Here 
68
import org.netbeans.modules.cnd.repository.disk.StorageAllocator;
68
import org.netbeans.modules.cnd.repository.disk.StorageAllocator;
69
import org.netbeans.modules.cnd.repository.testbench.Stats;
69
import org.netbeans.modules.cnd.repository.testbench.Stats;
70
import org.netbeans.modules.cnd.repository.util.IntToStringCache;
70
import org.netbeans.modules.cnd.repository.util.IntToStringCache;
71
import org.openide.modules.Places;
71
import org.openide.util.CharSequences;
72
import org.openide.util.CharSequences;
72
73
73
/**
74
/**
 Lines 116-125    Link Here 
116
    private static boolean loaded = false;
117
    private static boolean loaded = false;
117
    private static final int DEFAULT_VERSION_OF_PERSISTENCE_MECHANIZM = 0;
118
    private static final int DEFAULT_VERSION_OF_PERSISTENCE_MECHANIZM = 0;
118
    private static int version = DEFAULT_VERSION_OF_PERSISTENCE_MECHANIZM;
119
    private static int version = DEFAULT_VERSION_OF_PERSISTENCE_MECHANIZM;
119
    private final static String MASTER_INDEX_FILE_NAME = System.getProperty("netbeans.user") + //NOI18N
120
    private final static File MASTER_INDEX_FILE = Places.getCacheSubfile("cnd/model/index"); // NOI18N
120
            File.separator + "var" + File.separator + "cache" + //NOI18N
121
            File.separator + "cnd" + File.separator + "model" + //NOI18N
122
            File.separator + "index"; //NOI18N
123
    private final static String PROJECT_INDEX_FILE_NAME = "project-index"; //NOI18N
121
    private final static String PROJECT_INDEX_FILE_NAME = "project-index"; //NOI18N
124
122
125
    /** Creates a new instance of RepositoryTranslatorImpl */
123
    /** Creates a new instance of RepositoryTranslatorImpl */
 Lines 344-350    Link Here 
344
        InputStream bis = null;
342
        InputStream bis = null;
345
        DataInputStream dis = null;
343
        DataInputStream dis = null;
346
        try {
344
        try {
347
            fis = new FileInputStream(MASTER_INDEX_FILE_NAME);
345
            fis = new FileInputStream(MASTER_INDEX_FILE);
348
            bis = new BufferedInputStream(fis);
346
            bis = new BufferedInputStream(fis);
349
            dis = new DataInputStream(bis);
347
            dis = new DataInputStream(bis);
350
            readMasterIndex(dis);
348
            readMasterIndex(dis);
 Lines 379-385    Link Here 
379
        DataOutputStream dos = null;
377
        DataOutputStream dos = null;
380
378
381
        try {
379
        try {
382
            fos = new FileOutputStream(MASTER_INDEX_FILE_NAME, false);
380
            fos = new FileOutputStream(MASTER_INDEX_FILE, false);
383
            bos = new BufferedOutputStream(fos);
381
            bos = new BufferedOutputStream(fos);
384
            dos = new DataOutputStream(bos);
382
            dos = new DataOutputStream(bos);
385
            writeUnitsCache(dos);
383
            writeUnitsCache(dos);
(-)a/core.browser.xulrunner/nbproject/project.xml (-1 / +1 lines)
 Lines 103-109    Link Here 
103
                    <build-prerequisite/>
103
                    <build-prerequisite/>
104
                    <compile-dependency/>
104
                    <compile-dependency/>
105
                    <run-dependency>
105
                    <run-dependency>
106
                        <specification-version>7.11</specification-version>
106
                        <specification-version>7.25</specification-version>
107
                    </run-dependency>
107
                    </run-dependency>
108
                </dependency>
108
                </dependency>
109
                <dependency>
109
                <dependency>
(-)a/core.browser.xulrunner/src/org/netbeans/core/browser/xulrunner/BrowserManager.java (-11 / +2 lines)
 Lines 53-60    Link Here 
53
import javax.swing.event.ChangeListener;
53
import javax.swing.event.ChangeListener;
54
import org.mozilla.browser.MozillaConfig;
54
import org.mozilla.browser.MozillaConfig;
55
import org.netbeans.core.IDESettings;
55
import org.netbeans.core.IDESettings;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.modules.InstalledFileLocator;
56
import org.openide.modules.InstalledFileLocator;
57
import org.openide.modules.Places;
58
import org.openide.util.ChangeSupport;
58
import org.openide.util.ChangeSupport;
59
import org.openide.util.NbPreferences;
59
import org.openide.util.NbPreferences;
60
60
 Lines 157-172    Link Here 
157
    }
157
    }
158
158
159
    private void initProfileDir() {
159
    private void initProfileDir() {
160
        File profileDir;
160
        MozillaConfig.setProfileDir(Places.getCacheSubdirectory("mozillaprofilev1")); // NOI18N
161
        String userDir = System.getProperty("netbeans.user"); // NOI18N
162
        if (userDir != null) {
163
            profileDir = new File(new File(new File (userDir, "var"), "cache"), "mozillaprofilev1"); // NOI18N
164
        } else {
165
            profileDir = FileUtil.toFile(FileUtil.getConfigRoot());
166
            profileDir = new File(profileDir, "mozillaprofilev1"); // NOI18N
167
        }
168
        profileDir.mkdirs();
169
        MozillaConfig.setProfileDir(profileDir);
170
    }
161
    }
171
162
172
    private static class Holder {
163
    private static class Holder {
(-)a/core.netigso/nbproject/project.xml (-1 / +1 lines)
 Lines 80-86    Link Here 
80
                    <build-prerequisite/>
80
                    <build-prerequisite/>
81
                    <compile-dependency/>
81
                    <compile-dependency/>
82
                    <run-dependency>
82
                    <run-dependency>
83
                        <specification-version>7.8</specification-version>
83
                        <specification-version>7.25</specification-version>
84
                    </run-dependency>
84
                    </run-dependency>
85
                </dependency>
85
                </dependency>
86
                <dependency>
86
                <dependency>
(-)a/core.netigso/src/org/netbeans/core/netigso/Netigso.java (-6 / +2 lines)
 Lines 66-71    Link Here 
66
import org.netbeans.ProxyClassLoader;
66
import org.netbeans.ProxyClassLoader;
67
import org.netbeans.Stamps;
67
import org.netbeans.Stamps;
68
import org.openide.modules.ModuleInfo;
68
import org.openide.modules.ModuleInfo;
69
import org.openide.modules.Places;
69
import org.openide.util.Lookup;
70
import org.openide.util.Lookup;
70
import org.openide.util.lookup.ServiceProvider;
71
import org.openide.util.lookup.ServiceProvider;
71
import org.openide.util.lookup.ServiceProviders;
72
import org.openide.util.lookup.ServiceProviders;
 Lines 312-323    Link Here 
312
313
313
    private File getNetigsoCache() throws IllegalStateException {
314
    private File getNetigsoCache() throws IllegalStateException {
314
        // Explicitly specify the directory to use for caching bundles.
315
        // Explicitly specify the directory to use for caching bundles.
315
        String ud = System.getProperty("netbeans.user");
316
        return Places.getCacheSubdirectory("netigso");
316
        if (ud == null) {
317
            throw new IllegalStateException();
318
        }
319
        File udf = new File(ud);
320
        return new File(new File(new File(udf, "var"), "cache"), "netigso");
321
    }
317
    }
322
318
323
    private void deleteRec(File dir) {
319
    private void deleteRec(File dir) {
(-)a/core.startup/nbproject/project.xml (-1 / +1 lines)
 Lines 71-77    Link Here 
71
                    <build-prerequisite/>
71
                    <build-prerequisite/>
72
                    <compile-dependency/>
72
                    <compile-dependency/>
73
                    <run-dependency>
73
                    <run-dependency>
74
                        <specification-version>7.19</specification-version>
74
                        <specification-version>7.25</specification-version>
75
                    </run-dependency>
75
                    </run-dependency>
76
                </dependency>
76
                </dependency>
77
                <dependency>
77
                <dependency>
(-)a/core.startup/src/org/netbeans/core/startup/Bundle.properties (-1 / +1 lines)
 Lines 102-108    Link Here 
102
102
103
# error messages
103
# error messages
104
ERR_UIExpected=UI class name expected, using default UI...
104
ERR_UIExpected=UI class name expected, using default UI...
105
ERR_UserDirExpected=Directory expected after --userdir switch
105
ERR_UserDirExpected=Directory expected after --userdir or --cachedir switch
106
ERR_UINotFound=UI class not found, using default UI...
106
ERR_UINotFound=UI class not found, using default UI...
107
ERR_FontSizeExpected=Font size expected, using default font size...
107
ERR_FontSizeExpected=Font size expected, using default font size...
108
ERR_BadFontSize=Bad format of the font size, using default font size...
108
ERR_BadFontSize=Bad format of the font size, using default font size...
(-)a/core.startup/src/org/netbeans/core/startup/CLIOptions.java (-1 / +12 lines)
 Lines 51-56    Link Here 
51
import java.util.MissingResourceException;
51
import java.util.MissingResourceException;
52
import org.netbeans.CLIHandler;
52
import org.netbeans.CLIHandler;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
54
import org.openide.modules.Places;
54
import org.openide.util.NbBundle;
55
import org.openide.util.NbBundle;
55
56
56
/**
57
/**
 Lines 133-139    Link Here 
133
            } else if (isOption (args[i], "userdir")) { // NOI18N
134
            } else if (isOption (args[i], "userdir")) { // NOI18N
134
                args[i] = null;
135
                args[i] = null;
135
                try {
136
                try {
136
                    System.setProperty ("netbeans.user", args[++i]);
137
                    String v = args[++i];
138
                    Places.setUserDirectory(v.equals(/*Places.MEMORY*/"memory") ? null : FileUtil.normalizeFile(new File(v)));
139
                } catch(ArrayIndexOutOfBoundsException e) {
140
                    System.err.println(getString("ERR_UserDirExpected"));
141
                    return 2;
142
                }
143
            } else if (isOption(args[i], "cachedir")) { // NOI18N
144
                args[i] = null;
145
                try {
146
                    Places.setCacheDirectory(FileUtil.normalizeFile(new File(args[++i])));
137
                } catch(ArrayIndexOutOfBoundsException e) {
147
                } catch(ArrayIndexOutOfBoundsException e) {
138
                    System.err.println(getString("ERR_UserDirExpected"));
148
                    System.err.println(getString("ERR_UserDirExpected"));
139
                    return 2;
149
                    return 2;
 Lines 236-241    Link Here 
236
        w.println("  --fontsize <size>     set the base font size of the user interface, in points");
246
        w.println("  --fontsize <size>     set the base font size of the user interface, in points");
237
        w.println("  --locale <language[:country[:variant]]> use specified locale");
247
        w.println("  --locale <language[:country[:variant]]> use specified locale");
238
        w.println("  --userdir <path>      use specified directory to store user settings");
248
        w.println("  --userdir <path>      use specified directory to store user settings");
249
        w.println("  --cachedir <path>     use specified directory to store user cache");
239
        w.println("  --nosplash            do not show the splash screen");
250
        w.println("  --nosplash            do not show the splash screen");
240
        w.println("");
251
        w.println("");
241
//   \  --branding <token>    use specified branding (- for default)
252
//   \  --branding <token>    use specified branding (- for default)
(-)a/core.startup/src/org/netbeans/core/startup/InstalledFileLocatorImpl.java (-1 / +2 lines)
 Lines 66-71    Link Here 
66
import org.netbeans.Util;
66
import org.netbeans.Util;
67
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.FileUtil;
68
import org.openide.modules.InstalledFileLocator;
68
import org.openide.modules.InstalledFileLocator;
69
import org.openide.modules.Places;
69
import org.openide.util.lookup.ServiceProvider;
70
import org.openide.util.lookup.ServiceProvider;
70
71
71
/**
72
/**
 Lines 82-88    Link Here 
82
    private final File[] dirs;
83
    private final File[] dirs;
83
    public InstalledFileLocatorImpl() {
84
    public InstalledFileLocatorImpl() {
84
        List<File> _dirs = new ArrayList<File>();
85
        List<File> _dirs = new ArrayList<File>();
85
        addDir(_dirs, System.getProperty("netbeans.user"));
86
        addDir(_dirs, System.getProperty(Places.USER_DIR_PROP));
86
        String nbdirs = System.getProperty("netbeans.dirs"); // #27151
87
        String nbdirs = System.getProperty("netbeans.dirs"); // #27151
87
        if (nbdirs != null) {
88
        if (nbdirs != null) {
88
            StringTokenizer tok = new StringTokenizer(nbdirs, File.pathSeparator);
89
            StringTokenizer tok = new StringTokenizer(nbdirs, File.pathSeparator);
(-)a/core.startup/src/org/netbeans/core/startup/ModuleLifecycleManager.java (-1 / +2 lines)
 Lines 49-54    Link Here 
49
import org.netbeans.TopSecurityManager;
49
import org.netbeans.TopSecurityManager;
50
import org.netbeans.core.startup.layers.SessionManager;
50
import org.netbeans.core.startup.layers.SessionManager;
51
import org.openide.LifecycleManager;
51
import org.openide.LifecycleManager;
52
import org.openide.modules.Places;
52
import org.openide.util.Exceptions;
53
import org.openide.util.Exceptions;
53
import org.openide.util.lookup.ServiceProvider;
54
import org.openide.util.lookup.ServiceProvider;
54
55
 Lines 98-104    Link Here 
98
        if (!TopSecurityManager.class.getClassLoader().getClass().getName().endsWith(".Launcher$AppClassLoader")) {
99
        if (!TopSecurityManager.class.getClassLoader().getClass().getName().endsWith(".Launcher$AppClassLoader")) {
99
            throw new UnsupportedOperationException("not running in regular module system, cannot restart"); // NOI18N
100
            throw new UnsupportedOperationException("not running in regular module system, cannot restart"); // NOI18N
100
        }
101
        }
101
        String userdir = System.getProperty("netbeans.user"); // NOI18N
102
        File userdir = Places.getUserDirectory();
102
        if (userdir == null) {
103
        if (userdir == null) {
103
            throw new UnsupportedOperationException("no userdir"); // NOI18N
104
            throw new UnsupportedOperationException("no userdir"); // NOI18N
104
        }
105
        }
(-)a/core.startup/src/org/netbeans/core/startup/TopLogging.java (-5 / +7 lines)
 Lines 87-92    Link Here 
87
import java.util.regex.PatternSyntaxException;
87
import java.util.regex.PatternSyntaxException;
88
import org.netbeans.TopSecurityManager;
88
import org.netbeans.TopSecurityManager;
89
import org.openide.filesystems.FileUtil;
89
import org.openide.filesystems.FileUtil;
90
import org.openide.modules.Places;
90
import org.openide.util.Lookup;
91
import org.openide.util.Lookup;
91
import org.openide.util.LookupEvent;
92
import org.openide.util.LookupEvent;
92
import org.openide.util.LookupListener;
93
import org.openide.util.LookupListener;
 Lines 186-197    Link Here 
186
    public static void initializeQuietly() {
187
    public static void initializeQuietly() {
187
        initialize(false);
188
        initialize(false);
188
    }
189
    }
189
    private static String previousUser;
190
    private static File previousUser;
190
    static final void initialize() {
191
    static final void initialize() {
191
        initialize(true);
192
        initialize(true);
192
    }
193
    }
193
    private static void initialize(boolean verbose) {
194
    private static void initialize(boolean verbose) {
194
        if (previousUser == null || previousUser.equals(System.getProperty("netbeans.user"))) {
195
        if (previousUser == null || previousUser.equals(Places.getUserDirectory())) {
195
            // useful from tests
196
            // useful from tests
196
            streamHandler = null;
197
            streamHandler = null;
197
            defaultHandler = null;
198
            defaultHandler = null;
 Lines 307-312    Link Here 
307
        ps.println("  Current Directory       = " + System.getProperty("user.dir", "unknown"));
308
        ps.println("  Current Directory       = " + System.getProperty("user.dir", "unknown"));
308
        ps.print(  "  User Directory          = "); // NOI18N
309
        ps.print(  "  User Directory          = "); // NOI18N
309
        ps.println(CLIOptions.getUserDir()); // NOI18N
310
        ps.println(CLIOptions.getUserDir()); // NOI18N
311
        ps.println("  Cache Directory         = " + Places.getCacheDirectory()); // NOI18N
310
        ps.print(  "  Installation            = "); // NOI18N
312
        ps.print(  "  Installation            = "); // NOI18N
311
        for (File cluster : clusters) {
313
        for (File cluster : clusters) {
312
            ps.print(cluster + "\n                            "); // NOI18N
314
            ps.print(cluster + "\n                            "); // NOI18N
 Lines 393-402    Link Here 
393
    private static synchronized NonClose defaultHandler() {
395
    private static synchronized NonClose defaultHandler() {
394
        if (defaultHandler != null) return defaultHandler;
396
        if (defaultHandler != null) return defaultHandler;
395
397
396
        String home = System.getProperty("netbeans.user");
398
        File home = Places.getUserDirectory();
397
        if (home != null && !"memory".equals(home) && !CLIOptions.noLogging) {
399
        if (home != null && !CLIOptions.noLogging) {
398
            try {
400
            try {
399
                File dir = new File(new File(new File(home), "var"), "log");
401
                File dir = new File(new File(home, "var"), "log");
400
                dir.mkdirs ();
402
                dir.mkdirs ();
401
                File f = new File(dir, "messages.log");
403
                File f = new File(dir, "messages.log");
402
                File f1 = new File(dir, "messages.log.1");
404
                File f1 = new File(dir, "messages.log.1");
(-)a/core.startup/test/unit/src/org/netbeans/core/startup/CLIOptionsTest.java (-1 / +3 lines)
 Lines 43-49    Link Here 
43
 */
43
 */
44
package org.netbeans.core.startup;
44
package org.netbeans.core.startup;
45
45
46
import java.io.File;
46
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.openide.filesystems.FileUtil;
47
import org.openide.util.Utilities;
49
import org.openide.util.Utilities;
48
50
49
/**
51
/**
 Lines 104-110    Link Here 
104
        assertFalse("-userdir is not supported", "wrong".equals(System.getProperty("netbeans.user")));
106
        assertFalse("-userdir is not supported", "wrong".equals(System.getProperty("netbeans.user")));
105
        
107
        
106
        new CLIOptions().cli(new String[] { "--userdir", "correct" });
108
        new CLIOptions().cli(new String[] { "--userdir", "correct" });
107
        assertTrue("--userdir is supported", "correct".equals(System.getProperty("netbeans.user")));
109
        assertEquals("--userdir is supported", FileUtil.normalizeFile(new File("correct")).getAbsolutePath(), System.getProperty("netbeans.user"));
108
        
110
        
109
        if (orig != null) {
111
        if (orig != null) {
110
            System.setProperty("netbeans.user", orig);
112
            System.setProperty("netbeans.user", orig);
(-)a/core.startup/test/unit/src/org/netbeans/core/startup/ModuleListTest.java (-6 / +4 lines)
 Lines 71-76    Link Here 
71
import org.openide.filesystems.FileUtil;
71
import org.openide.filesystems.FileUtil;
72
import org.openide.filesystems.LocalFileSystem;
72
import org.openide.filesystems.LocalFileSystem;
73
import org.openide.modules.InstalledFileLocator;
73
import org.openide.modules.InstalledFileLocator;
74
import org.openide.modules.Places;
74
import org.openide.util.test.MockLookup;
75
import org.openide.util.test.MockLookup;
75
76
76
/** Test the functions of the module list, i.e. finding modules on
77
/** Test the functions of the module list, i.e. finding modules on
 Lines 79-86    Link Here 
79
 */
80
 */
80
public class ModuleListTest extends SetupHid {
81
public class ModuleListTest extends SetupHid {
81
    
82
    
82
    private File ud;
83
    
84
    private static final String PREFIX = "wherever/";
83
    private static final String PREFIX = "wherever/";
85
    private LocalFileSystem fs;
84
    private LocalFileSystem fs;
86
    
85
    
 Lines 110-118    Link Here 
110
109
111
        MockLookup.setInstances(new IFL());
110
        MockLookup.setInstances(new IFL());
112
111
113
        ud = new File(getWorkDir(), "ud");
112
        File ud = new File(getWorkDir(), "ud");
114
        ud.mkdirs();
113
        Places.setUserDirectory(ud);
115
        System.setProperty("netbeans.user", ud.getPath());
116
        
114
        
117
        MockModuleInstaller installer = new MockModuleInstaller();
115
        MockModuleInstaller installer = new MockModuleInstaller();
118
        MockEvents ev = new MockEvents();
116
        MockEvents ev = new MockEvents();
 Lines 204-210    Link Here 
204
        Stamps.getModulesJARs().flush(0);
202
        Stamps.getModulesJARs().flush(0);
205
        Stamps.getModulesJARs().shutdown();
203
        Stamps.getModulesJARs().shutdown();
206
        
204
        
207
        File f = new File(new File(new File(System.getProperty("netbeans.user"), "var"), "cache"), "all-modules.dat");
205
        File f = Places.getCacheSubfile("all-modules.dat");
208
        assertTrue("Cache exists", f.exists());
206
        assertTrue("Cache exists", f.exists());
209
207
210
        FileObject mf = fs.findResource(modulesfolder.getPath());
208
        FileObject mf = fs.findResource(modulesfolder.getPath());
(-)a/core.startup/test/unit/src/org/netbeans/core/startup/NbInstallerTest9.java (-2 / +3 lines)
 Lines 52-57    Link Here 
52
import java.util.jar.Manifest;
52
import java.util.jar.Manifest;
53
import org.netbeans.ModuleInstaller;
53
import org.netbeans.ModuleInstaller;
54
import org.netbeans.Stamps;
54
import org.netbeans.Stamps;
55
import org.openide.modules.Places;
55
56
56
/** Test the NetBeans module installer implementation.
57
/** Test the NetBeans module installer implementation.
57
 * Broken into pieces to ensure each runs in its own VM.
58
 * Broken into pieces to ensure each runs in its own VM.
 Lines 66-72    Link Here 
66
    /** Test #26786/#28755: manifest caching can be buggy.
67
    /** Test #26786/#28755: manifest caching can be buggy.
67
     */
68
     */
68
    public void testManifestCaching() throws Exception {
69
    public void testManifestCaching() throws Exception {
69
        System.setProperty("netbeans.user", getWorkDirPath());
70
        Places.setUserDirectory(getWorkDir());
70
        ModuleInstaller inst = new org.netbeans.core.startup.NbInstaller(new MockEvents());
71
        ModuleInstaller inst = new org.netbeans.core.startup.NbInstaller(new MockEvents());
71
        File littleJar = new File(jars, "little-manifest.jar");
72
        File littleJar = new File(jars, "little-manifest.jar");
72
        //inst.loadManifest(littleJar).write(System.out);
73
        //inst.loadManifest(littleJar).write(System.out);
 Lines 76-82    Link Here 
76
        File bigJar = new File(jars, "big-manifest.jar");
77
        File bigJar = new File(jars, "big-manifest.jar");
77
        assertEquals(getManifest(bigJar), inst.loadManifest(bigJar));
78
        assertEquals(getManifest(bigJar), inst.loadManifest(bigJar));
78
        Stamps.getModulesJARs().shutdown();
79
        Stamps.getModulesJARs().shutdown();
79
        File allManifestsDat = new File(new File(new File(getWorkDir(), "var"), "cache"), "all-manifest.dat");
80
        File allManifestsDat = Places.getCacheSubfile("all-manifest.dat");
80
        assertTrue("File " + allManifestsDat + " exists", allManifestsDat.isFile());
81
        assertTrue("File " + allManifestsDat + " exists", allManifestsDat.isFile());
81
        // Create a new NbInstaller, since otherwise it turns off caching...
82
        // Create a new NbInstaller, since otherwise it turns off caching...
82
        inst = new org.netbeans.core.startup.NbInstaller(new MockEvents());
83
        inst = new org.netbeans.core.startup.NbInstaller(new MockEvents());
(-)a/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java (-1 / +3 lines)
 Lines 200-205    Link Here 
200
import org.netbeans.spi.java.classpath.ClassPathProvider;
200
import org.netbeans.spi.java.classpath.ClassPathProvider;
201
import org.openide.loaders.DataObject;
201
import org.openide.loaders.DataObject;
202
import org.openide.loaders.DataObjectNotFoundException;
202
import org.openide.loaders.DataObjectNotFoundException;
203
import org.openide.modules.Places;
203
import org.openide.util.test.MockLookup;
204
import org.openide.util.test.MockLookup;
204
205
205
/**
206
/**
 Lines 218-224    Link Here 
218
        super.setUp();
219
        super.setUp();
219
220
220
        clearWorkDir();
221
        clearWorkDir();
221
        System.setProperty("netbeans.user", getWorkDirPath());
222
        Places.setUserDirectory(getWorkDir());
223
        // XXX are the following four lines actually necessary?
222
        final FileObject wd = FileUtil.toFileObject(getWorkDir());
224
        final FileObject wd = FileUtil.toFileObject(getWorkDir());
223
        assert wd != null;
225
        assert wd != null;
224
        FileObject cache = FileUtil.createFolder(wd, "var/cache");
226
        FileObject cache = FileUtil.createFolder(wd, "var/cache");
(-)a/dlight.remote.impl/nbproject/project.xml (+8 lines)
 Lines 89-94    Link Here 
89
                    </run-dependency>
89
                    </run-dependency>
90
                </dependency>
90
                </dependency>
91
                <dependency>
91
                <dependency>
92
                    <code-name-base>org.openide.modules</code-name-base>
93
                    <build-prerequisite/>
94
                    <compile-dependency/>
95
                    <run-dependency>
96
                        <specification-version>7.25</specification-version>
97
                    </run-dependency>
98
                </dependency>
99
                <dependency>
92
                    <code-name-base>org.openide.util</code-name-base>
100
                    <code-name-base>org.openide.util</code-name-base>
93
                    <build-prerequisite/>
101
                    <build-prerequisite/>
94
                    <compile-dependency/>
102
                    <compile-dependency/>
(-)a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/FileSystemCacheProviderImpl.java (-2 / +2 lines)
 Lines 45-50    Link Here 
45
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
45
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
46
import org.netbeans.modules.nativeexecution.api.util.EnvUtils;
46
import org.netbeans.modules.nativeexecution.api.util.EnvUtils;
47
import org.netbeans.modules.remote.spi.FileSystemCacheProvider;
47
import org.netbeans.modules.remote.spi.FileSystemCacheProvider;
48
import org.openide.modules.Places;
48
import org.openide.util.lookup.ServiceProvider;
49
import org.openide.util.lookup.ServiceProvider;
49
50
50
/**
51
/**
 Lines 58-64    Link Here 
58
    protected String getCacheImpl(ExecutionEnvironment executionEnvironment) {
59
    protected String getCacheImpl(ExecutionEnvironment executionEnvironment) {
59
        String hostId = EnvUtils.toHostID(executionEnvironment);
60
        String hostId = EnvUtils.toHostID(executionEnvironment);
60
        String userId = executionEnvironment.getUser();
61
        String userId = executionEnvironment.getUser();
61
        String root = System.getProperty("netbeans.user") == null ? null : System.getProperty("netbeans.user").replace('\\', '/') + "/var/cache/remote-files/"; //NOI18N;
62
        return Places.getCacheSubdirectory("remote-files").getAbsolutePath().replace('\\', '/') + '/' + hostId + '_' + userId + '/'; // NOI18N
62
        return (root == null) ? null : root + hostId + '_' + userId + '/';
63
    }
63
    }
64
}
64
}
(-)a/dlight.remote/src/org/netbeans/modules/remote/spi/FileSystemCacheProvider.java (+1 lines)
 Lines 58-63    Link Here 
58
58
59
    protected abstract String getCacheImpl(ExecutionEnvironment executionEnvironment);
59
    protected abstract String getCacheImpl(ExecutionEnvironment executionEnvironment);
60
60
61
    // XXX reconsider API - why not File? why /-separated on Windows?
61
    public static String getCacheRoot(ExecutionEnvironment executionEnvironment) {
62
    public static String getCacheRoot(ExecutionEnvironment executionEnvironment) {
62
        FileSystemCacheProvider provider = Lookup.getDefault().lookup(FileSystemCacheProvider.class);
63
        FileSystemCacheProvider provider = Lookup.getDefault().lookup(FileSystemCacheProvider.class);
63
        RemoteLogger.assertTrue(provider != null, "No FileSystemCacheProvider found"); // NOI18N
64
        RemoteLogger.assertTrue(provider != null, "No FileSystemCacheProvider found"); // NOI18N
(-)a/java.source.ant/nbproject/project.xml (+8 lines)
 Lines 119-124    Link Here 
119
                    </run-dependency>
119
                    </run-dependency>
120
                </dependency>
120
                </dependency>
121
                <dependency>
121
                <dependency>
122
                    <code-name-base>org.openide.modules</code-name-base>
123
                    <build-prerequisite/>
124
                    <compile-dependency/>
125
                    <run-dependency>
126
                        <specification-version>7.25</specification-version>
127
                    </run-dependency>
128
                </dependency>
129
                <dependency>
122
                    <code-name-base>org.openide.nodes</code-name-base>
130
                    <code-name-base>org.openide.nodes</code-name-base>
123
                    <build-prerequisite/>
131
                    <build-prerequisite/>
124
                    <compile-dependency/>
132
                    <compile-dependency/>
(-)a/java.source.ant/src/org/netbeans/modules/java/source/ant/ProjectRunnerImpl.java (-29 / +2 lines)
 Lines 80-85    Link Here 
80
import org.openide.filesystems.FileObject;
80
import org.openide.filesystems.FileObject;
81
import org.openide.filesystems.FileStateInvalidException;
81
import org.openide.filesystems.FileStateInvalidException;
82
import org.openide.filesystems.FileUtil;
82
import org.openide.filesystems.FileUtil;
83
import org.openide.modules.Places;
83
import org.openide.util.ChangeSupport;
84
import org.openide.util.ChangeSupport;
84
import org.openide.util.Exceptions;
85
import org.openide.util.Exceptions;
85
import org.openide.util.NbBundle;
86
import org.openide.util.NbBundle;
 Lines 384-390    Link Here 
384
385
385
        URL thisClassSource = ProjectRunnerImpl.class.getProtectionDomain().getCodeSource().getLocation();
386
        URL thisClassSource = ProjectRunnerImpl.class.getProtectionDomain().getCodeSource().getLocation();
386
        File jarFile = FileUtil.archiveOrDirForURL(thisClassSource);
387
        File jarFile = FileUtil.archiveOrDirForURL(thisClassSource);
387
        File scriptFile = new File(getCacheFolder(), actionName + ".xml");
388
        File scriptFile = Places.getCacheSubfile("executor-snippets/" + actionName + ".xml");
388
        
389
        
389
        if (!scriptFile.canRead() || (jarFile != null && jarFile.lastModified() > scriptFile.lastModified())) {
390
        if (!scriptFile.canRead() || (jarFile != null && jarFile.lastModified() > scriptFile.lastModified())) {
390
            try {
391
            try {
 Lines 404-437    Link Here 
404
        return FileUtil.toFileObject(scriptFile);
405
        return FileUtil.toFileObject(scriptFile);
405
    }
406
    }
406
407
407
    private static final String NB_USER_DIR = "netbeans.user";   //NOI18N
408
    private static final String SNIPPETS_CACHE_DIR = "var"+File.separatorChar+"cache"+File.separatorChar+"executor-snippets";    //NOI18N
409
410
411
    private static String getNbUserDir () {
412
        final String nbUserProp = System.getProperty(NB_USER_DIR);
413
        return nbUserProp;
414
    }
415
416
    private static File cacheFolder;
417
418
    private static synchronized File getCacheFolder () {
419
        if (cacheFolder == null) {
420
            final String nbUserDirProp = getNbUserDir();
421
            assert nbUserDirProp != null;
422
            final File nbUserDir = new File (nbUserDirProp);
423
            cacheFolder = FileUtil.normalizeFile(new File (nbUserDir, SNIPPETS_CACHE_DIR));
424
            if (!cacheFolder.exists()) {
425
                boolean created = cacheFolder.mkdirs();
426
                assert created : "Cannot create cache folder";  //NOI18N
427
            }
428
            else {
429
                assert cacheFolder.isDirectory() && cacheFolder.canRead() && cacheFolder.canWrite();
430
            }
431
        }
432
        return cacheFolder;
433
    }
434
435
    private static void copyFile(URLConnection source, FileObject target) throws IOException {
408
    private static void copyFile(URLConnection source, FileObject target) throws IOException {
436
        InputStream ins = null;
409
        InputStream ins = null;
437
        OutputStream out = null;
410
        OutputStream out = null;
(-)a/languages/nbproject/project.xml (-1 / +1 lines)
 Lines 161-167    Link Here 
161
                    <build-prerequisite/>
161
                    <build-prerequisite/>
162
                    <compile-dependency/>
162
                    <compile-dependency/>
163
                    <run-dependency>
163
                    <run-dependency>
164
                        <specification-version>6.4</specification-version>
164
                        <specification-version>7.25</specification-version>
165
                    </run-dependency>
165
                    </run-dependency>
166
                </dependency>
166
                </dependency>
167
                <dependency>
167
                <dependency>
(-)a/languages/src/org/netbeans/modules/languages/features/Index.java (-11 / +2 lines)
 Lines 70-75    Link Here 
70
import org.netbeans.modules.languages.Utils;
70
import org.netbeans.modules.languages.Utils;
71
import org.openide.filesystems.FileObject;
71
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileUtil;
72
import org.openide.filesystems.FileUtil;
73
import org.openide.modules.Places;
73
import org.openide.util.Exceptions;
74
import org.openide.util.Exceptions;
74
75
75
76
 Lines 197-213    Link Here 
197
    
198
    
198
    private static synchronized File getCacheFolder () {
199
    private static synchronized File getCacheFolder () {
199
        if (cacheFolder == null) {
200
        if (cacheFolder == null) {
200
            String userDir = System.getProperty ("netbeans.user");
201
            cacheFolder = Places.getCacheSubdirectory("sindex/1.0");
201
            assert userDir != null;
202
            String cacheDir = userDir + File.separatorChar + 
203
                "var" + File.separatorChar + "cache" + File.separatorChar + 
204
                "sindex" + File.separatorChar + "1.0";
205
            cacheFolder = FileUtil.normalizeFile (new File (cacheDir));
206
            if (!cacheFolder.exists ()) {
207
                boolean created = cacheFolder.mkdirs ();                
208
                assert created : "Cannot create cache folder";  //NOI18N
209
            } else
210
                assert cacheFolder.isDirectory () && cacheFolder.canRead () && cacheFolder.canWrite ();
211
        }
202
        }
212
        return cacheFolder;
203
        return cacheFolder;
213
    }
204
    }
(-)a/maven.indexer/nbproject/project.xml (-1 / +1 lines)
 Lines 124-130    Link Here 
124
                    <build-prerequisite/>
124
                    <build-prerequisite/>
125
                    <compile-dependency/>
125
                    <compile-dependency/>
126
                    <run-dependency>
126
                    <run-dependency>
127
                        <specification-version>7.7</specification-version>
127
                        <specification-version>7.25</specification-version>
128
                    </run-dependency>
128
                    </run-dependency>
129
                </dependency>
129
                </dependency>
130
                <dependency>
130
                <dependency>
(-)a/maven.indexer/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImpl.java (-13 / +2 lines)
 Lines 51-57    Link Here 
51
import org.codehaus.plexus.util.FileUtils;
51
import org.codehaus.plexus.util.FileUtils;
52
import java.util.Map;
52
import java.util.Map;
53
import org.apache.lucene.document.Document;
53
import org.apache.lucene.document.Document;
54
import org.netbeans.api.annotations.common.SuppressWarnings;
55
import org.netbeans.modules.maven.indexer.api.QueryField;
54
import org.netbeans.modules.maven.indexer.api.QueryField;
56
import org.netbeans.modules.maven.indexer.api.NBVersionInfo;
55
import org.netbeans.modules.maven.indexer.api.NBVersionInfo;
57
import java.io.File;
56
import java.io.File;
 Lines 163-168    Link Here 
163
import org.openide.awt.StatusDisplayer;
162
import org.openide.awt.StatusDisplayer;
164
import org.openide.filesystems.FileObject;
163
import org.openide.filesystems.FileObject;
165
import org.openide.filesystems.FileUtil;
164
import org.openide.filesystems.FileUtil;
165
import org.openide.modules.Places;
166
import org.openide.util.Exceptions;
166
import org.openide.util.Exceptions;
167
import org.openide.util.Lookup;
167
import org.openide.util.Lookup;
168
import org.openide.util.Mutex;
168
import org.openide.util.Mutex;
 Lines 179-185    Link Here 
179
public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementation,
179
public class NexusRepositoryIndexerImpl implements RepositoryIndexerImplementation,
180
        BaseQueries, ChecksumQueries, ArchetypeQueries, DependencyInfoQueries,
180
        BaseQueries, ChecksumQueries, ArchetypeQueries, DependencyInfoQueries,
181
        ClassesQuery, ClassUsageQuery, GenericFindQuery, ContextLoadedQuery {
181
        ClassesQuery, ClassUsageQuery, GenericFindQuery, ContextLoadedQuery {
182
    private static final String MAVENINDEX_PATH = "mavenindex";
183
182
184
    private PlexusContainer embedder;
183
    private PlexusContainer embedder;
185
    private ArtifactRepository repository;
184
    private ArtifactRepository repository;
 Lines 760-777    Link Here 
760
        repo.fireChangeIndex();
759
        repo.fireChangeIndex();
761
    }
760
    }
762
761
763
    @SuppressWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE") // if mkdirs fails, indexing will just fail later anyway
764
    private File getDefaultIndexLocation() {
762
    private File getDefaultIndexLocation() {
765
        String userdir = System.getProperty("netbeans.user"); //NOI18N
763
        return Places.getCacheSubdirectory("mavenindex");
766
        File cacheDir;
767
        if (userdir != null) {
768
            cacheDir = new File(new File(new File(userdir, "var"), "cache"), MAVENINDEX_PATH);//NOI18N
769
        } else {
770
            File root = FileUtil.toFile(FileUtil.getConfigRoot());
771
            cacheDir = new File(root, MAVENINDEX_PATH);//NOI18N
772
        }
773
        cacheDir.mkdirs();
774
        return cacheDir;
775
    }
764
    }
776
765
777
    @Override
766
    @Override
(-)a/maven.indexer/test/unit/src/org/netbeans/modules/maven/indexer/NexusRepositoryIndexerImplTest.java (-1 / +2 lines)
 Lines 57-62    Link Here 
57
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
57
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
58
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
58
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
59
import org.netbeans.modules.maven.indexer.spi.ClassUsageQuery.ClassUsageResult;
59
import org.netbeans.modules.maven.indexer.spi.ClassUsageQuery.ClassUsageResult;
60
import org.openide.modules.Places;
60
import org.openide.util.test.JarBuilder;
61
import org.openide.util.test.JarBuilder;
61
import org.openide.util.test.TestFileUtils;
62
import org.openide.util.test.TestFileUtils;
62
63
 Lines 74-80    Link Here 
74
    
75
    
75
    @Override protected void setUp() throws Exception {
76
    @Override protected void setUp() throws Exception {
76
        clearWorkDir();
77
        clearWorkDir();
77
        System.setProperty("netbeans.user", getWorkDirPath());
78
        Places.setUserDirectory(getWorkDir());
78
        File repo = new File(getWorkDir(), "repo");
79
        File repo = new File(getWorkDir(), "repo");
79
        embedder = EmbedderFactory.getProjectEmbedder();
80
        embedder = EmbedderFactory.getProjectEmbedder();
80
        defaultArtifactRepository = embedder.lookupComponent(ArtifactRepositoryFactory.class).createArtifactRepository("test", repo.toURI().toString(), "default", null, null);
81
        defaultArtifactRepository = embedder.lookupComponent(ArtifactRepositoryFactory.class).createArtifactRepository("test", repo.toURI().toString(), "default", null, null);
(-)a/maven/nbproject/project.xml (-1 / +1 lines)
 Lines 332-338    Link Here 
332
                    <build-prerequisite/>
332
                    <build-prerequisite/>
333
                    <compile-dependency/>
333
                    <compile-dependency/>
334
                    <run-dependency>
334
                    <run-dependency>
335
                        <specification-version>7.7</specification-version>
335
                        <specification-version>7.25</specification-version>
336
                    </run-dependency>
336
                    </run-dependency>
337
                </dependency>
337
                </dependency>
338
                <dependency>
338
                <dependency>
(-)a/maven/src/org/netbeans/modules/maven/CacheDirProvider.java (-2 / +2 lines)
 Lines 42-53    Link Here 
42
42
43
package org.netbeans.modules.maven;
43
package org.netbeans.modules.maven;
44
44
45
import java.io.File;
46
import java.io.IOException;
45
import java.io.IOException;
47
import org.netbeans.api.annotations.common.SuppressWarnings;
46
import org.netbeans.api.annotations.common.SuppressWarnings;
48
import org.netbeans.spi.project.CacheDirectoryProvider;
47
import org.netbeans.spi.project.CacheDirectoryProvider;
49
import org.openide.filesystems.FileObject;
48
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileUtil;
49
import org.openide.filesystems.FileUtil;
50
import org.openide.modules.Places;
51
51
52
/**
52
/**
53
 * implementation of CacheDirectoryProvider that places the cache directory in the user
53
 * implementation of CacheDirectoryProvider that places the cache directory in the user
 Lines 64-70    Link Here 
64
    @SuppressWarnings("RV_ABSOLUTE_VALUE_OF_HASHCODE") // for compatibility, use this decimal scheme
64
    @SuppressWarnings("RV_ABSOLUTE_VALUE_OF_HASHCODE") // for compatibility, use this decimal scheme
65
    public @Override FileObject getCacheDirectory() throws IOException {
65
    public @Override FileObject getCacheDirectory() throws IOException {
66
        int code = Math.abs(project.getProjectDirectory().getPath().hashCode());
66
        int code = Math.abs(project.getProjectDirectory().getPath().hashCode());
67
        return FileUtil.createFolder(FileUtil.createFolder(new File(System.getProperty("netbeans.user"))), "var/cache/mavencachedirs/" + code); // NOI18N
67
        return FileUtil.createFolder(Places.getCacheSubdirectory("mavencachedirs/" + code)); // NOI18N
68
    }
68
    }
69
69
70
}
70
}
(-)a/maven/src/org/netbeans/modules/maven/ProjectOpenedHookImpl.java (-5 / +2 lines)
 Lines 73-78    Link Here 
73
import org.netbeans.modules.maven.options.MavenSettings;
73
import org.netbeans.modules.maven.options.MavenSettings;
74
import org.netbeans.spi.project.ui.ProjectOpenedHook;
74
import org.netbeans.spi.project.ui.ProjectOpenedHook;
75
import org.openide.filesystems.FileUtil;
75
import org.openide.filesystems.FileUtil;
76
import org.openide.modules.Places;
76
import org.openide.util.Exceptions;
77
import org.openide.util.Exceptions;
77
import org.openide.util.NbBundle;
78
import org.openide.util.NbBundle;
78
import org.openide.util.RequestProcessor;
79
import org.openide.util.RequestProcessor;
 Lines 199-209    Link Here 
199
        }
200
        }
200
    }
201
    }
201
    private boolean existsDefaultIndexLocation() {
202
    private boolean existsDefaultIndexLocation() {
202
        String userdir = System.getProperty("netbeans.user"); //NOI18N
203
        File cacheDir = new File(Places.getCacheDirectory(), "mavenindex");//NOI18N
203
        if (userdir == null) {
204
            return false; // from a unit test
205
        }
206
        File cacheDir = new File(new File(new File(userdir, "var"), "cache"), "mavenindex");//NOI18N
207
        return cacheDir.exists() && cacheDir.isDirectory();
204
        return cacheDir.exists() && cacheDir.isDirectory();
208
    }
205
    }
209
    private boolean checkDiff(String repoid, long amount) {
206
    private boolean checkDiff(String repoid, long amount) {
(-)a/o.n.bootstrap/arch.xml (-5 lines)
 Lines 499-509    Link Here 
499
                </api>
499
                </api>
500
            </li>
500
            </li>
501
            <li>
501
            <li>
502
                <api type="export" group="systemproperty" name="netbeans.user" category="devel">
503
                    NetBeans user directory.
504
                </api>
505
            </li>
506
            <li>
507
                <api type="export" group="systemproperty" name="netbeans.dirs" category="friend">
502
                <api type="export" group="systemproperty" name="netbeans.dirs" category="friend">
508
                    Additional secondary NetBeans installation directories, if <a
503
                    Additional secondary NetBeans installation directories, if <a
509
                    href="http://www.netbeans.org/issues/show_bug.cgi?id=27151">applicable</a>.
504
                    href="http://www.netbeans.org/issues/show_bug.cgi?id=27151">applicable</a>.
(-)a/o.n.bootstrap/nbproject/project.xml (-1 / +1 lines)
 Lines 54-60    Link Here 
54
                    <build-prerequisite/>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
55
                    <compile-dependency/>
56
                    <run-dependency>
56
                    <run-dependency>
57
                        <specification-version>7.19</specification-version>
57
                        <specification-version>7.25</specification-version>
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
(-)a/o.n.bootstrap/src/org/netbeans/CLIHandler.java (-3 / +4 lines)
 Lines 74-79    Link Here 
74
import java.util.Random;
74
import java.util.Random;
75
import java.util.logging.Level;
75
import java.util.logging.Level;
76
import java.util.logging.Logger;
76
import java.util.logging.Logger;
77
import org.openide.modules.Places;
77
import org.openide.util.RequestProcessor;
78
import org.openide.util.RequestProcessor;
78
import org.openide.util.Task;
79
import org.openide.util.Task;
79
80
 Lines 523-535    Link Here 
523
        }
524
        }
524
        
525
        
525
        // get the value
526
        // get the value
526
        String home = System.getProperty("netbeans.user"); // NOI18N
527
        String home = System.getProperty(Places.USER_DIR_PROP); // NOI18N
527
        if (home == null) {
528
        if (home == null) {
528
            home = System.getProperty("user.home"); // NOI18N
529
            home = System.getProperty("user.home"); // NOI18N
529
            System.setProperty ("netbeans.user", home); // NOI18N
530
            System.setProperty(Places.USER_DIR_PROP, home); // NOI18N
530
        }
531
        }
531
    
532
    
532
        if ("memory".equals(home)) { // NOI18N
533
        if (/*Places.MEMORY*/"memory".equals(home)) { // NOI18N
533
            int execCode = processInitLevelCLI(args, handlers, failOnUnknownOptions);
534
            int execCode = processInitLevelCLI(args, handlers, failOnUnknownOptions);
534
            return new Status(execCode);
535
            return new Status(execCode);
535
        }
536
        }
(-)a/o.n.bootstrap/src/org/netbeans/Stamps.java (-25 / +13 lines)
 Lines 68-73    Link Here 
68
import java.util.concurrent.atomic.AtomicReference;
68
import java.util.concurrent.atomic.AtomicReference;
69
import java.util.logging.Level;
69
import java.util.logging.Level;
70
import java.util.logging.Logger;
70
import java.util.logging.Logger;
71
import org.openide.modules.Places;
71
import org.openide.util.Exceptions;
72
import org.openide.util.Exceptions;
72
73
73
/**
74
/**
 Lines 164-182    Link Here 
164
        return asByteBuffer(cache, true, false);
165
        return asByteBuffer(cache, true, false);
165
    }
166
    }
166
    final File file(String cache, int[] len) {
167
    final File file(String cache, int[] len) {
167
        String ud = getUserDir();
168
        if (ud == null) {
169
            LOG.log(Level.FINE, "No userdir when asking for {0}", cache); // NOI18N
170
            return null;
171
        }
172
        synchronized (this) {
168
        synchronized (this) {
173
            if (worker.isProcessing(cache)) {
169
            if (worker.isProcessing(cache)) {
174
                LOG.log(Level.FINE, "Worker processing when asking for {0}", cache); // NOI18N
170
                LOG.log(Level.FINE, "Worker processing when asking for {0}", cache); // NOI18N
175
                return null;
171
                return null;
176
            }
172
            }
177
        }
173
        }
178
        
174
179
        File cacheFile = new File(new File(new File(ud, "var"), "cache"), cache.replace('/', File.separatorChar)); // NOI18N
175
        File cacheFile = Places.getCacheSubfile(cache);
180
        long last = cacheFile.lastModified();
176
        long last = cacheFile.lastModified();
181
        if (last <= 0) {
177
        if (last <= 0) {
182
            LOG.log(Level.FINE, "Cache does not exist when asking for {0}", cache); // NOI18N
178
            LOG.log(Level.FINE, "Cache does not exist when asking for {0}", cache); // NOI18N
 Lines 265-271    Link Here 
265
    }
261
    }
266
    
262
    
267
    private static void discardCachesImpl(AtomicLong al) {
263
    private static void discardCachesImpl(AtomicLong al) {
268
        String user = getUserDir();
264
        File user = Places.getUserDirectory();
269
        long now = System.currentTimeMillis();
265
        long now = System.currentTimeMillis();
270
        if (user != null) {
266
        if (user != null) {
271
            File f = new File(user, ".lastModified");
267
            File f = new File(user, ".lastModified");
 Lines 316-326    Link Here 
316
    // This will be called externally from a launcher.
312
    // This will be called externally from a launcher.
317
    //
313
    //
318
314
319
    private static String getUserDir() {
320
        String ud = System.getProperty("netbeans.user"); // NOI18N
321
        return "memory".equals(ud) ? null : ud;
322
    }
323
324
    private static AtomicLong stamp(boolean checkStampFile) {
315
    private static AtomicLong stamp(boolean checkStampFile) {
325
        AtomicLong result = new AtomicLong();
316
        AtomicLong result = new AtomicLong();
326
        AtomicReference<File> newestFile = new AtomicReference<File>();
317
        AtomicReference<File> newestFile = new AtomicReference<File>();
 Lines 348-362    Link Here 
348
                }
339
                }
349
            }
340
            }
350
        }
341
        }
351
        String user = getUserDir();
342
        File user = Places.getUserDirectory();
352
        if (user != null) {
343
        if (user != null) {
353
            AtomicInteger crc = new AtomicInteger();
344
            AtomicInteger crc = new AtomicInteger();
354
            stampForCluster (new File (user), result, newestFile, new HashSet<File> (), false, false, crc);
345
            stampForCluster(user, result, newestFile, new HashSet<File>(), false, false, crc);
355
            sb.append(user).append('=').append(result.longValue()).append('\n');
346
            sb.append(user).append('=').append(result.longValue()).append('\n');
356
            sb.append("crc=").append(crc.intValue()).append('\n');
347
            sb.append("crc=").append(crc.intValue()).append('\n');
357
            
348
            
358
            File userDir = new File(user);
349
            File checkSum = new File(Places.getCacheDirectory(), "lastModified/all-checksum.txt");
359
            File checkSum = new File(new File(new File(new File(userDir, "var"), "cache"), "lastModified"), "all-checksum.txt");
360
            if (!compareAndUpdateFile(checkSum, sb.toString(), result)) {
350
            if (!compareAndUpdateFile(checkSum, sb.toString(), result)) {
361
                discardCachesImpl(result);
351
                discardCachesImpl(result);
362
            }
352
            }
 Lines 376-385    Link Here 
376
            }
366
            }
377
            return time;
367
            return time;
378
        }
368
        }
379
        String user = getUserDir();
369
        if (Places.getUserDirectory() != null) {
380
        if (user != null) {
370
            stamp = new File(new File(Places.getCacheDirectory(), "lastModified"), clusterLocalStamp(cluster));
381
            File userDir = new File(user);
382
            stamp = new File(new File(new File(new File(userDir, "var"), "cache"), "lastModified"), clusterLocalStamp(cluster));
383
            if (checkStampFile && (time = stamp.lastModified()) > 0) {
371
            if (checkStampFile && (time = stamp.lastModified()) > 0) {
384
                if (time > result.longValue()) {
372
                if (time > result.longValue()) {
385
                    newestFile.set(stamp);
373
                    newestFile.set(stamp);
 Lines 568-579    Link Here 
568
        public boolean store(AtomicInteger delay) {
556
        public boolean store(AtomicInteger delay) {
569
            assert os == null;
557
            assert os == null;
570
            
558
            
571
            String ud = getUserDir();
559
            File cacheDir = Places.getCacheDirectory();
572
            if (ud == null) {
560
            if (!cacheDir.isDirectory()) {
573
                LOG.warning("No 'netbeans.user' property to store: " + cache); // NOI18N
561
                LOG.log(Level.WARNING, "Nonexistent cache directory: {0}", cacheDir); // NOI18N
574
                return false;
562
                return false;
575
            }
563
            }
576
            File cacheFile = new File(new File(new File(ud, "var"), "cache"), cache); // NOI18N
564
            File cacheFile = new File(cacheDir, cache); // NOI18N
577
            boolean delete = false;
565
            boolean delete = false;
578
            try {
566
            try {
579
                LOG.log(Level.FINE, "Cleaning cache {0}", cacheFile);
567
                LOG.log(Level.FINE, "Cleaning cache {0}", cacheFile);
(-)a/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java (-1 / +3 lines)
 Lines 65-70    Link Here 
65
import java.util.logging.Level;
65
import java.util.logging.Level;
66
import java.util.logging.Logger;
66
import java.util.logging.Logger;
67
import java.util.logging.LoggingPermission;
67
import java.util.logging.LoggingPermission;
68
import org.openide.modules.Places;
68
import org.openide.util.Lookup;
69
import org.openide.util.Lookup;
69
70
70
/** NetBeans security manager implementation.
71
/** NetBeans security manager implementation.
 Lines 271-277    Link Here 
271
                }
272
                }
272
            }
273
            }
273
        }
274
        }
274
        if ("netbeans.home".equals(x)) { // NOI18N
275
        if ("netbeans.home".equals(x) || Places.USER_DIR_PROP.equals(x)) { // NOI18N
275
            // Control access to this system property.
276
            // Control access to this system property.
276
            for (Class<?> c : getClassContext()) {
277
            for (Class<?> c : getClassContext()) {
277
                if (c != TopSecurityManager.class &&
278
                if (c != TopSecurityManager.class &&
 Lines 299-304    Link Here 
299
    private final Set<String> warnedClassesNDE = new HashSet<String>(25);
300
    private final Set<String> warnedClassesNDE = new HashSet<String>(25);
300
    private static final Set<String> warnedClassesNH = new HashSet<String>(25);
301
    private static final Set<String> warnedClassesNH = new HashSet<String>(25);
301
    static {
302
    static {
303
        warnedClassesNH.add("org.openide.modules.Places");
302
        warnedClassesNH.add("org.netbeans.MainImpl"); // NOI18N
304
        warnedClassesNH.add("org.netbeans.MainImpl"); // NOI18N
303
        warnedClassesNH.add("org.netbeans.Stamps"); // NOI18N
305
        warnedClassesNH.add("org.netbeans.Stamps"); // NOI18N
304
        warnedClassesNH.add("org.netbeans.core.startup.InstalledFileLocatorImpl"); // NOI18N
306
        warnedClassesNH.add("org.netbeans.core.startup.InstalledFileLocatorImpl"); // NOI18N
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/StampsExtraTest.java (-4 / +3 lines)
 Lines 47-52    Link Here 
47
import java.util.logging.Level;
47
import java.util.logging.Level;
48
import java.util.logging.Logger;
48
import java.util.logging.Logger;
49
import org.netbeans.junit.NbTestCase;
49
import org.netbeans.junit.NbTestCase;
50
import org.openide.modules.Places;
50
51
51
/**
52
/**
52
 *
53
 *
 Lines 77-83    Link Here 
77
        
78
        
78
        System.setProperty("netbeans.home", platform.getPath());
79
        System.setProperty("netbeans.home", platform.getPath());
79
        System.setProperty("netbeans.dirs", ide.getPath() + File.pathSeparator + extra.getPath());
80
        System.setProperty("netbeans.dirs", ide.getPath() + File.pathSeparator + extra.getPath());
80
        System.setProperty("netbeans.user", userdir.getPath());
81
        Places.setUserDirectory(userdir);
81
82
82
        touch(platform, ".lastModified", 50000L);
83
        touch(platform, ".lastModified", 50000L);
83
        touch(ide, ".lastModified", 90000L);
84
        touch(ide, ".lastModified", 90000L);
 Lines 103-111    Link Here 
103
        CountingSecurityManager.assertCounts("Just few accesses to installation", 6);
104
        CountingSecurityManager.assertCounts("Just few accesses to installation", 6);
104
        assertEquals("Stamps are the same", stamp, newStamp);
105
        assertEquals("Stamps are the same", stamp, newStamp);
105
106
106
        File lastModifiedDir = new File(new File(new File(userdir, "var"), "cache"), "lastModified");
107
        assertFalse("File has not been created for non-existing cluster", Places.getCacheSubfile("lastModified/extra").canRead());
107
        File extraLM = new File(lastModifiedDir, "extra");
108
        assertFalse("File has not been created for non-existing cluster", extraLM.canRead());
109
108
110
        extra.mkdirs();
109
        extra.mkdirs();
111
        File lastModified = new File(extra, ".lastModified");
110
        File lastModified = new File(extra, ".lastModified");
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/StampsIdeLessThanPlatformTest.java (-4 / +3 lines)
 Lines 47-57    Link Here 
47
import java.io.FileInputStream;
47
import java.io.FileInputStream;
48
import java.io.FileReader;
48
import java.io.FileReader;
49
import java.io.IOException;
49
import java.io.IOException;
50
import java.util.Enumeration;
51
import java.util.Properties;
52
import java.util.logging.Level;
50
import java.util.logging.Level;
53
import java.util.logging.Logger;
51
import java.util.logging.Logger;
54
import org.netbeans.junit.NbTestCase;
52
import org.netbeans.junit.NbTestCase;
53
import org.openide.modules.Places;
55
54
56
/**
55
/**
57
 *
56
 *
 Lines 85-91    Link Here 
85
        
84
        
86
        System.setProperty("netbeans.home", platform.getPath());
85
        System.setProperty("netbeans.home", platform.getPath());
87
        System.setProperty("netbeans.dirs", ide.getPath() + File.pathSeparator + nonexist.getPath());
86
        System.setProperty("netbeans.dirs", ide.getPath() + File.pathSeparator + nonexist.getPath());
88
        System.setProperty("netbeans.user", userdir.getPath());
87
        Places.setUserDirectory(userdir);
89
        
88
        
90
        StampsTest.createModule("org.openide.awt", platform, 50000L);
89
        StampsTest.createModule("org.openide.awt", platform, 50000L);
91
        StampsTest.createModule("org.openide.nodes", platform, 60000L);
90
        StampsTest.createModule("org.openide.nodes", platform, 60000L);
 Lines 110-116    Link Here 
110
        StampsTest.assertStamp(-1L, userdir, false, false);
109
        StampsTest.assertStamp(-1L, userdir, false, false);
111
110
112
111
113
        File checkSum = new File(new File(new File(new File(userdir, "var"), "cache"), "lastModified"), "all-checksum.txt");
112
        File checkSum = Places.getCacheSubfile("lastModified/all-checksum.txt");
114
        assertTrue("Checksum created" , checkSum.isFile());
113
        assertTrue("Checksum created" , checkSum.isFile());
115
114
116
        byte[] arr = new byte[30000];
115
        byte[] arr = new byte[30000];
(-)a/o.n.core/nbproject/project.xml (-1 / +1 lines)
 Lines 144-150    Link Here 
144
                    <build-prerequisite/>
144
                    <build-prerequisite/>
145
                    <compile-dependency/>
145
                    <compile-dependency/>
146
                    <run-dependency>
146
                    <run-dependency>
147
                        <specification-version>7.19</specification-version>
147
                        <specification-version>7.25</specification-version>
148
                    </run-dependency>
148
                    </run-dependency>
149
                </dependency>
149
                </dependency>
150
                <dependency>
150
                <dependency>
(-)a/o.n.core/src/org/netbeans/core/actions/LogAction.java (-5 / +5 lines)
 Lines 47-52    Link Here 
47
import java.io.File;
47
import java.io.File;
48
import java.util.logging.Level;
48
import java.util.logging.Level;
49
import java.util.logging.Logger;
49
import java.util.logging.Logger;
50
import org.openide.modules.Places;
50
import org.openide.util.actions.CallableSystemAction;
51
import org.openide.util.actions.CallableSystemAction;
51
import org.openide.util.HelpCtx;
52
import org.openide.util.HelpCtx;
52
import org.openide.util.NbBundle;
53
import org.openide.util.NbBundle;
 Lines 61-72    Link Here 
61
62
62
63
63
    public void performAction() {
64
    public void performAction() {
64
        // FIXME This may not be used this way anymore.
65
        File userDir = Places.getUserDirectory();
65
        String userDir = System.getProperty("netbeans.user");
66
        if (userDir == null) {
66
	if (userDir == null)
67
            return;
67
            return;
68
        // FIXME the same as above
68
        }
69
	File f = new File(userDir + "/var/log/messages.log"); // TEMP
69
        File f = new File(userDir, "/var/log/messages.log");
70
        LogViewerSupport p = new LogViewerSupport(f, NbBundle.getMessage(LogAction.class, "MSG_ShortLogTab_name"));
70
        LogViewerSupport p = new LogViewerSupport(f, NbBundle.getMessage(LogAction.class, "MSG_ShortLogTab_name"));
71
	try {
71
	try {
72
            p.showLogViewer();
72
            p.showLogViewer();
(-)a/o.n.core/src/org/netbeans/core/ui/Bundle.properties (-2 lines)
 Lines 41-48    Link Here 
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
# Product Information panel
43
# Product Information panel
44
LBL_Description=<div style\="font-size: 12pt; font-family: Verdana, 'Verdana CE',  Arial, 'Arial CE', 'Lucida Grande CE', lucida, 'Helvetica CE', sans-serif;">\
45
    <p style=\"margin: 0\"><b>Product Version\:</b> {0}</p>\n <p style=\"margin: 0\"><b>Java\:</b> {1}; {2}</p>\n <p style=\"margin: 0\"><b>System\:</b> {3}; {4}; {5}</p>\n <p style=\"margin: 0\"><b>Userdir:</b> {6}</p></div>
46
LBL_Copyright=<div style="font-size: 12pt; font-family: Verdana, 'Verdana CE',  Arial, 'Arial CE', 'Lucida Grande CE', lucida, 'Helvetica CE', sans-serif;">\
44
LBL_Copyright=<div style="font-size: 12pt; font-family: Verdana, 'Verdana CE',  Arial, 'Arial CE', 'Lucida Grande CE', lucida, 'Helvetica CE', sans-serif;">\
47
    NetBeans IDE and NetBeans Platform are based on software from netbeans.org, \
45
    NetBeans IDE and NetBeans Platform are based on software from netbeans.org, \
48
    which has been dual licensed under the Common Development and Distribution License (CDDL) \
46
    which has been dual licensed under the Common Development and Distribution License (CDDL) \
(-)a/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java (-3 / +20 lines)
 Lines 68-86    Link Here 
68
import org.openide.awt.HtmlBrowser;
68
import org.openide.awt.HtmlBrowser;
69
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.modules.Places;
71
import org.openide.util.NbBundle;
72
import org.openide.util.NbBundle;
73
import static org.netbeans.core.ui.Bundle.*;
74
import org.openide.util.NbBundle.Messages;
72
75
73
public class ProductInformationPanel extends JPanel implements HyperlinkListener {
76
public class ProductInformationPanel extends JPanel implements HyperlinkListener {
74
77
75
    URL url = null;
78
    URL url = null;
76
    Icon about;
79
    Icon about;
77
    
80
    
81
    @Messages({
82
        "# {0} - product version",
83
        "# {1} - Java version",
84
        "# {2} - VM version",
85
        "# {3} - OS",
86
        "# {4} - encoding",
87
        "# {5} - locale",
88
        "# {6} - user dir",
89
        "# {7} - cache dir",
90
        "LBL_description=<div style=\"font-size: 12pt; font-family: Verdana, 'Verdana CE',  Arial, 'Arial CE', 'Lucida Grande CE', lucida, 'Helvetica CE', sans-serif;\">"
91
            + "<p style=\"margin: 0\"><b>Product Version:</b> {0}</p>\n "
92
            + "<p style=\"margin: 0\"><b>Java:</b> {1}; {2}</p>\n "
93
            + "<p style=\"margin: 0\"><b>System:</b> {3}; {4}; {5}</p>\n "
94
            + "<p style=\"margin: 0\"><b>User directory:</b> {6}</p>\n "
95
            + "<p style=\"margin: 0\"><b>Cache directory:</b> {7}</p></div>"
96
    })
78
    public ProductInformationPanel() {
97
    public ProductInformationPanel() {
79
        initComponents();
98
        initComponents();
80
        imageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
99
        imageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
81
        description.setText(org.openide.util.NbBundle.getMessage(ProductInformationPanel.class, 
100
        description.setText(LBL_description(getProductVersionValue(), getJavaValue(), getVMValue(), getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), Places.getCacheDirectory().getAbsolutePath()));
82
                "LBL_Description", new Object[] {getProductVersionValue(), getJavaValue(), getVMValue(), 
83
                getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue()}));
84
        description.setCaretPosition(0); // so that text is not scrolled down
101
        description.setCaretPosition(0); // so that text is not scrolled down
85
        description.addHyperlinkListener(this);
102
        description.addHyperlinkListener(this);
86
        copyright.addHyperlinkListener(this);
103
        copyright.addHyperlinkListener(this);
(-)a/openide.modules/apichanges.xml (+20 lines)
 Lines 50-55    Link Here 
50
  	<apidef name="modules">Modules API</apidef>
50
  	<apidef name="modules">Modules API</apidef>
51
  </apidefs>
51
  </apidefs>
52
<changes>
52
<changes>
53
    <change id="Places">
54
        <api name="modules"/>
55
        <summary>Added <code>Places</code></summary>
56
        <version major="7" minor="25"/>
57
        <date day="4" month="8" year="2011"/>
58
        <author login="jglick"/>
59
        <compatibility>
60
            <p>
61
                Modules using system properties such as <code>netbeans.user</code>
62
                should use this new API instead.
63
            </p>
64
        </compatibility>
65
        <description>
66
            <p>
67
                Introduced a structured API for accessing well-known file locations.
68
            </p>
69
        </description>
70
        <class package="org.openide.modules" name="Places"/>
71
        <issue number="57798"/>
72
    </change>
53
    <change id="Dependency.java.keywords">
73
    <change id="Dependency.java.keywords">
54
        <api name="modules"/>
74
        <api name="modules"/>
55
        <summary>Module names can contain Java keywords</summary>
75
        <summary>Module names can contain Java keywords</summary>
(-)a/openide.modules/manifest.mf (-1 / +1 lines)
 Lines 1-5    Link Here 
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.modules
2
OpenIDE-Module: org.openide.modules
3
OpenIDE-Module-Localizing-Bundle: org/openide/modules/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/modules/Bundle.properties
4
OpenIDE-Module-Specification-Version: 7.24
4
OpenIDE-Module-Specification-Version: 7.25
5
5
(-)a/openide.modules/src/org/openide/modules/Places.java (+158 lines)
Line 0    Link Here 
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
39
package org.openide.modules;
40
41
import java.io.File;
42
import java.util.logging.Level;
43
import java.util.logging.Logger;
44
45
/**
46
 * Provides access to standard file locations.
47
 * <div class="nonnormative">
48
 * This class should be used for limited purposes only. You might instead want to use:<ul>
49
 * <li><a href="@org-openide-filesystems@/org/openide/filesystems/FileUtil.html#getConfigFile(java.lang.String)"><code>FileUtil.getConfigFile</code></a>
50
 * to find a file declared in an XML layer or created or overridden in the {@code config} subdirectory of the user directory.
51
 * <li>{@link InstalledFileLocator} to find modules installed as part of an NBM.
52
 * <li>{@code someClass.getProtectionDomain().getCodeSource().getLocation()} to find resources inside a module class loader.
53
 * </ul>
54
 * </div>
55
 * @since 7.25
56
 */
57
public class Places {
58
59
    /**
60
     * System property key for {@link #getUserDirectory}.
61
     * Should not be used by most code directly.
62
     */
63
    public static final String USER_DIR_PROP = "netbeans.user";
64
65
    private static final String MEMORY = "memory";
66
67
    private static final Logger LOG = Logger.getLogger(Places.class.getName());
68
69
    private static File cacheDir;
70
71
    /**
72
     * Locates the NetBeans user directory.
73
     * This may be used to persist valuable files for which the system filesystem
74
     * ({@code FileUtil.getConfigFile}) is inappropriate due its being virtual.
75
     * Each module is responsible for using sufficiently unique filenames within this directory.
76
     * The system property {@link #USER_DIR_PROP} is used for compatibility.
77
     * @return a directory location (need not yet exist), or null if unconfigured
78
     */
79
    public static synchronized /*@CheckForNull*/ File getUserDirectory() {
80
        String p = System.getProperty(USER_DIR_PROP);
81
        return p != null && !p.equals(MEMORY) ? new File(p) : null;
82
    }
83
84
    /**
85
     * Configures the NetBeans user directory.
86
     * This would be called by startup code in the NetBeans Platform,
87
     * but might also be useful to call from a unit test if tested code calls {@link #getUserDirectory} or {@link #getCacheDirectory}.
88
     * @param dir a directory location (need not yet exist); null be passed but means the same as {@code memory} for the system property, interpreted by the module system
89
     */
90
    public static synchronized void setUserDirectory(/*@NullAllowed*/ File dir) {
91
        System.setProperty(USER_DIR_PROP, dir != null ? dir.getAbsolutePath() : MEMORY);
92
    }
93
94
    /**
95
     * Locates the NetBeans cache directory.
96
     * This may be used to store pure performance caches - files which could be safely deleted,
97
     * since they would be automatically recreated on demand.
98
     * Each module is responsible for using sufficiently unique filenames within this directory.
99
     * {@code $userdir/var/cache/} is used as a default when {@link #getUserDirectory} is configured.
100
     * As a final fallback, a location in the system temporary directory will be returned.
101
     * @return a directory location (never null but need not yet exist)
102
     * @see #getCacheSubdirectory
103
     * @see #getCacheSubfile
104
     */
105
    public static synchronized /*@NonNull*/ File getCacheDirectory() {
106
        if (cacheDir != null) {
107
            return cacheDir;
108
        }
109
        File userdir = getUserDirectory();
110
        if (userdir != null) {
111
            return new File(new File(userdir, "var"), "cache");
112
        }
113
        return new File(System.getProperty("java.io.tmpdir"), "nbcache");
114
    }
115
116
    /**
117
     * Convenience method to get a particular subdirectory within {@link #getCacheDirectory}.
118
     * The directory will be created if it does not yet exist (but a warning logged if permissions do not allow this).
119
     * @param path a subdirectory path such as {@code stuff} or {@code mymodule/stuff} ({@code /} permitted even on Windows)
120
     * @return a directory of that name within the general cache directory
121
     */
122
    public static /*@NonNull*/ File getCacheSubdirectory(String path) {
123
        File d = new File(getCacheDirectory(), path);
124
        if (!d.isDirectory() && !d.mkdirs()) {
125
            LOG.log(Level.WARNING, "could not create {0}", d);
126
        }
127
        return d;
128
    }
129
130
    /**
131
     * Convenience method to get a particular file within {@link #getCacheDirectory}.
132
     * The parent directory will be created if it does not yet exist (but a warning logged if permissions do not allow this);
133
     * the file itself will not be automatically created.
134
     * @param path a file path such as {@code stuff.ser} or {@code mymodule/stuff.ser} ({@code /} permitted even on Windows)
135
     * @return a file of that name within the general cache directory
136
     */
137
    public static /*@NonNull*/ File getCacheSubfile(String path) {
138
        File f = new File(getCacheDirectory(), path);
139
        File d = f.getParentFile();
140
        if (!d.isDirectory() && !d.mkdirs()) {
141
            LOG.log(Level.WARNING, "could not create {0}", d);
142
        }
143
        return f;
144
    }
145
146
    /**
147
     * Configures the NetBeans cache directory.
148
     * This would be called by startup code in the NetBeans Platform,
149
     * but might also be useful to call from a unit test if tested code calls {@link #getCacheDirectory}.
150
     * @param dir a directory location (need not yet exist)
151
     */
152
    public static synchronized void setCacheDirectory(/*@NonNull*/ File dir) {
153
        cacheDir = dir;
154
    }
155
156
    private Places() {}
157
158
}
(-)a/parsing.api/nbproject/project.xml (-1 / +1 lines)
 Lines 178-184    Link Here 
178
                    <build-prerequisite/>
178
                    <build-prerequisite/>
179
                    <compile-dependency/>
179
                    <compile-dependency/>
180
                    <run-dependency>
180
                    <run-dependency>
181
                        <specification-version>7.6</specification-version>
181
                        <specification-version>7.25</specification-version>
182
                    </run-dependency>
182
                    </run-dependency>
183
                </dependency>
183
                </dependency>
184
                <dependency>
184
                <dependency>
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/CacheFolder.java (-16 / +2 lines)
 Lines 59-64    Link Here 
59
import org.openide.filesystems.FileSystem;
59
import org.openide.filesystems.FileSystem;
60
import org.openide.filesystems.FileUtil;
60
import org.openide.filesystems.FileUtil;
61
import org.openide.filesystems.URLMapper;
61
import org.openide.filesystems.URLMapper;
62
import org.openide.modules.Places;
62
63
63
/**
64
/**
64
 *
65
 *
 Lines 68-75    Link Here 
68
69
69
    private static final Logger LOG = Logger.getLogger(CacheFolder.class.getName());
70
    private static final Logger LOG = Logger.getLogger(CacheFolder.class.getName());
70
    
71
    
71
    private static final String NB_USER_DIR = "netbeans.user";   //NOI18N
72
    private static final String INDEX_DIR = "var"+File.separatorChar+"cache"+File.separatorChar+"index";    //NOI18N
73
    private static final String SEGMENTS_FILE = "segments";      //NOI18N
72
    private static final String SEGMENTS_FILE = "segments";      //NOI18N
74
    private static final String SLICE_PREFIX = "s";              //NOI18N
73
    private static final String SLICE_PREFIX = "s";              //NOI18N
75
    
74
    
 Lines 198-217    Link Here 
198
197
199
    public static synchronized FileObject getCacheFolder () {
198
    public static synchronized FileObject getCacheFolder () {
200
        if (cacheFolder == null) {
199
        if (cacheFolder == null) {
201
            final String nbUserDirProp = System.getProperty(NB_USER_DIR);
200
            File cache = Places.getCacheSubdirectory("index"); // NOI18N
202
            if (nbUserDirProp == null) {
203
                throw new IllegalStateException("No " + NB_USER_DIR + " system property"); //NOI18N
204
            }
205
206
            final File nbUserDir = new File (nbUserDirProp);
207
            File cache = FileUtil.normalizeFile(new File (nbUserDir, INDEX_DIR));
208
            if (!cache.exists()) {
209
                cache.mkdirs();
210
                if (!cache.exists()) {
211
                    throw new IllegalStateException("Can't create indices cache folder " + cache.getAbsolutePath()); //NOI18N
212
                }
213
            }
214
215
            if (!cache.isDirectory()) {
201
            if (!cache.isDirectory()) {
216
                throw new IllegalStateException("Indices cache folder " + cache.getAbsolutePath() + " is not a folder"); //NOI18N
202
                throw new IllegalStateException("Indices cache folder " + cache.getAbsolutePath() + " is not a folder"); //NOI18N
217
            }
203
            }
(-)a/spellchecker/nbproject/project.xml (-1 / +1 lines)
 Lines 149-155    Link Here 
149
                    <build-prerequisite/>
149
                    <build-prerequisite/>
150
                    <compile-dependency/>
150
                    <compile-dependency/>
151
                    <run-dependency>
151
                    <run-dependency>
152
                        <specification-version>7.15</specification-version>
152
                        <specification-version>7.25</specification-version>
153
                    </run-dependency>
153
                    </run-dependency>
154
                </dependency>
154
                </dependency>
155
                <dependency>
155
                <dependency>
(-)a/spellchecker/src/org/netbeans/modules/spellchecker/TrieDictionary.java (-3 / +2 lines)
 Lines 69-74    Link Here 
69
import java.util.logging.Logger;
69
import java.util.logging.Logger;
70
import org.netbeans.modules.spellchecker.spi.dictionary.Dictionary;
70
import org.netbeans.modules.spellchecker.spi.dictionary.Dictionary;
71
import org.netbeans.modules.spellchecker.spi.dictionary.ValidityType;
71
import org.netbeans.modules.spellchecker.spi.dictionary.ValidityType;
72
import org.openide.modules.Places;
72
import org.openide.util.CharSequences;
73
import org.openide.util.CharSequences;
73
import org.openide.util.Exceptions;
74
import org.openide.util.Exceptions;
74
import org.openide.util.RequestProcessor;
75
import org.openide.util.RequestProcessor;
 Lines 225-234    Link Here 
225
226
226
    private static final int CURRENT_TRIE_DICTIONARY_VERSION = 1;
227
    private static final int CURRENT_TRIE_DICTIONARY_VERSION = 1;
227
228
228
    private static final File CACHE_DIR = new File(new File(new File(System.getProperty("netbeans.user"), "var"), "cache"), "dict");
229
230
    public static Dictionary getDictionary(String suffix, List<URL> sources) throws IOException {
229
    public static Dictionary getDictionary(String suffix, List<URL> sources) throws IOException {
231
        File trie = new File(CACHE_DIR, "dictionary" + suffix + ".trie" + CURRENT_TRIE_DICTIONARY_VERSION);
230
        File trie = Places.getCacheSubfile("dict/dictionary" + suffix + ".trie" + CURRENT_TRIE_DICTIONARY_VERSION);
232
        
231
        
233
        return getDictionary(trie, sources);
232
        return getDictionary(trie, sources);
234
    }
233
    }
(-)a/subversion/nbproject/project.xml (-1 / +1 lines)
 Lines 229-235    Link Here 
229
                    <build-prerequisite/>
229
                    <build-prerequisite/>
230
                    <compile-dependency/>
230
                    <compile-dependency/>
231
                    <run-dependency>
231
                    <run-dependency>
232
                        <specification-version>6.6</specification-version>
232
                        <specification-version>7.25</specification-version>
233
                    </run-dependency>
233
                    </run-dependency>
234
                </dependency>
234
                </dependency>
235
                <dependency>
235
                <dependency>
(-)a/subversion/src/org/netbeans/modules/subversion/DiskMapTurboProvider.java (-9 / +2 lines)
 Lines 48-58    Link Here 
48
import org.netbeans.modules.turbo.CacheIndex;
48
import org.netbeans.modules.turbo.CacheIndex;
49
import org.netbeans.modules.subversion.util.*;
49
import org.netbeans.modules.subversion.util.*;
50
import org.netbeans.modules.turbo.TurboProvider;
50
import org.netbeans.modules.turbo.TurboProvider;
51
import org.openide.filesystems.FileUtil;
52
import java.io.*;
51
import java.io.*;
53
import java.util.*;
52
import java.util.*;
54
import java.util.logging.Level;
53
import java.util.logging.Level;
55
import org.netbeans.modules.proxy.Base64Encoder;
54
import org.netbeans.modules.proxy.Base64Encoder;
55
import org.openide.modules.Places;
56
56
57
/**
57
/**
58
 * Storage of file attributes with shortcut to retrieve all stored values.
58
 * Storage of file attributes with shortcut to retrieve all stored values.
 Lines 481-494    Link Here 
481
    }
481
    }
482
482
483
    private void initCacheStore() {
483
    private void initCacheStore() {
484
        String userDir = System.getProperty("netbeans.user"); // NOI18N
484
        cacheStore = Places.getCacheSubdirectory(CACHE_DIRECTORY);
485
        if (userDir != null) {
486
            cacheStore = new File(new File(new File (userDir, "var"), "cache"), CACHE_DIRECTORY); // NOI18N
487
        } else {
488
            File cachedir = FileUtil.toFile(FileUtil.getConfigRoot());
489
            cacheStore = new File(cachedir, CACHE_DIRECTORY); // NOI18N
490
        }
491
        cacheStore.mkdirs();
492
    }
485
    }
493
486
494
    private static void copyStreams(OutputStream out, InputStream in, int len) throws IOException {
487
    private static void copyStreams(OutputStream out, InputStream in, int len) throws IOException {
(-)a/versioning.system.cvss/nbproject/project.xml (-1 / +1 lines)
 Lines 253-259    Link Here 
253
                    <build-prerequisite/>
253
                    <build-prerequisite/>
254
                    <compile-dependency/>
254
                    <compile-dependency/>
255
                    <run-dependency>
255
                    <run-dependency>
256
                        <specification-version>6.0</specification-version>
256
                        <specification-version>7.25</specification-version>
257
                    </run-dependency>
257
                    </run-dependency>
258
                </dependency>
258
                </dependency>
259
                <dependency>
259
                <dependency>
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/DiskMapTurboProvider.java (-8 / +2 lines)
 Lines 45-56    Link Here 
45
package org.netbeans.modules.versioning.system.cvss;
45
package org.netbeans.modules.versioning.system.cvss;
46
46
47
import org.netbeans.modules.turbo.TurboProvider;
47
import org.netbeans.modules.turbo.TurboProvider;
48
import org.openide.filesystems.FileUtil;
49
import org.openide.ErrorManager;
48
import org.openide.ErrorManager;
50
49
51
import java.io.*;
50
import java.io.*;
52
import java.util.*;
51
import java.util.*;
53
import java.util.logging.Level;
52
import java.util.logging.Level;
53
import org.openide.modules.Places;
54
54
55
/**
55
/**
56
 * Storage of file attributes with shortcut to retrieve all stored values.
56
 * Storage of file attributes with shortcut to retrieve all stored values.
 Lines 306-318    Link Here 
306
    }
306
    }
307
307
308
    private void initCacheStore() {
308
    private void initCacheStore() {
309
        String userDir = System.getProperty("netbeans.user"); // NOI18N
309
        cacheStore = Places.getCacheSubdirectory("cvscache"); // NOI18N
310
        if (userDir != null) {
311
            cacheStore = new File(new File(new File (userDir, "var"), "cache"), "cvscache"); // NOI18N
312
        } else {
313
            File cachedir = FileUtil.toFile(FileUtil.getConfigRoot());
314
            cacheStore = new File(cachedir, "cvscache"); // NOI18N
315
        }
316
    }
310
    }
317
311
318
    private void makeSureCacheStoreExists() {
312
    private void makeSureCacheStoreExists() {
(-)a/versioning.util/nbproject/project.xml (+8 lines)
 Lines 210-215    Link Here 
210
                    <run-dependency/>
210
                    <run-dependency/>
211
                </dependency>
211
                </dependency>
212
                <dependency>
212
                <dependency>
213
                    <code-name-base>org.openide.modules</code-name-base>
214
                    <build-prerequisite/>
215
                    <compile-dependency/>
216
                    <run-dependency>
217
                        <specification-version>7.25</specification-version>
218
                    </run-dependency>
219
                </dependency>
220
                <dependency>
213
                    <code-name-base>org.openide.nodes</code-name-base>
221
                    <code-name-base>org.openide.nodes</code-name-base>
214
                    <build-prerequisite/>
222
                    <build-prerequisite/>
215
                    <compile-dependency/>
223
                    <compile-dependency/>
(-)a/versioning.util/src/org/netbeans/modules/versioning/historystore/StorageManager.java (-2 / +2 lines)
 Lines 48-53    Link Here 
48
import java.util.logging.Level;
48
import java.util.logging.Level;
49
import java.util.logging.Logger;
49
import java.util.logging.Logger;
50
import org.netbeans.modules.versioning.util.Utils;
50
import org.netbeans.modules.versioning.util.Utils;
51
import org.openide.modules.Places;
51
import org.openide.util.NbPreferences;
52
import org.openide.util.NbPreferences;
52
53
53
/**
54
/**
 Lines 99-106    Link Here 
99
    }
100
    }
100
101
101
    private File getBaseFolder() {
102
    private File getBaseFolder() {
102
        String userDir = System.getProperty("netbeans.user"); // NOI18N
103
        return Places.getCacheSubdirectory("vcshistory"); // NOI18N
103
        return new File(new File(new File(userDir, "var"), "cache"), "vcshistory"); // NOI18N
104
    }
104
    }
105
105
106
    private void cleanUp() {
106
    private void cleanUp() {
(-)a/welcome/nbproject/project.xml (-9 / +9 lines)
 Lines 68-73    Link Here 
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
                <dependency>
71
                    <code-name-base>org.netbeans.modules.projectui</code-name-base>
72
                    <build-prerequisite/>
73
                    <compile-dependency/>
74
                    <run-dependency>
75
                        <specification-version>1.12</specification-version>
76
                    </run-dependency>
77
                </dependency>
78
                <dependency>
71
                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
79
                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
72
                    <build-prerequisite/>
80
                    <build-prerequisite/>
73
                    <compile-dependency/>
81
                    <compile-dependency/>
 Lines 77-90    Link Here 
77
                    </run-dependency>
85
                    </run-dependency>
78
                </dependency>
86
                </dependency>
79
                <dependency>
87
                <dependency>
80
                    <code-name-base>org.netbeans.modules.projectui</code-name-base>
81
                    <build-prerequisite/>
82
                    <compile-dependency/>
83
                    <run-dependency>
84
                        <specification-version>1.12</specification-version>
85
                    </run-dependency>
86
                </dependency>
87
                <dependency>
88
                    <code-name-base>org.openide.awt</code-name-base>
88
                    <code-name-base>org.openide.awt</code-name-base>
89
                    <build-prerequisite/>
89
                    <build-prerequisite/>
90
                    <compile-dependency/>
90
                    <compile-dependency/>
 Lines 119-125    Link Here 
119
                    <build-prerequisite/>
119
                    <build-prerequisite/>
120
                    <compile-dependency/>
120
                    <compile-dependency/>
121
                    <run-dependency>
121
                    <run-dependency>
122
                        <specification-version>7.0</specification-version>
122
                        <specification-version>7.25</specification-version>
123
                    </run-dependency>
123
                    </run-dependency>
124
                </dependency>
124
                </dependency>
125
                <dependency>
125
                <dependency>
(-)a/welcome/src/org/netbeans/modules/welcome/content/RSSFeed.java (-11 / +2 lines)
 Lines 92-98    Link Here 
92
import javax.xml.parsers.ParserConfigurationException;
92
import javax.xml.parsers.ParserConfigurationException;
93
import org.openide.ErrorManager;
93
import org.openide.ErrorManager;
94
import org.openide.awt.Mnemonics;
94
import org.openide.awt.Mnemonics;
95
import org.openide.filesystems.FileUtil;
95
import org.openide.modules.Places;
96
import org.openide.util.NbPreferences;
96
import org.openide.util.NbPreferences;
97
import org.openide.util.RequestProcessor;
97
import org.openide.util.RequestProcessor;
98
import org.openide.util.WeakListeners;
98
import org.openide.util.WeakListeners;
 Lines 135-150    Link Here 
135
     * Enclosing folder is created if it does not exist yet.
135
     * Enclosing folder is created if it does not exist yet.
136
     */
136
     */
137
    private static File initCacheStore(String path) throws IOException {
137
    private static File initCacheStore(String path) throws IOException {
138
        File cacheStore;
138
        File cacheStore = Places.getCacheSubfile("welcome/" + path); // NOI18N
139
        String userDir = System.getProperty("netbeans.user"); // NOI18N
140
        if (userDir != null) {
141
            cacheStore = new File(new File(new File (userDir, "var"), "cache"), "welcome"); // NOI18N
142
        } else {
143
            File cachedir = FileUtil.toFile(FileUtil.getConfigRoot());
144
            cacheStore = new File(cachedir, "welcome"); // NOI18N
145
        }
146
        cacheStore = new File(cacheStore, path);
147
        cacheStore.getParentFile().mkdirs();
148
        cacheStore.createNewFile();
139
        cacheStore.createNewFile();
149
        return cacheStore;
140
        return cacheStore;
150
    }
141
    }
(-)a/welcome/src/org/netbeans/modules/welcome/content/Utils.java (-10 / +2 lines)
 Lines 64-70    Link Here 
64
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
66
import org.openide.loaders.DataObject;
66
import org.openide.loaders.DataObject;
67
import org.openide.util.Lookup;
67
import org.openide.modules.Places;
68
import org.openide.util.NbBundle;
68
import org.openide.util.NbBundle;
69
69
70
/**
70
/**
 Lines 144-158    Link Here 
144
    }
144
    }
145
    
145
    
146
    public static File getCacheStore() throws IOException {
146
    public static File getCacheStore() throws IOException {
147
        File cacheStore;
147
        return Places.getCacheSubdirectory("welcome"); // NOI18N
148
        String userDir = System.getProperty("netbeans.user"); // NOI18N
149
        if (userDir != null) {
150
            cacheStore = new File(new File(new File (userDir, "var"), "cache"), "welcome"); // NOI18N
151
        } else {
152
            File cachedir = FileUtil.toFile(FileUtil.getConfigRoot());
153
            cacheStore = new File(cachedir, "welcome"); // NOI18N
154
        }
155
        return cacheStore;
156
    }
148
    }
157
149
158
    /**
150
    /**

Return to bug 57798
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo