mbenson 2005/02/07 13:38:51
Modified: src/main/org/apache/tools/ant/launch Locator.java
Log:
Javadoc
Revision Changes Path
1.16 +15 -26 ant/src/main/org/apache/tools/ant/launch/Locator.java
Index: Locator.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Locator.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Locator.java 25 Jan 2005 15:47:57 -0000 1.15
+++ Locator.java 7 Feb 2005 21:38:51 -0000 1.16
@@ -27,7 +27,7 @@
/**
* The Locator is a utility class which is used to find certain items
- * in the environment
+ * in the environment.
*
* @since Ant 1.6
*/
@@ -53,9 +53,9 @@
}
/**
- * Find the directory or jar a give resource has been loaded from.
+ * Find the directory or jar a given resource has been loaded from.
*
- * @param c the classloader to be consulted for the source
+ * @param c the classloader to be consulted for the source.
* @param resource the resource whose location is required.
*
* @return the file with the resource source or null if
@@ -67,7 +67,6 @@
if (c == null) {
c = Locator.class.getClassLoader();
}
-
URL url = null;
if (c == null) {
url = ClassLoader.getSystemResource(resource);
@@ -115,7 +114,6 @@
if (buf.length() > 0) {
buf.insert(0, File.separatorChar).insert(0, File.separatorChar);
}
-
String file = url.getFile();
int queryPos = file.indexOf('?');
buf.append((queryPos < 0) ? file : file.substring(0, queryPos));
@@ -126,7 +124,6 @@
&& Character.isLetter(uri.charAt(1)) && uri.lastIndexOf(':') >
-1) {
uri = uri.substring(1);
}
-
StringBuffer sb = new StringBuffer();
CharacterIterator iter = new StringCharacterIterator(uri);
for (char c = iter.first(); c != CharacterIterator.DONE;
@@ -145,24 +142,21 @@
sb.append(c);
}
}
-
String path = sb.toString();
return path;
}
-
/**
* Get the File necessary to load the Sun compiler tools. If the classes
* are available to this class, then no additional URL is required and
* null is returned. This may be because the classes are explicitly in
the
- * class path or provided by the JVM directly
+ * class path or provided by the JVM directly.
*
- * @return the tools jar as a File if required, null otherwise
+ * @return the tools jar as a File if required, null otherwise.
*/
public static File getToolsJar() {
// firstly check if the tools jar is already in the classpath
boolean toolsJarAvailable = false;
-
try {
// just check whether this throws an exception
Class.forName("com.sun.tools.javac.Main");
@@ -175,11 +169,9 @@
// ignore
}
}
-
if (toolsJarAvailable) {
return null;
}
-
// couldn't find compiler - try to find tools.jar
// based on java.home setting
String javaHome = System.getProperty("java.home");
@@ -196,17 +188,17 @@
}
/**
- * Get an array or URLs representing all of the jar files in the
+ * Get an array of URLs representing all of the jar files in the
* given location. If the location is a file, it is returned as the only
* element of the array. If the location is a directory, it is scanned
for
- * jar files
+ * jar files.
*
- * @param location the location to scan for Jars
+ * @param location the location to scan for Jars.
*
* @return an array of URLs for all jars in the given location.
*
* @exception MalformedURLException if the URLs for the jars cannot be
- * formed
+ * formed.
*/
public static URL[] getLocationURLs(File location)
throws MalformedURLException {
@@ -214,18 +206,18 @@
}
/**
- * Get an array or URLs representing all of the files of a given set of
+ * Get an array of URLs representing all of the files of a given set of
* extensions in the given location. If the location is a file, it is
* returned as the only element of the array. If the location is a
- * directory, it is scanned for matching files
+ * directory, it is scanned for matching files.
*
- * @param location the location to scan for files
+ * @param location the location to scan for files.
* @param extensions an array of extension that are to match in the
- * directory search
+ * directory search.
*
- * @return an array of URLs of matching files
+ * @return an array of URLs of matching files.
* @exception MalformedURLException if the URLs for the files cannot be
- * formed
+ * formed.
*/
public static URL[] getLocationURLs(File location,
final String[] extensions)
@@ -235,7 +227,6 @@
if (!location.exists()) {
return urls;
}
-
if (!location.isDirectory()) {
urls = new URL[1];
String path = location.getPath();
@@ -247,7 +238,6 @@
}
return urls;
}
-
File[] matches = location.listFiles(
new FilenameFilter() {
public boolean accept(File dir, String name) {
@@ -259,7 +249,6 @@
return false;
}
});
-
urls = new URL[matches.length];
for (int i = 0; i < matches.length; ++i) {
urls[i] = matches[i].toURL();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]