[netbeans] branch master updated: Janitor shall remove abandoned cache dirs

2022-04-05 Thread lkishalmi
This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
 new ab32c030c5 Janitor shall remove abandoned cache dirs
ab32c030c5 is described below

commit ab32c030c5ecb2e948252b0469391b832f9b2665
Author: Laszlo Kishalmi 
AuthorDate: Tue Mar 29 16:35:56 2022 -0700

Janitor shall remove abandoned cache dirs
---
 .../src/org/netbeans/modules/janitor/Janitor.java  | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/platform/janitor/src/org/netbeans/modules/janitor/Janitor.java 
b/platform/janitor/src/org/netbeans/modules/janitor/Janitor.java
index f93d60ee27..0d2ee6fe4a 100644
--- a/platform/janitor/src/org/netbeans/modules/janitor/Janitor.java
+++ b/platform/janitor/src/org/netbeans/modules/janitor/Janitor.java
@@ -30,9 +30,11 @@ import java.nio.file.attribute.BasicFileAttributes;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.temporal.ChronoUnit;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.WeakHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.prefs.Preferences;
@@ -70,6 +72,7 @@ public class Janitor {
 public static final String PROP_UNUSED_DAYS = "UnusedDays"; //NOI18N
 
 private static final String LOGFILE_NAME = "var/log/messages.log"; //NOI18N
+private static final String ALL_CHECKSUM_NAME = 
"lastModified/all-checksum.txt"; //NOI18N
 @StaticResource
 private static final String CLEAN_ICON = 
"org/netbeans/modules/janitor/resources/clean.gif"; //NOI18N
 
@@ -177,7 +180,7 @@ public class Janitor {
 }
 
 static void deleteDir(File dir) {
-if (dir == null) return;
+if ((dir == null) || !dir.exists()) return;
 Path path = dir.toPath();
 try {
 Files.walkFileTree(path, new SimpleFileVisitor() {
@@ -233,10 +236,12 @@ public class Janitor {
 static List> getOtherVersions() {
 File userDir = Places.getUserDirectory();
 List> ret = new LinkedList<>();
+Set availableUserDirs = new HashSet<>();
 Instant now = Instant.now();
 if (userDir != null) {
 File userParent = userDir.getParentFile();
 for (File f : userParent.listFiles()) {
+availableUserDirs.add(f.getName());
 Path logFile = new File(f, LOGFILE_NAME).toPath();
 if (!f.equals(userDir) && Files.isRegularFile(logFile)) {
 try {
@@ -251,6 +256,25 @@ public class Janitor {
 }
 }
 }
+
+//Search for abandoned cache dirs (cache dirs with no user dir)
+File cacheDir = Places.getCacheDirectory();
+if (cacheDir != null) {
+File cacheParent = cacheDir.getParentFile();
+for (File f : cacheParent.listFiles()) {
+if (f.isDirectory() && 
!availableUserDirs.contains(f.getName())) {
+if (new File(f, ALL_CHECKSUM_NAME).exists() && 
!cacheDir.equals(f)) {
+try {
+Instant lastModified = 
Files.getLastModifiedTime(f.toPath()).toInstant();
+Integer age = (int) Duration.between(lastModified, 
now).toDays();
+ret.add(Pair.of(f.getName(), age));
+} catch (IOException ex) {
+//Just ignore what we can't process
+}
+}
+}
+}
+}
 return ret;
 }
 


-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[jira] [Commented] (NETBEANS-2360) HiDPI scaling (and anti-aliasing on KDE) not applied automatically on Linux

2022-04-05 Thread Eirik Bakke (Jira)


[ 
https://issues.apache.org/jira/browse/NETBEANS-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17517388#comment-17517388
 ] 

Eirik Bakke commented on NETBEANS-2360:
---

Thanks, Javier. I suppose the xdpyinfo DPI probably comes from the screen 
itself rather than the global scale.

> HiDPI scaling (and anti-aliasing on KDE) not applied automatically on Linux
> ---
>
> Key: NETBEANS-2360
> URL: https://issues.apache.org/jira/browse/NETBEANS-2360
> Project: NetBeans
>  Issue Type: Bug
>  Components: platform - LaunchersCLI
>Affects Versions: 11.0, 12.2
> Environment: Kubuntu 18.03
> Oracle JDK 11.0.2
>Reporter: Eirik Bakke
>Priority: Major
>  Labels: HiDPI, Linux, pull-request-available
> Attachments: CheckHiDpi.java, image-2021-09-12-21-01-33-807.png, 
> image-2021-09-12-21-05-06-852.png, kubunt.jpg
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Running NetBeans 11 on Kubuntu 18.03, GUI text size does not seem to take 
> into account the system's default HiDPI scaling. This was reported in a 
> Twitter thread on https://twitter.com/nicktail/status/1114789604337405952 . 
> Note that Window decorations seem to be the correct size.
> Setting the GDK_SCALE environment variable seems to fix the problem, if I 
> understand the originally reporter correctly. This could probably be done 
> easily from the NetBeans launcher script (netbeans/bin). But it wouldn't fix 
> the problem in multi-monitor setups. We should investigate what could be done 
> to make scaling work properly in multi-monitor setups involving one HiDPI 
> screen and one non-HiDPI screen.
> Before merging a patch to the launcher script, it should be tested on a 
> couple of different Linux environments, using both HiDPI and non-HiDPI 
> screens. Note that the UNIX launcher script is also used on MacOS.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[netbeans] branch master updated: Cleanup raw type warnings related to WeakReference. (#3923)

2022-04-05 Thread bwalker
This is an automated email from the ASF dual-hosted git repository.

bwalker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
 new 04fc2a31b5 Cleanup raw type warnings related to WeakReference. (#3923)
04fc2a31b5 is described below

commit 04fc2a31b5b946a88130333279954417f04cdb2f
Author: Brad Walker 
AuthorDate: Tue Apr 5 07:21:04 2022 -0400

Cleanup raw type warnings related to WeakReference. (#3923)

Cleanup raw type warnings related to WeakReference. for issues like this..

[repeat] 
/home/bwalker/src/netbeans/platform/openide.compat/src/org/openide/util/WeakListener.java:921:
 warning: [rawtypes] found raw type: WeakReference
   [repeat] private static final class ListenerReference extends 
WeakReference implements Runnable {
   [repeat]  ^
   [repeat]   missing type arguments for generic class WeakReference
   [repeat]   where T is a type-variable:
   [repeat] T extends Object declared in class WeakReference
   [repeat] 
/home/bwalker/src/netbeans/platform/openide.compat/src/org/openide/util/WeakListener.java:922:
 warning: [rawtypes] found raw type: Class
   [repeat] private static Class lastClass;
   [repeat]^
   [repeat]   missing type arguments for generic class Class
   [repeat]   where T is a type-variable:
   [repeat] T extends Object declared in class Class

This work is done project wide. There are 3 remaining warnings that I was 
unable to get resolved. They will have to wait until later.
---
 .../modules/j2ee/dd/api/web/DDProvider.java| 12 +--
 .../ddloaders/multiview/DDMultiViewDataObject.java | 25 --
 .../modules/gradle/cache/AbstractDiskCache.java|  2 +-
 .../modules/bugtracking/RepositoryImpl.java|  2 +-
 .../xml/multiview/XmlMultiViewDataObject.java  |  4 ++--
 .../xml/tax/cookies/TreeEditorCookieImpl.java  |  6 +++---
 .../org/netbeans/modules/xml/DTDDataObject.java|  4 ++--
 .../org/netbeans/modules/xml/XMLDataObject.java|  4 ++--
 .../modules/xml/text/TextEditorSupport.java|  4 ++--
 .../modules/ant/debugger/DebuggerAntLogger.java|  4 ++--
 .../editor/completion/db/DBMetaDataProvider.java   |  4 ++--
 .../hints/declarative/DeclarativeHintsParser.java  |  2 +-
 .../java/source/ui/OpenProjectFastIndex.java   | 10 +
 .../src/org/openide/util/WeakListener.java |  4 ++--
 .../src/org/openide/filesystems/Repository.java|  4 ++--
 .../modules/sampler/SamplesOutputStream.java   |  2 +-
 .../saas/model/wsdl/impl/WsdlModelerFactory.java   |  6 +++---
 17 files changed, 38 insertions(+), 61 deletions(-)

diff --git 
a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java 
b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java
index 18597698ce..21940ec8b2 100644
--- 
a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java
+++ 
b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java
@@ -107,7 +107,7 @@ public final class DDProvider {
 // preparsing
 error = parse(fo);
 original = DDUtils.createWebApp(fo, version);
-baseBeanMap.put(fo.toURL(), new 
WeakReference(original));
+baseBeanMap.put(fo.toURL(), new 
WeakReference<>(original));
 errorMap.put(fo.toURL(), error);
 }
 } else {
@@ -155,7 +155,7 @@ public final class DDProvider {
 if (cached != null) {
 return cached;
 }
-ddMap.put(fo.toURL(), new WeakReference(webApp));
+ddMap.put(fo.toURL(), new WeakReference<>(webApp));
 }
 return webApp;
 }
@@ -189,7 +189,7 @@ public final class DDProvider {
 }
 
 private WebAppProxy getFromCache(FileObject fo) throws IOException {
-WeakReference wr = (WeakReference) ddMap.get(fo.toURL());
+WeakReference wr = ddMap.get(fo.toURL());
 if (wr == null) {
 return null;
 }
@@ -201,7 +201,7 @@ public final class DDProvider {
 }
 
 private WebApp getOriginalFromCache(FileObject fo) throws IOException {
-WeakReference wr = (WeakReference) baseBeanMap.get(fo.toURL());
+WeakReference wr = baseBeanMap.get(fo.toURL());
 if (wr == null) {
 return null;
 }
@@ -290,7 +290,7 @@ public final class DDProvider {
 
webApp.setStatus(WebApp.STATE_INVALID_OLD_VERSION);
 webApp.setError(null);
 }
-baseBeanMap.put(fo.toURL(), new 

[netbeans] branch master updated (4a26239f4d -> da882833f9)

2022-04-05 Thread sdedic
This is an automated email from the ASF dual-hosted git repository.

sdedic pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


from 4a26239f4d Merge pull request #3906 from ppisl/fix_userhome
 new 16ffb0aafb Relaxed cache checks. Builder uses cache to augment source 
and javadoc artifacts.
 new 4e339ecbb6 Avoid duplicate project loads.
 new 2c155e5f27 Improve diagnostic logging.
 new 5102a73705 Restart in online mode if resolution fails because of 
offline.
 new da882833f9 Merge pull request #3907 from sdedic/gradle/artifactCacheBug

The 6864 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../gradle/tooling/NbProjectInfoBuilder.java   | 10 
 .../{Model.java => NeedOnlineModeException.java}   | 14 ++---
 .../gradle/tooling/NetBeansToolingPlugin.java  |  2 +
 .../modules/gradle/NbGradleProjectImpl.java| 59 --
 .../gradle/api/GradleBaseProjectBuilder.java   |  9 
 .../gradle/loaders/GradleArtifactStore.java| 38 --
 .../gradle/loaders/LegacyProjectLoader.java| 46 +++--
 7 files changed, 161 insertions(+), 17 deletions(-)
 copy 
extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/{Model.java
 => NeedOnlineModeException.java} (78%)


-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists