You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2014/07/04 15:15:08 UTC
[4/8] make it compile under Java5 (1.5.0_22-b03)
http://git-wip-us.apache.org/repos/asf/ant/blob/13f6d98c/src/main/org/apache/tools/ant/taskdefs/Tar.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java
index c5259ba..268e660 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Tar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java
@@ -24,10 +24,13 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.Enumeration;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.Vector;
import java.util.zip.GZIPOutputStream;
@@ -68,31 +71,36 @@ public class Tar extends MatchingTask {
* Tar.WARN is deprecated and is replaced with
* Tar.TarLongFileMode.WARN
*/
- public static final String WARN = "warn";
+ @Deprecated
+ public static final String WARN = "warn";
/**
* @deprecated since 1.5.x.
* Tar.FAIL is deprecated and is replaced with
* Tar.TarLongFileMode.FAIL
*/
- public static final String FAIL = "fail";
+ @Deprecated
+ public static final String FAIL = "fail";
/**
* @deprecated since 1.5.x.
* Tar.TRUNCATE is deprecated and is replaced with
* Tar.TarLongFileMode.TRUNCATE
*/
- public static final String TRUNCATE = "truncate";
+ @Deprecated
+ public static final String TRUNCATE = "truncate";
/**
* @deprecated since 1.5.x.
* Tar.GNU is deprecated and is replaced with
* Tar.TarLongFileMode.GNU
*/
- public static final String GNU = "gnu";
+ @Deprecated
+ public static final String GNU = "gnu";
/**
* @deprecated since 1.5.x.
* Tar.OMIT is deprecated and is replaced with
* Tar.TarLongFileMode.OMIT
*/
- public static final String OMIT = "omit";
+ @Deprecated
+ public static final String OMIT = "omit";
// CheckStyle:VisibilityModifier OFF - bc
File tarFile;
@@ -101,12 +109,10 @@ public class Tar extends MatchingTask {
private TarLongFileMode longFileMode = new TarLongFileMode();
// need to keep the package private version for backwards compatibility
- Vector filesets = new Vector();
+ Vector<TarFileSet> filesets = new Vector<TarFileSet>();
// we must keep two lists since other classes may modify the
// filesets Vector (it is package private) without us noticing
- private Vector resourceCollections = new Vector();
-
- Vector fileSetFiles = new Vector();
+ private final Vector<ResourceCollection> resourceCollections = new Vector<ResourceCollection>();
// CheckStyle:VisibilityModifier ON
@@ -122,7 +128,7 @@ public class Tar extends MatchingTask {
* @return the tar fileset to be used as the nested element.
*/
public TarFileSet createTarFileSet() {
- TarFileSet fs = new TarFileSet();
+ final TarFileSet fs = new TarFileSet();
fs.setProject(getProject());
filesets.addElement(fs);
return fs;
@@ -133,7 +139,7 @@ public class Tar extends MatchingTask {
* @param res a resource collection to archive.
* @since Ant 1.7
*/
- public void add(ResourceCollection res) {
+ public void add(final ResourceCollection res) {
resourceCollections.add(res);
}
@@ -143,7 +149,8 @@ public class Tar extends MatchingTask {
* @deprecated since 1.5.x.
* For consistency with other tasks, please use setDestFile().
*/
- public void setTarfile(File tarFile) {
+ @Deprecated
+ public void setTarfile(final File tarFile) {
this.tarFile = tarFile;
}
@@ -152,7 +159,7 @@ public class Tar extends MatchingTask {
* @since Ant 1.5
* @param destFile The output of the tar
*/
- public void setDestFile(File destFile) {
+ public void setDestFile(final File destFile) {
this.tarFile = destFile;
}
@@ -160,7 +167,7 @@ public class Tar extends MatchingTask {
* This is the base directory to look in for things to tar.
* @param baseDir the base directory.
*/
- public void setBasedir(File baseDir) {
+ public void setBasedir(final File baseDir) {
this.baseDir = baseDir;
}
@@ -183,7 +190,8 @@ public class Tar extends MatchingTask {
* mechanism do the work and also to encapsulate operations on
* the mode in its own class.
*/
- public void setLongfile(String mode) {
+ @Deprecated
+ public void setLongfile(final String mode) {
log("DEPRECATED - The setLongfile(String) method has been deprecated."
+ " Use setLongfile(Tar.TarLongFileMode) instead.");
this.longFileMode = new TarLongFileMode();
@@ -205,7 +213,7 @@ public class Tar extends MatchingTask {
* </ul>
* @param mode the mode to handle long file names.
*/
- public void setLongfile(TarLongFileMode mode) {
+ public void setLongfile(final TarLongFileMode mode) {
this.longFileMode = mode;
}
@@ -219,7 +227,7 @@ public class Tar extends MatchingTask {
* </ul>
* @param mode the compression method.
*/
- public void setCompression(TarCompressionMethod mode) {
+ public void setCompression(final TarCompressionMethod mode) {
this.compression = mode;
}
@@ -227,7 +235,8 @@ public class Tar extends MatchingTask {
* do the business
* @throws BuildException on error
*/
- public void execute() throws BuildException {
+ @Override
+ public void execute() throws BuildException {
if (tarFile == null) {
throw new BuildException("tarfile attribute must be set!",
getLocation());
@@ -243,7 +252,8 @@ public class Tar extends MatchingTask {
getLocation());
}
- Vector savedFileSets = (Vector) filesets.clone();
+ @SuppressWarnings("unchecked")
+ final Vector<TarFileSet> savedFileSets = (Vector<TarFileSet>) filesets.clone();
try {
if (baseDir != null) {
if (!baseDir.exists()) {
@@ -252,7 +262,7 @@ public class Tar extends MatchingTask {
}
// add the main fileset to the list of filesets to process.
- TarFileSet mainFileSet = new TarFileSet(fileset);
+ final TarFileSet mainFileSet = new TarFileSet(fileset);
mainFileSet.setDir(baseDir);
filesets.addElement(mainFileSet);
}
@@ -267,12 +277,11 @@ public class Tar extends MatchingTask {
// check if tar is out of date with respect to each
// fileset
boolean upToDate = true;
- for (Enumeration e = filesets.elements(); e.hasMoreElements();) {
- upToDate &= check((TarFileSet) e.nextElement());
+ for(final TarFileSet tfs : filesets) {
+ upToDate &= check(tfs);
}
- for (Enumeration e = resourceCollections.elements();
- e.hasMoreElements();) {
- upToDate &= check((ResourceCollection) e.nextElement());
+ for(final ResourceCollection rcol : resourceCollections) {
+ upToDate &= check(rcol);
}
if (upToDate) {
@@ -281,7 +290,7 @@ public class Tar extends MatchingTask {
return;
}
- File parent = tarFile.getParentFile();
+ final File parent = tarFile.getParentFile();
if (parent != null && !parent.isDirectory()
&& !(parent.mkdirs() || parent.isDirectory())) {
throw new BuildException("Failed to create missing parent"
@@ -310,16 +319,14 @@ public class Tar extends MatchingTask {
}
longWarningGiven = false;
- for (Enumeration e = filesets.elements();
- e.hasMoreElements();) {
- tar((TarFileSet) e.nextElement(), tOut);
+ for(final TarFileSet tfs : filesets) {
+ tar(tfs, tOut);
}
- for (Enumeration e = resourceCollections.elements();
- e.hasMoreElements();) {
- tar((ResourceCollection) e.nextElement(), tOut);
+ for(final ResourceCollection rcol : resourceCollections) {
+ tar(rcol, tOut);
}
- } catch (IOException ioe) {
- String msg = "Problem creating TAR: " + ioe.getMessage();
+ } catch (final IOException ioe) {
+ final String msg = "Problem creating TAR: " + ioe.getMessage();
throw new BuildException(msg, ioe, getLocation());
} finally {
FileUtils.close(tOut);
@@ -337,8 +344,8 @@ public class Tar extends MatchingTask {
* @param tarFileSet the fileset that the file came from.
* @throws IOException on error
*/
- protected void tarFile(File file, TarOutputStream tOut, String vPath,
- TarFileSet tarFileSet)
+ protected void tarFile(final File file, final TarOutputStream tOut, final String vPath,
+ final TarFileSet tarFileSet)
throws IOException {
if (file.equals(tarFile)) {
// If the archive is built for the first time and it is
@@ -364,8 +371,8 @@ public class Tar extends MatchingTask {
* @throws IOException on error
* @since Ant 1.7
*/
- protected void tarResource(Resource r, TarOutputStream tOut, String vPath,
- TarFileSet tarFileSet)
+ protected void tarResource(final Resource r, final TarOutputStream tOut, String vPath,
+ final TarFileSet tarFileSet)
throws IOException {
if (!r.isExists()) {
@@ -375,7 +382,7 @@ public class Tar extends MatchingTask {
boolean preserveLeadingSlashes = false;
if (tarFileSet != null) {
- String fullpath = tarFileSet.getFullpath(this.getProject());
+ final String fullpath = tarFileSet.getFullpath(this.getProject());
if (fullpath.length() > 0) {
vPath = fullpath;
} else {
@@ -395,7 +402,7 @@ public class Tar extends MatchingTask {
preserveLeadingSlashes = tarFileSet.getPreserveLeadingSlashes();
if (vPath.startsWith("/") && !preserveLeadingSlashes) {
- int l = vPath.length();
+ final int l = vPath.length();
if (l <= 1) {
// we would end up adding "" to the archive
return;
@@ -429,14 +436,14 @@ public class Tar extends MatchingTask {
}
}
- TarEntry te = new TarEntry(vPath, preserveLeadingSlashes);
+ final TarEntry te = new TarEntry(vPath, preserveLeadingSlashes);
te.setModTime(r.getLastModified());
// preserve permissions
if (r instanceof ArchiveResource) {
- ArchiveResource ar = (ArchiveResource) r;
+ final ArchiveResource ar = (ArchiveResource) r;
te.setMode(ar.getMode());
if (r instanceof TarResource) {
- TarResource tr = (TarResource) r;
+ final TarResource tr = (TarResource) r;
te.setUserName(tr.getUserName());
te.setUserId(tr.getUid());
te.setGroupName(tr.getGroup());
@@ -483,7 +490,7 @@ public class Tar extends MatchingTask {
if (!r.isDirectory()) {
in = r.getInputStream();
- byte[] buffer = new byte[BUFFER_SIZE];
+ final byte[] buffer = new byte[BUFFER_SIZE];
int count = 0;
do {
tOut.write(buffer, 0, count);
@@ -504,7 +511,8 @@ public class Tar extends MatchingTask {
* @deprecated since 1.5.x.
* use the two-arg version instead.
*/
- protected boolean archiveIsUpToDate(String[] files) {
+ @Deprecated
+ protected boolean archiveIsUpToDate(final String[] files) {
return archiveIsUpToDate(files, baseDir);
}
@@ -515,9 +523,9 @@ public class Tar extends MatchingTask {
* @return true if the archive is up to date.
* @since Ant 1.5.2
*/
- protected boolean archiveIsUpToDate(String[] files, File dir) {
- SourceFileScanner sfs = new SourceFileScanner(this);
- MergingMapper mm = new MergingMapper();
+ protected boolean archiveIsUpToDate(final String[] files, final File dir) {
+ final SourceFileScanner sfs = new SourceFileScanner(this);
+ final MergingMapper mm = new MergingMapper();
mm.setTo(tarFile.getAbsolutePath());
return sfs.restrict(files, dir, null, mm).length == 0;
}
@@ -528,7 +536,7 @@ public class Tar extends MatchingTask {
* @return true if the archive is up to date.
* @since Ant 1.7
*/
- protected boolean archiveIsUpToDate(Resource r) {
+ protected boolean archiveIsUpToDate(final Resource r) {
return SelectorUtils.isOutOfDate(new FileResource(tarFile), r,
FileUtils.getFileUtils()
.getFileTimestampGranularity());
@@ -563,27 +571,27 @@ public class Tar extends MatchingTask {
* @return whether the archive is up-to-date
* @since Ant 1.7
*/
- protected boolean check(ResourceCollection rc) {
+ protected boolean check(final ResourceCollection rc) {
boolean upToDate = true;
if (isFileFileSet(rc)) {
- FileSet fs = (FileSet) rc;
+ final FileSet fs = (FileSet) rc;
upToDate = check(fs.getDir(getProject()), getFileNames(fs));
} else if (!rc.isFilesystemOnly() && !supportsNonFileResources()) {
throw new BuildException("only filesystem resources are supported");
} else if (rc.isFilesystemOnly()) {
- HashSet basedirs = new HashSet();
- HashMap basedirToFilesMap = new HashMap();
- for (Resource res : rc) {
- FileResource r = ResourceUtils
+ final Set<File> basedirs = new HashSet<File>();
+ final Map<File, List<String>> basedirToFilesMap = new HashMap<File, List<String>>();
+ for (final Resource res : rc) {
+ final FileResource r = ResourceUtils
.asFileResource(res.as(FileProvider.class));
File base = r.getBaseDir();
if (base == null) {
base = Copy.NULL_FILE_PLACEHOLDER;
}
basedirs.add(base);
- Vector files = (Vector) basedirToFilesMap.get(base);
+ List<String> files = basedirToFilesMap.get(base);
if (files == null) {
- files = new Vector();
+ files = new Vector<String>();
basedirToFilesMap.put(base, files);
}
if (base == Copy.NULL_FILE_PLACEHOLDER) {
@@ -592,19 +600,15 @@ public class Tar extends MatchingTask {
files.add(r.getName());
}
}
- Iterator iter = basedirs.iterator();
- while (iter.hasNext()) {
- File base = (File) iter.next();
- Vector f = (Vector) basedirToFilesMap.get(base);
- String[] files = (String[]) f.toArray(new String[f.size()]);
- upToDate &=
- check(base == Copy.NULL_FILE_PLACEHOLDER ? null : base,
- files);
+ for(final File base : basedirs) {
+ final File tmpBase = base == Copy.NULL_FILE_PLACEHOLDER ? null : base;
+ final List<String> files = basedirToFilesMap.get(base);
+ check(tmpBase, files);
}
} else { // non-file resources
- Iterator<Resource> iter = rc.iterator();
+ final Iterator<Resource> iter = rc.iterator();
while (upToDate && iter.hasNext()) {
- Resource r = iter.next();
+ final Resource r = iter.next();
upToDate = archiveIsUpToDate(r);
}
}
@@ -620,7 +624,7 @@ public class Tar extends MatchingTask {
* @return whether the archive is up-to-date
* @since Ant 1.7
*/
- protected boolean check(File basedir, String[] files) {
+ protected boolean check(final File basedir, final String[] files) {
boolean upToDate = true;
if (!archiveIsUpToDate(files, basedir)) {
upToDate = false;
@@ -636,6 +640,20 @@ public class Tar extends MatchingTask {
}
/**
+ * <p>Checks whether the archive is out-of-date with respect to the
+ * given files, ensures that the archive won't contain itself.</p>
+ *
+ * @param basedir base directory for file names
+ * @param files array of relative file names
+ * @return whether the archive is up-to-date
+ * @see #check(File, String[])
+ * @since Ant 1.9.5
+ */
+ protected boolean check(final File basedir, final Collection<String> files) {
+ return check(basedir, files.toArray(new String[files.size()]));
+ }
+
+ /**
* Adds the resources contained in this collection to the archive.
*
* <p>Uses the file based methods for file resources for backwards
@@ -646,7 +664,7 @@ public class Tar extends MatchingTask {
* @throws IOException on error.
* @since Ant 1.7
*/
- protected void tar(ResourceCollection rc, TarOutputStream tOut)
+ protected void tar(final ResourceCollection rc, final TarOutputStream tOut)
throws IOException {
ArchiveFileSet afs = null;
if (rc instanceof ArchiveFileSet) {
@@ -659,23 +677,23 @@ public class Tar extends MatchingTask {
+ "filesets that specify a "
+ "single file.");
}
- TarFileSet tfs = asTarFileSet(afs);
+ final TarFileSet tfs = asTarFileSet(afs);
if (isFileFileSet(rc)) {
- FileSet fs = (FileSet) rc;
- String[] files = getFileNames(fs);
+ final FileSet fs = (FileSet) rc;
+ final String[] files = getFileNames(fs);
for (int i = 0; i < files.length; i++) {
- File f = new File(fs.getDir(getProject()), files[i]);
- String name = files[i].replace(File.separatorChar, '/');
+ final File f = new File(fs.getDir(getProject()), files[i]);
+ final String name = files[i].replace(File.separatorChar, '/');
tarFile(f, tOut, name, tfs);
}
} else if (rc.isFilesystemOnly()) {
- for (Resource r : rc) {
- File f = r.as(FileProvider.class).getFile();
+ for (final Resource r : rc) {
+ final File f = r.as(FileProvider.class).getFile();
tarFile(f, tOut, f.getName(), tfs);
}
} else { // non-file resources
- for (Resource r : rc) {
+ for (final Resource r : rc) {
tarResource(r, tOut, r.getName(), tfs);
}
}
@@ -688,7 +706,7 @@ public class Tar extends MatchingTask {
* @return true if the collection is a fileset.
* @since Ant 1.7
*/
- protected static boolean isFileFileSet(ResourceCollection rc) {
+ protected static boolean isFileFileSet(final ResourceCollection rc) {
return rc instanceof FileSet && rc.isFilesystemOnly();
}
@@ -699,11 +717,11 @@ public class Tar extends MatchingTask {
* @return a list of the filenames.
* @since Ant 1.7
*/
- protected static String[] getFileNames(FileSet fs) {
- DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject());
- String[] directories = ds.getIncludedDirectories();
- String[] filesPerSe = ds.getIncludedFiles();
- String[] files = new String [directories.length + filesPerSe.length];
+ protected static String[] getFileNames(final FileSet fs) {
+ final DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject());
+ final String[] directories = ds.getIncludedDirectories();
+ final String[] filesPerSe = ds.getIncludedFiles();
+ final String[] files = new String [directories.length + filesPerSe.length];
System.arraycopy(directories, 0, files, 0, directories.length);
System.arraycopy(filesPerSe, 0, files, directories.length,
filesPerSe.length);
@@ -719,7 +737,7 @@ public class Tar extends MatchingTask {
* @return a new TarFileSet.
* @since Ant 1.7
*/
- protected TarFileSet asTarFileSet(ArchiveFileSet archiveFileSet) {
+ protected TarFileSet asTarFileSet(final ArchiveFileSet archiveFileSet) {
TarFileSet tfs = null;
if (archiveFileSet != null && archiveFileSet instanceof TarFileSet) {
tfs = (TarFileSet) archiveFileSet;
@@ -740,7 +758,7 @@ public class Tar extends MatchingTask {
if (archiveFileSet
instanceof org.apache.tools.ant.types.TarFileSet) {
- org.apache.tools.ant.types.TarFileSet t =
+ final org.apache.tools.ant.types.TarFileSet t =
(org.apache.tools.ant.types.TarFileSet) archiveFileSet;
if (t.hasUserNameBeenSet()) {
tfs.setUserName(t.getUserName());
@@ -776,7 +794,7 @@ public class Tar extends MatchingTask {
*
* @param fileset a <code>FileSet</code> value
*/
- public TarFileSet(FileSet fileset) {
+ public TarFileSet(final FileSet fileset) {
super(fileset);
}
@@ -794,7 +812,7 @@ public class Tar extends MatchingTask {
* @return a list of file and directory names, relative to
* the baseDir for the project.
*/
- public String[] getFiles(Project p) {
+ public String[] getFiles(final Project p) {
if (files == null) {
files = getFileNames(this);
}
@@ -808,7 +826,7 @@ public class Tar extends MatchingTask {
* optional, default=0644
* @param octalString a 3 digit octal string.
*/
- public void setMode(String octalString) {
+ public void setMode(final String octalString) {
setFileMode(octalString);
}
@@ -825,7 +843,7 @@ public class Tar extends MatchingTask {
* Optional, default is <code>false</code>.
* @param b the leading slashes flag.
*/
- public void setPreserveLeadingSlashes(boolean b) {
+ public void setPreserveLeadingSlashes(final boolean b) {
this.preserveLeadingSlashes = b;
}
@@ -865,7 +883,8 @@ public class Tar extends MatchingTask {
/**
* @return the possible values for this enumerated type.
*/
- public String[] getValues() {
+ @Override
+ public String[] getValues() {
return validModes;
}
@@ -945,7 +964,8 @@ public class Tar extends MatchingTask {
* Get valid enumeration values.
* @return valid enumeration values
*/
- public String[] getValues() {
+ @Override
+ public String[] getValues() {
return new String[] {NONE, GZIP, BZIP2 };
}
http://git-wip-us.apache.org/repos/asf/ant/blob/13f6d98c/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
index 91ea062..32ef10a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
+++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
@@ -90,7 +90,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
private String fileDirParameter = null;
/** additional parameters to be passed to the stylesheets */
- private List<Param> params = new ArrayList<Param>();
+ private final List<Param> params = new ArrayList<Param>();
/** Input XML document to be used */
private File inFile = null;
@@ -116,10 +116,10 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
private boolean force = false;
/** XSL output properties to be used */
- private Vector outputProperties = new Vector();
+ private final Vector outputProperties = new Vector();
/** for resolving entities such as dtds */
- private XMLCatalog xmlCatalog = new XMLCatalog();
+ private final XMLCatalog xmlCatalog = new XMLCatalog();
/** Utilities used for file operations */
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
@@ -167,7 +167,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.7
*/
- private Union resources = new Union();
+ private final Union resources = new Union();
/**
* Whether to use the implicit fileset.
@@ -229,7 +229,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- private CommandlineJava.SysProperties sysProperties =
+ private final CommandlineJava.SysProperties sysProperties =
new CommandlineJava.SysProperties();
/**
@@ -252,7 +252,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param b true if files in included directories are processed.
* @since Ant 1.5
*/
- public void setScanIncludedDirectories(boolean b) {
+ public void setScanIncludedDirectories(final boolean b) {
performDirectoryScan = b;
}
@@ -264,7 +264,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param b a <code>boolean</code> value
* @since Ant 1.5.2
*/
- public void setReloadStylesheet(boolean b) {
+ public void setReloadStylesheet(final boolean b) {
reuseLoadedStylesheet = !b;
}
@@ -274,7 +274,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @exception BuildException if more than one mapper is defined
* @since Ant 1.6.2
*/
- public void addMapper(Mapper mapper) {
+ public void addMapper(final Mapper mapper) {
if (mapperElement != null) {
handleError("Cannot define more than one mapper");
} else {
@@ -289,7 +289,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param rc the collection of resources to style
* @since Ant 1.7
*/
- public void add(ResourceCollection rc) {
+ public void add(final ResourceCollection rc) {
resources.add(rc);
}
@@ -298,7 +298,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param rc the configured Resources object represented as <style>.
* @since Ant 1.7
*/
- public void addConfiguredStyle(Resources rc) {
+ public void addConfiguredStyle(final Resources rc) {
if (rc.size() != 1) {
handleError("The style element must be specified with exactly one"
+ " nested resource.");
@@ -312,7 +312,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param xslResource Resource to set as the stylesheet.
* @since Ant 1.7
*/
- public void setXslResource(Resource xslResource) {
+ public void setXslResource(final Resource xslResource) {
this.xslResource = xslResource;
}
@@ -322,8 +322,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @exception BuildException if more than one mapper is defined
* @since Ant 1.7.0
*/
- public void add(FileNameMapper fileNameMapper) throws BuildException {
- Mapper mapper = new Mapper(getProject());
+ public void add(final FileNameMapper fileNameMapper) throws BuildException {
+ final Mapper mapper = new Mapper(getProject());
mapper.add(fileNameMapper);
addMapper(mapper);
}
@@ -340,13 +340,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
log("Warning: the task name <style> is deprecated. Use <xslt> instead.",
Project.MSG_WARN);
}
- File savedBaseDir = baseDir;
+ final File savedBaseDir = baseDir;
DirectoryScanner scanner;
String[] list;
String[] dirs;
- String baseMessage =
+ final String baseMessage =
"specify the stylesheet either as a filename in style attribute "
+ "or as a nested resource";
@@ -386,7 +386,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
// via style attribute
File stylesheet = getProject().resolveFile(xslFile);
if (!stylesheet.exists()) {
- File alternative = FILE_UTILS.resolveFile(baseDir, xslFile);
+ final File alternative = FILE_UTILS.resolveFile(baseDir, xslFile);
/*
* shouldn't throw out deprecation warnings before we know,
* the wrong version has been used.
@@ -398,7 +398,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
stylesheet = alternative;
}
}
- FileResource fr = new FileResource();
+ final FileResource fr = new FileResource();
fr.setProject(getProject());
fr.setFile(stylesheet);
styleResource = fr;
@@ -474,7 +474,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param force true if always generate.
*/
- public void setForce(boolean force) {
+ public void setForce(final boolean force) {
this.force = force;
}
@@ -484,7 +484,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param dir the base directory
**/
- public void setBasedir(File dir) {
+ public void setBasedir(final File dir) {
baseDir = dir;
}
@@ -495,7 +495,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* specified.
* @param dir the name of the destination directory
**/
- public void setDestdir(File dir) {
+ public void setDestdir(final File dir) {
destDir = dir;
}
@@ -504,7 +504,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* optional, default is html.
* @param name the extension to use
**/
- public void setExtension(String name) {
+ public void setExtension(final String name) {
targetExtension = name;
}
@@ -514,7 +514,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param xslFile the stylesheet to use
*/
- public void setStyle(String xslFile) {
+ public void setStyle(final String xslFile) {
this.xslFile = xslFile;
}
@@ -523,7 +523,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param classpath the classpath to use when loading the XSL processor
*/
- public void setClasspath(Path classpath) {
+ public void setClasspath(final Path classpath) {
createClasspath().append(classpath);
}
@@ -545,7 +545,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param r the id of the Ant path instance to act as the classpath
* for loading the XSL processor
*/
- public void setClasspathRef(Reference r) {
+ public void setClasspathRef(final Reference r) {
createClasspath().setRefid(r);
}
@@ -554,7 +554,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param processor the name of the XSL processor
*/
- public void setProcessor(String processor) {
+ public void setProcessor(final String processor) {
this.processor = processor;
}
@@ -566,7 +566,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param useimplicitfileset set to true if you want to use implicit fileset
* @since Ant 1.7
*/
- public void setUseImplicitFileset(boolean useimplicitfileset) {
+ public void setUseImplicitFileset(final boolean useimplicitfileset) {
useImplicitFileset = useimplicitfileset;
}
@@ -575,7 +575,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param xmlCatalog the XMLCatalog instance to use to look up DTDs
*/
- public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog) {
+ public void addConfiguredXMLCatalog(final XMLCatalog xmlCatalog) {
this.xmlCatalog.addConfiguredXMLCatalog(xmlCatalog);
}
@@ -586,7 +586,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param fileNameParameter name of the xsl parameter retrieving the
* current file name
*/
- public void setFileNameParameter(String fileNameParameter) {
+ public void setFileNameParameter(final String fileNameParameter) {
this.fileNameParameter = fileNameParameter;
}
@@ -597,7 +597,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param fileDirParameter name of the xsl parameter retrieving the
* current file directory
*/
- public void setFileDirParameter(String fileDirParameter) {
+ public void setFileDirParameter(final String fileDirParameter) {
this.fileDirParameter = fileDirParameter;
}
@@ -606,7 +606,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- public void setSuppressWarnings(boolean b) {
+ public void setSuppressWarnings(final boolean b) {
suppressWarnings = b;
}
@@ -624,7 +624,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- public void setFailOnTransformationError(boolean b) {
+ public void setFailOnTransformationError(final boolean b) {
failOnTransformationError = b;
}
@@ -633,7 +633,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- public void setFailOnError(boolean b) {
+ public void setFailOnError(final boolean b) {
failOnError = b;
}
@@ -642,7 +642,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- public void setFailOnNoResources(boolean b) {
+ public void setFailOnNoResources(final boolean b) {
failOnNoResources = b;
}
@@ -651,7 +651,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- public void addSysproperty(Environment.Variable sysp) {
+ public void addSysproperty(final Environment.Variable sysp) {
sysProperties.addVariable(sysp);
}
@@ -660,7 +660,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- public void addSyspropertyset(PropertySet sysp) {
+ public void addSyspropertyset(final PropertySet sysp) {
sysProperties.addSyspropertyset(sysp);
}
@@ -699,12 +699,12 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param proc the name of the processor to load.
* @exception Exception if the processor cannot be loaded.
*/
- private void resolveProcessor(String proc) throws Exception {
+ private void resolveProcessor(final String proc) throws Exception {
if (proc.equals(PROCESSOR_TRAX)) {
liaison = new org.apache.tools.ant.taskdefs.optional.TraXLiaison();
} else {
//anything else is a classname
- Class clazz = loadClass(proc);
+ final Class clazz = loadClass(proc);
liaison = (XSLTLiaison) clazz.newInstance();
}
}
@@ -718,7 +718,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @return the requested class.
* @exception Exception if the class could not be loaded.
*/
- private Class loadClass(String classname) throws Exception {
+ private Class loadClass(final String classname) throws Exception {
setupLoader();
if (loader == null) {
return Class.forName(classname);
@@ -744,7 +744,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param outFile the output File instance.
*/
- public void setOut(File outFile) {
+ public void setOut(final File outFile) {
this.outFile = outFile;
}
@@ -754,7 +754,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param inFile the input file
*/
- public void setIn(File inFile) {
+ public void setIn(final File inFile) {
this.inFile = inFile;
}
@@ -775,16 +775,16 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param stylesheet style sheet to use
* @since Ant 1.7
*/
- private void processResources(Resource stylesheet) {
- for (Resource r : resources) {
+ private void processResources(final Resource stylesheet) {
+ for (final Resource r : resources) {
if (!r.isExists()) {
continue;
}
File base = baseDir;
String name = r.getName();
- FileProvider fp = r.as(FileProvider.class);
+ final FileProvider fp = r.as(FileProvider.class);
if (fp != null) {
- FileResource f = ResourceUtils.asFileResource(fp);
+ final FileResource f = ResourceUtils.asFileResource(fp);
base = f.getBaseDir();
if (base == null) {
name = f.getFile().getAbsolutePath();
@@ -804,14 +804,14 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param stylesheet the stylesheet to use.
* @exception BuildException if the processing fails.
*/
- private void process(File baseDir, String xmlFile, File destDir, Resource stylesheet)
+ private void process(final File baseDir, final String xmlFile, final File destDir, final Resource stylesheet)
throws BuildException {
File outF = null;
File inF = null;
try {
- long styleSheetLastModified = stylesheet.getLastModified();
+ final long styleSheetLastModified = stylesheet.getLastModified();
inF = new File(baseDir, xmlFile);
if (inF.isDirectory()) {
@@ -825,7 +825,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
mapper = new StyleMapper();
}
- String[] outFileName = mapper.mapFileName(xmlFile);
+ final String[] outFileName = mapper.mapFileName(xmlFile);
if (outFileName == null || outFileName.length == 0) {
log("Skipping " + inFile + " it cannot get mapped to output.", Project.MSG_VERBOSE);
return;
@@ -843,7 +843,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
setLiaisonDynamicFileParameters(liaison, inF);
liaison.transform(inF, outF);
}
- } catch (Exception ex) {
+ } catch (final Exception ex) {
// If failed to process document, must delete target document,
// or it will not attempt to process it the second time
log("Failed to process " + inFile, Project.MSG_INFO);
@@ -863,9 +863,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param stylesheet the stylesheet to use.
* @exception BuildException if the processing fails.
*/
- private void process(File inFile, File outFile, Resource stylesheet) throws BuildException {
+ private void process(final File inFile, final File outFile, final Resource stylesheet) throws BuildException {
try {
- long styleSheetLastModified = stylesheet.getLastModified();
+ final long styleSheetLastModified = stylesheet.getLastModified();
log("In file " + inFile + " time: " + inFile.lastModified(), Project.MSG_DEBUG);
log("Out file " + outFile + " time: " + outFile.lastModified(), Project.MSG_DEBUG);
log("Style file " + xslFile + " time: " + styleSheetLastModified, Project.MSG_DEBUG);
@@ -880,7 +880,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
log("Skipping input file " + inFile + " because it is older than output file "
+ outFile + " and so is the stylesheet " + stylesheet, Project.MSG_DEBUG);
}
- } catch (Exception ex) {
+ } catch (final Exception ex) {
log("Failed to process " + inFile, Project.MSG_INFO);
if (outFile != null) {
outFile.delete();
@@ -895,8 +895,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param targetFile the file for which the directories are required.
* @exception BuildException if the directories cannot be created.
*/
- private void ensureDirectoryFor(File targetFile) throws BuildException {
- File directory = targetFile.getParentFile();
+ private void ensureDirectoryFor(final File targetFile) throws BuildException {
+ final File directory = targetFile.getParentFile();
if (!directory.exists()) {
if (!(directory.mkdirs() || directory.isDirectory())) {
handleError("Unable to create directory: "
@@ -943,13 +943,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
if (processor != null) {
try {
resolveProcessor(processor);
- } catch (Exception e) {
+ } catch (final Exception e) {
handleError(e);
}
} else {
try {
resolveProcessor(PROCESSOR_TRAX);
- } catch (Throwable e1) {
+ } catch (final Throwable e1) {
e1.printStackTrace();
handleError(e1);
}
@@ -964,7 +964,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @return an instance of the Param class to be configured.
*/
public Param createParam() {
- Param p = new Param();
+ final Param p = new Param();
params.add(p);
return p;
}
@@ -994,7 +994,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param project the current project
*/
- public void setProject(Project project) {
+ public void setProject(final Project project) {
this.project = project;
}
@@ -1003,7 +1003,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @param name the name of the parameter.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name;
}
@@ -1013,7 +1013,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param expression the parameter's value/expression.
* @see #setType(java.lang.String)
*/
- public void setExpression(String expression) {
+ public void setExpression(final String expression) {
this.expression = expression;
}
@@ -1021,7 +1021,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @see ParamType
* @since Ant 1.9.3
*/
- public void setType(String type) {
+ public void setType(final String type) {
this.type = type;
}
@@ -1067,7 +1067,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param ifCond evaluated expression
* @since Ant 1.8.0
*/
- public void setIf(Object ifCond) {
+ public void setIf(final Object ifCond) {
this.ifCond = ifCond;
}
@@ -1077,7 +1077,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* which has been set, otherwise it won't.
* @param ifProperty evaluated expression
*/
- public void setIf(String ifProperty) {
+ public void setIf(final String ifProperty) {
setIf((Object) ifProperty);
}
@@ -1088,7 +1088,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param unlessCond evaluated expression
* @since Ant 1.8.0
*/
- public void setUnless(Object unlessCond) {
+ public void setUnless(final Object unlessCond) {
this.unlessCond = unlessCond;
}
@@ -1098,7 +1098,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* property which has been set, otherwise it will be used.
* @param unlessProperty evaluated expression
*/
- public void setUnless(String unlessProperty) {
+ public void setUnless(final String unlessProperty) {
setUnless((Object) unlessProperty);
}
@@ -1108,7 +1108,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @return true if the task passes the "if" and "unless" parameters
*/
public boolean shouldUse() {
- PropertyHelper ph = PropertyHelper.getPropertyHelper(project);
+ final PropertyHelper ph = PropertyHelper.getPropertyHelper(project);
return ph.testIfCondition(ifCond)
&& ph.testUnlessCondition(unlessCond);
}
@@ -1155,7 +1155,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
public static final Map<ParamType, QName> XPATH_TYPES;
static {
- Map<ParamType, QName> m = new EnumMap<ParamType, QName>(ParamType.class);
+ final Map<ParamType, QName> m = new EnumMap<ParamType, QName>(ParamType.class);
m.put(XPATH_STRING, XPathConstants.STRING);
m.put(XPATH_BOOLEAN, XPathConstants.BOOLEAN);
m.put(XPATH_NUMBER, XPathConstants.NUMBER);
@@ -1171,7 +1171,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @since Ant 1.5
*/
public OutputProperty createOutputProperty() {
- OutputProperty p = new OutputProperty();
+ final OutputProperty p = new OutputProperty();
outputProperties.addElement(p);
return p;
}
@@ -1201,7 +1201,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param name A non-null String that specifies an
* output property name, which may be namespace qualified.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name;
}
@@ -1216,7 +1216,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* set the value for this property
* @param value The non-null string value of the output property.
*/
- public void setValue(String value) {
+ public void setValue(final String value) {
this.value = value;
}
}
@@ -1234,8 +1234,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
xpathFactory = XPathFactory.newInstance();
xpath = xpathFactory.newXPath();
xpath.setXPathVariableResolver(new XPathVariableResolver() {
- @Override
- public Object resolveVariable(QName variableName) {
+ public Object resolveVariable(final QName variableName) {
return getProject().getProperty(variableName.toString());
}
});
@@ -1249,8 +1248,8 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @deprecated since Ant 1.7
*/
@Deprecated
- protected void configureLiaison(File stylesheet) throws BuildException {
- FileResource fr = new FileResource();
+ protected void configureLiaison(final File stylesheet) throws BuildException {
+ final FileResource fr = new FileResource();
fr.setProject(getProject());
fr.setFile(stylesheet);
configureLiaison(fr);
@@ -1263,7 +1262,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @exception BuildException if the stylesheet cannot be loaded.
* @since Ant 1.7
*/
- protected void configureLiaison(Resource stylesheet) throws BuildException {
+ protected void configureLiaison(final Resource stylesheet) throws BuildException {
if (stylesheetLoaded && reuseLoadedStylesheet) {
return;
}
@@ -1284,7 +1283,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
// If we are here we cannot set the stylesheet as
// a resource, but we can set it as a file. So,
// we make an attempt to get it as a file
- FileProvider fp =
+ final FileProvider fp =
stylesheet.as(FileProvider.class);
if (fp != null) {
liaison.setStylesheet(fp.getFile());
@@ -1294,9 +1293,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
return;
}
}
- for (Param p : params) {
+ for (final Param p : params) {
if (p.shouldUse()) {
- Object evaluatedParam = evaluateParam(p);
+ final Object evaluatedParam = evaluateParam(p);
if (liaison instanceof XSLTLiaison4) {
((XSLTLiaison4)liaison).addParam(p.getName(), evaluatedParam);
} else {
@@ -1311,7 +1310,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
}
}
}
- } catch (Exception ex) {
+ } catch (final Exception ex) {
log("Failed to transform using stylesheet " + stylesheet, Project.MSG_INFO);
handleTransformationError(ex);
}
@@ -1328,9 +1327,9 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @throws XPathExpressionException if XPath expression can not be compiled
* @since Ant 1.9.3
*/
- private Object evaluateParam(Param param) throws XPathExpressionException {
- String typeName = param.getType();
- String expression = param.getExpression();
+ private Object evaluateParam(final Param param) throws XPathExpressionException {
+ final String typeName = param.getType();
+ final String expression = param.getExpression();
ParamType type;
@@ -1339,7 +1338,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
} else {
try {
type = ParamType.valueOf(typeName);
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid XSLT parameter type: " + typeName, e);
}
}
@@ -1356,11 +1355,11 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
case LONG:
return Long.parseLong(expression);
default: // XPath expression
- QName xpathType = ParamType.XPATH_TYPES.get(type);
+ final QName xpathType = ParamType.XPATH_TYPES.get(type);
if (xpathType == null) {
throw new IllegalArgumentException("Invalid XSLT parameter type: " + typeName);
} else {
- XPathExpression xpe = xpath.compile(expression);
+ final XPathExpression xpe = xpath.compile(expression);
// null = evaluate XPath on empty XML document
return xpe.evaluate((Object) null, xpathType);
}
@@ -1378,13 +1377,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @since Ant 1.7
*/
private void setLiaisonDynamicFileParameters(
- XSLTLiaison liaison, File inFile) throws Exception {
+ final XSLTLiaison liaison, final File inFile) throws Exception {
if (fileNameParameter != null) {
liaison.addParam(fileNameParameter, inFile.getName());
}
if (fileDirParameter != null) {
- String fileName = FileUtils.getRelativePath(baseDir, inFile);
- File file = new File(fileName);
+ 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
liaison.addParam(fileDirParameter, file.getParent() != null ? file.getParent().replace(
@@ -1412,7 +1411,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- protected void handleError(String msg) {
+ protected void handleError(final String msg) {
if (failOnError) {
throw new BuildException(msg, getLocation());
}
@@ -1427,7 +1426,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- protected void handleError(Throwable ex) {
+ protected void handleError(final Throwable ex) {
if (failOnError) {
throw new BuildException(ex);
} else {
@@ -1442,7 +1441,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*
* @since Ant 1.8.0
*/
- protected void handleTransformationError(Exception ex) {
+ protected void handleTransformationError(final Exception ex) {
if (failOnError && failOnTransformationError) {
throw new BuildException(ex);
} else {
@@ -1463,7 +1462,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
/**
* the list of factory attributes to use for TraXLiaison
*/
- private Vector attributes = new Vector();
+ private final Vector attributes = new Vector();
/**
* @return the name of the factory.
@@ -1476,7 +1475,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Set the name of the factory
* @param name the name of the factory.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name;
}
@@ -1484,7 +1483,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Create an instance of a factory attribute.
* @param attr the newly created factory attribute
*/
- public void addAttribute(Attribute attr) {
+ public void addAttribute(final Attribute attr) {
attributes.addElement(attr);
}
@@ -1532,8 +1531,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @return null
* @throws BuildException never
*/
- @Override
- public Object createDynamicElement(String name) throws BuildException {
+ public Object createDynamicElement(final String name) throws BuildException {
return null;
}
@@ -1544,8 +1542,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @param value the value of the attribute
* @throws BuildException on error
*/
- @Override
- public void setDynamicAttribute(String name, String value) throws BuildException {
+ public void setDynamicAttribute(final String name, final String value) throws BuildException {
// only 'name' and 'value' exist.
if ("name".equalsIgnoreCase(name)) {
this.name = value;
@@ -1559,7 +1556,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
} else {
try {
this.value = new Integer(value);
- } catch (NumberFormatException e) {
+ } catch (final NumberFormatException e) {
this.value = value;
}
}
@@ -1580,15 +1577,12 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @since Ant 1.6.2
*/
private class StyleMapper implements FileNameMapper {
- @Override
- public void setFrom(String from) {
+ public void setFrom(final String from) {
}
- @Override
- public void setTo(String to) {
+ public void setTo(final String to) {
}
- @Override
public String[] mapFileName(String xmlFile) {
- int dotPos = xmlFile.lastIndexOf('.');
+ final int dotPos = xmlFile.lastIndexOf('.');
if (dotPos > 0) {
xmlFile = xmlFile.substring(0, dotPos);
}
@@ -1608,7 +1602,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Set to true if the listener is to print events that occur
* as each node is 'executed' in the stylesheet.
*/
- public void setElements(boolean b) {
+ public void setElements(final boolean b) {
elements = b;
}
@@ -1624,7 +1618,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Set to true if the listener is to print information after
* each extension event.
*/
- public void setExtension(boolean b) {
+ public void setExtension(final boolean b) {
extension = b;
}
@@ -1640,7 +1634,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Set to true if the listener is to print information after
* each result-tree generation event.
*/
- public void setGeneration(boolean b) {
+ public void setGeneration(final boolean b) {
generation = b;
}
@@ -1656,7 +1650,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Set to true if the listener is to print information after
* each selection event.
*/
- public void setSelection(boolean b) {
+ public void setSelection(final boolean b) {
selection = b;
}
@@ -1672,7 +1666,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* Set to true if the listener is to print an event whenever a
* template is invoked.
*/
- public void setTemplates(boolean b) {
+ public void setTemplates(final boolean b) {
templates = b;
}