mbien commented on code in PR #6975:
URL: https://github.com/apache/netbeans/pull/6975#discussion_r1460809935
##########
java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/SingleSourceFileUtil.java:
##########
@@ -82,10 +82,18 @@ public static boolean isSingleSourceFile(FileObject fObj) {
}
public static boolean isSupportedFile(FileObject file) {
+ if (file == null) {
+ return false;
+ }
try {
- return !MultiSourceRootProvider.DISABLE_MULTI_SOURCE_ROOT &&
- FileOwnerQuery.getOwner(file) == null &&
- !file.getFileSystem().isReadOnly();
+ FileObject dir = file.getParent();
+ File dirFile = dir != null ? FileUtil.toFile(dir) : null;
+ return !MultiSourceRootProvider.DISABLE_MULTI_SOURCE_ROOT
+ && FileOwnerQuery.getOwner(file) == null
+ && !file.getFileSystem().isReadOnly()
+ && !(dirFile != null
+ && dirFile.getName().startsWith("vcs-")
+ &&
dirFile.getAbsolutePath().startsWith(System.getProperty("java.io.tmpdir")));
Review Comment:
nitpick: this growing chain of seemingly unrelated conditions might look
better when torn apart into multiple checks:
```java
if (file == null || MultiSourceRootProvider.DISABLE_MULTI_SOURCE_ROOT) {
return false;
}
try {
if (fileConditionsFail)
return false,
}
File dirFile = ...
if (parentConditionsFail) {
return false;
}
return true;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists