You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2018/01/02 10:12:50 UTC

[incubator-netbeans] branch master updated (301f641 -> 7cce405)

This is an automated email from the ASF dual-hosted git repository.

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


    from 301f641  Randomly failed on Linux #296: https://builds.apache.org/view/Incubator%20Projects/job/incubator-netbeans-linux/296/
     new 431ce82  Removing the 8.3 test altogether
     new 7cce405  When on Windows ignore file separator and case

The 2 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:
 .../startup/layers/CountingSecurityManager.java    | 48 +++++++++++++++-------
 .../netbeans/modules/masterfs/URLMapperTest.java   | 25 -----------
 2 files changed, 33 insertions(+), 40 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@netbeans.apache.org" <co...@netbeans.apache.org>'].

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

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


[incubator-netbeans] 02/02: When on Windows ignore file separator and case

Posted by jt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7cce405efc8ed171eff2f079e73f9f5607c05c59
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Tue Jan 2 11:12:39 2018 +0100

    When on Windows ignore file separator and case
---
 .../startup/layers/CountingSecurityManager.java    | 48 +++++++++++++++-------
 1 file changed, 33 insertions(+), 15 deletions(-)

diff --git a/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java b/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java
index 0bc9c52..0e6bf79 100644
--- a/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java
+++ b/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java
@@ -29,6 +29,7 @@ import java.security.Permission;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -39,6 +40,8 @@ import java.util.logging.Logger;
 import junit.framework.Assert;
 import org.netbeans.core.startup.InstalledFileLocatorImpl;
 import org.openide.modules.Places;
+import org.openide.util.Exceptions;
+import org.openide.util.Utilities;
 
 /**
  *
@@ -61,6 +64,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
     
     public static void initialize(String prefix, Mode mode, Set<String> allowedFiles) {
         System.setProperty("counting.security.disabled", "true");
+        inSubtree("", "");
 
         if (System.getSecurityManager() instanceof CountingSecurityManager) {
             // ok
@@ -161,7 +165,13 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
             setCnt(getCnt() + 1);
             pw.println("checkRead: " + file);
             if (who.get(file) == null) {
-                Exception now = new Exception("checkRead: " + file);
+                File home = new File(System.getProperty("netbeans.home"));
+                try {
+                    home = home.getCanonicalFile();
+                } catch (IOException ex) {
+                    Exceptions.printStackTrace(ex);
+                }
+                Exception now = new Exception("canon: " + home + " home: " + System.getProperty("netbeans.home") + " dirs: " + dirs + " prefix: " + prefix + " checkRead: " + file);
                 who.put(file, now);
                 now.printStackTrace(pw);
                 pw.flush();
@@ -172,7 +182,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
     @Override
     public void checkRead(String file, Object context) {
         /*
-        if (file.startsWith(prefix)) {
+        if (inSubtree(file, prefix)) {
             cnt++;
             pw.println("checkRead2: " + file);
         }
@@ -385,7 +395,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
             // still initializing
             return false;
         }
-        if (!file.startsWith(ud)) {
+        if (!inSubtree(file, ud)) {
             return false;
         }
 
@@ -408,7 +418,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
             }
         }
         
-        if (file.startsWith(ud)) {
+        if (inSubtree(file, ud)) {
             if (f.startsWith("/")) {
                 f = f.substring(1);
             }
@@ -417,11 +427,11 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
             }
         }
 
-        return prefix == null || file.startsWith(prefix);
+        return prefix == null || inSubtree(file, prefix);
     }
 
     private boolean acceptFileRead(String file) {
-        if (prefix != null && !file.startsWith(prefix)) {
+        if (prefix != null && !inSubtree(file, prefix)) {
             return false;
         }
         if (acceptAll) {
@@ -433,7 +443,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
         }
         for (Class c : this.getClassContext()) {
             if (c.getName().equals(InstalledFileLocatorImpl.class.getName())) {
-                if (file.startsWith(Places.getCacheDirectory().getPath())) {
+                if (inSubtree(file, Places.getCacheDirectory().getPath())) {
                     return false;
                 }
                 if (file.equals(System.getProperty("netbeans.home"))) {
@@ -461,26 +471,26 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
         if (file.endsWith("org-netbeans-modules-nbjunit.jar")) {
             return false;
         }
-        if (file.startsWith(System.getProperty("java.home").replaceAll("[/\\\\][^/\\\\]*$", ""))) {
+        if (inSubtree(file, System.getProperty("java.home").replaceAll("[/\\\\][^/\\\\]*$", ""))) {
             return false;
         }
-        if (file.startsWith("/usr/jdk/packages/javax.help-")) {
-            // ignore javahelp location on solaris
+        if (inSubtree(file, "/usr/jdk/packages/javax.help-")) {
+            // iile.startsWith(System.getProperty("netbeans.home") + File.separator + "core")gnore javahelp location on solaris
             return false;
         }
-        if (file.startsWith(System.getProperty("netbeans.home") + File.separator + "lib")) {
+        if (inSubtree(file, System.getProperty("netbeans.home") + File.separator + "lib")) {
             return false;
         }
-        if (file.startsWith(System.getProperty("netbeans.home") + File.separator + "core")) {
+        if (inSubtree(file, System.getProperty("netbeans.home") + File.separator + "core")) {
             return false;
         }
         String dirs = System.getProperty("netbeans.dirs");
         if (dirs != null) {
             for (String dir : dirs.split(File.pathSeparator)) {
-                if (file.startsWith(dir + File.separator + "lib")) {
+                if (inSubtree(file, dir + File.separator + "lib")) {
                     return false;
                 }
-                if (file.startsWith(dir + File.separator + "core")) {
+                if (inSubtree(file, dir + File.separator + "core")) {
                     return false;
                 }
             }
@@ -489,7 +499,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
         dirs = System.getProperty("java.ext.dirs");
         if (dirs != null) {
             for (String dir : dirs.split(File.pathSeparator)) {
-                if (file.startsWith(dir)) {
+                if (inSubtree(file, dir)) {
                     return false;
                 }
             }
@@ -497,6 +507,14 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
         return true;
     }
 
+    private static boolean inSubtree(String file, String dir) {
+        if (Utilities.isWindows()) {
+            file = file.replace(File.separatorChar, '/').toLowerCase(Locale.ENGLISH);
+            dir = dir.replace(File.separatorChar, '/').toLowerCase(Locale.ENGLISH);
+        }
+        return file.startsWith(dir);
+    }
+
     @Override
     public void checkExec(String cmd) {
         if (cmd.contains("chmod")) {

-- 
To stop receiving notification emails like this one, please contact
"commits@netbeans.apache.org" <co...@netbeans.apache.org>.

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

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


[incubator-netbeans] 01/02: Removing the 8.3 test altogether

Posted by jt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 431ce82c09e793915df9c8b72143579a38a68c2d
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Tue Jan 2 05:46:45 2018 +0100

    Removing the 8.3 test altogether
---
 .../netbeans/modules/masterfs/URLMapperTest.java   | 25 ----------------------
 1 file changed, 25 deletions(-)

diff --git a/masterfs/test/unit/src/org/netbeans/modules/masterfs/URLMapperTest.java b/masterfs/test/unit/src/org/netbeans/modules/masterfs/URLMapperTest.java
index 462c5db..2e7f349 100644
--- a/masterfs/test/unit/src/org/netbeans/modules/masterfs/URLMapperTest.java
+++ b/masterfs/test/unit/src/org/netbeans/modules/masterfs/URLMapperTest.java
@@ -19,18 +19,12 @@
 
 package org.netbeans.modules.masterfs;
 
-import java.io.File;
-import java.net.URL;
-import org.junit.Assume;
-import static org.junit.Assume.assumeTrue;
 import org.netbeans.junit.NbTestCase;
 import org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileSystem;
 import org.openide.filesystems.FileUtil;
-import org.openide.filesystems.URLMapper;
 import org.openide.util.Lookup;
-import org.openide.util.Utilities;
 import org.openide.util.lookup.Lookups;
 import org.openide.util.lookup.ServiceProvider;
 
@@ -51,25 +45,6 @@ public class URLMapperTest extends NbTestCase {
         assertEquals(MyInstance2.class, obj.getClass());
     }
     
-    public void testNormalize8_3Names() throws Exception {
-        if (!Utilities.isWindows()) {
-            return;
-        }
-        
-        clearWorkDir();
-        File f = new File(getWorkDir(), "my new temp folder with long name");
-        f.mkdirs();
-        
-        File shrtF = new File(getWorkDir(), "MYNEWT~1");
-        assumeTrue("Short name exists", shrtF.isDirectory());
-        
-        final URL u = shrtF.toURI().toURL();
-        final FileObject fo = URLMapper.findFileObject(u);
-        File found = FileUtil.toFile(fo);
-        
-        assertEquals("The same file as original", f, found);
-    }
-
     @ServiceProvider(service=Object.class)
     public static class MyInstance2 {
         public MyInstance2() {

-- 
To stop receiving notification emails like this one, please contact
"commits@netbeans.apache.org" <co...@netbeans.apache.org>.

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

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