< prev index next >

test/tools/lib/ToolBox.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -1592,19 +1592,24 @@
             }
             }
         }
 
         /*
-         * A jar: URL is of the form  jar:URL!/entry  where URL is a URL for the .jar file itself.
+         * A jar: URL is of the form  jar:URL!/<entry>  where URL is a URL for the .jar file itself.
          * In Symbol files (i.e. ct.sym) the underlying entry is prefixed META-INF/sym/<base>.
          */
         private final Pattern jarEntry = Pattern.compile(".*!/(?:META-INF/sym/[^/]+/)?(.*)");
 
         /*
-         * A jrt: URL is of the form  jrt:/module/package/file
+         * A jrt: URL is of the form  jrt:/modules/<module>/<package>/<file>
          */
-        private final Pattern jrtEntry = Pattern.compile("/([^/]+)/(.*)");
+        private final Pattern jrtEntry = Pattern.compile("/modules/([^/]+)/(.*)");
+
+        /*
+         * A file: URL is of the form  file:/path/to/modules/<module>/<package>/<file>
+         */
+        private final Pattern fileEntry = Pattern.compile(".*/modules/([^/]+)/(.*)");
 
         private String guessPath(FileObject fo) {
             URI u = fo.toUri();
             switch (u.getScheme()) {
                 case "jar": {

@@ -1619,10 +1624,17 @@
                     if (m.matches()) {
                         return m.group(2);
                     }
                     break;
                 }
+                case "file": {
+                    Matcher m = fileEntry.matcher(u.getSchemeSpecificPart());
+                    if (m.matches()) {
+                        return m.group(2);
+                    }
+                    break;
+                }
             }
             throw new IllegalArgumentException(fo.getName() + "--" + fo.toUri());
         }
 
         private void error(String message, Throwable t) {
< prev index next >