[Arakhnę-Dev] [189] * Improve performances of the Classpath utils. |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 189
Author: galland
Date: 2010-09-29 19:52:35 +0200 (Wed, 29 Sep 2010)
Log Message:
-----------
* Improve performances of the Classpath utils.
* Fixing bug in FileSystem for Windows OS.
Modified Paths:
--------------
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ClasspathUtil.java
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java
trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/ClasspathUtilTest.java
trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ClasspathUtil.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ClasspathUtil.java 2010-09-28 18:54:05 UTC (rev 188)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ClasspathUtil.java 2010-09-29 17:52:35 UTC (rev 189)
@@ -25,9 +25,9 @@
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.LinkedList;
+import java.util.Iterator;
import java.util.List;
-import java.util.regex.Pattern;
+import java.util.NoSuchElementException;
/**
* Current classpath and associated utility functions.
@@ -40,87 +40,188 @@
*/
public class ClasspathUtil {
- private static URL[] startupClasspath = null;
-
/** Replies the classpath at start of the virtual machine.
*
* @return the startup classpath, never <code>null</code>.
+ * @deprecated see {@link #getStartClasspath()}
*/
+ @Deprecated
public static URL[] getStartupClasspath() {
- if (startupClasspath==null) {
- URL[] urls;
- String paths = System.getProperty("java.class.path"); //$NON-NLS-1$
- if (paths==null || "".equals(paths)) { //$NON-NLS-1$
- urls = new URL[0];
- }
- else {
- String[] pathList = paths.split(Pattern.quote(File.pathSeparator));
- if (pathList==null || pathList.length==0) {
- urls = new URL[0];
- }
- else {
- List<URL> urlList = new ArrayList<URL>(pathList.length);
- URL u;
- for(String p : pathList) {
- u = FileSystem.convertStringToUrl(p, true);
- if (u!=null) {
- urlList.add(u);
- }
- }
- urls = new URL[urlList.size()];
- urlList.toArray(urls);
- }
- }
- startupClasspath = urls;
- }
- return startupClasspath;
+ Iterator<URL> iterator = getStartClasspath();
+ List<URL> list = new ArrayList<URL>();
+ while (iterator.hasNext())
+ list.add(iterator.next());
+ URL[] tab = new URL[list.size()];
+ list.toArray(tab);
+ list.clear();
+ return tab;
}
+ /** Replies the classpath at start of the virtual machine.
+ *
+ * @return the startup classpath, never <code>null</code>.
+ * @since 6.0
+ */
+ public static Iterator<URL> getStartClasspath() {
+ return new PathIterator(System.getProperty("java.class.path")); //$NON-NLS-1$
+ }
+
/** Replies the current classpath.
*
* @return the current classpath, never <code>null</code>.
+ * @deprecated see {@link #getClasspath()}
+ */
+ @Deprecated
+ public static URL[] getCurrentClasspath() {
+ Iterator<URL> iterator = getClasspath();
+ List<URL> list = new ArrayList<URL>();
+ while (iterator.hasNext())
+ list.add(iterator.next());
+ URL[] tab = new URL[list.size()];
+ list.toArray(tab);
+ list.clear();
+ return tab;
+ }
+
+ /** Replies the current classpath.
+ *
+ * @return the current classpath, never <code>null</code>.
* @since 6.0
*/
- public static URL[] getCurrentClasspath() {
- URL[] startupClasspath = getStartupClasspath();
- List<URL> additionalUrls = new LinkedList<URL>(Arrays.asList(startupClasspath));
+ public static Iterator<URL> getClasspath() {
+ Iterator<URL> iterator = getStartClasspath();
- URL[] addurls;
-
ClassLoader loader = ClassLoaderFinder.findClassLoader();
if (loader instanceof DynamicURLClassLoader) {
DynamicURLClassLoader dLoader = (DynamicURLClassLoader)loader;
- addurls = dLoader.getURLs();
+ iterator = new IteratorIterator(
+ Arrays.asList(dLoader.getURLs()).iterator(),
+ iterator);
}
else if (loader instanceof URLClassLoader) {
URLClassLoader dLoader = (URLClassLoader)loader;
- addurls = dLoader.getURLs();
+ iterator = new IteratorIterator(
+ Arrays.asList(dLoader.getURLs()).iterator(),
+ iterator);
}
- else {
- return startupClasspath;
+
+ return iterator;
+ }
+
+ /**
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 6.0
+ */
+ private static class IteratorIterator implements Iterator<URL> {
+
+ private final Iterator<URL> i1;
+ private final Iterator<URL> i2;
+
+ /**
+ * @param i1
+ * @param i2
+ */
+ public IteratorIterator(Iterator<URL> i1, Iterator<URL> i2) {
+ assert(i1!=null && i2!=null);
+ this.i1 = i1;
+ this.i2 = i2;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasNext() {
+ return (this.i1.hasNext() || this.i2.hasNext());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL next() {
+ if (this.i1.hasNext())
+ return this.i1.next();
+ return this.i2.next();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
- for(URL url : addurls) {
- if (!contains(additionalUrls, url)) {
- additionalUrls.add(0, url);
+ }
+
+ /**
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 6.0
+ */
+ private static class PathIterator implements Iterator<URL> {
+
+ private final String path;
+ private String nextPath;
+ private int nextIndex;
+
+ /**
+ * @param path
+ */
+ public PathIterator(String path) {
+ this.path = path;
+ this.nextIndex = path.indexOf(File.pathSeparatorChar);
+ if (this.nextIndex>=0)
+ this.nextPath = path.substring(0, this.nextIndex);
+ else
+ this.nextPath = path;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasNext() {
+ return this.nextPath!=null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL next() {
+ String p = this.nextPath;
+ if (p==null) throw new NoSuchElementException();
+ if (this.nextIndex>=0) {
+ int idx = this.path.indexOf(File.pathSeparatorChar, this.nextIndex+1);
+ if (idx<0) {
+ this.nextPath = this.path.substring(this.nextIndex+1);
+ }
+ else {
+ this.nextPath = this.path.substring(this.nextIndex+1, idx);
+ }
+ this.nextIndex = idx;
}
+ else {
+ this.nextPath = null;
+ }
+ return FileSystem.convertStringToURL(p, false, true, false);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
- URL[] allUrls = new URL[additionalUrls.size()];
- additionalUrls.toArray(allUrls);
- return allUrls;
}
- private static boolean contains(List<URL> list, URL url) {
- String s1;
- String s2 = url.toString();
- s2 = s2.replaceFirst("/$", ""); //$NON-NLS-1$ //$NON-NLS-2$
- for(URL u : list) {
- s1 = u.toExternalForm().replaceFirst("/$", ""); //$NON-NLS-1$ //$NON-NLS-2$
- if (s2.equals(s1))
- return true;
- }
- return false;
- }
-
}
\ No newline at end of file
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java 2010-09-28 18:54:05 UTC (rev 188)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileSystem.java 2010-09-29 17:52:35 UTC (rev 189)
@@ -34,6 +34,7 @@
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
+import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -1355,9 +1356,11 @@
* @return the URL.
* @throws IllegalArgumentException is the string could not be formatted to URL.
* @see Resources#getResource(String)
+ * @deprecated see {@link #convertStringToURL(String, boolean)}
*/
+ @Deprecated
public static URL convertStringToUrl(String urlDescription, boolean allowResourceSearch) {
- return convertStringToURL(urlDescription, allowResourceSearch, true);
+ return convertStringToURL(urlDescription, allowResourceSearch, true, true);
}
/** Convert a string to an URL according to several rules.
@@ -1372,6 +1375,34 @@
* <li>if <var>allowResourceSearch</var> is <code>true</code>, call
* {@link Resources#getResource(String)} with the <var>urlDescription</var> as
* parameter;</li>
+ * <li>assuming that the <var>urlDescription</var> is
+ * a filename, call {@link File#toURI()} to retreive an URI and then
+ * {@link URI#toURL()};</li>
+ * <li>If everything else failed, return <code>null</code>.</li>
+ * </ul>
+ *
+ * @param urlDescription is a string which is describing an URL.
+ * @param allowResourceSearch indicates if the convertion must take into account the Java resources.
+ * @return the URL.
+ * @throws IllegalArgumentException is the string could not be formatted to URL.
+ * @see Resources#getResource(String)
+ */
+ public static URL convertStringToURL(String urlDescription, boolean allowResourceSearch) {
+ return convertStringToURL(urlDescription, allowResourceSearch, true, true);
+ }
+
+ /** Convert a string to an URL according to several rules.
+ * <p>
+ * The rules are (the first succeeded is replied):
+ * <ul>
+ * <li>if <var>urlDescription</var> is <code>null</code> or empty, return <code>null</code>;</li>
+ * <li>try to build an {@link URL} with <var>urlDescription</var> as parameter;</li>
+ * <li>if <var>allowResourceSearch</var> is <code>true</code> and
+ * <var>urlDescription</var> starts with {@code "resource:"}, call
+ * {@link Resources#getResource(String)} with the rest of the string as parameter;</li>
+ * <li>if <var>allowResourceSearch</var> is <code>true</code>, call
+ * {@link Resources#getResource(String)} with the <var>urlDescription</var> as
+ * parameter;</li>
* <li>if <var>repliesFileURL</var> is <code>true</code> and
* assuming that the <var>urlDescription</var> is
* a filename, call {@link File#toURI()} to retreive an URI and then
@@ -1389,7 +1420,7 @@
*/
@Deprecated
public static URL convertStringToUrl(String urlDescription, boolean allowResourceSearch, boolean repliesFileURL) {
- return convertStringToURL(urlDescription, allowResourceSearch, repliesFileURL);
+ return convertStringToURL(urlDescription, allowResourceSearch, repliesFileURL, true);
}
/** Convert a string to an URL according to several rules.
@@ -1419,11 +1450,42 @@
* @see Resources#getResource(String)
*/
public static URL convertStringToURL(String urlDescription, boolean allowResourceSearch, boolean repliesFileURL) {
+ return convertStringToURL(urlDescription, allowResourceSearch, repliesFileURL, true);
+ }
+
+ /** Convert a string to an URL according to several rules.
+ * <p>
+ * The rules are (the first succeeded is replied):
+ * <ul>
+ * <li>if <var>urlDescription</var> is <code>null</code> or empty, return <code>null</code>;</li>
+ * <li>try to build an {@link URL} with <var>urlDescription</var> as parameter;</li>
+ * <li>if <var>allowResourceSearch</var> is <code>true</code> and
+ * <var>urlDescription</var> starts with {@code "resource:"}, call
+ * {@link Resources#getResource(String)} with the rest of the string as parameter;</li>
+ * <li>if <var>allowResourceSearch</var> is <code>true</code>, call
+ * {@link Resources#getResource(String)} with the <var>urlDescription</var> as
+ * parameter;</li>
+ * <li>if <var>repliesFileURL</var> is <code>true</code> and
+ * assuming that the <var>urlDescription</var> is
+ * a filename, call {@link File#toURI()} to retreive an URI and then
+ * {@link URI#toURL()};</li>
+ * <li>If everything else failed, return <code>null</code>.</li>
+ * </ul>
+ *
+ * @param urlDescription is a string which is describing an URL.
+ * @param allowResourceSearch indicates if the convertion must take into account the Java resources.
+ * @param repliesFileURL indicates if urlDescription is allowed to be a filename.
+ * @param supportWindowsPaths indicates if Windows paths should be treated in particular way.
+ * @return the URL.
+ * @throws IllegalArgumentException is the string could not be formatted to URL.
+ * @see Resources#getResource(String)
+ */
+ static URL convertStringToURL(String urlDescription, boolean allowResourceSearch, boolean repliesFileURL, boolean supportWindowsPaths) {
URL url = null;
if (urlDescription!=null && urlDescription.length()>0) {
-
- if (isWindowsNativeFilename(urlDescription)) {
+
+ if (supportWindowsPaths && isWindowsNativeFilename(urlDescription)) {
File f = normalizeWindowsNativeFilename(urlDescription);
if (f!=null) return convertFileToURL(f);
}
@@ -1468,7 +1530,7 @@
if (URISchemeType.JAR.isScheme(urlDescription)) {
int idx = urlPart.indexOf(JAR_URL_FILE_ROOT);
if (idx>0) {
- URL jarURL = convertStringToUrl(urlPart.substring(0, idx), allowResourceSearch);
+ URL jarURL = convertStringToURL(urlPart.substring(0, idx), allowResourceSearch);
if (jarURL!=null) {
try {
url = toJarURL(jarURL, urlPart.substring(idx+2));
@@ -2046,9 +2108,11 @@
public static URL toShortestURL(URL url) {
String s = url.toExternalForm().replaceAll("/$", ""); //$NON-NLS-1$//$NON-NLS-2$
String sp;
- URL[] classpath = ClasspathUtil.getCurrentClasspath();
+ Iterator<URL> classpath = ClasspathUtil.getClasspath();
+ URL path;
- for(URL path : classpath) {
+ while (classpath.hasNext()) {
+ path = classpath.next();
sp = path.toExternalForm().replaceAll("/$", ""); //$NON-NLS-1$//$NON-NLS-2$
if (s.startsWith(sp)) {
StringBuffer buffer = new StringBuffer("resource:"); //$NON-NLS-1$
Modified: trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/ClasspathUtilTest.java
===================================================================
--- trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/ClasspathUtilTest.java 2010-09-28 18:54:05 UTC (rev 188)
+++ trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/ClasspathUtilTest.java 2010-09-29 17:52:35 UTC (rev 189)
@@ -22,8 +22,6 @@
import java.io.File;
import java.net.URL;
import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
import java.util.regex.Pattern;
import junit.framework.AssertionFailedError;
@@ -55,88 +53,38 @@
/**
*/
- public void testGetStartupClasspath() {
- URL[] urls = ClasspathUtil.getStartupClasspath();
+ public void testGetStartClasspath() {
+ Iterator<URL> urls = ClasspathUtil.getStartClasspath();
assertNotNull(urls);
String[] paths = System.getProperty("java.class.path").split( //$NON-NLS-1$
Pattern.quote(File.pathSeparator));
- assertEquals(paths.length, urls.length);
-
for(int i=0; i<paths.length; i++) {
- URL u = FileSystem.convertStringToUrl(paths[i], true);
- assertEquals(u, urls[i]);
+ URL u = FileSystem.convertStringToURL(paths[i], true);
+ assertTrue(urls.hasNext());
+ assertEquals(u, urls.next());
}
}
/**
*/
public void testGetCurrentClasspath_standardClassLoader() {
- URL[] urls = ClasspathUtil.getCurrentClasspath();
+ Iterator<URL> urls = ClasspathUtil.getClasspath();
assertNotNull(urls);
String[] paths = System.getProperty("java.class.path").split( //$NON-NLS-1$
Pattern.quote(File.pathSeparator));
- assertEquals(paths.length, urls.length);
-
for(int i=0; i<paths.length; i++) {
- URL u = FileSystem.convertStringToUrl(paths[i], true);
- if (!isEquals(u, urls[i])) {
- throw new AssertionFailedError("expected: "+u+"; actual: "+urls[i]); //$NON-NLS-1$//$NON-NLS-2$
+ URL u = FileSystem.convertStringToURL(paths[i], true);
+ assertTrue(urls.hasNext());
+ URL u2 = urls.next();
+ if (!isEquals(u, u2)) {
+ throw new AssertionFailedError("expected: "+u+"; actual: "+u2); //$NON-NLS-1$//$NON-NLS-2$
}
}
- }
-
- /**
- * @throws Exception
- */
- public void testGetCurrentClasspath_dynamicClassLoader() throws Exception {
- URL addUrl = new File("/toto").toURI().toURL(); //$NON-NLS-1$
- DynamicURLClassLoader myLoader = new DynamicURLClassLoader(
- ClasspathUtilTest.class.getClassLoader(),
- null);
- ClassLoaderFinder.setPreferredClassLoader(myLoader);
- myLoader.addURL(addUrl);
- try {
- URL[] urls = ClasspathUtil.getCurrentClasspath();
- assertNotNull(urls);
-
- List<URL> list = new LinkedList<URL>();
- String[] paths = System.getProperty("java.class.path").split( //$NON-NLS-1$
- Pattern.quote(File.pathSeparator));
- for(String s : paths) {
- list.add(FileSystem.convertStringToUrl(s, true));
- }
- list.add(addUrl);
-
- assertEquals(paths.length+1, urls.length);
-
- for(URL r : urls) {
- Iterator<URL> iter = list.iterator();
- URL u;
- boolean found = false;
- while (!found && iter.hasNext()) {
- u = iter.next();
- if (isEquals(u, r)) {
- iter.remove();
- found = true;
- }
- }
- if (!found) {
- throw new AssertionFailedError("additional path found: "+r); //$NON-NLS-1$
- }
- }
-
- if (!list.isEmpty()) {
- throw new AssertionFailedError("expected: "+list.toString()); //$NON-NLS-1$
- }
- }
- finally {
- ClassLoaderFinder.popPreferredClassLoader();
- }
- }
+ }
private boolean isEquals(URL expected, URL actual) {
String u1 = expected==null ? null : expected.toExternalForm().replaceFirst("/$", ""); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java
===================================================================
--- trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java 2010-09-28 18:54:05 UTC (rev 188)
+++ trunk/arakhneVmutils/java/src/test/java/org/arakhne/vmutil/FileSystemTest.java 2010-09-29 17:52:35 UTC (rev 189)
@@ -751,12 +751,12 @@
assertEquals("", rr.getPath()); //$NON-NLS-1$
//-----
- assertNull(FileSystem.convertStringToUrl(null, true));
- assertNull(FileSystem.convertStringToUrl("", true)); //$NON-NLS-1$
- assertNull(FileSystem.convertStringToUrl(null, false));
- assertNull(FileSystem.convertStringToUrl("", false)); //$NON-NLS-1$
+ assertNull(FileSystem.convertStringToURL(null, true));
+ assertNull(FileSystem.convertStringToURL("", true)); //$NON-NLS-1$
+ assertNull(FileSystem.convertStringToURL(null, false));
+ assertNull(FileSystem.convertStringToURL("", false)); //$NON-NLS-1$
- rr = FileSystem.convertStringToUrl("file://marbre.jpg", false); //$NON-NLS-1$
+ rr = FileSystem.convertStringToURL("file://marbre.jpg", false); //$NON-NLS-1$
assertNotNull(rr);
assertEquals("file", rr.getProtocol()); //$NON-NLS-1$
assertEquals("", rr.getAuthority()); //$NON-NLS-1$s
@@ -765,34 +765,34 @@
assertEquals("marbre.jpg", rr.getPath()); //$NON-NLS-1$
assertEquals(new URL("http", "www.arakhne.org", "/"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("http://www.arakhne.org/", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("http://www.arakhne.org/", true)); //$NON-NLS-1$
assertEquals(new URL("http", "www.arakhne.org", "/"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("http://www.arakhne.org/", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("http://www.arakhne.org/", false)); //$NON-NLS-1$
assertEquals(new URL("file", "", f1.getAbsolutePath()), //$NON-NLS-1$ //$NON-NLS-2$
- FileSystem.convertStringToUrl("file:"+f1.getAbsolutePath(), true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("file:"+f1.getAbsolutePath(), true)); //$NON-NLS-1$
assertEquals(new URL("file", "", f1.getAbsolutePath()), //$NON-NLS-1$ //$NON-NLS-2$
- FileSystem.convertStringToUrl("file:"+f1.getAbsolutePath(), false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("file:"+f1.getAbsolutePath(), false)); //$NON-NLS-1$
assertEquals(new URL("file", "", "./toto"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("file:./toto", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("file:./toto", false)); //$NON-NLS-1$
// CAUTION: testing right-formed jar URL.
assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("jar:file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("jar:file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", true)); //$NON-NLS-1$
assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("jar:file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("jar:file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", false)); //$NON-NLS-1$
// CAUTION: testing malformed jar URL. Right syntax is: jar:{url}!/{entry}
assertEquals(new URL("file", "", "/home/test/j.jar"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("jar:/home/test/j.jar", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("jar:/home/test/j.jar", true)); //$NON-NLS-1$
assertEquals(new URL("file", "", "/home/test/j.jar"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("jar:/home/test/j.jar", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("jar:/home/test/j.jar", false)); //$NON-NLS-1$
// CAUTION: testing malformed jar URL. Right syntax is: jar:{url}!/{entry}
assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("jar:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("jar:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", true)); //$NON-NLS-1$
assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/vmutil/ff.properties"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- FileSystem.convertStringToUrl("jar:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("jar:/home/test/j.jar!/org/arakhne/vmutil/ff.properties", false)); //$NON-NLS-1$
URL testResource = Resources.getResource("/org/arakhne/vmutil/test.txt"); //$NON-NLS-1$
assertNotNull(testResource);
@@ -800,24 +800,24 @@
URL testResourceFileAbs = new File("/org/arakhne/vmutil/test.txt").toURI().toURL(); //$NON-NLS-1$
assertEquals(testResource,
- FileSystem.convertStringToUrl("resource:/org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("resource:/org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
assertEquals(null,
- FileSystem.convertStringToUrl("resource:/org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("resource:/org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
assertEquals(testResource,
- FileSystem.convertStringToUrl("resource:org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("resource:org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
assertEquals(null,
- FileSystem.convertStringToUrl("resource:org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("resource:org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
assertEquals(testResource,
- FileSystem.convertStringToUrl("/org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("/org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
assertEquals(testResourceFileAbs,
- FileSystem.convertStringToUrl("/org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("/org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
assertEquals(testResource,
- FileSystem.convertStringToUrl("org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("org/arakhne/vmutil/test.txt", true)); //$NON-NLS-1$
assertEquals(testResourceFileRel,
- FileSystem.convertStringToUrl("org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
+ FileSystem.convertStringToURL("org/arakhne/vmutil/test.txt", false)); //$NON-NLS-1$
}
/**