Browse Source

checkstyle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@564907 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
c9a992d30c
2 changed files with 22 additions and 14 deletions
  1. +16
    -8
      src/main/org/apache/tools/ant/launch/Locator.java
  2. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java

+ 16
- 8
src/main/org/apache/tools/ant/launch/Locator.java View File

@@ -28,6 +28,7 @@ import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Locale;

// CheckStyle:LineLengthCheck OFF - urls are long!
/**
* The Locator is a utility class which is used to find certain items
* in the environment.
@@ -44,6 +45,7 @@ import java.util.Locale;
* Be very careful when making changes to this class, as a break will upset a lot of people.
* @since Ant 1.6
*/
// CheckStyle:LineLengthCheck ON - urls are long!
public final class Locator {
/**
* encoding used to represent URIs
@@ -59,7 +61,9 @@ public final class Locator {
private static char[] gAfterEscaping2 = new char[128];
private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static final String ERROR_NOT_FILE_URI = "Can only handle valid file: URIs, not ";
/** Error string used when an invalid uri is seen */
public static final String ERROR_NOT_FILE_URI
= "Can only handle valid file: URIs, not ";

// initialize the above 3 arrays
static {
@@ -202,9 +206,11 @@ public final class Locator {
Throwable e2 = e.getTargetException();
if (e2 instanceof IllegalArgumentException) {
// Bad URI, pass this on.
// no, this is downgraded to a warning after various JRE bugs surfaced. Hand off
// no, this is downgraded to a warning after various
// JRE bugs surfaced. Hand off
// to our built in code on a failure
//throw new IllegalArgumentException("Bad URI " + uri + ":" + e2.getMessage(), e2);
//throw new IllegalArgumentException(
// "Bad URI " + uri + ":" + e2.getMessage(), e2);
e2.printStackTrace();

} else {
@@ -235,7 +241,7 @@ public final class Locator {
// Ignore malformed exception
}
if (url == null || !("file".equals(url.getProtocol()))) {
throw new IllegalArgumentException(ERROR_NOT_FILE_URI +uri);
throw new IllegalArgumentException(ERROR_NOT_FILE_URI + uri);
}
StringBuffer buf = new StringBuffer(url.getHost());
if (buf.length() > 0) {
@@ -262,8 +268,9 @@ public final class Locator {
} catch (UnsupportedEncodingException exc) {
// not sure whether this is clean, but this method is
// declared not to throw exceptions.
throw new IllegalStateException("Could not convert URI "+uri+" to path: "
+ exc.getMessage());
throw new IllegalStateException(
"Could not convert URI " + uri + " to path: "
+ exc.getMessage());
}
return path;
}
@@ -415,7 +422,8 @@ public final class Locator {
}
// couldn't find compiler - try to find tools.jar
// based on java.home setting
String libToolsJar= File.separator + "lib" + File.separator + "tools.jar";
String libToolsJar
= File.separator + "lib" + File.separator + "tools.jar";
String javaHome = System.getProperty("java.home");
File toolsJar = new File(javaHome + libToolsJar);
if (toolsJar.exists()) {
@@ -424,7 +432,7 @@ public final class Locator {
}
if (javaHome.toLowerCase(Locale.US).endsWith(File.separator + "jre")) {
javaHome = javaHome.substring(0, javaHome.length() - 4);
toolsJar = new File(javaHome + libToolsJar );
toolsJar = new File(javaHome + libToolsJar);
}
if (!toolsJar.exists()) {
System.out.println("Unable to locate tools.jar. "


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java View File

@@ -281,16 +281,16 @@ public abstract class DefaultRmicAdapter implements RmicAdapter {
*/
protected String[] filterJvmCompilerArgs(String[] compilerArgs) {
int len = compilerArgs.length;
List args=new ArrayList(len);
for(int i=0;i<len;i++) {
String arg=compilerArgs[i];
if(!arg.startsWith("-J")) {
List args = new ArrayList(len);
for (int i = 0; i < len; i++) {
String arg = compilerArgs[i];
if (!arg.startsWith("-J")) {
args.add(arg);
} else {
attributes.log("Dropping "+arg+" from compiler arguments");
attributes.log("Dropping " + arg + " from compiler arguments");
}
}
int count=args.size();
int count = args.size();
return (String[]) args.toArray(new String[count]);
}



Loading…
Cancel
Save