@@ -59,7 +59,7 @@ import org.apache.tools.ant.util.FileUtils; | |||
*/ | |||
public class ComponentHelper { | |||
/** Map of component name to lists of restricted definitions */ | |||
private Map<String, List<AntTypeDefinition>> restrictedDefinitions = new HashMap<String, List<AntTypeDefinition>>(); | |||
private Map<String, List<AntTypeDefinition>> restrictedDefinitions = new HashMap<String, List<AntTypeDefinition>>(); | |||
/** Map from component name to anttypedefinition */ | |||
private final Hashtable<String, AntTypeDefinition> antTypeTable = new Hashtable<String, AntTypeDefinition>(); | |||
@@ -146,8 +146,8 @@ public class ComponentHelper { | |||
if (project == null) { | |||
return null; | |||
} | |||
// Singleton for now, it may change ( per/classloader ) | |||
ComponentHelper ph = (ComponentHelper) project.getReference(COMPONENT_HELPER_REFERENCE); | |||
// Singleton for now, it may change (per/classloader) | |||
ComponentHelper ph = project.getReference(COMPONENT_HELPER_REFERENCE); | |||
if (ph != null) { | |||
return ph; | |||
} | |||
@@ -972,7 +972,7 @@ public class ComponentHelper { | |||
out.println("Cause: The constructor threw the exception"); | |||
out.println(t.toString()); | |||
t.printStackTrace(out); //NOSONAR | |||
} catch (NoClassDefFoundError ncdfe) { | |||
} catch (NoClassDefFoundError ncdfe) { | |||
jars = true; | |||
out.println("Cause: A class needed by class " + classname | |||
+ " cannot be found: "); | |||
@@ -124,7 +124,7 @@ public class DemuxOutputStream extends OutputStream { | |||
*/ | |||
private void removeBuffer() { | |||
Thread current = Thread.currentThread(); | |||
buffers.remove (current); | |||
buffers.remove(current); | |||
} | |||
/** | |||
@@ -792,8 +792,7 @@ public class DirectoryScanner | |||
System.arraycopy(this.excludes, 0, tmp, 0, | |||
this.excludes.length); | |||
for (int i = 0; i < excludes.length; i++) { | |||
tmp[this.excludes.length + i] = | |||
normalizePattern(excludes[i]); | |||
tmp[this.excludes.length + i] = normalizePattern(excludes[i]); | |||
} | |||
this.excludes = tmp; | |||
} else { | |||
@@ -856,8 +855,7 @@ public class DirectoryScanner | |||
while (scanning) { | |||
try { | |||
scanLock.wait(); | |||
} catch (final InterruptedException e) { | |||
continue; | |||
} catch (final InterruptedException ignored) { | |||
} | |||
} | |||
if (illegal != null) { | |||
@@ -875,8 +873,7 @@ public class DirectoryScanner | |||
// set in/excludes to reasonable defaults if needed: | |||
final boolean nullIncludes = (includes == null); | |||
includes = nullIncludes | |||
? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes; | |||
includes = nullIncludes ? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes; | |||
final boolean nullExcludes = (excludes == null); | |||
excludes = nullExcludes ? new String[0] : excludes; | |||
@@ -954,8 +951,7 @@ public class DirectoryScanner | |||
for (int i = 0; i < includePatterns.length; i++) { | |||
final String pattern = includePatterns[i].toString(); | |||
if (!shouldSkipPattern(pattern)) { | |||
newroots.put(includePatterns[i].rtrimWildcardTokens(), | |||
pattern); | |||
newroots.put(includePatterns[i].rtrimWildcardTokens(), pattern); | |||
} | |||
} | |||
for (final Map.Entry<String, TokenizedPath> entry : includeNonPatterns.entrySet()) { | |||
@@ -983,8 +979,7 @@ public class DirectoryScanner | |||
for (final Map.Entry<TokenizedPath, String> entry : newroots.entrySet()) { | |||
TokenizedPath currentPath = entry.getKey(); | |||
String currentelement = currentPath.toString(); | |||
if (basedir == null | |||
&& !FileUtils.isAbsolutePath(currentelement)) { | |||
if (basedir == null && !FileUtils.isAbsolutePath(currentelement)) { | |||
continue; | |||
} | |||
File myfile = new File(basedir, currentelement); | |||
@@ -1003,10 +998,8 @@ public class DirectoryScanner | |||
if (myfile != null && basedir != null) { | |||
currentelement = FILE_UTILS.removeLeadingPath( | |||
basedir, myfile); | |||
if (!currentPath.toString() | |||
.equals(currentelement)) { | |||
currentPath = | |||
new TokenizedPath(currentelement); | |||
if (!currentPath.toString().equals(currentelement)) { | |||
currentPath = new TokenizedPath(currentelement); | |||
} | |||
} | |||
} | |||
@@ -1123,8 +1116,7 @@ public class DirectoryScanner | |||
// set in/excludes to reasonable defaults if needed: | |||
final boolean nullIncludes = (includes == null); | |||
includes = nullIncludes | |||
? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes; | |||
includes = nullIncludes ? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes; | |||
final boolean nullExcludes = (excludes == null); | |||
excludes = nullExcludes ? new String[0] : excludes; | |||
@@ -1294,10 +1286,8 @@ public class DirectoryScanner | |||
} else { | |||
everythingIncluded = false; | |||
dirsNotIncluded.addElement(name); | |||
if (fast && couldHoldIncluded(newPath) | |||
&& !contentsExcluded(newPath)) { | |||
scandir(file, newPath, fast, children, | |||
directoryNamesFollowed); | |||
if (fast && couldHoldIncluded(newPath) && !contentsExcluded(newPath)) { | |||
scandir(file, newPath, fast, children, directoryNamesFollowed); | |||
} | |||
} | |||
if (!fast) { | |||
@@ -1351,10 +1341,8 @@ public class DirectoryScanner | |||
} | |||
private void accountForNotFollowedSymlink(final TokenizedPath name, final File file) { | |||
if (!isExcluded(name) && | |||
(isIncluded(name) | |||
|| (file.isDirectory() && couldHoldIncluded(name) | |||
&& !contentsExcluded(name)))) { | |||
if (!isExcluded(name) && (isIncluded(name) | |||
|| (file.isDirectory() && couldHoldIncluded(name) && !contentsExcluded(name)))) { | |||
notFollowedSymlinks.add(file.getAbsolutePath()); | |||
} | |||
} | |||
@@ -1383,7 +1371,7 @@ public class DirectoryScanner | |||
* Test whether or not a name matches against at least one include | |||
* pattern. | |||
* | |||
* @param name The name to match. Must not be <code>null</code>. | |||
* @param name The path to match. Must not be <code>null</code>. | |||
* @return <code>true</code> when the name matches against at least one | |||
* include pattern, or <code>false</code> otherwise. | |||
*/ | |||
@@ -1496,8 +1484,7 @@ public class DirectoryScanner | |||
* @since Ant 1.6 | |||
*/ | |||
private boolean isMorePowerfulThanExcludes(final String name) { | |||
final String soughtexclude = | |||
name + File.separatorChar + SelectorUtils.DEEP_TREE_MATCH; | |||
final String soughtexclude = name + File.separatorChar + SelectorUtils.DEEP_TREE_MATCH; | |||
for (int counter = 0; counter < excludePatterns.length; counter++) { | |||
if (excludePatterns[counter].toString().equals(soughtexclude)) { | |||
return false; | |||
@@ -1761,8 +1748,7 @@ public class DirectoryScanner | |||
public synchronized String[] getNotFollowedSymlinks() { | |||
String[] links; | |||
synchronized (this) { | |||
links = notFollowedSymlinks | |||
.toArray(new String[notFollowedSymlinks.size()]); | |||
links = notFollowedSymlinks.toArray(new String[notFollowedSymlinks.size()]); | |||
} | |||
Arrays.sort(links); | |||
return links; | |||
@@ -1854,12 +1840,12 @@ public class DirectoryScanner | |||
* @param patterns String[] of patterns. | |||
* @since Ant 1.8.0 | |||
*/ | |||
private TokenizedPattern[] fillNonPatternSet(final Map<String, TokenizedPath> map, final String[] patterns) { | |||
private TokenizedPattern[] fillNonPatternSet(final Map<String, TokenizedPath> map, | |||
final String[] patterns) { | |||
final ArrayList<TokenizedPattern> al = new ArrayList<TokenizedPattern>(patterns.length); | |||
for (int i = 0; i < patterns.length; i++) { | |||
if (!SelectorUtils.hasWildcards(patterns[i])) { | |||
final String s = isCaseSensitive() | |||
? patterns[i] : patterns[i].toUpperCase(); | |||
final String s = isCaseSensitive() ? patterns[i] : patterns[i].toUpperCase(); | |||
map.put(s, new TokenizedPath(s)); | |||
} else { | |||
al.add(new TokenizedPattern(patterns[i])); | |||
@@ -1883,8 +1869,7 @@ public class DirectoryScanner | |||
final LinkedList<String> directoryNamesFollowed) { | |||
try { | |||
if (directoryNamesFollowed.size() >= maxLevelsOfSymlinks | |||
&& CollectionUtils.frequency(directoryNamesFollowed, dirName) | |||
>= maxLevelsOfSymlinks | |||
&& CollectionUtils.frequency(directoryNamesFollowed, dirName) >= maxLevelsOfSymlinks | |||
&& SYMLINK_UTILS.isSymbolicLink(parent, dirName)) { | |||
final ArrayList<String> files = new ArrayList<String>(); | |||
@@ -1899,8 +1884,7 @@ public class DirectoryScanner | |||
f = FILE_UTILS.resolveFile(parent, relPath + dir); | |||
files.add(f.getCanonicalPath()); | |||
if (files.size() > maxLevelsOfSymlinks | |||
&& CollectionUtils.frequency(files, target) | |||
> maxLevelsOfSymlinks) { | |||
&& CollectionUtils.frequency(files, target) > maxLevelsOfSymlinks) { | |||
return true; | |||
} | |||
} | |||
@@ -1125,7 +1125,7 @@ public final class IntrospectionHelper { | |||
void set(final Project p, final Object parent, final String value) throws InvocationTargetException, | |||
IllegalAccessException, BuildException { | |||
m.invoke(parent, new Object[] {new FileResource(p, p.resolveFile(value))}); | |||
}; | |||
} | |||
}; | |||
} | |||
// EnumeratedAttributes have their own helper class | |||
@@ -192,12 +192,12 @@ public class Project implements ResourceFactory { | |||
private ClassLoader coreLoader = null; | |||
/** Records the latest task to be executed on a thread. */ | |||
private final Map<Thread,Task> threadTasks = | |||
Collections.synchronizedMap(new WeakHashMap<Thread, Task>()); | |||
private final Map<Thread, Task> threadTasks | |||
= Collections.synchronizedMap(new WeakHashMap<Thread, Task>()); | |||
/** Records the latest task to be executed on a thread group. */ | |||
private final Map<ThreadGroup,Task> threadGroupTasks | |||
= Collections.synchronizedMap(new WeakHashMap<ThreadGroup,Task>()); | |||
private final Map<ThreadGroup, Task> threadGroupTasks | |||
= Collections.synchronizedMap(new WeakHashMap<ThreadGroup,Task>()); | |||
/** | |||
* Called to handle any input requests. | |||
@@ -593,8 +593,7 @@ public class RuntimeConfigurable implements Serializable { | |||
// Children (this is a shadow of UnknownElement#children) | |||
if (r.children != null) { | |||
ArrayList<RuntimeConfigurable> newChildren = new ArrayList<RuntimeConfigurable>(); | |||
newChildren.addAll(r.children); | |||
ArrayList<RuntimeConfigurable> newChildren = new ArrayList<RuntimeConfigurable>(r.children); | |||
if (children != null) { | |||
newChildren.addAll(children); | |||
} | |||
@@ -400,8 +400,7 @@ public class UnknownElement extends Task { | |||
// Do the runtime | |||
getWrapper().applyPreSet(u.getWrapper()); | |||
if (u.children != null) { | |||
List<UnknownElement> newChildren = new ArrayList<UnknownElement>(); | |||
newChildren.addAll(u.children); | |||
List<UnknownElement> newChildren = new ArrayList<UnknownElement>(u.children); | |||
if (children != null) { | |||
newChildren.addAll(children); | |||
} | |||
@@ -466,7 +466,7 @@ public class XmlLogger implements BuildLogger { | |||
} | |||
private void synchronizedAppend(Node parent, Node child) { | |||
synchronized(parent) { | |||
synchronized (parent) { | |||
parent.appendChild(child); | |||
} | |||
} | |||
@@ -176,7 +176,7 @@ public abstract class BaseFilterReader extends FilterReader { | |||
StringBuffer line = new StringBuffer(); | |||
while (ch != -1) { | |||
line.append ((char) ch); | |||
line.append((char) ch); | |||
if (ch == '\n') { | |||
break; | |||
} | |||
@@ -87,7 +87,8 @@ public final class ReplaceTokens | |||
* | |||
* @see BaseFilterReader#BaseFilterReader() | |||
*/ | |||
public ReplaceTokens() {} | |||
public ReplaceTokens() { | |||
} | |||
/** | |||
* Creates a new filtered reader. | |||
@@ -138,12 +139,12 @@ public final class ReplaceTokens | |||
if (next == -1) { | |||
return next; // end of stream. all buffers empty. | |||
} | |||
readBuffer += (char)next; | |||
readBuffer += (char) next; | |||
} | |||
for (;;) { | |||
// get the closest tokens | |||
SortedMap<String,String> possibleTokens = resolvedTokens.tailMap(readBuffer); | |||
SortedMap<String, String> possibleTokens = resolvedTokens.tailMap(readBuffer); | |||
if (possibleTokens.isEmpty() || !possibleTokens.firstKey().startsWith(readBuffer)) { // if there is none, then deliver the first char from the buffer. | |||
return getFirstCharacterFromReadBuffer(); | |||
} else if (readBuffer.equals(possibleTokens.firstKey())) { // there exists a nearest token - is it an exact match? | |||
@@ -156,7 +157,7 @@ public final class ReplaceTokens | |||
} else { // nearest token is not matching exactly - read one character more. | |||
int next = in.read(); | |||
if (next != -1) { | |||
readBuffer += (char)next; | |||
readBuffer += (char) next; | |||
} else { | |||
return getFirstCharacterFromReadBuffer(); // end of stream. deliver remaining characters from buffer. | |||
} | |||
@@ -120,7 +120,7 @@ public class Launcher { | |||
} | |||
if (exitCode != 0) { | |||
if (launchDiag) { | |||
System.out.println("Exit code: "+exitCode); | |||
System.out.println("Exit code: " + exitCode); | |||
} | |||
System.exit(exitCode); | |||
} | |||
@@ -237,7 +237,7 @@ public class Launcher { | |||
} | |||
} | |||
logPath("Launcher JAR",sourceJar); | |||
logPath("Launcher JAR", sourceJar); | |||
logPath("Launcher JAR directory", sourceJar.getParentFile()); | |||
logPath("java.home", new File(System.getProperty("java.home"))); | |||
@@ -256,7 +256,7 @@ public class Launcher { | |||
final URL[] userURLs = noUserLib ? new URL[0] : getUserURLs(); | |||
final File toolsJAR = Locator.getToolsJar(); | |||
logPath("tools.jar",toolsJAR); | |||
logPath("tools.jar", toolsJAR); | |||
final URL[] jars = getJarArray( | |||
libURLs, userURLs, systemURLs, toolsJAR); | |||
@@ -279,7 +279,7 @@ public class Launcher { | |||
Thread.currentThread().setContextClassLoader(loader); | |||
Class<?> mainClass = null; | |||
int exitCode = 0; | |||
Throwable thrown=null; | |||
Throwable thrown = null; | |||
try { | |||
mainClass = loader.loadClass(mainClassname); | |||
final AntMain main = (AntMain) mainClass.newInstance(); | |||
@@ -297,10 +297,10 @@ public class Launcher { | |||
thrown = cnfe; | |||
} catch (final Throwable t) { | |||
t.printStackTrace(System.err); //NOSONAR | |||
thrown=t; | |||
thrown = t; | |||
} | |||
if(thrown!=null) { | |||
System.err.println(ANTHOME_PROPERTY+": "+antHome.getAbsolutePath()); | |||
if (thrown != null) { | |||
System.err.println(ANTHOME_PROPERTY + ": " + antHome.getAbsolutePath()); | |||
System.err.println("Classpath: " + baseClassPath.toString()); | |||
System.err.println("Launcher JAR: " + sourceJar.getAbsolutePath()); | |||
System.err.println("Launcher Directory: " + jarDir.getAbsolutePath()); | |||
@@ -374,8 +374,8 @@ public class Launcher { | |||
* @return a combined array | |||
* @throws MalformedURLException if there is a problem. | |||
*/ | |||
private URL[] getJarArray ( | |||
final URL[] libJars, final URL[] userJars, final URL[] systemJars, final File toolsJar) | |||
private URL[] getJarArray(final URL[] libJars, final URL[] userJars, | |||
final URL[] systemJars, final File toolsJar) | |||
throws MalformedURLException { | |||
int numJars = libJars.length + userJars.length + systemJars.length; | |||
if (toolsJar != null) { | |||
@@ -405,7 +405,7 @@ public class Launcher { | |||
System.setProperty(name, value); | |||
} | |||
private void logPath(final String name,final File path) { | |||
private void logPath(final String name, final File path) { | |||
if(launchDiag) { | |||
System.out.println(name+"= \""+path+"\""); | |||
} | |||
@@ -401,8 +401,7 @@ public final class Locator { | |||
* @deprecated since 1.9, use <code>FileUtils.getFileURL(File)</code> | |||
*/ | |||
@Deprecated | |||
public static URL fileToURL(File file) | |||
throws MalformedURLException { | |||
public static URL fileToURL(File file) throws MalformedURLException { | |||
return new URL(file.toURI().toASCIIString()); | |||
} | |||
@@ -103,8 +103,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger { | |||
/** {@inheritDoc}. */ | |||
public void buildStarted(final BuildEvent event) { | |||
final String categoryString = PROJECT_LOG; | |||
final Log log = getLog(categoryString, null); | |||
final Log log = getLog(PROJECT_LOG, null); | |||
if (initialized) { | |||
realLog(log, "Build started.", Project.MSG_INFO, null); | |||
@@ -114,8 +113,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger { | |||
/** {@inheritDoc}. */ | |||
public void buildFinished(final BuildEvent event) { | |||
if (initialized) { | |||
final String categoryString = PROJECT_LOG; | |||
final Log log = getLog(categoryString, event.getProject().getName()); | |||
final Log log = getLog(PROJECT_LOG, event.getProject().getName()); | |||
if (event.getException() == null) { | |||
realLog(log, "Build finished.", Project.MSG_INFO, null); | |||
@@ -245,7 +243,7 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger { | |||
final Log log = getLog(categoryString, categoryDetail); | |||
final int priority = event.getPriority(); | |||
final String message = event.getMessage(); | |||
realLog(log, message, priority , null); | |||
realLog(log, message, priority, null); | |||
} | |||
} | |||
@@ -369,7 +369,7 @@ public class Ant extends Task { | |||
log("calling target(s) " | |||
+ ((locals.size() > 0) ? locals.toString() : "[default]") | |||
+ " in build file " + antFile, Project.MSG_VERBOSE); | |||
newProject.setUserProperty(MagicNames.ANT_FILE , antFile); | |||
newProject.setUserProperty(MagicNames.ANT_FILE, antFile); | |||
String thisAntFile = getProject().getProperty(MagicNames.ANT_FILE); | |||
// Are we trying to call the target in which we are defined (or | |||
@@ -82,9 +82,8 @@ public class BindTargets extends Task { | |||
ProjectHelper.PROJECTHELPER_REFERENCE); | |||
for (final Iterator<String> itTarget = targets.iterator(); itTarget.hasNext();) { | |||
helper.getExtensionStack().add( | |||
new String[] {extensionPoint, itTarget.next(), | |||
onMissingExtensionPoint.name()}); | |||
helper.getExtensionStack().add(new String[] {extensionPoint, | |||
itTarget.next(), onMissingExtensionPoint.name()}); | |||
} | |||
} | |||
@@ -114,7 +114,7 @@ public class CVSPass extends Task { | |||
String pwdfile = buf.toString() + cvsRoot + " A" | |||
+ mangle(password); | |||
log("Writing -> " + pwdfile , Project.MSG_DEBUG); | |||
log("Writing -> " + pwdfile, Project.MSG_DEBUG); | |||
writer = new BufferedWriter(new FileWriter(passFile)); | |||
@@ -490,7 +490,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
dis.close(); | |||
fis.close(); | |||
fis = null; | |||
byte[] fileDigest = messageDigest.digest (); | |||
byte[] fileDigest = messageDigest.digest(); | |||
if (totalproperty != null) { | |||
allDigests.put(src, fileDigest); | |||
} | |||
@@ -229,7 +229,7 @@ public class Classloader extends Task { | |||
for (int i = 0; i < list.length; i++) { | |||
File f = new File(list[i]); | |||
if (f.exists()) { | |||
log("Adding to class loader " + acl + " " + f.getAbsolutePath(), | |||
log("Adding to class loader " + acl + " " + f.getAbsolutePath(), | |||
Project.MSG_DEBUG); | |||
acl.addPathElement(f.getAbsolutePath()); | |||
} | |||
@@ -121,7 +121,8 @@ public abstract class Definer extends DefBase { | |||
* @return an array of the allowed values for this attribute. | |||
*/ | |||
public String[] getValues() { | |||
return new String[] {POLICY_FAIL, POLICY_REPORT, POLICY_IGNORE, POLICY_FAILALL}; | |||
return new String[] {POLICY_FAIL, POLICY_REPORT, POLICY_IGNORE, | |||
POLICY_FAILALL}; | |||
} | |||
} | |||
@@ -559,8 +559,7 @@ public class Delete extends MatchingTask { | |||
} | |||
if (quiet && failonerror) { | |||
throw new BuildException("quiet and failonerror cannot both be " | |||
+ "set to true", getLocation()); | |||
throw new BuildException("quiet and failonerror cannot both be set to true", getLocation()); | |||
} | |||
// delete the single file | |||
@@ -609,8 +608,7 @@ public class Delete extends MatchingTask { | |||
+ " which looks like a broken symlink.", | |||
quiet ? Project.MSG_VERBOSE : verbosity); | |||
if (!delete(dir)) { | |||
handle("Unable to delete directory " | |||
+ dir.getAbsolutePath()); | |||
handle("Unable to delete directory " + dir.getAbsolutePath()); | |||
} | |||
} | |||
} | |||
@@ -638,13 +636,11 @@ public class Delete extends MatchingTask { | |||
fs.setProject(getProject()); | |||
} | |||
final File fsDir = fs.getDir(); | |||
if (!fs.getErrorOnMissingDir() && | |||
(fsDir == null || !fsDir.exists())) { | |||
if (!fs.getErrorOnMissingDir() && (fsDir == null || !fsDir.exists())) { | |||
continue; | |||
} | |||
if (fsDir == null) { | |||
throw new BuildException( | |||
"File or Resource without directory or file specified"); | |||
throw new BuildException("File or Resource without directory or file specified"); | |||
} else if (!fsDir.isDirectory()) { | |||
handle("Directory does not exist: " + fsDir); | |||
} else { | |||
@@ -657,9 +653,11 @@ public class Delete extends MatchingTask { | |||
public boolean isFilesystemOnly() { | |||
return true; | |||
} | |||
public int size() { | |||
return files.length; | |||
} | |||
public Iterator<Resource> iterator() { | |||
return new FileResourceIterator(getProject(), | |||
fsDir, files); | |||
@@ -667,8 +665,7 @@ public class Delete extends MatchingTask { | |||
}); | |||
if (includeEmpty) { | |||
filesetDirs.add(new ReverseDirs(getProject(), fsDir, | |||
ds | |||
.getIncludedDirectories())); | |||
ds.getIncludedDirectories())); | |||
} | |||
if (removeNotFollowedSymlinks) { | |||
@@ -706,8 +703,7 @@ public class Delete extends MatchingTask { | |||
for (Resource r : resourcesToDelete) { | |||
// nonexistent resources could only occur if we already | |||
// deleted something from a fileset: | |||
File f = r.as(FileProvider.class) | |||
.getFile(); | |||
File f = r.as(FileProvider.class).getFile(); | |||
if (!f.exists()) { | |||
continue; | |||
} | |||
@@ -741,8 +737,7 @@ public class Delete extends MatchingTask { | |||
private void handle(Exception e) { | |||
if (failonerror) { | |||
throw (e instanceof BuildException) | |||
? (BuildException) e : new BuildException(e); | |||
throw (e instanceof BuildException) ? (BuildException) e : new BuildException(e); | |||
} | |||
log(e, quiet ? Project.MSG_VERBOSE : verbosity); | |||
} | |||
@@ -825,8 +820,7 @@ public class Delete extends MatchingTask { | |||
log("Deleting " + currDir.getAbsolutePath(), | |||
quiet ? Project.MSG_VERBOSE : verbosity); | |||
if (!delete(currDir)) { | |||
handle("Unable to delete directory " | |||
+ currDir.getAbsolutePath()); | |||
handle("Unable to delete directory " + currDir.getAbsolutePath()); | |||
} else { | |||
dirCount++; | |||
} | |||
@@ -834,8 +828,7 @@ public class Delete extends MatchingTask { | |||
} | |||
if (dirCount > 0) { | |||
log("Deleted " | |||
+ dirCount | |||
log("Deleted " + dirCount | |||
+ " director" + (dirCount == 1 ? "y" : "ies") | |||
+ " form " + d.getAbsolutePath(), | |||
quiet ? Project.MSG_VERBOSE : verbosity); | |||
@@ -108,7 +108,8 @@ public class EchoXML extends XMLFragment { | |||
public static final NamespacePolicy DEFAULT | |||
= new NamespacePolicy(IGNORE); | |||
public NamespacePolicy() {} | |||
public NamespacePolicy() { | |||
} | |||
public NamespacePolicy(String s) { | |||
setValue(s); | |||
@@ -318,7 +318,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||
exe.setVMLauncher(true); | |||
File vmsJavaOptionFile = null; | |||
try { | |||
String [] args = new String[command.length - 1]; | |||
String[] args = new String[command.length - 1]; | |||
System.arraycopy(command, 1, args, 0, command.length - 1); | |||
vmsJavaOptionFile = JavaEnvUtils.createVmsJavaOptionFile(args); | |||
//we mark the file to be deleted on exit. | |||
@@ -326,7 +326,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||
//after execution finished, which is much better for long-lived runtimes | |||
//though spawning complicates things... | |||
vmsJavaOptionFile.deleteOnExit(); | |||
String [] vmsCmd = {command[0], "-V", vmsJavaOptionFile.getPath()}; | |||
String[] vmsCmd = {command[0], "-V", vmsJavaOptionFile.getPath()}; | |||
exe.setCommandline(vmsCmd); | |||
} catch (IOException e) { | |||
throw new BuildException("Failed to create a temporary file for \"-V\" switch"); | |||
@@ -328,8 +328,7 @@ public class ExecuteOn extends ExecTask { | |||
*/ | |||
protected ExecuteStreamHandler createHandler() throws BuildException { | |||
//if we have a RedirectorElement, return a decoy | |||
return (redirectorElement == null) | |||
? super.createHandler() : new PumpStreamHandler(); | |||
return (redirectorElement == null) ? super.createHandler() : new PumpStreamHandler(); | |||
} | |||
/** | |||
@@ -394,8 +393,7 @@ public class ExecuteOn extends ExecTask { | |||
fileNames.copyInto(s); | |||
for (int j = 0; j < s.length; j++) { | |||
String[] command = getCommandline(s[j], base); | |||
log(Commandline.describeCommand(command), | |||
Project.MSG_VERBOSE); | |||
log(Commandline.describeCommand(command), Project.MSG_VERBOSE); | |||
exe.setCommandline(command); | |||
if (redirectorElement != null) { | |||
@@ -438,11 +436,9 @@ public class ExecuteOn extends ExecTask { | |||
continue; | |||
} | |||
if ((!res.isDirectory() || !res.isExists()) | |||
&& !FileDirBoth.DIR.equals(type)) { | |||
if ((!res.isDirectory() || !res.isExists()) && !FileDirBoth.DIR.equals(type)) { | |||
totalFiles++; | |||
} else if (res.isDirectory() | |||
&& !FileDirBoth.FILE.equals(type)) { | |||
} else if (res.isDirectory() && !FileDirBoth.FILE.equals(type)) { | |||
totalDirs++; | |||
} else { | |||
continue; | |||
@@ -453,8 +449,7 @@ public class ExecuteOn extends ExecTask { | |||
if (!parallel) { | |||
String[] command = getCommandline(name, base); | |||
log(Commandline.describeCommand(command), | |||
Project.MSG_VERBOSE); | |||
log(Commandline.describeCommand(command), Project.MSG_VERBOSE); | |||
exe.setCommandline(command); | |||
if (redirectorElement != null) { | |||
@@ -479,10 +474,8 @@ public class ExecuteOn extends ExecTask { | |||
haveExecuted = true; | |||
} | |||
if (haveExecuted) { | |||
log("Applied " + cmdl.getExecutable() + " to " | |||
+ totalFiles + " file" | |||
+ (totalFiles != 1 ? "s" : "") + " and " | |||
+ totalDirs + " director" | |||
log("Applied " + cmdl.getExecutable() + " to " + totalFiles + " file" | |||
+ (totalFiles != 1 ? "s" : "") + " and " + totalDirs + " director" | |||
+ (totalDirs != 1 ? "ies" : "y") + ".", | |||
verbose ? Project.MSG_INFO : Project.MSG_VERBOSE); | |||
} | |||
@@ -504,11 +497,8 @@ public class ExecuteOn extends ExecTask { | |||
*/ | |||
private void logSkippingFileset( | |||
String currentType, DirectoryScanner ds, File base) { | |||
int includedCount | |||
= ((!FileDirBoth.DIR.equals(currentType)) | |||
? ds.getIncludedFilesCount() : 0) | |||
+ ((!FileDirBoth.FILE.equals(currentType)) | |||
? ds.getIncludedDirsCount() : 0); | |||
int includedCount = (!FileDirBoth.DIR.equals(currentType) ? ds.getIncludedFilesCount() : 0) | |||
+ (!FileDirBoth.FILE.equals(currentType) ? ds.getIncludedDirsCount() : 0); | |||
log("Skipping fileset for directory " + base + ". It is " | |||
+ ((includedCount > 0) ? "up to date." : "empty."), | |||
@@ -624,9 +614,8 @@ public class ExecuteOn extends ExecTask { | |||
if (forwardSlash && fileSeparator != '/') { | |||
src = src.replace(fileSeparator, '/'); | |||
} | |||
if (srcFilePos != null && | |||
(srcFilePos.getPrefix().length() > 0 | |||
|| srcFilePos.getSuffix().length() > 0)) { | |||
if (srcFilePos != null && (srcFilePos.getPrefix().length() > 0 | |||
|| srcFilePos.getSuffix().length() > 0)) { | |||
src = srcFilePos.getPrefix() + src + srcFilePos.getSuffix(); | |||
} | |||
result[srcIndex + i] = src; | |||
@@ -702,8 +691,7 @@ public class ExecuteOn extends ExecTask { | |||
File[] b = new File[baseDirs.size()]; | |||
baseDirs.copyInto(b); | |||
if (maxParallel <= 0 | |||
|| s.length == 0 /* this is skipEmpty == false */) { | |||
if (maxParallel <= 0 || s.length == 0 /* this is skipEmpty == false */) { | |||
String[] command = getCommandline(s, b); | |||
log(Commandline.describeCommand(command), Project.MSG_VERBOSE); | |||
exe.setCommandline(command); | |||
@@ -687,8 +687,8 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||
* {@inheritDoc}. | |||
*/ | |||
public String[] getValues() { | |||
return new String[] {"asis", "cr", "lf", "crlf", | |||
"mac", "unix", "dos"}; | |||
return new String[] {"asis", "cr", "lf", "crlf", "mac", "unix", | |||
"dos"}; | |||
} | |||
} | |||
@@ -19,7 +19,6 @@ | |||
package org.apache.tools.ant.taskdefs; | |||
import java.io.File; | |||
import java.io.FileNotFoundException; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
@@ -349,7 +348,7 @@ public class Get extends Task { | |||
* @param v if "true" then be quiet | |||
* @since Ant 1.9.4 | |||
*/ | |||
public void setQuiet(final boolean v){ | |||
public void setQuiet(final boolean v) { | |||
this.quiet = v; | |||
} | |||
@@ -626,8 +625,8 @@ public class Get extends Task { | |||
private int redirections = 0; | |||
private String userAgent = null; | |||
GetThread(final URL source, final File dest, | |||
final boolean h, final long t, final DownloadProgress p, final int l, final String userAgent) { | |||
GetThread(final URL source, final File dest, final boolean h, | |||
final long t, final DownloadProgress p, final int l, final String userAgent) { | |||
this.source = source; | |||
this.dest = dest; | |||
hasTimestamp = h; | |||
@@ -670,34 +669,29 @@ public class Get extends Task { | |||
private boolean redirectionAllowed(final URL aSource, final URL aDest) { | |||
if (!(aSource.getProtocol().equals(aDest.getProtocol()) || (HTTP | |||
.equals(aSource.getProtocol()) && HTTPS.equals(aDest | |||
.getProtocol())))) { | |||
final String message = "Redirection detected from " | |||
+ aSource.getProtocol() + " to " + aDest.getProtocol() | |||
+ ". Protocol switch unsafe, not allowed."; | |||
if (ignoreErrors) { | |||
log(message, logLevel); | |||
return false; | |||
} else { | |||
if (aSource.getProtocol().equals(aDest.getProtocol()) | |||
&& (HTTP.equals(aSource.getProtocol()) || HTTPS.equals(aDest.getProtocol()))) { | |||
redirections++; | |||
if (redirections > REDIRECT_LIMIT) { | |||
final String message = "More than " + REDIRECT_LIMIT | |||
+ " times redirected, giving up"; | |||
if (ignoreErrors) { | |||
log(message, logLevel); | |||
return false; | |||
} | |||
throw new BuildException(message); | |||
} | |||
return true; | |||
} | |||
redirections++; | |||
if (redirections > REDIRECT_LIMIT) { | |||
final String message = "More than " + REDIRECT_LIMIT | |||
+ " times redirected, giving up"; | |||
if (ignoreErrors) { | |||
log(message, logLevel); | |||
return false; | |||
} else { | |||
throw new BuildException(message); | |||
} | |||
final String message = "Redirection detected from " | |||
+ aSource.getProtocol() + " to " + aDest.getProtocol() | |||
+ ". Protocol switch unsafe, not allowed."; | |||
if (ignoreErrors) { | |||
log(message, logLevel); | |||
return false; | |||
} | |||
return true; | |||
throw new BuildException(message); | |||
} | |||
private URLConnection openConnection(final URL aSource) throws IOException { | |||
@@ -721,8 +715,7 @@ public class Get extends Task { | |||
// testing | |||
final Base64Converter encoder = new Base64Converter(); | |||
encoding = encoder.encode(up.getBytes()); | |||
connection.setRequestProperty("Authorization", "Basic " | |||
+ encoding); | |||
connection.setRequestProperty("Authorization", "Basic " + encoding); | |||
} | |||
if (tryGzipEncoding) { | |||
@@ -730,10 +723,8 @@ public class Get extends Task { | |||
} | |||
if (connection instanceof HttpURLConnection) { | |||
((HttpURLConnection) connection) | |||
.setInstanceFollowRedirects(false); | |||
((HttpURLConnection) connection) | |||
.setUseCaches(httpUseCaches); | |||
((HttpURLConnection) connection).setInstanceFollowRedirects(false); | |||
connection.setUseCaches(httpUseCaches); | |||
} | |||
// connect to the remote site (may take some time) | |||
try { | |||
@@ -791,14 +782,13 @@ public class Get extends Task { | |||
} | |||
private boolean isMoved(final int responseCode) { | |||
return responseCode == HttpURLConnection.HTTP_MOVED_PERM || | |||
responseCode == HttpURLConnection.HTTP_MOVED_TEMP || | |||
responseCode == HttpURLConnection.HTTP_SEE_OTHER || | |||
responseCode == HTTP_MOVED_TEMP; | |||
return responseCode == HttpURLConnection.HTTP_MOVED_PERM | |||
|| responseCode == HttpURLConnection.HTTP_MOVED_TEMP | |||
|| responseCode == HttpURLConnection.HTTP_SEE_OTHER | |||
|| responseCode == HTTP_MOVED_TEMP; | |||
} | |||
private boolean downloadFile() | |||
throws FileNotFoundException, IOException { | |||
private boolean downloadFile() throws IOException { | |||
for (int i = 0; i < numberRetries; i++) { | |||
// this three attempt trick is to get round quirks in different | |||
// Java implementations. Some of them take a few goes to bind | |||
@@ -855,9 +845,7 @@ public class Get extends Task { | |||
if (verbose) { | |||
final Date t = new Date(remoteTimestamp); | |||
log("last modified = " + t.toString() | |||
+ ((remoteTimestamp == 0) | |||
? " - using current time instead" | |||
: ""), logLevel); | |||
+ ((remoteTimestamp == 0) ? " - using current time instead" : ""), logLevel); | |||
} | |||
if (remoteTimestamp != 0) { | |||
FILE_UTILS.setFileLastModified(dest, remoteTimestamp); | |||
@@ -242,7 +242,7 @@ public class HostInfo extends Task { | |||
int idx = fqdn.indexOf('.'); | |||
if (idx > 0) { | |||
setProperty(NAME, fqdn.substring(0, idx)); | |||
setProperty(DOMAIN, fqdn.substring(idx+1)); | |||
setProperty(DOMAIN, fqdn.substring(idx + 1)); | |||
} else { | |||
setProperty(NAME, fqdn); | |||
setProperty(DOMAIN, DEF_DOMAIN); | |||
@@ -122,11 +122,10 @@ public class Input extends Task { | |||
public static class HandlerType extends EnumeratedAttribute { | |||
private static final String[] VALUES = {"default", "propertyfile", "greedy", "secure"}; | |||
private static final InputHandler[] HANDLERS | |||
= {new DefaultInputHandler(), | |||
new PropertyFileInputHandler(), | |||
new GreedyInputHandler(), | |||
new SecureInputHandler()}; | |||
private static final InputHandler[] HANDLERS = {new DefaultInputHandler(), | |||
new PropertyFileInputHandler(), | |||
new GreedyInputHandler(), | |||
new SecureInputHandler()}; | |||
/** {@inheritDoc} */ | |||
@Override | |||
@@ -153,7 +152,7 @@ public class Input extends Task { | |||
* | |||
* @param validargs A comma separated String defining valid input args. | |||
*/ | |||
public void setValidargs (final String validargs) { | |||
public void setValidargs(final String validargs) { | |||
this.validargs = validargs; | |||
} | |||
@@ -164,7 +163,7 @@ public class Input extends Task { | |||
* | |||
* @param addproperty Name for the property to be created from input | |||
*/ | |||
public void setAddproperty (final String addproperty) { | |||
public void setAddproperty(final String addproperty) { | |||
this.addproperty = addproperty; | |||
} | |||
@@ -172,7 +171,7 @@ public class Input extends Task { | |||
* Sets the Message which gets displayed to the user during the build run. | |||
* @param message The message to be displayed. | |||
*/ | |||
public void setMessage (final String message) { | |||
public void setMessage(final String message) { | |||
this.message = message; | |||
messageAttribute = true; | |||
} | |||
@@ -184,7 +183,7 @@ public class Input extends Task { | |||
* @param defaultvalue Default value for the property if no input | |||
* is received | |||
*/ | |||
public void setDefaultvalue (final String defaultvalue) { | |||
public void setDefaultvalue(final String defaultvalue) { | |||
this.defaultvalue = defaultvalue; | |||
} | |||
@@ -210,7 +209,7 @@ public class Input extends Task { | |||
* @throws BuildException on error | |||
*/ | |||
@Override | |||
public void execute () throws BuildException { | |||
public void execute() throws BuildException { | |||
if (addproperty != null | |||
&& getProject().getProperty(addproperty) != null) { | |||
log("skipping " + getTaskName() + " as property " + addproperty | |||
@@ -1180,9 +1180,7 @@ public class Jar extends Zip { | |||
if (rcs[i] instanceof FileSet) { | |||
resources = grabResources(new FileSet[] {(FileSet) rcs[i]}); | |||
} else { | |||
resources = grabNonFileSetResources(new ResourceCollection[] { | |||
rcs[i] | |||
}); | |||
resources = grabNonFileSetResources(new ResourceCollection[] {rcs[i]}); | |||
} | |||
for (int j = 0; j < resources[0].length; j++) { | |||
String name = resources[0][j].getName().replace('\\', '/'); | |||
@@ -1227,7 +1225,7 @@ public class Jar extends Zip { | |||
* @return the list of values. | |||
*/ | |||
public String[] getValues() { | |||
return new String[]{"fail", "warn", "ignore"}; | |||
return new String[] {"fail", "warn", "ignore"}; | |||
} | |||
/** | |||
* @return The log level according to the strict mode. | |||
@@ -1671,9 +1671,8 @@ public class Javac extends MatchingTask { | |||
throw new BuildException("The modulesourcepath entry must contain at most one module mark"); | |||
} | |||
final String pathToModule = pattern.substring(0, startIndex); | |||
final String pathInModule = endIndex == pattern.length() ? | |||
null : | |||
pattern.substring(endIndex + 1); //+1 the separator | |||
final String pathInModule = endIndex == pattern.length() | |||
? null : pattern.substring(endIndex + 1); //+1 the separator | |||
findModules(root, pathToModule, pathInModule, collector); | |||
} | |||
} | |||
@@ -1334,7 +1334,7 @@ public class Javadoc extends Task { | |||
private String scope = "a"; | |||
/** Sole constructor. */ | |||
public TagArgument () { | |||
public TagArgument() { | |||
//empty | |||
} | |||
@@ -1344,7 +1344,7 @@ public class Javadoc extends Task { | |||
* @param name The name of the tag. | |||
* Must not be <code>null</code> or empty. | |||
*/ | |||
public void setName (final String name) { | |||
public void setName(final String name) { | |||
this.name = name; | |||
} | |||
@@ -1364,7 +1364,7 @@ public class Javadoc extends Task { | |||
* elements are specified, or if any unrecognised elements are | |||
* specified. | |||
*/ | |||
public void setScope (String verboseScope) throws BuildException { | |||
public void setScope(String verboseScope) throws BuildException { | |||
verboseScope = verboseScope.toLowerCase(Locale.ENGLISH); | |||
final boolean[] elements = new boolean[SCOPE_ELEMENTS.length]; | |||
@@ -1374,7 +1374,7 @@ public class Javadoc extends Task { | |||
// Go through the tokens one at a time, updating the | |||
// elements array and issuing warnings where appropriate. | |||
final StringTokenizer tok = new StringTokenizer (verboseScope, ","); | |||
final StringTokenizer tok = new StringTokenizer(verboseScope, ","); | |||
while (tok.hasMoreTokens()) { | |||
final String next = tok.nextToken().trim(); | |||
if (next.equals("all")) { | |||
@@ -1430,7 +1430,7 @@ public class Javadoc extends Task { | |||
* | |||
* @param enabled Whether or not this tag is enabled. | |||
*/ | |||
public void setEnabled (final boolean enabled) { | |||
public void setEnabled(final boolean enabled) { | |||
this.enabled = enabled; | |||
} | |||
@@ -176,18 +176,18 @@ public class KeySubst extends Task { | |||
while ((index = origString.indexOf("${", i)) > -1) { | |||
key = origString.substring(index + 2, origString.indexOf("}", | |||
index + 3)); | |||
finalString.append (origString.substring(i, index)); | |||
finalString.append(origString.substring(i, index)); | |||
if (keys.containsKey(key)) { | |||
finalString.append (keys.get(key)); | |||
finalString.append(keys.get(key)); | |||
} else { | |||
finalString.append ("${"); | |||
finalString.append (key); | |||
finalString.append ("}"); | |||
finalString.append("${"); | |||
finalString.append(key); | |||
finalString.append("}"); | |||
} | |||
i = index + 3 + key.length(); | |||
} | |||
// CheckStyle:MagicNumber ON | |||
finalString.append (origString.substring(i)); | |||
finalString.append(origString.substring(i)); | |||
return finalString.toString(); | |||
} | |||
} |
@@ -170,7 +170,7 @@ public class PathConvert extends Task { | |||
*/ | |||
@Override | |||
public String[] getValues() { | |||
return new String[]{"windows", "unix", "netware", "os/2", "tandem"}; | |||
return new String[] {"windows", "unix", "netware", "os/2", "tandem"}; | |||
} | |||
} | |||
@@ -514,7 +514,7 @@ public class Replace extends MatchingTask { | |||
Properties props = getProperties(replaceFilterResource); | |||
Iterator e = getOrderedIterator(props); | |||
while (e.hasNext()) { | |||
String tok = e.next().toString(); | |||
String tok = e.next().toString(); | |||
Replacefilter replaceFilter = createReplacefilter(); | |||
replaceFilter.setToken(tok); | |||
replaceFilter.setValue(props.getProperty(tok)); | |||
@@ -1109,9 +1109,9 @@ public class SQLExec extends JDBCTask { | |||
public int lastDelimiterPosition(StringBuffer buf, String currentLine) { | |||
if (strictDelimiterMatching) { | |||
if ((delimiterType.equals(DelimiterType.NORMAL) | |||
&& StringUtils.endsWith(buf, delimiter)) || | |||
(delimiterType.equals(DelimiterType.ROW) | |||
&& currentLine.equals(delimiter))) { | |||
&& StringUtils.endsWith(buf, delimiter)) | |||
|| (delimiterType.equals(DelimiterType.ROW) | |||
&& currentLine.equals(delimiter))) { | |||
return buf.length() - delimiter.length(); | |||
} | |||
// no match | |||
@@ -1123,17 +1123,15 @@ public class SQLExec extends JDBCTask { | |||
// StringUtils.endsWith | |||
int endIndex = delimiter.length() - 1; | |||
int bufferIndex = buf.length() - 1; | |||
while (bufferIndex >= 0 | |||
&& Character.isWhitespace(buf.charAt(bufferIndex))) { | |||
while (bufferIndex >= 0 && Character.isWhitespace(buf.charAt(bufferIndex))) { | |||
--bufferIndex; | |||
} | |||
if (bufferIndex < endIndex) { | |||
return -1; | |||
} | |||
while (endIndex >= 0) { | |||
if (buf.substring(bufferIndex, bufferIndex + 1) | |||
.toLowerCase(Locale.ENGLISH).charAt(0) | |||
!= d.charAt(endIndex)) { | |||
if (buf.substring(bufferIndex, bufferIndex + 1).toLowerCase(Locale.ENGLISH) | |||
.charAt(0) != d.charAt(endIndex)) { | |||
return -1; | |||
} | |||
bufferIndex--; | |||
@@ -143,7 +143,7 @@ public class StreamPumper implements Runnable { | |||
} | |||
// On completion, drain any available data (which might be the first data available for quick executions) | |||
if (finish) { | |||
while((length = is.available()) > 0) { | |||
while ((length = is.available()) > 0) { | |||
if (Thread.interrupted()) { | |||
break; | |||
} | |||
@@ -987,7 +987,7 @@ public class Tar extends MatchingTask { | |||
*/ | |||
@Override | |||
public String[] getValues() { | |||
return new String[] {NONE, GZIP, BZIP2 }; | |||
return new String[] {NONE, GZIP, BZIP2}; | |||
} | |||
/** | |||
@@ -77,14 +77,14 @@ public class Tstamp extends Task { | |||
cts.execute(getProject(), d, getLocation()); | |||
} | |||
SimpleDateFormat dstamp = new SimpleDateFormat ("yyyyMMdd"); | |||
SimpleDateFormat dstamp = new SimpleDateFormat("yyyyMMdd"); | |||
setProperty("DSTAMP", dstamp.format(d)); | |||
SimpleDateFormat tstamp = new SimpleDateFormat ("HHmm"); | |||
SimpleDateFormat tstamp = new SimpleDateFormat("HHmm"); | |||
setProperty("TSTAMP", tstamp.format(d)); | |||
SimpleDateFormat today | |||
= new SimpleDateFormat ("MMMM d yyyy", Locale.US); | |||
= new SimpleDateFormat("MMMM d yyyy", Locale.US); | |||
setProperty("TODAY", today.format(d)); | |||
} catch (Exception e) { | |||
@@ -189,16 +189,14 @@ public class Tstamp extends Task { | |||
if (st.hasMoreElements()) { | |||
variant = st.nextToken(); | |||
if (st.hasMoreElements()) { | |||
throw new BuildException("bad locale format", | |||
getLocation()); | |||
throw new BuildException("bad locale format", getLocation()); | |||
} | |||
} | |||
} else { | |||
country = ""; | |||
} | |||
} catch (NoSuchElementException e) { | |||
throw new BuildException("bad locale format", e, | |||
getLocation()); | |||
throw new BuildException("bad locale format", e, getLocation()); | |||
} | |||
} | |||
@@ -266,25 +264,20 @@ public class Tstamp extends Task { | |||
*/ | |||
public void execute(Project project, Date date, Location location) { | |||
if (propertyName == null) { | |||
throw new BuildException("property attribute must be provided", | |||
location); | |||
throw new BuildException("property attribute must be provided", location); | |||
} | |||
if (pattern == null) { | |||
throw new BuildException("pattern attribute must be provided", | |||
location); | |||
throw new BuildException("pattern attribute must be provided", location); | |||
} | |||
SimpleDateFormat sdf; | |||
if (language == null) { | |||
sdf = new SimpleDateFormat(pattern); | |||
} else if (variant == null) { | |||
sdf = new SimpleDateFormat(pattern, | |||
new Locale(language, country)); | |||
sdf = new SimpleDateFormat(pattern, new Locale(language, country)); | |||
} else { | |||
sdf = new SimpleDateFormat(pattern, | |||
new Locale(language, country, | |||
variant)); | |||
sdf = new SimpleDateFormat(pattern, new Locale(language, country, variant)); | |||
} | |||
if (offset != 0) { | |||
Calendar calendar = Calendar.getInstance(); | |||
@@ -1310,10 +1310,10 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
if (p.shouldUse()) { | |||
final Object evaluatedParam = evaluateParam(p); | |||
if (liaison instanceof XSLTLiaison4) { | |||
((XSLTLiaison4)liaison).addParam(p.getName(), evaluatedParam); | |||
((XSLTLiaison4) liaison).addParam(p.getName(), evaluatedParam); | |||
} else { | |||
if (evaluatedParam == null || evaluatedParam instanceof String) { | |||
liaison.addParam(p.getName(), (String)evaluatedParam); | |||
liaison.addParam(p.getName(), (String) evaluatedParam); | |||
} else { | |||
log("XSLTLiaison '" + liaison.getClass().getName() | |||
+ "' supports only String parameters. Converting parameter '" + p.getName() | |||
@@ -1398,7 +1398,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
final String fileName = FileUtils.getRelativePath(baseDir, inFile); | |||
final File file = new File(fileName); | |||
// Give always a slash as file separator, so the stylesheet could be sure about that | |||
// Use '.' so a dir+"/"+name would not result in an absolute path | |||
// Use '.' so a dir + "/" + name would not result in an absolute path | |||
liaison.addParam(fileDirParameter, file.getParent() != null ? file.getParent().replace( | |||
'\\', '/') : "."); | |||
} | |||
@@ -335,7 +335,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
* either a String if this node resulted in setting an attribute, | |||
* or a Path. | |||
*/ | |||
public Object processNode (Node node, String prefix, Object container) { | |||
public Object processNode(Node node, String prefix, Object container) { | |||
// Parse the attribute(s) and text of this node, adding | |||
// properties for each. | |||
@@ -465,7 +465,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
* Actually add the given property/value to the project | |||
* after writing a log message. | |||
*/ | |||
private void addProperty (String name, String value, String id) { | |||
private void addProperty(String name, String value, String id) { | |||
String msg = name + ":" + value; | |||
if (id != null) { | |||
msg += ("(id=" + id + ")"); | |||
@@ -502,7 +502,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
* Otherwise, we return "(nodename)". This is long-standing | |||
* (and default) <xmlproperty> behavior. | |||
*/ | |||
private String getAttributeName (Node attributeNode) { | |||
private String getAttributeName(Node attributeNode) { | |||
String attributeName = attributeNode.getNodeName(); | |||
if (semanticAttributes) { | |||
@@ -523,7 +523,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
/** | |||
* Return whether the provided attribute name is recognized or not. | |||
*/ | |||
private static boolean isSemanticAttribute (String attributeName) { | |||
private static boolean isSemanticAttribute(String attributeName) { | |||
for (int i = 0; i < ATTRIBUTES.length; i++) { | |||
if (attributeName.equals(ATTRIBUTES[i])) { | |||
return true; | |||
@@ -544,7 +544,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
* resolved to absolute file names. Also for refid values, look | |||
* up the referenced object from the project.</p> | |||
*/ | |||
private String getAttributeValue (Node attributeNode) { | |||
private String getAttributeValue(Node attributeNode) { | |||
String nodeValue = attributeNode.getNodeValue().trim(); | |||
if (semanticAttributes) { | |||
String attributeName = attributeNode.getNodeName(); | |||
@@ -673,7 +673,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
/** | |||
* @return the file attribute. | |||
*/ | |||
protected File getFile () { | |||
protected File getFile() { | |||
FileProvider fp = src.as(FileProvider.class); | |||
return fp != null ? fp.getFile() : null; | |||
} | |||
@@ -693,42 +693,42 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
/** | |||
* @return the prefix attribute. | |||
*/ | |||
protected String getPrefix () { | |||
protected String getPrefix() { | |||
return this.prefix; | |||
} | |||
/** | |||
* @return the keeproot attribute. | |||
*/ | |||
protected boolean getKeeproot () { | |||
protected boolean getKeeproot() { | |||
return this.keepRoot; | |||
} | |||
/** | |||
* @return the validate attribute. | |||
*/ | |||
protected boolean getValidate () { | |||
protected boolean getValidate() { | |||
return this.validate; | |||
} | |||
/** | |||
* @return the collapse attributes attribute. | |||
*/ | |||
protected boolean getCollapseAttributes () { | |||
protected boolean getCollapseAttributes() { | |||
return this.collapseAttributes; | |||
} | |||
/** | |||
* @return the semantic attributes attribute. | |||
*/ | |||
protected boolean getSemanticAttributes () { | |||
protected boolean getSemanticAttributes() { | |||
return this.semanticAttributes; | |||
} | |||
/** | |||
* @return the root directory attribute. | |||
*/ | |||
protected File getRootDirectory () { | |||
protected File getRootDirectory() { | |||
return this.rootDirectory; | |||
} | |||
@@ -103,7 +103,7 @@ public class Zip extends MatchingTask { | |||
protected String archiveType = "zip"; | |||
// For directories: | |||
private static final long EMPTY_CRC = new CRC32 ().getValue (); | |||
private static final long EMPTY_CRC = new CRC32().getValue(); | |||
protected String emptyBehavior = "skip"; | |||
private final Vector<ResourceCollection> resources = new Vector<ResourceCollection>(); | |||
protected Hashtable<String, String> addedDirs = new Hashtable<String, String>(); | |||
@@ -783,7 +783,7 @@ public class Zip extends MatchingTask { | |||
// temporary file | |||
if (doUpdate) { | |||
if (!renamedFile.delete()) { | |||
log ("Warning: unable to delete temporary file " | |||
log("Warning: unable to delete temporary file " | |||
+ renamedFile.getName(), Project.MSG_WARN); | |||
} | |||
} | |||
@@ -1761,7 +1761,7 @@ public class Zip extends MatchingTask { | |||
addedDirs.put(vPath, vPath); | |||
if (!skipWriting) { | |||
final ZipEntry ze = new ZipEntry (vPath); | |||
final ZipEntry ze = new ZipEntry(vPath); | |||
// ZIPs store time with a granularity of 2 seconds, round up | |||
final int millisToAdd = roundUp ? ROUNDUP_MILLIS : 0; | |||
@@ -1773,10 +1773,10 @@ public class Zip extends MatchingTask { | |||
} else { | |||
ze.setTime(System.currentTimeMillis() + millisToAdd); | |||
} | |||
ze.setSize (0); | |||
ze.setMethod (ZipEntry.STORED); | |||
ze.setSize(0); | |||
ze.setMethod(ZipEntry.STORED); | |||
// This is faintly ridiculous: | |||
ze.setCrc (EMPTY_CRC); | |||
ze.setCrc(EMPTY_CRC); | |||
ze.setUnixMode(mode); | |||
if (extra != null) { | |||
@@ -433,8 +433,8 @@ public abstract class DefaultCompilerAdapter | |||
cmd.createArgument().setPath(ump); | |||
} | |||
if (attributes.getNativeHeaderDir() != null) { | |||
if (assumeJava13() || assumeJava14() || assumeJava15() | |||
|| assumeJava16() || assumeJava17()) { | |||
if (assumeJava13() || assumeJava14() || assumeJava15() || assumeJava16() | |||
|| assumeJava17()) { | |||
attributes.log("Support for javac -h has been added in Java8," | |||
+ " ignoring it"); | |||
} else { | |||
@@ -485,8 +485,7 @@ public abstract class DefaultCompilerAdapter | |||
* @param cmd the command line | |||
*/ | |||
protected void logAndAddFilesToCompile(final Commandline cmd) { | |||
attributes.log("Compilation " + cmd.describeArguments(), | |||
Project.MSG_VERBOSE); | |||
attributes.log("Compilation " + cmd.describeArguments(), Project.MSG_VERBOSE); | |||
final StringBuffer niceSourceList = new StringBuffer("File"); | |||
if (compileList.length != 1) { | |||
@@ -728,10 +727,10 @@ public abstract class DefaultCompilerAdapter | |||
return "javac1.9".equals(attributes.getCompilerVersion()) | |||
|| "javac9".equals(attributes.getCompilerVersion()) | |||
|| "javac10+".equals(attributes.getCompilerVersion()) | |||
|| (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9) && | |||
("classic".equals(attributes.getCompilerVersion()) | |||
|| "modern".equals(attributes.getCompilerVersion()) | |||
|| "extJavac".equals(attributes.getCompilerVersion()))); | |||
|| (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9) | |||
&& ("classic".equals(attributes.getCompilerVersion()) | |||
|| "modern".equals(attributes.getCompilerVersion()) | |||
|| "extJavac".equals(attributes.getCompilerVersion()))); | |||
} | |||
/** | |||
@@ -740,8 +739,8 @@ public abstract class DefaultCompilerAdapter | |||
*/ | |||
private boolean assumeJavaXY(final String javacXY, final String javaEnvVersionXY) { | |||
return javacXY.equals(attributes.getCompilerVersion()) | |||
|| (JavaEnvUtils.isJavaVersion(javaEnvVersionXY) && | |||
("classic".equals(attributes.getCompilerVersion()) | |||
|| (JavaEnvUtils.isJavaVersion(javaEnvVersionXY) | |||
&& ("classic".equals(attributes.getCompilerVersion()) | |||
|| "modern".equals(attributes.getCompilerVersion()) | |||
|| "extJavac".equals(attributes.getCompilerVersion()))); | |||
} | |||
@@ -830,8 +829,7 @@ public abstract class DefaultCompilerAdapter | |||
t = t.substring(2); | |||
} | |||
return t.equals("1") || t.equals("2") || t.equals("3") || t.equals("4") | |||
|| ((t.equals("5") || t.equals("6")) | |||
&& !assumeJava15() && !assumeJava16()) | |||
|| ((t.equals("5") || t.equals("6")) && !assumeJava15() && !assumeJava16()) | |||
|| (t.equals("7") && !assumeJava17()) | |||
|| (t.equals("8") && !assumeJava18()) | |||
|| (t.equals("9") && !assumeJava9Plus()); | |||
@@ -142,10 +142,9 @@ public class Gcj extends DefaultCompilerAdapter { | |||
int argsLength = 0; | |||
while (!nativeBuild && argsLength < additionalArguments.length) { | |||
int conflictLength = 0; | |||
while (!nativeBuild | |||
&& conflictLength < CONFLICT_WITH_DASH_C.length) { | |||
nativeBuild = (additionalArguments[argsLength].startsWith | |||
(CONFLICT_WITH_DASH_C[conflictLength])); | |||
while (!nativeBuild && conflictLength < CONFLICT_WITH_DASH_C.length) { | |||
nativeBuild = additionalArguments[argsLength] | |||
.startsWith(CONFLICT_WITH_DASH_C[conflictLength]); | |||
conflictLength++; | |||
} | |||
argsLength++; | |||
@@ -153,8 +152,6 @@ public class Gcj extends DefaultCompilerAdapter { | |||
return nativeBuild; | |||
} | |||
private static final String [] CONFLICT_WITH_DASH_C = { | |||
"-o" , "--main=", "-D", "-fjni", "-L" | |||
}; | |||
private static final String[] CONFLICT_WITH_DASH_C = {"-o", "--main=", "-D", "-fjni", "-L"}; | |||
} |
@@ -68,7 +68,7 @@ public class Javac12 extends DefaultCompilerAdapter { | |||
new Object[] {cmd.getArguments()}); | |||
return ok.booleanValue(); | |||
} catch (ClassNotFoundException ex) { | |||
throw new BuildException("Cannot use classic compiler , as it is " | |||
throw new BuildException("Cannot use classic compiler, as it is " | |||
+ "not available. \n" | |||
+ " A common solution is " | |||
+ "to set the environment variable" | |||
@@ -50,7 +50,7 @@ public class Javac13 extends DefaultCompilerAdapter { | |||
// Use reflection to be able to build on all JDKs >= 1.1: | |||
try { | |||
Class c = Class.forName ("com.sun.tools.javac.Main"); | |||
Class c = Class.forName("com.sun.tools.javac.Main"); | |||
Object compiler = c.newInstance (); | |||
Method compile = c.getMethod ("compile", | |||
new Class [] {(new String [] {}).getClass ()}); | |||
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.condition; | |||
import java.net.HttpURLConnection; | |||
import java.net.MalformedURLException; | |||
import java.net.ProtocolException; | |||
import java.net.URL; | |||
import java.net.URLConnection; | |||
import java.util.Locale; | |||
@@ -115,7 +116,7 @@ public class Http extends ProjectComponent implements Condition { | |||
} | |||
return false; | |||
} | |||
} catch (java.net.ProtocolException pe) { | |||
} catch (ProtocolException pe) { | |||
throw new BuildException("Invalid HTTP protocol: " | |||
+ requestMethod, pe); | |||
} catch (java.io.IOException e) { | |||
@@ -161,7 +161,7 @@ public class IsLastModified extends ProjectComponent implements Condition { | |||
long expected = getMillis(); | |||
long actual = resource.getLastModified(); | |||
log("expected timestamp: " + expected + " (" + new Date(expected) + ")" | |||
+ ", actual timestamp: " + actual + " (" + new Date(actual) + ")" , | |||
+ ", actual timestamp: " + actual + " (" + new Date(actual) + ")", | |||
Project.MSG_VERBOSE); | |||
if (CompareMode.EQUALS_TEXT.equals(mode.getValue())) { | |||
return expected == actual; | |||
@@ -165,7 +165,7 @@ public class Message extends ProjectComponent { | |||
* @since Ant 1.6 | |||
*/ | |||
public void setCharset(String charset) { | |||
this.charset = charset; | |||
this.charset = charset; | |||
} | |||
/** | |||
* Returns the charset of mail message. | |||
@@ -174,7 +174,7 @@ public class Message extends ProjectComponent { | |||
* @since Ant 1.6 | |||
*/ | |||
public String getCharset() { | |||
return charset; | |||
return charset; | |||
} | |||
/** | |||
@@ -56,9 +56,9 @@ public class Java13CommandLauncher extends CommandLauncher { | |||
Project.MSG_DEBUG); | |||
} | |||
return Runtime.getRuntime().exec(cmd, env, workingDir); | |||
} catch(IOException ioex) { | |||
} catch (IOException ioex) { | |||
throw ioex; | |||
} catch(Exception exc) { | |||
} catch (Exception exc) { | |||
// IllegalAccess, IllegalArgument, ClassCast | |||
throw new BuildException("Unable to execute command", exc); | |||
} | |||
@@ -80,9 +80,7 @@ public class VmsCommandLauncher extends Java13CommandLauncher { | |||
public Process exec(Project project, String[] cmd, String[] env, | |||
File workingDir) throws IOException { | |||
File cmdFile = createCommandFile(cmd, env); | |||
Process p = super.exec(project, new String[] { | |||
cmdFile.getPath() | |||
}, env, workingDir); | |||
Process p = super.exec(project, new String[] {cmdFile.getPath()}, env, workingDir); | |||
deleteAfter(cmdFile, p); | |||
return p; | |||
} | |||
@@ -264,8 +264,7 @@ public class Cab extends MatchingTask { | |||
try { | |||
Process p = Execute.launch(getProject(), | |||
new String[] {"listcab"}, null, | |||
baseDir != null ? baseDir | |||
: getProject().getBaseDir(), | |||
baseDir != null ? baseDir : getProject().getBaseDir(), | |||
true); | |||
OutputStream out = p.getOutputStream(); | |||
@@ -243,7 +243,7 @@ public class EchoProperties extends Task { | |||
* The values are "xml" and "text". | |||
*/ | |||
public static class FormatAttribute extends EnumeratedAttribute { | |||
private String [] formats = new String[]{"xml", "text"}; | |||
private String[] formats = new String[] {"xml", "text"}; | |||
/** | |||
* @see EnumeratedAttribute#getValues() | |||
@@ -467,11 +467,9 @@ public class Javah extends Task { | |||
classpath = classpath.concatSystemClasspath("ignore"); | |||
} | |||
JavahAdapter ad = | |||
nestedAdapter != null ? nestedAdapter : | |||
JavahAdapterFactory.getAdapter(facade.getImplementation(), | |||
this, | |||
createImplementationClasspath()); | |||
JavahAdapter ad = nestedAdapter != null ? nestedAdapter | |||
: JavahAdapterFactory.getAdapter(facade.getImplementation(), this, | |||
createImplementationClasspath()); | |||
if (!ad.compile(this)) { | |||
throw new BuildException("compilation failed"); | |||
} | |||
@@ -294,11 +294,9 @@ public class Native2Ascii extends MatchingTask { | |||
} | |||
log("converting " + srcName, Project.MSG_VERBOSE); | |||
Native2AsciiAdapter ad = | |||
nestedAdapter != null ? nestedAdapter : | |||
Native2AsciiAdapterFactory.getAdapter(facade.getImplementation(), | |||
this, | |||
createImplementationClasspath()); | |||
Native2AsciiAdapter ad = nestedAdapter != null ? nestedAdapter | |||
: Native2AsciiAdapterFactory.getAdapter(facade.getImplementation(), this, | |||
createImplementationClasspath()); | |||
if (!ad.convert(this, srcFile, destFile)) { | |||
throw new BuildException("conversion failed"); | |||
} | |||
@@ -324,8 +322,7 @@ public class Native2Ascii extends MatchingTask { | |||
public String[] mapFileName(String fileName) { | |||
int lastDot = fileName.lastIndexOf('.'); | |||
if (lastDot >= 0) { | |||
return new String[] {fileName.substring(0, lastDot) | |||
+ extension}; | |||
return new String[] {fileName.substring(0, lastDot) + extension}; | |||
} else { | |||
return new String[] {fileName + extension}; | |||
} | |||
@@ -1023,7 +1023,7 @@ public class NetRexxC extends MatchingTask { | |||
public static class TraceAttr extends EnumeratedAttribute { | |||
/** {@inheritDoc}. */ | |||
public String[] getValues() { | |||
return new String[]{"trace", "trace1", "trace2", "notrace"}; | |||
return new String[] {"trace", "trace1", "trace2", "notrace"}; | |||
} | |||
} | |||
@@ -1033,9 +1033,8 @@ public class NetRexxC extends MatchingTask { | |||
public static class VerboseAttr extends EnumeratedAttribute { | |||
/** {@inheritDoc}. */ | |||
public String[] getValues() { | |||
return new String[]{"verbose", "verbose0", "verbose1", | |||
"verbose2", "verbose3", "verbose4", | |||
"verbose5", "noverbose"}; | |||
return new String[] {"verbose", "verbose0", "verbose1", "verbose2", | |||
"verbose3", "verbose4", "verbose5", "noverbose"}; | |||
} | |||
} | |||
} |
@@ -298,14 +298,14 @@ public class PropertyFile extends Task { | |||
private static final String DEFAULT_DATE_VALUE = "now"; | |||
private static final String DEFAULT_STRING_VALUE = ""; | |||
private String key = null; | |||
private int type = Type.STRING_TYPE; | |||
private int operation = Operation.EQUALS_OPER; | |||
private String value = null; | |||
private String defaultValue = null; | |||
private String newValue = null; | |||
private String pattern = null; | |||
private int field = Calendar.DATE; | |||
private String key = null; | |||
private int type = Type.STRING_TYPE; | |||
private int operation = Operation.EQUALS_OPER; | |||
private String value = null; | |||
private String defaultValue = null; | |||
private String newValue = null; | |||
private String pattern = null; | |||
private int field = Calendar.DATE; | |||
/** | |||
* Name of the property name/value pair | |||
@@ -404,8 +404,7 @@ public class PropertyFile extends Task { | |||
} else if (type == Type.STRING_TYPE) { | |||
executeString(oldValue); | |||
} else { | |||
throw new BuildException("Unknown operation type: " | |||
+ type); | |||
throw new BuildException("Unknown operation type: " + type); | |||
} | |||
} catch (NullPointerException npe) { | |||
// Default to string type | |||
@@ -615,13 +614,13 @@ public class PropertyFile extends Task { | |||
// Property type operations | |||
/** + */ | |||
public static final int INCREMENT_OPER = 0; | |||
public static final int INCREMENT_OPER = 0; | |||
/** - */ | |||
public static final int DECREMENT_OPER = 1; | |||
public static final int DECREMENT_OPER = 1; | |||
/** = */ | |||
public static final int EQUALS_OPER = 2; | |||
public static final int EQUALS_OPER = 2; | |||
/** del */ | |||
public static final int DELETE_OPER = 3; | |||
public static final int DELETE_OPER = 3; | |||
/** {@inheritDoc}. */ | |||
@Override | |||
@@ -653,11 +652,11 @@ public class PropertyFile extends Task { | |||
// Property types | |||
/** int */ | |||
public static final int INTEGER_TYPE = 0; | |||
public static final int INTEGER_TYPE = 0; | |||
/** date */ | |||
public static final int DATE_TYPE = 1; | |||
public static final int DATE_TYPE = 1; | |||
/** string */ | |||
public static final int STRING_TYPE = 2; | |||
public static final int STRING_TYPE = 2; | |||
/** {@inheritDoc} */ | |||
@Override | |||
@@ -697,9 +696,8 @@ public class PropertyFile extends Task { | |||
private static final String MONTH = "month"; | |||
private static final String YEAR = "year"; | |||
private static final String[] UNITS | |||
= {MILLISECOND, SECOND, MINUTE, HOUR, | |||
DAY, WEEK, MONTH, YEAR }; | |||
private static final String[] UNITS = {MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, | |||
YEAR}; | |||
private Map calendarFields = new HashMap(); | |||
@@ -114,9 +114,8 @@ public class Rpm extends Task { | |||
Commandline toExecute = new Commandline(); | |||
toExecute.setExecutable(rpmBuildCommand == null | |||
? guessRpmBuildCommand() | |||
: rpmBuildCommand); | |||
toExecute.setExecutable(rpmBuildCommand == null ? guessRpmBuildCommand() | |||
: rpmBuildCommand); | |||
if (topDir != null) { | |||
toExecute.createArgument().setValue("--define"); | |||
toExecute.createArgument().setValue("_topdir " + topDir); | |||
@@ -169,7 +168,7 @@ public class Rpm extends Task { | |||
fos = new FileOutputStream(error); | |||
BufferedOutputStream bos = new BufferedOutputStream(fos); | |||
errorstream = new PrintStream(bos); | |||
} catch (IOException e) { | |||
} catch (IOException e) { | |||
FileUtils.close(fos); | |||
throw new BuildException(e, getLocation()); | |||
} | |||
@@ -253,12 +253,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool | |||
File borlandDD = new File(getConfig().descriptorDir, ddPrefix + dd); | |||
if (borlandDD.exists()) { | |||
log("Borland specific file found " + borlandDD, Project.MSG_VERBOSE); | |||
ejbFiles.put(META_DIR + dd , borlandDD); | |||
ejbFiles.put(META_DIR + dd, borlandDD); | |||
} else { | |||
log("Unable to locate borland deployment descriptor. " | |||
+ "It was expected to be in " | |||
+ borlandDD.getPath(), Project.MSG_WARN); | |||
return; | |||
} | |||
} | |||
@@ -29,6 +29,7 @@ import java.util.Hashtable; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.Task; | |||
import org.xml.sax.AttributeList; | |||
import org.xml.sax.HandlerBase; | |||
import org.xml.sax.InputSource; | |||
import org.xml.sax.SAXException; | |||
@@ -40,7 +41,7 @@ import org.xml.sax.SAXException; | |||
* inserted into an EJB jar as to a File representing the file on disk. This | |||
* list can then be accessed through the getFiles() method. | |||
*/ | |||
public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
public class DescriptorHandler extends HandlerBase { | |||
private static final int DEFAULT_HASH_TABLE_SIZE = 10; | |||
private static final int STATE_LOOKING_EJBJAR = 1; | |||
private static final int STATE_IN_EJBJAR = 2; | |||
@@ -220,7 +221,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
} | |||
} | |||
owningTask.log("Could not resolve ( publicId: " + publicId | |||
owningTask.log("Could not resolve (publicId: " + publicId | |||
+ ", systemId: " + systemId + ") to a local entity", Project.MSG_INFO); | |||
return null; | |||
@@ -790,7 +790,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
manifest = new Manifest(in); | |||
} catch (IOException e) { | |||
throw new BuildException ("Unable to read manifest", e, getLocation()); | |||
throw new BuildException("Unable to read manifest", e, getLocation()); | |||
} finally { | |||
if (in != null) { | |||
in.close(); | |||
@@ -114,7 +114,7 @@ public class IPlanetEjbcTask extends Task { | |||
* @param iasdescriptor The name and location of the iAS-specific EJB | |||
* descriptor. | |||
*/ | |||
public void setIasdescriptor (File iasdescriptor) { | |||
public void setIasdescriptor(File iasdescriptor) { | |||
this.iasdescriptor = iasdescriptor; | |||
} | |||
@@ -587,7 +587,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool { | |||
log("Cannot find GenIC class in classpath.", Project.MSG_ERR); | |||
throw new BuildException("GenIC class not found, please check the classpath."); | |||
} else { | |||
log("Using '" + genicClass + "' GenIC class." , Project.MSG_VERBOSE); | |||
log("Using '" + genicClass + "' GenIC class.", Project.MSG_VERBOSE); | |||
genicTask.setClassname(genicClass); | |||
} | |||
@@ -46,7 +46,7 @@ public class OrionDeploymentTool extends GenericDeploymentTool { | |||
* @param baseName String | |||
*/ | |||
protected void addVendorFiles(Hashtable ejbFiles, String baseName) { | |||
String ddPrefix = (usingBaseJarName() ? "" : baseName ); | |||
String ddPrefix = usingBaseJarName() ? "" : baseName; | |||
File orionDD = new File(getConfig().descriptorDir, ddPrefix + ORION_DD); | |||
if (orionDD.exists()) { | |||
@@ -172,7 +172,7 @@ public class ExtensionAdapter extends DataType { | |||
} | |||
/** | |||
* Convert this adpater object into an extension object. | |||
* Convert this adapter object into an extension object. | |||
* | |||
* @return the extension object | |||
*/ | |||
@@ -239,7 +239,7 @@ public class Image extends MatchingTask { | |||
final String dstName = dstNames[j]; | |||
final File dstFile = new File(dstDir, dstName).getAbsoluteFile(); | |||
if (dstFile.exists()){ | |||
if (dstFile.exists()) { | |||
// avoid overwriting unless necessary | |||
if(!overwrite | |||
&& srcFile.lastModified() <= dstFile.lastModified()) { | |||
@@ -252,7 +252,7 @@ public class Image extends MatchingTask { | |||
} | |||
// avoid extra work while overwriting | |||
if (!srcFile.equals(dstFile)){ | |||
if (!srcFile.equals(dstFile)) { | |||
dstFile.delete(); | |||
} | |||
} | |||
@@ -317,7 +317,7 @@ public class Image extends MatchingTask { | |||
+ dstParent); | |||
} | |||
if ((overwrite && newFile.exists()) && (!newFile.equals(file))) { | |||
if (overwrite && newFile.exists() && !newFile.equals(file)) { | |||
newFile.delete(); | |||
} | |||
@@ -333,7 +333,7 @@ public class Image extends MatchingTask { | |||
FileUtils.close(stream); | |||
} | |||
} catch (IOException err) { | |||
if (!file.equals(newFile)){ | |||
if (!file.equals(newFile)) { | |||
newFile.delete(); | |||
} | |||
if (!failonerror) { | |||
@@ -362,7 +362,7 @@ public class Image extends MatchingTask { | |||
validateAttributes(); | |||
try { | |||
File dest = destDir != null ? destDir : srcDir; | |||
File dest = (destDir != null) ? destDir : srcDir; | |||
int writeCount = 0; | |||
@@ -392,9 +392,8 @@ public class Image extends MatchingTask { | |||
writeCount += processDir(fromDir, files, dest, mapper); | |||
} | |||
if (writeCount>0){ | |||
log("Processed " + writeCount + | |||
(writeCount == 1 ? " image." : " images.")); | |||
if (writeCount > 0) { | |||
log("Processed " + writeCount + (writeCount == 1 ? " image." : " images.")); | |||
} | |||
} catch (Exception err) { | |||
@@ -53,8 +53,8 @@ public class JonasHotDeploymentTool extends GenericHotDeploymentTool implements | |||
/** | |||
* All the valid actions that weblogic.deploy permits * | |||
*/ | |||
private static final String[] VALID_ACTIONS | |||
= {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||
private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, | |||
ACTION_UNDEPLOY, ACTION_UPDATE}; | |||
/** | |||
* Description of the Field | |||
@@ -320,7 +320,7 @@ public class JDependTask extends Task { | |||
* @see EnumeratedAttribute | |||
*/ | |||
public static class FormatAttribute extends EnumeratedAttribute { | |||
private String [] formats = new String[]{"xml", "text"}; | |||
private String[] formats = new String[] {"xml", "text"}; | |||
/** | |||
* @return the enumerated values | |||
@@ -459,7 +459,7 @@ public class JspC extends MatchingTask { | |||
throw new BuildException("srcdir attribute must be set!", | |||
getLocation()); | |||
} | |||
String [] list = src.list(); | |||
String[] list = src.list(); | |||
if (list.length == 0) { | |||
throw new BuildException("srcdir attribute must be set!", | |||
getLocation()); | |||
@@ -67,7 +67,7 @@ public class JspNameMangler implements JspMangler { | |||
* map from a jsp file to a base name; does not deal with extensions | |||
* | |||
* @param jspFile jspFile file | |||
* @return exensionless potentially remapped name | |||
* @return extensionless potentially remapped name | |||
*/ | |||
private String mapJspToBaseName(File jspFile) { | |||
String className; | |||
@@ -231,7 +231,7 @@ public class WLJspc extends MatchingTask { | |||
* Set the directory containing the source jsp's | |||
* | |||
* | |||
* @param dirName the directory containg the source jsp's | |||
* @param dirName the directory containing the source jsp's | |||
*/ | |||
public void setSrc(File dirName) { | |||
@@ -242,7 +242,7 @@ public class WLJspc extends MatchingTask { | |||
* Set the directory containing the source jsp's | |||
* | |||
* | |||
* @param dirName the directory containg the source jsp's | |||
* @param dirName the directory containing the source jsp's | |||
*/ | |||
public void setDest(File dirName) { | |||
@@ -115,7 +115,7 @@ public class AggregateTransformer { | |||
/** | |||
* Used to ensure the uniqueness of a property | |||
*/ | |||
private volatile static int counter = 0; | |||
private static volatile int counter = 0; | |||
/** the format to use for the report. Must be <tt>FRAMES</tt> or <tt>NOFRAMES</tt> */ | |||
protected String format = FRAMES; | |||
@@ -41,7 +41,8 @@ public abstract class BaseTest { | |||
protected String errorProperty; | |||
// CheckStyle:VisibilityModifier ON | |||
private Object ifCond, unlessCond; | |||
private Object ifCond; | |||
private Object unlessCond; | |||
private boolean skipNonTests; | |||
/** | |||
@@ -39,8 +39,8 @@ public class Constants { | |||
static final String LOGTESTLISTENEREVENTS = "logtestlistenerevents="; | |||
static final String TESTSFILE = "testsfile="; | |||
static final String TERMINATED_SUCCESSFULLY = "terminated successfully"; | |||
static final String LOG_FAILED_TESTS="logfailedtests="; | |||
static final String LOG_FAILED_TESTS = "logfailedtests="; | |||
static final String SKIP_NON_TESTS = "skipNonTests="; | |||
/** @since Ant 1.9.4 */ | |||
static final String THREADID="threadid="; | |||
static final String THREADID = "threadid="; | |||
} |
@@ -135,7 +135,7 @@ public final class DOMUtil { | |||
* the parent is <tt>null</tt> or if a child does not match the | |||
* given name. | |||
*/ | |||
public static Element getChildByTagName (Node parent, String tagname) { | |||
public static Element getChildByTagName(Node parent, String tagname) { | |||
if (parent == null) { | |||
return null; | |||
} | |||
@@ -54,8 +54,8 @@ import org.apache.tools.ant.util.StringUtils; | |||
* } | |||
* public static Test suite() { | |||
* TestSuite suite = new TestSuite(); | |||
* suite.addTest( new B("test04") ); | |||
* suite.addTest( new org.D("test10") ); | |||
* suite.addTest(new B("test04")); | |||
* suite.addTest(new org.D("test10")); | |||
* return suite; | |||
* } | |||
* } | |||
@@ -44,7 +44,7 @@ public class IgnoredTestResult extends TestResult { | |||
public synchronized void addListener(TestListener listener) { | |||
if (listener instanceof IgnoredTestListener) { | |||
listeners.add((IgnoredTestListener)listener); | |||
listeners.add((IgnoredTestListener) listener); | |||
} | |||
super.addListener(listener); | |||
} | |||
@@ -370,8 +370,7 @@ public class JUnitTask extends Task { | |||
*/ | |||
@Override | |||
public String[] getValues() { | |||
return new String[] {"true", "yes", "false", "no", | |||
"on", "off", "withOutAndErr"}; | |||
return new String[] {"true", "yes", "false", "no", "on", "off", "withOutAndErr"}; | |||
} | |||
/** | |||
@@ -821,23 +820,13 @@ public class JUnitTask extends Task { | |||
mirrorLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { | |||
public Object run() { | |||
return new SplitClassLoader(myLoader, path, getProject(), | |||
new String[] { | |||
"BriefJUnitResultFormatter", | |||
"JUnit4TestMethodAdapter", | |||
"JUnitResultFormatter", | |||
"JUnitTaskMirrorImpl", | |||
"JUnitTestRunner", | |||
"JUnitVersionHelper", | |||
"OutErrSummaryJUnitResultFormatter", | |||
"PlainJUnitResultFormatter", | |||
"SummaryJUnitResultFormatter", | |||
"TearDownOnVmCrash", | |||
"XMLJUnitResultFormatter", | |||
"IgnoredTestListener", | |||
"IgnoredTestResult", | |||
"CustomJUnit4TestAdapterCache", | |||
"TestListenerWrapper" | |||
}); | |||
new String[] {"BriefJUnitResultFormatter", "JUnit4TestMethodAdapter", | |||
"JUnitResultFormatter", "JUnitTaskMirrorImpl", "JUnitTestRunner", | |||
"JUnitVersionHelper", "OutErrSummaryJUnitResultFormatter", | |||
"PlainJUnitResultFormatter", "SummaryJUnitResultFormatter", | |||
"TearDownOnVmCrash", "XMLJUnitResultFormatter", "IgnoredTestListener", | |||
"IgnoredTestResult", "CustomJUnit4TestAdapterCache", | |||
"TestListenerWrapper"}); | |||
} | |||
}); | |||
} else { | |||
@@ -860,9 +849,7 @@ public class JUnitTask extends Task { | |||
final List<List> testLists = new ArrayList<List>(); | |||
/* parallel test execution is only supported for multi-process execution */ | |||
final int threads = ((!fork) || (forkMode.getValue().equals(ForkMode.ONCE)) | |||
? 1 | |||
: this.threads); | |||
final int threads = !fork || forkMode.getValue().equals(ForkMode.ONCE) ? 1 : this.threads; | |||
final boolean forkPerTest = forkMode.getValue().equals(ForkMode.PER_TEST); | |||
if (forkPerTest || forkMode.getValue().equals(ForkMode.ONCE)) { | |||
@@ -1002,7 +989,7 @@ public class JUnitTask extends Task { | |||
/* create 1 thread using the passthrough class, and let each thread start */ | |||
for (i = 0; i < numThreads; i++) { | |||
threads[i] = new Thread(new JunitTestThread(this, iter, i+1)); | |||
threads[i] = new Thread(new JunitTestThread(this, iter, i + 1)); | |||
threads[i].start(); | |||
} | |||
@@ -77,7 +77,7 @@ public interface JUnitTaskMirror { | |||
/** The interface that JUnitResultFormatter extends. */ | |||
public interface JUnitResultFormatterMirror { | |||
interface JUnitResultFormatterMirror { | |||
/** | |||
* Set the output stream. | |||
* @param outputStream the stream to use. | |||
@@ -86,7 +86,7 @@ public interface JUnitTaskMirror { | |||
} | |||
/** The interface that SummaryJUnitResultFormatter extends. */ | |||
public interface SummaryJUnitResultFormatterMirror | |||
interface SummaryJUnitResultFormatterMirror | |||
extends JUnitResultFormatterMirror { | |||
/** | |||
@@ -97,7 +97,7 @@ public interface JUnitTaskMirror { | |||
} | |||
/** Interface that test runners implement. */ | |||
public interface JUnitTestRunnerMirror { | |||
interface JUnitTestRunnerMirror { | |||
/** | |||
* Used in formatter arguments as a placeholder for the basename | |||
@@ -23,6 +23,7 @@ import java.io.BufferedWriter; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.FileReader; | |||
import java.io.FileWriter; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
@@ -99,25 +100,22 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
*/ | |||
private Permissions perm = null; | |||
private static final String JUNIT_4_TEST_ADAPTER | |||
= "junit.framework.JUnit4TestAdapter"; | |||
private static final String[] DEFAULT_TRACE_FILTERS = new String[] { | |||
"junit.framework.TestCase", | |||
"junit.framework.TestResult", | |||
"junit.framework.TestSuite", | |||
"junit.framework.Assert.", // don't filter AssertionFailure | |||
"junit.swingui.TestRunner", | |||
"junit.awtui.TestRunner", | |||
"junit.textui.TestRunner", | |||
"java.lang.reflect.Method.invoke(", | |||
"sun.reflect.", | |||
"org.apache.tools.ant.", | |||
// JUnit 4 support: | |||
"org.junit.", | |||
"junit.framework.JUnit4TestAdapter", | |||
" more", | |||
}; | |||
private static final String JUNIT_4_TEST_ADAPTER = "junit.framework.JUnit4TestAdapter"; | |||
private static final String[] DEFAULT_TRACE_FILTERS = new String[] {"junit.framework.TestCase", | |||
"junit.framework.TestResult", | |||
"junit.framework.TestSuite", | |||
"junit.framework.Assert.", // don't filter AssertionFailure | |||
"junit.swingui.TestRunner", | |||
"junit.awtui.TestRunner", | |||
"junit.textui.TestRunner", | |||
"java.lang.reflect.Method.invoke(", | |||
"sun.reflect.", | |||
"org.apache.tools.ant.", | |||
// JUnit 4 support: | |||
"org.junit.", | |||
"junit.framework.JUnit4TestAdapter", | |||
" more"}; | |||
/** | |||
@@ -459,12 +457,10 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
useSingleMethodAdapter = true; | |||
} | |||
} else { | |||
junit4TestAdapterClass = | |||
Class.forName(JUNIT_4_TEST_ADAPTER, | |||
junit4TestAdapterClass = Class.forName(JUNIT_4_TEST_ADAPTER, | |||
true, loader); | |||
if (testMethodsSpecified) { | |||
junit4TestAdapterClass = | |||
Class.forName( | |||
junit4TestAdapterClass = Class.forName( | |||
"org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter", | |||
true, loader); | |||
useSingleMethodAdapter = true; | |||
@@ -491,13 +487,13 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
formalParams = new Class[] {Class.class, String[].class}; | |||
actualParams = new Object[] {testClass, methods}; | |||
} else { | |||
formalParams = new Class[] {Class.class, Class.forName("junit.framework.JUnit4TestAdapterCache")}; | |||
actualParams = new Object[] {testClass, junit4TestAdapterCacheClass.getMethod("getInstance").invoke(null)}; | |||
formalParams = new Class[] {Class.class, Class.forName( | |||
"junit.framework.JUnit4TestAdapterCache")}; | |||
actualParams = new Object[] {testClass, junit4TestAdapterCacheClass | |||
.getMethod("getInstance").invoke(null)}; | |||
} | |||
suite = | |||
(Test) junit4TestAdapterClass | |||
.getConstructor(formalParams). | |||
newInstance(actualParams); | |||
suite = (Test) junit4TestAdapterClass.getConstructor(formalParams) | |||
.newInstance(actualParams); | |||
} else { | |||
// Use JUnit 3. | |||
@@ -532,8 +528,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
if (exception != null) { // had an exception constructing suite | |||
final int formatterSize = formatters.size(); | |||
for (int i = 0; i < formatterSize; i++) { | |||
((TestListener) formatters.elementAt(i)) | |||
.addError(null, exception); | |||
((TestListener) formatters.elementAt(i)).addError(null, exception); | |||
} | |||
junitTest.setCounts(1, 0, 1, 0); | |||
junitTest.setRunTime(0); | |||
@@ -542,10 +537,10 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
logTestListenerEvent("tests to run: " + suite.countTestCases()); | |||
suite.run(res); | |||
} finally { | |||
if (junit4 || | |||
suite.getClass().getName().equals(JUNIT_4_TEST_ADAPTER)) { | |||
if (junit4 || suite.getClass().getName().equals(JUNIT_4_TEST_ADAPTER)) { | |||
final int[] cnts = findJUnit4FailureErrorCount(res); | |||
junitTest.setCounts(res.runCount() + res.ignoredCount(), cnts[0], cnts[1], res.ignoredCount() + res.skippedCount()); | |||
junitTest.setCounts(res.runCount() + res.ignoredCount(), cnts[0], cnts[1], | |||
res.ignoredCount() + res.skippedCount()); | |||
} else { | |||
junitTest.setCounts(res.runCount() + res.ignoredCount(), res.failureCount(), | |||
res.errorCount(), res.ignoredCount() + res.skippedCount()); | |||
@@ -610,12 +605,12 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
try { | |||
suiteAnnotation = Class.forName("org.junit.Suite.SuiteClasses"); | |||
} catch(final ClassNotFoundException ex) { | |||
} catch (final ClassNotFoundException ex) { | |||
// ignore - we don't have this annotation so make sure we don't check for it | |||
} | |||
try { | |||
runWithAnnotation = Class.forName("org.junit.runner.RunWith"); | |||
} catch(final ClassNotFoundException ex) { | |||
} catch (final ClassNotFoundException ex) { | |||
// also ignore as this annotation doesn't exist so tests can't use it | |||
} | |||
@@ -643,12 +638,13 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
return true; | |||
} | |||
if (runWithAnnotation != null && testClass.getAnnotation(runWithAnnotation) != null) { | |||
/* Class is marked with @RunWith. If this class is badly written (no test methods, multiple | |||
* constructors, private constructor etc) then the class is automatically run and fails in the | |||
* IDEs I've tried... so I'm happy handing the class to JUnit to try and run, and let JUnit | |||
* report a failure if a bad test case is provided. Trying to do anything else is likely to | |||
* result in us filtering out cases that could be valid for future versions of JUnit so would | |||
* just increase future maintenance work. | |||
/* Class is marked with @RunWith. If this class is badly written (no test methods, | |||
* multiple constructors, private constructor etc) then the class is automatically | |||
* run and fails in the IDEs I've tried... so I'm happy handing the class to JUnit | |||
* to try and run, and let JUnit report a failure if a bad test case is provided. | |||
* Trying to do anything else is likely to result in us filtering out cases that | |||
* could be valid for future versions of JUnit so would just increase future | |||
* maintenance work. | |||
*/ | |||
return true; | |||
} | |||
@@ -661,7 +657,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
return true; | |||
} | |||
} else { | |||
// check if JUnit3 class have public or protected no-args methods starting with names starting with test | |||
// check if JUnit3 class have public or protected no-args methods starting with | |||
// names starting with test | |||
if (m.getName().startsWith("test") && m.getParameterTypes().length == 0 | |||
&& (Modifier.isProtected(m.getModifiers()) || Modifier.isPublic(m.getModifiers()))) { | |||
return true; | |||
@@ -713,6 +710,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
private void logTestListenerEvent(String msg) { | |||
if (logTestListenerEvents) { | |||
@SuppressWarnings("resource") | |||
final PrintStream out = savedOut != null ? savedOut : System.out; | |||
out.flush(); | |||
if (msg == null) { | |||
@@ -720,8 +718,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
} | |||
final StringTokenizer msgLines = new StringTokenizer(msg, "\r\n", false); | |||
while (msgLines.hasMoreTokens()) { | |||
out.println(JUnitTask.TESTLISTENER_PREFIX | |||
+ msgLines.nextToken()); | |||
out.println(JUnitTask.TESTLISTENER_PREFIX + msgLines.nextToken()); | |||
} | |||
out.flush(); | |||
} | |||
@@ -840,16 +837,14 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
private void fireStartTestSuite() { | |||
final int size = formatters.size(); | |||
for (int i = 0; i < size; i++) { | |||
((JUnitResultFormatter) formatters.elementAt(i)) | |||
.startTestSuite(junitTest); | |||
((JUnitResultFormatter) formatters.elementAt(i)).startTestSuite(junitTest); | |||
} | |||
} | |||
private void fireEndTestSuite() { | |||
final int size = formatters.size(); | |||
for (int i = 0; i < size; i++) { | |||
((JUnitResultFormatter) formatters.elementAt(i)) | |||
.endTestSuite(junitTest); | |||
((JUnitResultFormatter) formatters.elementAt(i)).endTestSuite(junitTest); | |||
} | |||
} | |||
@@ -915,7 +910,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
boolean logFailedTests = true; | |||
boolean logTestListenerEvents = false; | |||
boolean skipNonTests = false; | |||
int antThreadID = 0; /* Ant id of thread running this unit test, 0 in single-threaded mode */ | |||
/* Ant id of thread running this unit test, 0 in single-threaded mode */ | |||
int antThreadID = 0; | |||
if (args.length == 0) { | |||
System.err.println("required argument TestClassName missing"); | |||
@@ -954,7 +950,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
} | |||
} else if (args[i].startsWith(Constants.PROPSFILE)) { | |||
final FileInputStream in = new FileInputStream(args[i] | |||
.substring(Constants.PROPSFILE.length())); | |||
.substring(Constants.PROPSFILE.length())); | |||
props.load(in); | |||
in.close(); | |||
} else if (args[i].startsWith(Constants.SHOWOUTPUT)) { | |||
@@ -986,8 +982,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
int returnCode = SUCCESS; | |||
if (multipleTests) { | |||
try { | |||
final java.io.BufferedReader reader = | |||
new java.io.BufferedReader(new java.io.FileReader(args[0])); | |||
final BufferedReader reader = new BufferedReader(new FileReader(args[0])); | |||
String testCaseName; | |||
String[] testMethodNames; | |||
int code = 0; | |||
@@ -1020,8 +1015,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
errorOccurred = (code == ERRORS); | |||
failureOccurred = (code != SUCCESS); | |||
if (errorOccurred || failureOccurred) { | |||
if ((errorOccurred && haltError) | |||
|| (failureOccurred && haltFail)) { | |||
if ((errorOccurred && haltError) || (failureOccurred && haltFail)) { | |||
registerNonCrash(); | |||
System.exit(code); | |||
} else { | |||
@@ -1029,8 +1023,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
returnCode = code; | |||
} | |||
if (logFailedTests) { | |||
System.out.println("TEST " + t.getName() | |||
+ " FAILED"); | |||
System.out.println("TEST " + t.getName() + " FAILED"); | |||
} | |||
} | |||
} | |||
@@ -1043,9 +1036,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
t.setThread(antThreadID); | |||
t.setProperties(props); | |||
t.setSkipNonTests(skipNonTests); | |||
returnCode = launch( | |||
t, methods, haltError, stackfilter, haltFail, | |||
showOut, outputToFormat, logTestListenerEvents); | |||
returnCode = launch(t, methods, haltError, stackfilter, haltFail, showOut, | |||
outputToFormat, logTestListenerEvents); | |||
} | |||
registerNonCrash(); | |||
@@ -1090,9 +1082,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
for (int i = 0; i < size; i++) { | |||
final FormatterElement fe = (FormatterElement) fromCmdLine.elementAt(i); | |||
if (multipleTests && fe.getUseFile()) { | |||
final File destFile = | |||
new File(test.getTodir(), | |||
test.getOutfile() + fe.getExtension()); | |||
final File destFile = new File(test.getTodir(), | |||
test.getOutfile() + fe.getExtension()); | |||
fe.setOutfile(destFile); | |||
} | |||
runner.addFormatter((JUnitResultFormatter) fe.createFormatter()); | |||
@@ -1119,9 +1110,8 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
} else { | |||
final int fName = line.indexOf(IGNORED_FILE_NAME); | |||
if (fName > -1) { | |||
fe.setExtension(line | |||
.substring(fName | |||
+ IGNORED_FILE_NAME.length())); | |||
fe.setExtension(line.substring(fName | |||
+ IGNORED_FILE_NAME.length())); | |||
} | |||
} | |||
} | |||
@@ -45,8 +45,7 @@ public class TearDownOnVmCrash implements JUnitResultFormatter { | |||
*/ | |||
public void startTestSuite(final JUnitTest suite) { | |||
suiteName = suite.getName(); | |||
if (suiteName != null && | |||
suiteName.endsWith(JUnitTask.NAME_OF_DUMMY_TEST)) { | |||
if (suiteName != null && suiteName.endsWith(JUnitTask.NAME_OF_DUMMY_TEST)) { | |||
// no way to know which class caused the timeout | |||
suiteName = null; | |||
} | |||
@@ -58,28 +57,35 @@ public class TearDownOnVmCrash implements JUnitResultFormatter { | |||
* error generated by Ant. | |||
*/ | |||
public void addError(final Test fakeTest, final Throwable t) { | |||
if (suiteName != null | |||
&& fakeTest instanceof JUnitTaskMirrorImpl.VmExitErrorTest) { | |||
if (suiteName != null && fakeTest instanceof JUnitTaskMirrorImpl.VmExitErrorTest) { | |||
tearDown(); | |||
} | |||
} | |||
// no need to implement the rest | |||
public void addFailure(Test test, Throwable t) {} | |||
public void addFailure(Test test, Throwable t) { | |||
} | |||
public void addFailure(Test test, AssertionFailedError t) {} | |||
public void addFailure(Test test, AssertionFailedError t) { | |||
} | |||
public void startTest(Test test) {} | |||
public void startTest(Test test) { | |||
} | |||
public void endTest(Test test) {} | |||
public void endTest(Test test) { | |||
} | |||
public void endTestSuite(JUnitTest suite) {} | |||
public void endTestSuite(JUnitTest suite) { | |||
} | |||
public void setOutput(OutputStream out) {} | |||
public void setOutput(OutputStream out) { | |||
} | |||
public void setSystemOutput(String out) {} | |||
public void setSystemOutput(String out) { | |||
} | |||
public void setSystemError(String err) {} | |||
public void setSystemError(String err) { | |||
} | |||
private void tearDown() { | |||
try { | |||
@@ -96,8 +102,7 @@ public class TearDownOnVmCrash implements JUnitResultFormatter { | |||
} | |||
if (testClass == null && getClass().getClassLoader() != null) { | |||
try { | |||
testClass = | |||
getClass().getClassLoader().loadClass(suiteName); | |||
testClass = getClass().getClassLoader().loadClass(suiteName); | |||
} catch (ClassNotFoundException cnfe) { | |||
// ignore | |||
} | |||
@@ -447,33 +447,27 @@ public class FTP extends Task implements FTPTaskConfig { | |||
} | |||
if (isOK) { | |||
currentelement = path.replace(remoteFileSep.charAt(0), File.separatorChar); | |||
if (!isFollowSymlinks() | |||
&& traversesSymlinks) { | |||
if (!isFollowSymlinks() && traversesSymlinks) { | |||
continue; | |||
} | |||
if (myfile.isDirectory()) { | |||
if (isIncluded(currentelement) | |||
&& currentelement.length() > 0) { | |||
if (isIncluded(currentelement) && currentelement.length() > 0) { | |||
accountForIncludedDir(currentelement, myfile, true); | |||
} else { | |||
if (currentelement.length() > 0) { | |||
if (currentelement.charAt(currentelement | |||
.length() - 1) | |||
if (currentelement.charAt(currentelement.length() - 1) | |||
!= File.separatorChar) { | |||
currentelement = | |||
currentelement + File.separatorChar; | |||
currentelement = currentelement + File.separatorChar; | |||
} | |||
} | |||
scandir(myfile.getAbsolutePath(), currentelement, true); | |||
} | |||
} else { | |||
if (isCaseSensitive | |||
&& originalpattern.equals(currentelement)) { | |||
if (isCaseSensitive && originalpattern.equals(currentelement)) { | |||
accountForIncludedFile(currentelement); | |||
} else if (!isCaseSensitive | |||
&& originalpattern | |||
.equalsIgnoreCase(currentelement)) { | |||
&& originalpattern.equalsIgnoreCase(currentelement)) { | |||
accountForIncludedFile(currentelement); | |||
} | |||
} | |||
@@ -337,7 +337,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
try { | |||
path = myfile.getRelativePath(); | |||
traversesSymlinks = myfile.isTraverseSymlinks(); | |||
} catch (IOException be) { | |||
} catch (IOException be) { | |||
throw new BuildException(be, task.getLocation()); | |||
} catch (BuildException be) { | |||
isOK = false; | |||
@@ -1177,8 +1177,8 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
for (int i = 0; i < dsfiles.length; i++) { | |||
final String dsfile = dsfiles[i]; | |||
executeRetryable(h, new Retryable() { | |||
public void execute() throws IOException { | |||
switch (task.getAction()) { | |||
public void execute() throws IOException { | |||
switch (task.getAction()) { | |||
case FTPTask.SEND_FILES: | |||
sendFile(ftp, fdir, dsfile); | |||
break; | |||
@@ -1199,9 +1199,9 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
default: | |||
throw new BuildException("unknown ftp action " | |||
+ task.getAction()); | |||
} | |||
} | |||
}, dsfile); | |||
} | |||
}, dsfile); | |||
} | |||
} | |||
} finally { | |||
@@ -1443,20 +1443,20 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
+ task.getGranularityMillis(); | |||
StringBuffer msg; | |||
synchronized(TIMESTAMP_LOGGING_SDF) { | |||
synchronized (TIMESTAMP_LOGGING_SDF) { | |||
msg = new StringBuffer(" [") | |||
.append(TIMESTAMP_LOGGING_SDF.format(new Date(localTimestamp))) | |||
.append("] local"); | |||
} | |||
task.log(msg.toString(), Project.MSG_VERBOSE); | |||
synchronized(TIMESTAMP_LOGGING_SDF) { | |||
synchronized (TIMESTAMP_LOGGING_SDF) { | |||
msg = new StringBuffer(" [") | |||
.append(TIMESTAMP_LOGGING_SDF.format(new Date(adjustedRemoteTimestamp))) | |||
.append("] remote"); | |||
} | |||
if (remoteTimestamp != adjustedRemoteTimestamp) { | |||
synchronized(TIMESTAMP_LOGGING_SDF) { | |||
synchronized (TIMESTAMP_LOGGING_SDF) { | |||
msg.append(" - (raw: ") | |||
.append(TIMESTAMP_LOGGING_SDF.format(new Date(remoteTimestamp))) | |||
.append(")"); | |||
@@ -1936,4 +1936,3 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
} | |||
} | |||
} | |||
@@ -202,10 +202,8 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||
tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log"); | |||
log(commandLine.describeCommand(), Project.MSG_VERBOSE); | |||
try { | |||
result = runCmd(commandLine, | |||
new PumpStreamHandler(fos, | |||
new LogOutputStream(this, | |||
Project.MSG_WARN))); | |||
result = runCmd(commandLine, new PumpStreamHandler(fos, | |||
new LogOutputStream(this, Project.MSG_WARN))); | |||
} finally { | |||
FileUtils.close(fos); | |||
} | |||
@@ -250,8 +248,7 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||
commandLine.createArgument().setValue("-v" + getLabel()); | |||
} else { | |||
if (getRevision() != null) { | |||
commandLine.createArgument().setValue("-r" | |||
+ getRevision()); | |||
commandLine.createArgument().setValue("-r" + getRevision()); | |||
} | |||
} | |||
} | |||
@@ -304,10 +301,10 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||
String line = in.readLine(); | |||
while (line != null) { | |||
log("Considering \"" + line + "\"", Project.MSG_VERBOSE); | |||
if (line.startsWith("\"\\") // Checking for "\ | |||
|| line.startsWith("\"/") // or "/ | |||
// or "X:\... | |||
|| (line.length() > POS_3 && line.startsWith("\"") | |||
if (line.startsWith("\"\\") // Checking for "\ | |||
|| line.startsWith("\"/") // or "/ | |||
// or "X:\... | |||
|| (line.length() > POS_3 && line.startsWith("\"") | |||
&& Character.isLetter(line.charAt(POS_1)) | |||
&& String.valueOf(line.charAt(POS_2)).equals(":") | |||
&& String.valueOf(line.charAt(POS_3)).equals("\\"))) { | |||
@@ -48,7 +48,7 @@ public class Directory { | |||
* @param directory a directory | |||
* @param parent a parent Directory | |||
*/ | |||
public Directory(File directory , Directory parent) { | |||
public Directory(File directory, Directory parent) { | |||
this.parent = parent; | |||
this.childDirectories = new LinkedHashSet(); | |||
this.files = new ArrayList(); | |||
@@ -428,8 +428,7 @@ public class Scp extends SSHBase { | |||
// password. (so if the path contains an @ and a : it will not work) | |||
int indexOfCurrentAt = indexOfAt; | |||
final int indexOfLastColon = uri.lastIndexOf(':'); | |||
while (indexOfCurrentAt > -1 && indexOfCurrentAt < indexOfLastColon) | |||
{ | |||
while (indexOfCurrentAt > -1 && indexOfCurrentAt < indexOfLastColon) { | |||
indexOfAt = indexOfCurrentAt; | |||
indexOfCurrentAt = uri.indexOf('@', indexOfCurrentAt + 1); | |||
} | |||
@@ -42,7 +42,7 @@ public class ScpFromMessage extends AbstractSshMessage { | |||
private static final int HUNDRED_KILOBYTES = 102400; | |||
private static final byte LINE_FEED = 0x0a; | |||
private static final int BUFFER_SIZE = 100*1024; | |||
private static final int BUFFER_SIZE = 100 * 1024; | |||
private String remoteFile; | |||
private File localFile; | |||
@@ -36,7 +36,7 @@ import com.jcraft.jsch.Session; | |||
public class ScpToMessage extends AbstractSshMessage { | |||
private static final int HUNDRED_KILOBYTES = 102400; | |||
private static final int BUFFER_SIZE = 100*1024; | |||
private static final int BUFFER_SIZE = 100 * 1024; | |||
private static final int DEFAULT_DIR_MODE = 0755; | |||
private static final int DEFAULT_FILE_MODE = 0644; | |||
@@ -76,7 +76,7 @@ public class MSVSSCREATE extends MSVSS { | |||
* | |||
* @param quiet The boolean value for quiet. | |||
*/ | |||
public final void setQuiet (boolean quiet) { | |||
public final void setQuiet(boolean quiet) { | |||
super.setInternalQuiet(quiet); | |||
} | |||
@@ -93,7 +93,7 @@ public class MSVSSGET extends MSVSS { | |||
* | |||
* @param quiet The boolean value for quiet. | |||
*/ | |||
public final void setQuiet (boolean quiet) { | |||
public final void setQuiet(boolean quiet) { | |||
super.setInternalQuiet(quiet); | |||
} | |||
@@ -176,8 +176,8 @@ public class Attrib extends ExecuteOn { | |||
* @return true if the os is valid. | |||
*/ | |||
protected boolean isValidOs() { | |||
return getOs() == null && getOsFamily() == null ? | |||
Os.isFamily(Os.FAMILY_WINDOWS) : super.isValidOs(); | |||
return getOs() == null && getOsFamily() == null | |||
? Os.isFamily(Os.FAMILY_WINDOWS) : super.isValidOs(); | |||
} | |||
private static String getSignString(boolean attr) { | |||
@@ -45,8 +45,7 @@ public class XNewRmic extends ForkingSunRmic { | |||
String[] options = new String[] { | |||
"-Xnew" | |||
}; | |||
Commandline commandline = super.setupRmicCommand(options); | |||
return commandline; | |||
return super.setupRmicCommand(options); | |||
} | |||
} |
@@ -188,7 +188,7 @@ public class Commandline implements Cloneable { | |||
*/ | |||
public String[] getParts() { | |||
if (parts == null || parts.length == 0 | |||
|| (prefix.length() == 0 && suffix.length() == 0)) { | |||
|| (prefix.length() == 0 && suffix.length() == 0)) { | |||
return parts; | |||
} | |||
String[] fullParts = new String[parts.length]; | |||
@@ -385,15 +385,12 @@ public class CommandlineJava implements Cloneable { | |||
javaCommand.setExecutable(module, false); | |||
break; | |||
case CLASS: | |||
javaCommand.setExecutable(createModuleClassPair( | |||
module, | |||
javaCommand.setExecutable(createModuleClassPair(module, | |||
javaCommand.getExecutable()), false); | |||
break; | |||
case MODULE: | |||
javaCommand.setExecutable(createModuleClassPair( | |||
module, | |||
parseClassFromModuleClassPair(javaCommand.getExecutable())), | |||
false); | |||
javaCommand.setExecutable(createModuleClassPair(module, | |||
parseClassFromModuleClassPair(javaCommand.getExecutable())), false); | |||
break; | |||
} | |||
} | |||
@@ -500,8 +497,7 @@ public class CommandlineJava implements Cloneable { | |||
if (isCloneVm()) { | |||
SysProperties clonedSysProperties = new SysProperties(); | |||
PropertySet ps = new PropertySet(); | |||
PropertySet.BuiltinPropertySetName sys = | |||
new PropertySet.BuiltinPropertySetName(); | |||
PropertySet.BuiltinPropertySetName sys = new PropertySet.BuiltinPropertySetName(); | |||
sys.setValue("system"); | |||
ps.appendBuiltin(sys); | |||
clonedSysProperties.addSyspropertyset(ps); | |||
@@ -515,20 +511,17 @@ public class CommandlineJava implements Cloneable { | |||
//main classpath | |||
if (haveClasspath()) { | |||
listIterator.add("-classpath"); | |||
listIterator.add( | |||
classpath.concatSystemClasspath("ignore").toString()); | |||
listIterator.add(classpath.concatSystemClasspath("ignore").toString()); | |||
} | |||
//module path | |||
if (haveModulepath()) { | |||
listIterator.add("--module-path"); | |||
listIterator.add( | |||
modulepath.concatSystemClasspath("ignore").toString()); | |||
listIterator.add(modulepath.concatSystemClasspath("ignore").toString()); | |||
} | |||
//upgrade module path | |||
if (haveUpgrademodulepath()) { | |||
listIterator.add("--upgrade-module-path"); | |||
listIterator.add( | |||
upgrademodulepath.concatSystemClasspath("ignore").toString()); | |||
listIterator.add(upgrademodulepath.concatSystemClasspath("ignore").toString()); | |||
} | |||
//now any assertions are added | |||
if (getAssertions() != null) { | |||
@@ -762,10 +755,8 @@ public class CommandlineJava implements Cloneable { | |||
* @since Ant 1.6 | |||
*/ | |||
public boolean haveClasspath() { | |||
Path fullClasspath = classpath != null | |||
? classpath.concatSystemClasspath("ignore") : null; | |||
return fullClasspath != null | |||
&& fullClasspath.toString().trim().length() > 0; | |||
Path fullClasspath = classpath != null ? classpath.concatSystemClasspath("ignore") : null; | |||
return fullClasspath != null && fullClasspath.toString().trim().length() > 0; | |||
} | |||
/** | |||
@@ -789,7 +780,7 @@ public class CommandlineJava implements Cloneable { | |||
*/ | |||
public boolean haveModulepath() { | |||
Path fullClasspath = modulepath != null | |||
? modulepath.concatSystemClasspath("ignore") : null; | |||
? modulepath.concatSystemClasspath("ignore") : null; | |||
return fullClasspath != null | |||
&& fullClasspath.toString().trim().length() > 0; | |||
} | |||
@@ -802,8 +793,7 @@ public class CommandlineJava implements Cloneable { | |||
public boolean haveUpgrademodulepath() { | |||
Path fullClasspath = upgrademodulepath != null | |||
? upgrademodulepath.concatSystemClasspath("ignore") : null; | |||
return fullClasspath != null | |||
&& fullClasspath.toString().trim().length() > 0; | |||
return fullClasspath != null && fullClasspath.toString().trim().length() > 0; | |||
} | |||
/** | |||
@@ -816,8 +806,7 @@ public class CommandlineJava implements Cloneable { | |||
private Path calculateBootclasspath(boolean log) { | |||
if (vmVersion.startsWith("1.1")) { | |||
if (bootclasspath != null && log) { | |||
bootclasspath.log("Ignoring bootclasspath as " | |||
+ "the target VM doesn't support it."); | |||
bootclasspath.log("Ignoring bootclasspath as the target VM doesn't support it."); | |||
} | |||
} else { | |||
Path b = bootclasspath; | |||
@@ -839,8 +828,7 @@ public class CommandlineJava implements Cloneable { | |||
* @since 1.7 | |||
*/ | |||
private boolean isCloneVm() { | |||
return cloneVm | |||
|| "true".equals(System.getProperty("ant.build.clonevm")); | |||
return cloneVm || "true".equals(System.getProperty("ant.build.clonevm")); | |||
} | |||
/** | |||
@@ -851,9 +839,7 @@ public class CommandlineJava implements Cloneable { | |||
* @since 1.9.7 | |||
*/ | |||
private static String createModuleClassPair(final String module, final String classname) { | |||
return classname == null ? | |||
module : | |||
String.format("%s/%s", module, classname); //NOI18N | |||
return classname == null ? module : String.format("%s/%s", module, classname); //NOI18N | |||
} | |||
/** | |||
@@ -881,9 +867,7 @@ public class CommandlineJava implements Cloneable { | |||
return null; | |||
} | |||
final String[] moduleAndClass = moduleClassPair.split("/"); //NOI18N | |||
return moduleAndClass.length == 2 ? | |||
moduleAndClass[1] : | |||
null; | |||
return moduleAndClass.length == 2 ? moduleAndClass[1] : null; | |||
} | |||
/** | |||
@@ -363,7 +363,7 @@ public abstract class DataType extends ProjectComponent implements Cloneable { | |||
} | |||
private String displayName(Class<?> clazz) { | |||
return clazz.getName() + " (loaded via " + clazz.getClassLoader() +")"; | |||
return clazz.getName() + " (loaded via " + clazz.getClassLoader() + ")"; | |||
} | |||
} | |||
@@ -47,7 +47,6 @@ import org.xml.sax.SAXException; | |||
import org.xml.sax.XMLReader; | |||
/** | |||
* <p>This data type provides a catalog of resource locations (such as | |||
* DTDs and XML entities), based on the <a | |||
@@ -17,7 +17,6 @@ | |||
*/ | |||
package org.apache.tools.ant.types.optional.image; | |||
import java.awt.Color; | |||
import java.awt.Font; | |||
import java.awt.FontMetrics; | |||
import java.awt.Graphics2D; | |||
@@ -95,7 +94,6 @@ public class Text extends ImageOperation implements DrawOperation { | |||
public PlanarImage executeDrawOperation() { | |||
log("\tCreating Text \"" + strText + "\""); | |||
Color couloir = ColorMapper.getColorByName(color); | |||
int width = 1; | |||
int height = 1; | |||
@@ -120,7 +118,7 @@ public class Text extends ImageOperation implements DrawOperation { | |||
RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); | |||
graphics.setFont(f); | |||
graphics.setColor(couloir); | |||
graphics.setColor(ColorMapper.getColorByName(color)); | |||
graphics.drawString(strText, 0, height - fmetrics.getMaxDescent()); | |||
PlanarImage image = PlanarImage.wrapRenderedImage(bi); | |||
return image; | |||
@@ -187,7 +187,7 @@ public class MultiRootFileSet extends AbstractFileSet | |||
/** | |||
* What to return from the set: files, directories or both. | |||
*/ | |||
public static enum SetType { | |||
public enum SetType { | |||
file, dir, both | |||
} | |||
@@ -905,7 +905,7 @@ public class ModifiedSelector extends BaseExtendSelector | |||
* @see EnumeratedAttribute#getValues() | |||
*/ | |||
public String[] getValues() { | |||
return new String[] {"propertyfile" }; | |||
return new String[] {"propertyfile"}; | |||
} | |||
} | |||
@@ -935,7 +935,7 @@ public class ModifiedSelector extends BaseExtendSelector | |||
* @see EnumeratedAttribute#getValues() | |||
*/ | |||
public String[] getValues() { | |||
return new String[] {"hashvalue", "digest", "checksum" }; | |||
return new String[] {"hashvalue", "digest", "checksum"}; | |||
} | |||
} | |||
@@ -965,7 +965,7 @@ public class ModifiedSelector extends BaseExtendSelector | |||
* @see EnumeratedAttribute#getValues() | |||
*/ | |||
public String[] getValues() { | |||
return new String[] {"equal", "rule" }; | |||
return new String[] {"equal", "rule"}; | |||
} | |||
} | |||
@@ -518,7 +518,8 @@ public class DOMElementWriter { | |||
*/ | |||
public void encodedata(final Writer out, final String value) throws IOException { | |||
final int len = value.length(); | |||
int prevEnd = 0, cdataEndPos = value.indexOf("]]>"); | |||
int prevEnd = 0; | |||
int cdataEndPos = value.indexOf("]]>"); | |||
while (prevEnd < len) { | |||
final int end = (cdataEndPos < 0 ? len : cdataEndPos); | |||
// Write out stretches of legal characters in the range [prevEnd, end). | |||
@@ -545,8 +545,7 @@ public final class JavaEnvUtils { | |||
tests.addElement("org.xml.sax.XMLReader"); | |||
} | |||
if (isAtLeastJavaVersion(JAVA_1_5)) { | |||
tests.addElement( | |||
"com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl"); | |||
tests.addElement("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl"); | |||
} | |||
if (isAtLeastJavaVersion(JAVA_1_7)) { | |||
tests.addElement("jdk.net.Sockets"); | |||
@@ -357,7 +357,7 @@ public class LayoutPreservingProperties extends Properties { | |||
line = new Blank(); | |||
} else { | |||
line = new Pair(logicalLineBuffer.toString()); | |||
final String key = unescape(((Pair)line).getName()); | |||
final String key = unescape(((Pair) line).getName()); | |||
if (keyedPairLines.containsKey(key)) { | |||
// this key is already present, so we remove it and add | |||
// the new one | |||
@@ -474,7 +474,7 @@ public class LayoutPreservingProperties extends Properties { | |||
buffy.append('\t'); | |||
} else if (c == 'u') { | |||
// handle unicode escapes | |||
c = unescapeUnicode(ch, i+1); | |||
c = unescapeUnicode(ch, i + 1); | |||
i += 4; | |||
buffy.append(c); | |||
} else { | |||
@@ -554,7 +554,7 @@ public class LayoutPreservingProperties extends Properties { | |||
} | |||
final int p = forEscaping.indexOf(c); | |||
if (p != -1) { | |||
buffy.append("\\").append(escaped.substring(p,p+1)); | |||
buffy.append("\\").append(escaped.substring(p, p + 1)); | |||
} else if (c < 0x0020 || c > 0x007e) { | |||
buffy.append(escapeUnicode(c)); | |||
} else { | |||
@@ -715,7 +715,7 @@ public class LayoutPreservingProperties extends Properties { | |||
value = null; | |||
} else { | |||
name = text.substring(0, pos); | |||
value = text.substring(pos+1, text.length()); | |||
value = text.substring(pos + 1, text.length()); | |||
} | |||
// trim leading whitespace only | |||
name = stripStart(name, " \t\f"); | |||
@@ -727,7 +727,7 @@ public class LayoutPreservingProperties extends Properties { | |||
} | |||
int i = 0; | |||
for (;i < s.length(); i++) { | |||
for (; i < s.length(); i++) { | |||
if (chars.indexOf(s.charAt(i)) == -1) { | |||
break; | |||
} | |||