From 6154080061f869b4e425d608da3bd61fad967564 Mon Sep 17 00:00:00 2001
From: Conor MacNeill
Date: Mon, 15 Apr 2002 12:11:52 +0000
Subject: [PATCH] More coding standard fixes
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272433 13f79535-47bb-0310-9956-ffa450edef68
---
.../tools/ant/helper/ProjectHelperImpl.java | 20 +-
.../tools/ant/taskdefs/BuildNumber.java | 169 ++--
.../org/apache/tools/ant/taskdefs/Concat.java | 20 +-
.../tools/ant/taskdefs/LoadProperties.java | 2 +-
.../apache/tools/ant/taskdefs/Manifest.java | 42 +-
.../apache/tools/ant/taskdefs/Parallel.java | 6 +-
.../org/apache/tools/ant/taskdefs/Patch.java | 6 +-
.../tools/ant/taskdefs/PathConvert.java | 286 +++----
.../ant/taskdefs/cvslib/ChangeLogParser.java | 2 +-
.../tools/ant/taskdefs/cvslib/CvsTagDiff.java | 10 +-
.../ant/taskdefs/optional/TraXLiaison.java | 26 +-
.../taskdefs/optional/XMLValidateTask.java | 66 +-
.../taskdefs/optional/jlink/JlinkTask.java | 10 +-
.../ant/taskdefs/optional/jlink/jlink.java | 380 ++++-----
.../tools/ant/taskdefs/optional/jsp/JspC.java | 86 +--
.../ant/taskdefs/optional/jsp/WLJspc.java | 62 +-
.../compilers/DefaultJspCompilerAdapter.java | 12 +-
.../optional/jsp/compilers/JasperC.java | 26 +-
.../jsp/compilers/JspCompilerAdapter.java | 2 +-
.../compilers/JspCompilerAdapterFactory.java | 18 +-
.../optional/junit/AggregateTransformer.java | 2 +-
.../taskdefs/optional/junit/BatchTest.java | 12 +-
.../ant/taskdefs/optional/junit/DOMUtil.java | 18 +-
.../taskdefs/optional/junit/Enumerations.java | 4 +-
.../optional/junit/FormatterElement.java | 5 +-
.../optional/junit/JUnitResultFormatter.java | 8 +-
.../taskdefs/optional/junit/JUnitTask.java | 53 +-
.../taskdefs/optional/junit/JUnitTest.java | 28 +-
.../optional/junit/JUnitTestRunner.java | 38 +-
.../junit/PlainJUnitResultFormatter.java | 14 +-
.../junit/SummaryJUnitResultFormatter.java | 14 +-
.../junit/XMLJUnitResultFormatter.java | 17 +-
.../optional/junit/XMLResultAggregator.java | 17 +-
.../optional/junit/Xalan1Executor.java | 2 +-
.../taskdefs/optional/metamata/MParse.java | 14 +-
.../tools/ant/taskdefs/optional/net/FTP.java | 697 ++++++++---------
.../ant/taskdefs/optional/net/MimeMail.java | 3 +-
.../ant/taskdefs/optional/net/TelnetTask.java | 26 +-
.../taskdefs/optional/perforce/P4Submit.java | 4 +-
.../ant/taskdefs/optional/pvcs/Pvcs.java | 141 ++--
.../optional/scm/AntStarTeamCheckOut.java | 724 ++++++++----------
.../optional/sound/AntSoundPlayer.java | 5 +-
.../taskdefs/optional/sound/SoundTask.java | 14 +-
.../optional/splash/SplashScreen.java | 18 +-
.../taskdefs/optional/splash/SplashTask.java | 24 +-
.../optional/starteam/StarTeamTask.java | 2 +-
.../ant/taskdefs/optional/vss/MSVSS.java | 14 +-
.../ant/taskdefs/optional/vss/MSVSSADD.java | 20 +-
.../taskdefs/optional/vss/MSVSSCHECKIN.java | 28 +-
.../taskdefs/optional/vss/MSVSSCHECKOUT.java | 24 +-
.../ant/taskdefs/optional/vss/MSVSSCP.java | 12 +-
.../taskdefs/optional/vss/MSVSSCREATE.java | 6 +-
.../ant/taskdefs/optional/vss/MSVSSGET.java | 29 +-
.../taskdefs/optional/vss/MSVSSHISTORY.java | 36 +-
.../ant/taskdefs/optional/vss/MSVSSLABEL.java | 25 +-
.../ant/taskdefs/rmic/DefaultRmicAdapter.java | 37 +-
.../tools/ant/taskdefs/rmic/KaffeRmic.java | 4 +-
.../tools/ant/taskdefs/rmic/RmicAdapter.java | 2 +-
.../ant/taskdefs/rmic/RmicAdapterFactory.java | 24 +-
.../tools/ant/taskdefs/rmic/SunRmic.java | 6 +-
.../tools/ant/taskdefs/rmic/WLRmic.java | 2 +-
.../tools/ant/types/AbstractFileSet.java | 12 +-
.../apache/tools/ant/types/Commandline.java | 32 +-
.../tools/ant/types/CommandlineJava.java | 10 +-
.../org/apache/tools/ant/types/DataType.java | 18 +-
.../apache/tools/ant/types/Environment.java | 4 +-
.../org/apache/tools/ant/types/FileList.java | 2 +-
.../org/apache/tools/ant/types/FilterSet.java | 36 +-
.../tools/ant/types/FilterSetCollection.java | 4 +-
.../org/apache/tools/ant/types/Mapper.java | 4 +-
src/main/org/apache/tools/ant/types/Path.java | 39 +-
.../apache/tools/ant/types/PatternSet.java | 22 +-
.../org/apache/tools/ant/types/Reference.java | 2 +-
.../tools/ant/types/RegularExpression.java | 3 +-
.../apache/tools/ant/types/XMLCatalog.java | 4 +-
.../apache/tools/ant/types/ZipFileSet.java | 2 +-
.../types/optional/depend/ClassfileSet.java | 6 +-
.../types/optional/depend/DependScanner.java | 8 +-
.../tools/ant/util/DOMElementWriter.java | 19 +-
.../org/apache/tools/ant/util/DateUtils.java | 2 +-
.../org/apache/tools/ant/util/FileUtils.java | 40 +-
.../tools/ant/util/GlobPatternMapper.java | 6 +-
.../apache/tools/ant/util/LoaderUtils.java | 2 +-
.../tools/ant/util/RegexpPatternMapper.java | 4 +-
.../tools/ant/util/SourceFileScanner.java | 22 +-
.../apache/tools/ant/util/StringUtils.java | 16 +-
.../util/depend/bcel/AncestorAnalyzer.java | 16 +-
.../ant/util/depend/bcel/FullAnalyzer.java | 19 +-
.../ant/util/regexp/JakartaOroMatcher.java | 2 +-
.../ant/util/regexp/JakartaOroRegexp.java | 2 +-
.../ant/util/regexp/JakartaRegexpMatcher.java | 2 +-
.../ant/util/regexp/JakartaRegexpRegexp.java | 2 +-
.../ant/util/regexp/Jdk14RegexpMatcher.java | 2 +-
.../ant/util/regexp/Jdk14RegexpRegexp.java | 2 +-
.../apache/tools/bzip2/CBZip2InputStream.java | 122 +--
.../tools/bzip2/CBZip2OutputStream.java | 226 +++---
src/main/org/apache/tools/bzip2/CRC.java | 4 +-
src/main/org/apache/tools/tar/TarEntry.java | 6 +-
.../org/apache/tools/zip/AsiExtraField.java | 18 +-
.../org/apache/tools/zip/ExtraFieldUtils.java | 42 +-
.../tools/zip/UnrecognizedExtraField.java | 10 +-
src/main/org/apache/tools/zip/ZipEntry.java | 8 +-
src/main/org/apache/tools/zip/ZipLong.java | 8 +-
.../org/apache/tools/zip/ZipOutputStream.java | 12 +-
src/main/org/apache/tools/zip/ZipShort.java | 4 +-
105 files changed, 2112 insertions(+), 2138 deletions(-)
diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
index eceed8d06..5bba57089 100644
--- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
+++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
@@ -128,9 +128,9 @@ public class ProjectHelperImpl extends ProjectHelper {
*/
public void parse(Project project, Object source) throws BuildException {
if (!(source instanceof File)) {
- throw new BuildException( "Only File source supported by default plugin" );
+ throw new BuildException("Only File source supported by default plugin");
}
- File buildFile = (File)source;
+ File buildFile = (File) source;
FileInputStream inputStream = null;
InputSource inputSource = null;
@@ -193,7 +193,7 @@ public class ProjectHelperImpl extends ProjectHelper {
exc);
} catch (IOException exc) {
throw new BuildException("Error reading project file: "
- +exc.getMessage(), exc);
+ + exc.getMessage(), exc);
} finally {
if (inputStream != null) {
try {
@@ -321,7 +321,7 @@ public class ProjectHelperImpl extends ProjectHelper {
static class RootHandler extends HandlerBase {
ProjectHelperImpl helperImpl;
- public RootHandler( ProjectHelperImpl helperImpl ) {
+ public RootHandler(ProjectHelperImpl helperImpl) {
this.helperImpl = helperImpl;
}
@@ -876,9 +876,11 @@ public class ProjectHelperImpl extends ProjectHelper {
public void startElement(String name, AttributeList attrs) throws SAXParseException {
if (task instanceof TaskContainer) {
// task can contain other tasks - no other nested elements possible
- new TaskHandler(helperImpl, this, (TaskContainer)task, wrapper, target).init(name, attrs);
+ new TaskHandler(helperImpl, this, (TaskContainer) task,
+ wrapper, target).init(name, attrs);
} else {
- new NestedElementHandler(helperImpl, this, task, wrapper, target).init(name, attrs);
+ new NestedElementHandler(helperImpl, this, task,
+ wrapper, target).init(name, attrs);
}
}
}
@@ -1027,9 +1029,11 @@ public class ProjectHelperImpl extends ProjectHelper {
if (child instanceof TaskContainer) {
// taskcontainer nested element can contain other tasks - no other
// nested elements possible
- new TaskHandler(helperImpl, this, (TaskContainer)child, childWrapper, target).init(name, attrs);
+ new TaskHandler(helperImpl, this, (TaskContainer) child,
+ childWrapper, target).init(name, attrs);
} else {
- new NestedElementHandler(helperImpl, this, child, childWrapper, target).init(name, attrs);
+ new NestedElementHandler(helperImpl, this, child,
+ childWrapper, target).init(name, attrs);
}
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java b/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java
index b3f6b309d..e05fc4ded 100644
--- a/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java
+++ b/src/main/org/apache/tools/ant/taskdefs/BuildNumber.java
@@ -63,12 +63,11 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.FileUtils;
/**
- * This is a basic task that can be used to track build numbers.
- *
- * It will first attempt to read a build number from a file, then
- * set the property "build.number" to the value that was read in
- * (or 0 if no such value). Then it will increment the build number
- * by one and write it back out into the file.
+ * This is a basic task that can be used to track build numbers. It will first
+ * attempt to read a build number from a file, then set the property
+ * "build.number" to the value that was read in (or 0 if no such value). Then
+ * it will increment the build number by one and write it back out into the
+ * file.
*
* @author Peter Donald
* @version $Revision$ $Date$
@@ -76,85 +75,76 @@ import org.apache.tools.ant.util.FileUtils;
* @ant.task name="buildnumber"
*/
public class BuildNumber
- extends Task
-{
+ extends Task {
/**
* The name of the property in which the build number is stored.
*/
private static final String DEFAULT_PROPERTY_NAME = "build.number";
- /**
- * The default filename to use if no file specified.
- */
+ /** The default filename to use if no file specified. */
private static final String DEFAULT_FILENAME = DEFAULT_PROPERTY_NAME;
- /**
- * The File in which the build number is stored.
- */
+ /** The File in which the build number is stored. */
private File m_file;
+
/**
- * Specify the file in which the build numberis stored.
- * Defaults to "build.number" if not specified.
+ * Specify the file in which the build numberis stored. Defaults to
+ * "build.number" if not specified.
*
* @param file the file in which build number is stored.
*/
- public void setFile( final File file )
- {
+ public void setFile(final File file) {
m_file = file;
}
+
/**
* Run task.
*
* @exception BuildException if an error occurs
*/
public void execute()
- throws BuildException
- {
- File savedFile = m_file; // may be altered in validate
+ throws BuildException {
+ File savedFile = m_file;// may be altered in validate
+
validate();
final Properties properties = loadProperties();
- final int buildNumber = getBuildNumber( properties );
+ final int buildNumber = getBuildNumber(properties);
- properties.put( DEFAULT_PROPERTY_NAME,
- String.valueOf( buildNumber + 1 ) );
+ properties.put(DEFAULT_PROPERTY_NAME,
+ String.valueOf(buildNumber + 1));
// Write the properties file back out
FileOutputStream output = null;
- try
- {
- output = new FileOutputStream( m_file );
+
+ try {
+ output = new FileOutputStream(m_file);
final String header = "Build Number for ANT. Do not edit!";
- properties.save( output, header );
- }
- catch( final IOException ioe )
- {
+
+ properties.save(output, header);
+ } catch (final IOException ioe) {
final String message = "Error while writing " + m_file;
- throw new BuildException( message, ioe );
- }
- finally
- {
- if( null != output )
- {
- try
- {
+
+ throw new BuildException(message, ioe);
+ } finally {
+ if (null != output) {
+ try {
output.close();
- }
- catch( final IOException ioe )
- {
+ } catch (final IOException ioe) {
}
}
m_file = savedFile;
}
//Finally set the property
- getProject().setNewProperty( DEFAULT_PROPERTY_NAME,
- String.valueOf( buildNumber ) );
+ getProject().setNewProperty(DEFAULT_PROPERTY_NAME,
+ String.valueOf(buildNumber));
}
+
/**
* Utility method to retrieve build number from properties object.
*
@@ -162,25 +152,23 @@ public class BuildNumber
* @return the build number or if no number in properties object
* @throws BuildException if build.number property is not an integer
*/
- private int getBuildNumber( final Properties properties )
- throws BuildException
- {
+ private int getBuildNumber(final Properties properties)
+ throws BuildException {
final String buildNumber =
- properties.getProperty( DEFAULT_PROPERTY_NAME, "0" ).trim();
+ properties.getProperty(DEFAULT_PROPERTY_NAME, "0").trim();
// Try parsing the line into an integer.
- try
- {
- return Integer.parseInt( buildNumber );
- }
- catch( final NumberFormatException nfe )
- {
- final String message =
+ try {
+ return Integer.parseInt(buildNumber);
+ } catch (final NumberFormatException nfe) {
+ final String message =
m_file + " contains a non integer build number: " + buildNumber;
- throw new BuildException( message , nfe );
+
+ throw new BuildException(message, nfe);
}
}
+
/**
* Utility method to load properties from file.
*
@@ -188,72 +176,61 @@ public class BuildNumber
* @throws BuildException
*/
private Properties loadProperties()
- throws BuildException
- {
+ throws BuildException {
FileInputStream input = null;
- try
- {
+
+ try {
final Properties properties = new Properties();
- input = new FileInputStream( m_file );
- properties.load( input );
+
+ input = new FileInputStream(m_file);
+ properties.load(input);
return properties;
- }
- catch( final IOException ioe )
- {
- throw new BuildException( ioe );
- }
- finally
- {
- if( null != input )
- {
- try
- {
+ } catch (final IOException ioe) {
+ throw new BuildException(ioe);
+ } finally {
+ if (null != input) {
+ try {
input.close();
- }
- catch( final IOException ioe )
- {
+ } catch (final IOException ioe) {
}
}
}
}
+
/**
* Validate that the task parameters are valid.
*
* @throws BuildException if parameters are invalid
*/
private void validate()
- throws BuildException
- {
- if( null == m_file )
- {
- m_file = getProject().resolveFile( DEFAULT_FILENAME );
+ throws BuildException {
+ if (null == m_file) {
+ m_file = getProject().resolveFile(DEFAULT_FILENAME);
}
- if( !m_file.exists() )
- {
- try
- {
+ if (!m_file.exists()) {
+ try {
FileUtils.newFileUtils().createNewFile(m_file);
- }
- catch( final IOException ioe )
- {
- final String message =
+ } catch (final IOException ioe) {
+ final String message =
m_file + " doesn't exist and new file can't be created.";
- throw new BuildException( message, ioe );
+
+ throw new BuildException(message, ioe);
}
}
- if( !m_file.canRead() )
- {
+ if (!m_file.canRead()) {
final String message = "Unable to read from " + m_file + ".";
- throw new BuildException( message );
+
+ throw new BuildException(message);
}
- if( !m_file.canWrite() )
- {
+ if (!m_file.canWrite()) {
final String message = "Unable to write to " + m_file + ".";
- throw new BuildException( message );
+
+ throw new BuildException(message);
}
}
}
+
diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java
index f104e2d18..77c0689f2 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Concat.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java
@@ -227,7 +227,7 @@ public class Concat extends Task {
try {
// Iterate the FileSet collection, concatenating each file as
// it is encountered.
- for (Enumeration e = fileSets.elements(); e.hasMoreElements(); ) {
+ for (Enumeration e = fileSets.elements(); e.hasMoreElements();) {
// Root directory for files.
File fileSetBase = null;
@@ -392,17 +392,14 @@ public class Concat extends Task {
// Log using WARN so it displays in 'quiet' mode.
out = new PrintWriter(
new OutputStreamWriter(
- new LogOutputStream(this, Project.MSG_WARN)
- )
- );
+ new LogOutputStream(this, Project.MSG_WARN)));
} else {
out = new PrintWriter(
new OutputStreamWriter(
new FileOutputStream(destinationFile
.getAbsolutePath(),
append),
- encoding)
- );
+ encoding));
// This flag should only be recognized for the first
// file. In the context of a single 'cat', we always
@@ -412,11 +409,8 @@ public class Concat extends Task {
for (int i = 0; i < len; i++) {
in = new BufferedReader(
- new InputStreamReader(
- new FileInputStream(input[i]),
- encoding
- )
- );
+ new InputStreamReader(new FileInputStream(input[i]),
+ encoding));
String line;
while ((line = in.readLine()) != null) {
@@ -480,9 +474,7 @@ public class Concat extends Task {
// Reads the text, line by line.
BufferedReader reader = null;
try {
- reader = new BufferedReader(
- new StringReader(text)
- );
+ reader = new BufferedReader(new StringReader(text));
String line;
while ((line = reader.readLine()) != null) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
index b4ec09775..08f5e55be 100644
--- a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
+++ b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
@@ -122,7 +122,7 @@ public final class LoadProperties extends Task {
try {
final long len = srcFile.length();
- final int size=(int) len;
+ final int size = (int) len;
//open up the file
fis = new FileInputStream(srcFile);
diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
index 59fbc7805..394a7070b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
@@ -184,7 +184,7 @@ public class Manifest extends Task {
return false;
}
- Attribute rhsAttribute = (Attribute)rhs;
+ Attribute rhsAttribute = (Attribute) rhs;
return (name != null && rhsAttribute.name != null &&
getKey().equals(rhsAttribute.getKey()) &&
values != null &&
@@ -266,7 +266,7 @@ public class Manifest extends Task {
String fullValue = "";
for (Enumeration e = getValues(); e.hasMoreElements();) {
- String value = (String)e.nextElement();
+ String value = (String) e.nextElement();
fullValue += value + " ";
}
return fullValue.trim();
@@ -301,7 +301,7 @@ public class Manifest extends Task {
* @param line the continuation line.
*/
public void addContinuation(String line) {
- String currentValue = (String)values.elementAt(currentIndex);
+ String currentValue = (String) values.elementAt(currentIndex);
setValue(currentValue + line.substring(1));
}
@@ -314,7 +314,7 @@ public class Manifest extends Task {
*/
public void write(PrintWriter writer) throws IOException {
for (Enumeration e = getValues(); e.hasMoreElements();) {
- writeValue(writer, (String)e.nextElement());
+ writeValue(writer, (String) e.nextElement());
}
}
@@ -451,14 +451,14 @@ public class Manifest extends Task {
Enumeration e = section.getAttributeKeys();
while (e.hasMoreElements()) {
- String attributeName = (String)e.nextElement();
+ String attributeName = (String) e.nextElement();
Attribute attribute = section.getAttribute(attributeName);
if (attributeName.equals(ATTRIBUTE_CLASSPATH) &&
attributes.containsKey(attributeName)) {
Attribute ourClassPath = getAttribute(attributeName);
Enumeration cpe = attribute.getValues();
while (cpe.hasMoreElements()) {
- String value = (String)cpe.nextElement();
+ String value = (String) cpe.nextElement();
ourClassPath.addValue(value);
}
} else {
@@ -488,7 +488,7 @@ public class Manifest extends Task {
}
Enumeration e = getAttributeKeys();
while (e.hasMoreElements()) {
- String key = (String)e.nextElement();
+ String key = (String) e.nextElement();
Attribute attribute = getAttribute(key);
attribute.write(writer);
}
@@ -504,7 +504,7 @@ public class Manifest extends Task {
* instances.
*/
public Attribute getAttribute(String attributeName) {
- return (Attribute)attributes.get(attributeName.toLowerCase());
+ return (Attribute) attributes.get(attributeName.toLowerCase());
}
/**
@@ -594,14 +594,14 @@ public class Manifest extends Task {
String attributeKey = attribute.getKey();
if (attributeKey.equals(ATTRIBUTE_CLASSPATH)) {
Attribute classpathAttribute =
- (Attribute)attributes.get(attributeKey);
+ (Attribute) attributes.get(attributeKey);
if (classpathAttribute == null) {
storeAttribute(attribute);
} else {
Enumeration e = attribute.getValues();
while (e.hasMoreElements()) {
- String value = (String)e.nextElement();
+ String value = (String) e.nextElement();
classpathAttribute.addValue(value);
}
}
@@ -649,13 +649,13 @@ public class Manifest extends Task {
return false;
}
- Section rhsSection = (Section)rhs;
+ Section rhsSection = (Section) rhs;
if (attributes.size() != rhsSection.attributes.size()) {
return false;
}
for (Enumeration e = attributes.keys(); e.hasMoreElements();) {
- String attributeName = (String)e.nextElement();
+ String attributeName = (String) e.nextElement();
Object attributeValue = attributes.get(attributeName);
Object rhsAttributeValue
= rhsSection.attributes.get(attributeName);
@@ -843,10 +843,10 @@ public class Manifest extends Task {
Enumeration e = other.getSectionNames();
while (e.hasMoreElements()) {
- String sectionName = (String)e.nextElement();
- Section ourSection = (Section)sections.get(sectionName);
+ String sectionName = (String) e.nextElement();
+ Section ourSection = (Section) sections.get(sectionName);
Section otherSection
- = (Section)other.sections.get(sectionName);
+ = (Section) other.sections.get(sectionName);
if (ourSection == null) {
if (otherSection != null) {
addConfiguredSection(otherSection);
@@ -889,7 +889,7 @@ public class Manifest extends Task {
Enumeration e = sectionIndex.elements();
while (e.hasMoreElements()) {
- String sectionName = (String)e.nextElement();
+ String sectionName = (String) e.nextElement();
Section section = getSection(sectionName);
section.write(writer);
}
@@ -927,7 +927,7 @@ public class Manifest extends Task {
// create a vector and add in the warnings for all the sections
Enumeration e = sections.elements();
while (e.hasMoreElements()) {
- Section section = (Section)e.nextElement();
+ Section section = (Section) e.nextElement();
Enumeration e2 = section.getWarnings();
while (e2.hasMoreElements()) {
warnings.addElement(e2.nextElement());
@@ -945,7 +945,7 @@ public class Manifest extends Task {
return false;
}
- Manifest rhsManifest = (Manifest)rhs;
+ Manifest rhsManifest = (Manifest) rhs;
if (manifestVersion == null) {
if (rhsManifest.manifestVersion != null) {
return false;
@@ -963,9 +963,9 @@ public class Manifest extends Task {
Enumeration e = sections.elements();
while (e.hasMoreElements()) {
- Section section = (Section)e.nextElement();
+ Section section = (Section) e.nextElement();
Section rhsSection
- = (Section)rhsManifest.sections.get(section.getName());
+ = (Section) rhsManifest.sections.get(section.getName());
if (!section.equals(rhsSection)) {
return false;
}
@@ -1018,7 +1018,7 @@ public class Manifest extends Task {
* does not exist in the manifest
*/
public Section getSection(String name) {
- return (Section)sections.get(name);
+ return (Section) sections.get(name);
}
/**
diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java
index e7baca1f7..366f34976 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java
@@ -99,7 +99,7 @@ public class Parallel extends Task
int threadNumber = 0;
for (Enumeration e = nestedTasks.elements(); e.hasMoreElements();
threadNumber++) {
- Task nestedTask = (Task)e.nextElement();
+ Task nestedTask = (Task) e.nextElement();
threads[threadNumber] = new TaskThread(threadNumber, nestedTask);
}
@@ -132,7 +132,7 @@ public class Parallel extends Task
}
if (t instanceof BuildException &&
firstLocation == Location.UNKNOWN_LOCATION) {
- firstLocation = ((BuildException)t).getLocation();
+ firstLocation = ((BuildException) t).getLocation();
}
exceptionMessage.append(StringUtils.LINE_SEP);
exceptionMessage.append(t.getMessage());
@@ -141,7 +141,7 @@ public class Parallel extends Task
if (numExceptions == 1) {
if (firstException instanceof BuildException) {
- throw (BuildException)firstException;
+ throw (BuildException) firstException;
}
else {
throw new BuildException(firstException);
diff --git a/src/main/org/apache/tools/ant/taskdefs/Patch.java b/src/main/org/apache/tools/ant/taskdefs/Patch.java
index 02e0e1ecf..c54e8fb95 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Patch.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Patch.java
@@ -88,7 +88,7 @@ public class Patch extends Task {
*/
public void setPatchfile(File file) {
if (!file.exists()) {
- throw new BuildException("patchfile "+file+" doesn\'t exist",
+ throw new BuildException("patchfile " + file + " doesn\'t exist",
location);
}
cmd.createArgument().setValue("-i");
@@ -124,7 +124,7 @@ public class Patch extends Task {
if (num < 0) {
throw new BuildException("strip has to be >= 0", location);
}
- cmd.createArgument().setValue("-p"+num);
+ cmd.createArgument().setValue("-p" + num);
}
/**
@@ -151,7 +151,7 @@ public class Patch extends Task {
location);
}
- Commandline toExecute = (Commandline)cmd.clone();
+ Commandline toExecute = (Commandline) cmd.clone();
toExecute.setExecutable("patch");
if (originalFile != null) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
index 86103b662..441a07173 100644
--- a/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
+++ b/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,6 @@
* information on the Apache Software Foundation, please see
* .
*/
-
package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.BuildException;
@@ -70,53 +69,66 @@ import java.util.Vector;
import java.io.File;
/**
- * This task converts path and classpath information to a specific
- * target OS format. The resulting formatted path is placed into a
- * specified property.
- *
- * @author Larry Streepy streepy@healthlanguage.com
+ * This task converts path and classpath information to a specific target OS
+ * format. The resulting formatted path is placed into a specified property.
*
+ * @author Larry Streepy
+ * streepy@healthlanguage.com
* @since Ant 1.4
- *
* @ant.task category="utility"
*/
public class PathConvert extends Task {
+ // Members
+ private Path path = null;// Path to be converted
+ private Reference refid = null;// Reference to path/fileset to
+ // convert
+ private String targetOS = null;// The target OS type
+ private boolean targetWindows = false;// Set when targetOS is set
+ private boolean onWindows = false;// Set if we're running on windows
+ private String property = null;// The property to receive the
+ //results
+ private Vector prefixMap = new Vector();// Path prefix map
+ private String pathSep = null;// User override on path sep char
+ private String dirSep = null;// User override on directory sep
+ // char
+
public PathConvert() {
onWindows = Os.isFamily("dos");
}
+
/**
- * Helper class, holds the nested
+ * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets">
+ * http://www.w3.org/TR/1998/REC-xml-19980210#charsets.
*
* @since 1.10, Ant 1.5
*/
diff --git a/src/main/org/apache/tools/ant/util/DateUtils.java b/src/main/org/apache/tools/ant/util/DateUtils.java
index 45a7fcf10..b5ec73236 100644
--- a/src/main/org/apache/tools/ant/util/DateUtils.java
+++ b/src/main/org/apache/tools/ant/util/DateUtils.java
@@ -212,7 +212,7 @@ public final class DateUtils {
*/
public static int getPhaseOfMoon(Calendar cal) {
int dayOfTheYear = cal.get(Calendar.DAY_OF_YEAR);
- int yearInMetonicCycle = ((cal.get(Calendar.YEAR)-1900) % 19) + 1;
+ int yearInMetonicCycle = ((cal.get(Calendar.YEAR) - 1900) % 19) + 1;
int epact = (11 * yearInMetonicCycle + 18) % 30;
if ((epact == 25 && yearInMetonicCycle > 11) || epact == 24) {
epact++;
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java
index 417c25761..c6209a797 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -489,13 +489,10 @@ public class FileUtils {
// deal with absolute files
if (!onNetWare) {
- if (filename.startsWith(File.separator) ||
-
- (filename.length() >= 2 &&
- Character.isLetter(filename.charAt(0)) &&
- filename.charAt(1) == ':')
-
- ) {
+ if (filename.startsWith(File.separator)
+ || (filename.length() >= 2
+ && Character.isLetter(filename.charAt(0))
+ && filename.charAt(1) == ':')) {
return normalize(filename);
}
} else {
@@ -503,9 +500,8 @@ public class FileUtils {
// the path name breaks down when NetWare is a supported platform.
// Netware volumes are of the pattern: "data:\"
int colon = filename.indexOf(":");
- if (filename.startsWith(File.separator) ||
- (colon > -1)
- ) {
+ if (filename.startsWith(File.separator)
+ || (colon > -1)) {
return normalize(filename);
}
}
@@ -562,17 +558,15 @@ public class FileUtils {
if (!onNetWare) {
if (!path.startsWith(File.separator) &&
- ! (path.length() >= 2 &&
+ !(path.length() >= 2 &&
Character.isLetter(path.charAt(0)) &&
- colon == 1)
- ) {
+ colon == 1)) {
String msg = path + " is not an absolute path";
throw new BuildException(msg);
}
} else {
- if (!path.startsWith(File.separator) &&
- (colon == -1)
- ) {
+ if (!path.startsWith(File.separator)
+ && (colon == -1)) {
String msg = path + " is not an absolute path";
throw new BuildException(msg);
}
@@ -585,8 +579,7 @@ public class FileUtils {
path.length() >= 2 &&
Character.isLetter(path.charAt(0)) &&
path.charAt(1) == ':') ||
- (onNetWare && colon > -1)
- ) {
+ (onNetWare && colon > -1)) {
dosWithDrive = true;
@@ -603,10 +596,9 @@ public class FileUtils {
// Eliminate consecutive slashes after the drive spec
StringBuffer sbPath = new StringBuffer();
- for (int i = colon+1; i < ca.length; i++) {
+ for (int i = colon + 1; i < ca.length; i++) {
if ((ca[i] != '\\') ||
- (ca[i] == '\\' && ca[i - 1] != '\\')
- ) {
+ (ca[i] == '\\' && ca[i - 1] != '\\')) {
sbPath.append(ca[i]);
}
}
@@ -618,7 +610,7 @@ public class FileUtils {
path = "";
} else if (path.charAt(1) == File.separatorChar) {
// UNC drive
- root = File.separator+File.separator;
+ root = File.separator + File.separator;
path = path.substring(2);
} else {
root = File.separator;
@@ -635,7 +627,7 @@ public class FileUtils {
continue;
} else if ("..".equals(thisToken)) {
if (s.size() < 2) {
- throw new BuildException("Cannot resolve path "+orig);
+ throw new BuildException("Cannot resolve path " + orig);
} else {
s.pop();
}
@@ -645,7 +637,7 @@ public class FileUtils {
}
StringBuffer sb = new StringBuffer();
- for (int i=0; i 1) {
// not before the filesystem root and not after it, since root
// already contains one
diff --git a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
index d2ca22a77..0e78fb3a2 100644
--- a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
+++ b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -109,7 +109,7 @@ public class GlobPatternMapper implements FileNameMapper {
fromPostfix = "";
} else {
fromPrefix = from.substring(0, index);
- fromPostfix = from.substring(index+1);
+ fromPostfix = from.substring(index + 1);
}
prefixLength = fromPrefix.length();
postfixLength = fromPostfix.length();
@@ -125,7 +125,7 @@ public class GlobPatternMapper implements FileNameMapper {
toPostfix = "";
} else {
toPrefix = to.substring(0, index);
- toPostfix = to.substring(index+1);
+ toPostfix = to.substring(index + 1);
}
}
diff --git a/src/main/org/apache/tools/ant/util/LoaderUtils.java b/src/main/org/apache/tools/ant/util/LoaderUtils.java
index 042e60ee6..0b903c244 100644
--- a/src/main/org/apache/tools/ant/util/LoaderUtils.java
+++ b/src/main/org/apache/tools/ant/util/LoaderUtils.java
@@ -124,7 +124,7 @@ public class LoaderUtils {
try {
Thread currentThread = Thread.currentThread();
- return (ClassLoader)getContextClassLoader.invoke(currentThread,
+ return (ClassLoader) getContextClassLoader.invoke(currentThread,
new Object[0]);
} catch (IllegalAccessException e) {
throw new BuildException
diff --git a/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java b/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
index 694ff624d..bf1fd158d 100644
--- a/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
+++ b/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -118,7 +118,7 @@ public class RegexpPatternMapper implements FileNameMapper {
Vector v = reg.getGroups(source);
result.setLength(0);
- for (int i=0; i now) {
- task.log("Warning: "+files[i]+" modified in the future.",
+ task.log("Warning: " + files[i] + " modified in the future.",
Project.MSG_WARN);
}
boolean added = false;
targetList.setLength(0);
- for (int j=0; !added && j dest.lastModified()) {
- task.log(files[i]+" added as "+dest.getAbsolutePath()+" is outdated.",
- Project.MSG_VERBOSE);
+ task.log(files[i] + " added as " + dest.getAbsolutePath()
+ + " is outdated.", Project.MSG_VERBOSE);
v.addElement(files[i]);
added = true;
} else {
@@ -155,7 +155,7 @@ public class SourceFileScanner {
}
if (!added) {
- task.log(files[i]+" omitted as "+targetList.toString()
+ task.log(files[i] + " omitted as " + targetList.toString()
+ (targets.length == 1 ? " is" : " are ")
+ " up to date.", Project.MSG_VERBOSE);
}
@@ -175,7 +175,7 @@ public class SourceFileScanner {
FileNameMapper mapper) {
String[] res = restrict(files, srcDir, destDir, mapper);
File[] result = new File[res.length];
- for (int i=0; i '9') {
+ if (magic3 != 'h' || magic4 < '1' || magic4 > '9') {
bsFinishedWithStream();
streamEnd = true;
return;
@@ -316,11 +316,11 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
int zzi;
char thech = 0;
try {
- thech = (char)bsStream.read();
- } catch(IOException e) {
+ thech = (char) bsStream.read();
+ } catch (IOException e) {
compressedStreamEOF();
}
- if(thech == -1) {
+ if (thech == -1) {
compressedStreamEOF();
}
zzi = thech;
@@ -329,13 +329,13 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
}
- v = (bsBuff >> (bsLive-n)) & ((1 << n)-1);
+ v = (bsBuff >> (bsLive - n)) & ((1 << n) - 1);
bsLive -= n;
return v;
}
private char bsGetUChar() {
- return (char)bsR(8);
+ return (char) bsR(8);
}
private int bsGetint() {
@@ -348,11 +348,11 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
private int bsGetIntVS(int numBits) {
- return (int)bsR(numBits);
+ return (int) bsR(numBits);
}
private int bsGetInt32() {
- return (int)bsGetint();
+ return (int) bsGetint();
}
private void hbCreateDecodeTables(int[] limit, int[] base,
@@ -361,8 +361,8 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
int pp, i, j, vec;
pp = 0;
- for(i = minLen; i <= maxLen; i++) {
- for(j = 0; j < alphaSize; j++) {
+ for (i = minLen; i <= maxLen; i++) {
+ for (j = 0; j < alphaSize; j++) {
if (length[j] == i) {
perm[pp] = j;
pp++;
@@ -370,15 +370,15 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
};
- for(i = 0; i < MAX_CODE_LEN; i++) {
+ for (i = 0; i < MAX_CODE_LEN; i++) {
base[i] = 0;
}
- for(i = 0; i < alphaSize; i++) {
- base[length[i]+1]++;
+ for (i = 0; i < alphaSize; i++) {
+ base[length[i] + 1]++;
}
- for(i = 1; i < MAX_CODE_LEN; i++) {
- base[i] += base[i-1];
+ for (i = 1; i < MAX_CODE_LEN; i++) {
+ base[i] += base[i - 1];
}
for (i = 0; i < MAX_CODE_LEN; i++) {
@@ -387,12 +387,12 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
vec = 0;
for (i = minLen; i <= maxLen; i++) {
- vec += (base[i+1] - base[i]);
- limit[i] = vec-1;
+ vec += (base[i + 1] - base[i]);
+ limit[i] = vec - 1;
vec <<= 1;
}
for (i = minLen + 1; i <= maxLen; i++) {
- base[i] = ((limit[i-1] + 1) << 1) - base[i];
+ base[i] = ((limit[i - 1] + 1) << 1) - base[i];
}
}
@@ -426,7 +426,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
makeMaps();
- alphaSize = nInUse+2;
+ alphaSize = nInUse + 2;
/* Now the selectors */
nGroups = bsR(3);
@@ -436,7 +436,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
while (bsR(1) == 1) {
j++;
}
- selectorMtf[i] = (char)j;
+ selectorMtf[i] = (char) j;
}
/* Undo the MTF values for the selectors. */
@@ -451,7 +451,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
v = selectorMtf[i];
tmp = pos[v];
while (v > 0) {
- pos[v] = pos[v-1];
+ pos[v] = pos[v - 1];
v--;
}
pos[0] = tmp;
@@ -461,7 +461,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
/* Now the coding tables */
for (t = 0; t < nGroups; t++) {
- int curr = bsR ( 5 );
+ int curr = bsR(5);
for (i = 0; i < alphaSize; i++) {
while (bsR(1) == 1) {
if (bsR(1) == 0) {
@@ -470,7 +470,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
curr--;
}
}
- len[t][i] = (char)curr;
+ len[t][i] = (char) curr;
}
}
@@ -501,7 +501,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
origPtr = bsGetIntVS(24);
recvDecodingTables();
- EOB = nInUse+1;
+ EOB = nInUse + 1;
groupNo = -1;
groupPos = 0;
@@ -539,11 +539,11 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
int zzi;
char thech = 0;
try {
- thech = (char)bsStream.read();
- } catch(IOException e) {
+ thech = (char) bsStream.read();
+ } catch (IOException e) {
compressedStreamEOF();
}
- if(thech == -1) {
+ if (thech == -1) {
compressedStreamEOF();
}
zzi = thech;
@@ -551,7 +551,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
bsLive += 8;
}
}
- zj = (bsBuff >> (bsLive-1)) & 1;
+ zj = (bsBuff >> (bsLive - 1)) & 1;
bsLive--;
}
zvec = (zvec << 1) | zj;
@@ -559,7 +559,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
nextSym = perm[zt][zvec - base[zt][zn]];
}
- while(true) {
+ while (true) {
if (nextSym == EOB) {
break;
@@ -571,9 +571,9 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
int N = 1;
do {
if (nextSym == RUNA) {
- s = s + (0+1) * N;
+ s = s + (0 + 1) * N;
} else if (nextSym == RUNB) {
- s = s + (1+1) * N;
+ s = s + (1 + 1) * N;
}
N = N * 2;
{
@@ -594,11 +594,11 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
int zzi;
char thech = 0;
try {
- thech = (char)bsStream.read();
- } catch(IOException e) {
+ thech = (char) bsStream.read();
+ } catch (IOException e) {
compressedStreamEOF();
}
- if(thech == -1) {
+ if (thech == -1) {
compressedStreamEOF();
}
zzi = thech;
@@ -606,7 +606,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
bsLive += 8;
}
}
- zj = (bsBuff >> (bsLive-1)) & 1;
+ zj = (bsBuff >> (bsLive - 1)) & 1;
bsLive--;
}
zvec = (zvec << 1) | zj;
@@ -636,7 +636,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
blockOverrun();
}
- tmp = yy[nextSym-1];
+ tmp = yy[nextSym - 1];
unzftab[seqToUnseq[tmp]]++;
ll8[last] = seqToUnseq[tmp];
@@ -647,15 +647,15 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
for (j = nextSym-1; j > 0; j--) yy[j] = yy[j-1];
*/
- j = nextSym-1;
+ j = nextSym - 1;
for (; j > 3; j -= 4) {
- yy[j] = yy[j-1];
- yy[j-1] = yy[j-2];
- yy[j-2] = yy[j-3];
- yy[j-3] = yy[j-4];
+ yy[j] = yy[j - 1];
+ yy[j - 1] = yy[j - 2];
+ yy[j - 2] = yy[j - 3];
+ yy[j - 3] = yy[j - 4];
}
for (; j > 0; j--) {
- yy[j] = yy[j-1];
+ yy[j] = yy[j - 1];
}
yy[0] = tmp;
@@ -677,8 +677,8 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
int zzi;
char thech = 0;
try {
- thech = (char)bsStream.read();
- } catch(IOException e) {
+ thech = (char) bsStream.read();
+ } catch (IOException e) {
compressedStreamEOF();
}
zzi = thech;
@@ -686,7 +686,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
bsLive += 8;
}
}
- zj = (bsBuff >> (bsLive-1)) & 1;
+ zj = (bsBuff >> (bsLive - 1)) & 1;
bsLive--;
}
zvec = (zvec << 1) | zj;
@@ -704,14 +704,14 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
cftab[0] = 0;
for (i = 1; i <= 256; i++) {
- cftab[i] = unzftab[i-1];
+ cftab[i] = unzftab[i - 1];
}
for (i = 1; i <= 256; i++) {
- cftab[i] += cftab[i-1];
+ cftab[i] += cftab[i - 1];
}
for (i = 0; i <= last; i++) {
- ch = (char)ll8[i];
+ ch = (char) ll8[i];
tt[cftab[ch]] = i;
cftab[ch]++;
}
@@ -733,19 +733,19 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
private void setupRandPartA() {
- if(i2 <= last) {
+ if (i2 <= last) {
chPrev = ch2;
ch2 = ll8[tPos];
tPos = tt[tPos];
if (rNToGo == 0) {
rNToGo = rNums[rTPos];
rTPos++;
- if(rTPos == 512) {
+ if (rTPos == 512) {
rTPos = 0;
}
}
rNToGo--;
- ch2 ^= (int)((rNToGo == 1) ? 1 : 0);
+ ch2 ^= (int) ((rNToGo == 1) ? 1 : 0);
i2++;
currentChar = ch2;
@@ -759,7 +759,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
private void setupNoRandPartA() {
- if(i2 <= last) {
+ if (i2 <= last) {
chPrev = ch2;
ch2 = ll8[tPos];
tPos = tt[tPos];
@@ -788,7 +788,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
if (rNToGo == 0) {
rNToGo = rNums[rTPos];
rTPos++;
- if(rTPos == 512) {
+ if (rTPos == 512) {
rTPos = 0;
}
}
@@ -805,7 +805,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
private void setupRandPartC() {
- if(j2 < (int)z) {
+ if (j2 < (int) z) {
currentChar = ch2;
mCrc.updateCRC(ch2);
j2++;
@@ -838,7 +838,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
private void setupNoRandPartC() {
- if(j2 < (int)z) {
+ if (j2 < (int) z) {
currentChar = ch2;
mCrc.updateCRC(ch2);
j2++;
@@ -851,14 +851,14 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
private void setDecompressStructureSizes(int newSize100k) {
- if (! (0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k
+ if (!(0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k
&& blockSize100k <= 9)) {
// throw new IOException("Invalid block size");
}
blockSize100k = newSize100k;
- if(newSize100k == 0) {
+ if (newSize100k == 0) {
return;
}
diff --git a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
index 09a695710..1fad83964 100644
--- a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
+++ b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -99,8 +99,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
nInUse = 0;
for (i = 0; i < 256; i++) {
if (inUse[i]) {
- seqToUnseq[nInUse] = (char)i;
- unseqToSeq[i] = (char)nInUse;
+ seqToUnseq[nInUse] = (char) i;
+ unseqToSeq[i] = (char) nInUse;
nInUse++;
}
}
@@ -120,7 +120,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
int[] parent = new int[MAX_ALPHA_SIZE * 2];
for (i = 0; i < alphaSize; i++) {
- weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
+ weight[i + 1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
}
while (true) {
@@ -146,7 +146,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
heap[zz] = tmp;
}
}
- if (!(nHeap < (MAX_ALPHA_SIZE+2))) {
+ if (!(nHeap < (MAX_ALPHA_SIZE + 2))) {
panic();
}
@@ -164,7 +164,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
break;
}
if (yy < nHeap &&
- weight[heap[yy+1]] < weight[heap[yy]]) {
+ weight[heap[yy + 1]] < weight[heap[yy]]) {
yy++;
}
if (weight[tmp] < weight[heap[yy]]) {
@@ -188,7 +188,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
break;
}
if (yy < nHeap &&
- weight[heap[yy+1]] < weight[heap[yy]]) {
+ weight[heap[yy + 1]] < weight[heap[yy]]) {
yy++;
}
if (weight[tmp] < weight[heap[yy]]) {
@@ -235,13 +235,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
k = parent[k];
j++;
}
- len[i-1] = (char)j;
+ len[i - 1] = (char) j;
if (j > maxLen) {
tooLong = true;
}
}
- if (! tooLong) {
+ if (!tooLong) {
break;
}
@@ -325,10 +325,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
bsSetStream(inStream);
workFactor = 50;
- if(inBlockSize > 9) {
+ if (inBlockSize > 9) {
inBlockSize = 9;
}
- if(inBlockSize < 1) {
+ if (inBlockSize < 1) {
inBlockSize = 1;
}
blockSize100k = inBlockSize;
@@ -344,10 +344,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
*/
public void write(int bv) throws IOException {
int b = (256 + bv) % 256;
- if(currentChar != -1) {
- if(currentChar == b) {
+ if (currentChar != -1) {
+ if (currentChar == b) {
runLength++;
- if(runLength > 254) {
+ if (runLength > 254) {
writeRun();
currentChar = -1;
runLength = 0;
@@ -364,42 +364,42 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
private void writeRun() throws IOException {
- if(last < allowableBlockSize) {
+ if (last < allowableBlockSize) {
inUse[currentChar] = true;
- for(int i = 0; i < runLength; i++) {
- mCrc.updateCRC((char)currentChar);
+ for (int i = 0; i < runLength; i++) {
+ mCrc.updateCRC((char) currentChar);
}
switch (runLength) {
case 1:
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
break;
case 2:
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
break;
case 3:
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
break;
default:
inUse[runLength - 4] = true;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)currentChar;
+ block[last + 1] = (char) currentChar;
last++;
- block[last + 1] = (char)(runLength - 4);
+ block[last + 1] = (char) (runLength - 4);
break;
}
} else {
@@ -416,11 +416,11 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
public void close() throws IOException {
- if(closed) {
+ if (closed) {
return;
}
- if(runLength > 0) {
+ if (runLength > 0) {
writeRun();
}
currentChar = -1;
@@ -460,7 +460,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
last = -1;
// ch = 0;
- for(int i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
inUse[i] = false;
}
@@ -470,7 +470,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
private void endBlock() throws IOException {
blockCRC = mCrc.getFinalCRC();
- combinedCRC = (combinedCRC << 1)|(combinedCRC >>> 31);
+ combinedCRC = (combinedCRC << 1) | (combinedCRC >>> 31);
combinedCRC ^= blockCRC;
/* sort the block and establish posn of original string */
@@ -501,10 +501,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
/* Now a single bit indicating randomisation. */
if (blockRandomised) {
- bsW(1,1);
+ bsW(1, 1);
nBlocksRandomised++;
} else {
- bsW(1,0);
+ bsW(1, 0);
}
/* Finally, block's contents proper. */
@@ -561,7 +561,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
try {
bsStream.write(ch); // write 8-bit
}
- catch(IOException e) {
+ catch (IOException e) {
throw e;
}
bsBuff <<= 8;
@@ -576,7 +576,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
try {
bsStream.write(ch); // write 8-bit
}
- catch(IOException e) {
+ catch (IOException e) {
throw e;
}
bsBuff <<= 8;
@@ -612,7 +612,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
alphaSize = nInUse + 2;
for (t = 0; t < N_GROUPS; t++) {
for (v = 0; v < alphaSize; v++) {
- len[t][v] = (char)GREATER_ICOST;
+ len[t][v] = (char) GREATER_ICOST;
}
}
@@ -625,13 +625,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
nGroups = 2;
} else if (nMTF < 600) {
nGroups = 3;
- } else if (nMTF < 1200) {
+ } else if (nMTF < 1200) {
nGroups = 4;
- } else if (nMTF < 2400) {
+ } else if (nMTF < 2400) {
nGroups = 5;
- } else {
+ } else {
nGroups = 6;
- }
+ }
/* Generate an initial set of coding tables */ {
int nPart, remF, tFreq, aFreq;
@@ -641,29 +641,29 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
gs = 0;
while (nPart > 0) {
tFreq = remF / nPart;
- ge = gs-1;
+ ge = gs - 1;
aFreq = 0;
- while (aFreq < tFreq && ge < alphaSize-1) {
+ while (aFreq < tFreq && ge < alphaSize - 1) {
ge++;
aFreq += mtfFreq[ge];
}
if (ge > gs && nPart != nGroups && nPart != 1
- && ((nGroups-nPart) % 2 == 1)) {
+ && ((nGroups - nPart) % 2 == 1)) {
aFreq -= mtfFreq[ge];
ge--;
}
for (v = 0; v < alphaSize; v++) {
if (v >= gs && v <= ge) {
- len[nPart-1][v] = (char)LESSER_ICOST;
+ len[nPart - 1][v] = (char) LESSER_ICOST;
} else {
- len[nPart-1][v] = (char)GREATER_ICOST;
+ len[nPart - 1][v] = (char) GREATER_ICOST;
}
}
nPart--;
- gs = ge+1;
+ gs = ge + 1;
remF -= aFreq;
}
}
@@ -696,7 +696,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
ge = gs + G_SIZE - 1;
if (ge >= nMTF) {
- ge = nMTF-1;
+ ge = nMTF - 1;
}
/*
@@ -748,7 +748,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
};
totc += bc;
fave[bt]++;
- selector[nSelectors] = (char)bt;
+ selector[nSelectors] = (char) bt;
nSelectors++;
/*
@@ -758,7 +758,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
rfreq[bt][szptr[i]]++;
}
- gs = ge+1;
+ gs = ge + 1;
}
/*
@@ -786,20 +786,20 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
char[] pos = new char[N_GROUPS];
char ll_i, tmp2, tmp;
for (i = 0; i < nGroups; i++) {
- pos[i] = (char)i;
+ pos[i] = (char) i;
}
for (i = 0; i < nSelectors; i++) {
ll_i = selector[i];
j = 0;
tmp = pos[j];
- while ( ll_i != tmp ) {
+ while (ll_i != tmp) {
j++;
tmp2 = tmp;
tmp = pos[j];
pos[j] = tmp2;
}
pos[0] = tmp;
- selectorMtf[i] = (char)j;
+ selectorMtf[i] = (char) j;
}
}
@@ -841,9 +841,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
nBytes = bytesOut;
for (i = 0; i < 16; i++) {
if (inUse16[i]) {
- bsW(1,1);
+ bsW(1, 1);
} else {
- bsW(1,0);
+ bsW(1, 0);
}
}
@@ -851,9 +851,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
if (inUse16[i]) {
for (j = 0; j < 16; j++) {
if (inUse[i * 16 + j]) {
- bsW(1,1);
+ bsW(1, 1);
} else {
- bsW(1,0);
+ bsW(1, 0);
}
}
}
@@ -863,13 +863,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
/* Now the selectors. */
nBytes = bytesOut;
- bsW ( 3, nGroups );
- bsW ( 15, nSelectors );
+ bsW (3, nGroups);
+ bsW (15, nSelectors);
for (i = 0; i < nSelectors; i++) {
for (j = 0; j < selectorMtf[i]; j++) {
- bsW(1,1);
+ bsW(1, 1);
}
- bsW(1,0);
+ bsW(1, 0);
}
/* Now the coding tables. */
@@ -880,14 +880,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
bsW(5, curr);
for (i = 0; i < alphaSize; i++) {
while (curr < len[t][i]) {
- bsW(2,2);
+ bsW(2, 2);
curr++; /* 10 */
}
while (curr > len[t][i]) {
- bsW(2,3);
+ bsW(2, 3);
curr--; /* 11 */
}
- bsW ( 1, 0 );
+ bsW (1, 0);
}
}
@@ -901,14 +901,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
ge = gs + G_SIZE - 1;
if (ge >= nMTF) {
- ge = nMTF-1;
+ ge = nMTF - 1;
}
for (i = gs; i <= ge; i++) {
- bsW(len [selector[selCtr]] [szptr[i]],
- code [selector[selCtr]] [szptr[i]] );
+ bsW(len[selector[selCtr]][szptr[i]],
+ code[selector[selCtr]][szptr[i]]);
}
- gs = ge+1;
+ gs = ge + 1;
selCtr++;
}
if (!(selCtr == nSelectors)) {
@@ -924,7 +924,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
private OutputStream bsStream;
- private void simpleSort ( int lo, int hi, int d ) {
+ private void simpleSort(int lo, int hi, int d) {
int i, j, h, bigN, hp;
int v;
@@ -950,8 +950,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
v = zptr[i];
j = i;
- while ( fullGtU ( zptr[j-h]+d, v+d ) ) {
- zptr[j] = zptr[j-h];
+ while (fullGtU(zptr[j - h] + d, v + d)) {
+ zptr[j] = zptr[j - h];
j = j - h;
if (j <= (lo + h - 1)) {
break;
@@ -966,8 +966,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
v = zptr[i];
j = i;
- while ( fullGtU ( zptr[j-h]+d, v+d ) ) {
- zptr[j] = zptr[j-h];
+ while (fullGtU(zptr[j - h] + d, v + d)) {
+ zptr[j] = zptr[j - h];
j = j - h;
if (j <= (lo + h - 1)) {
break;
@@ -982,8 +982,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
v = zptr[i];
j = i;
- while ( fullGtU ( zptr[j-h]+d, v+d ) ) {
- zptr[j] = zptr[j-h];
+ while (fullGtU(zptr[j - h] + d, v + d)) {
+ zptr[j] = zptr[j - h];
j = j - h;
if (j <= (lo + h - 1)) {
break;
@@ -999,7 +999,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
}
- private void vswap ( int p1, int p2, int n ) {
+ private void vswap(int p1, int p2, int n) {
int temp = 0;
while (n > 0) {
temp = zptr[p1];
@@ -1011,7 +1011,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
}
- private char med3( char a, char b, char c ) {
+ private char med3(char a, char b, char c) {
char t;
if (a > b) {
t = a;
@@ -1035,11 +1035,11 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
int dd;
}
- private void qSort3 ( int loSt, int hiSt, int dSt ) {
+ private void qSort3(int loSt, int hiSt, int dSt) {
int unLo, unHi, ltLo, gtHi, med, n, m;
int sp, lo, hi, d;
StackElem[] stack = new StackElem[QSORT_STACK_SIZE];
- for(int count = 0; count < QSORT_STACK_SIZE; count++) {
+ for (int count = 0; count < QSORT_STACK_SIZE; count++) {
stack[count] = new StackElem();
}
@@ -1080,7 +1080,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
if (unLo > unHi) {
break;
}
- n = ((int)block[zptr[unLo]+d + 1]) - med;
+ n = ((int) block[zptr[unLo] + d + 1]) - med;
if (n == 0) {
int temp = 0;
temp = zptr[unLo];
@@ -1099,7 +1099,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
if (unLo > unHi) {
break;
}
- n = ((int)block[zptr[unHi]+d + 1]) - med;
+ n = ((int) block[zptr[unHi] + d + 1]) - med;
if (n == 0) {
int temp = 0;
temp = zptr[unHi];
@@ -1128,15 +1128,15 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
if (gtHi < ltLo) {
stack[sp].ll = lo;
stack[sp].hh = hi;
- stack[sp].dd = d+1;
+ stack[sp].dd = d + 1;
sp++;
continue;
}
- n = ((ltLo-lo) < (unLo-ltLo)) ? (ltLo-lo) : (unLo-ltLo);
- vswap(lo, unLo-n, n);
- m = ((hi-gtHi) < (gtHi-unHi)) ? (hi-gtHi) : (gtHi-unHi);
- vswap(unLo, hi-m+1, m);
+ n = ((ltLo - lo) < (unLo - ltLo)) ? (ltLo - lo) : (unLo - ltLo);
+ vswap(lo, unLo - n, n);
+ m = ((hi - gtHi) < (gtHi - unHi)) ? (hi - gtHi) : (gtHi - unHi);
+ vswap(unLo, hi - m + 1, m);
n = lo + unLo - ltLo - 1;
m = hi - (gtHi - unHi) + 1;
@@ -1148,7 +1148,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
stack[sp].ll = n + 1;
stack[sp].hh = m - 1;
- stack[sp].dd = d+1;
+ stack[sp].dd = d + 1;
sp++;
stack[sp].ll = m;
@@ -1172,7 +1172,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
set up the overshoot area for block.
*/
- // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" );
+ // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" );
for (i = 0; i < NUM_OVERSHOOT_BYTES; i++) {
block[last + i + 2] = block[(i % (last + 1)) + 1];
}
@@ -1180,7 +1180,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
quadrant[i] = 0;
}
- block[0] = (char)(block[last + 1]);
+ block[0] = (char) (block[last + 1]);
if (last < 4000) {
/*
@@ -1192,7 +1192,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
firstAttempt = false;
workDone = workLimit = 0;
- simpleSort ( 0, last, 0 );
+ simpleSort(0, last, 0);
} else {
numQSorted = 0;
for (i = 0; i <= 255; i++) {
@@ -1249,10 +1249,10 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
for (i = h; i <= 255; i++) {
vv = runningOrder[i];
j = i;
- while ((ftab[((runningOrder[j-h])+1) << 8]
- - ftab[(runningOrder[j-h]) << 8]) >
- (ftab[((vv)+1) << 8] - ftab[(vv) << 8])) {
- runningOrder[j] = runningOrder[j-h];
+ while ((ftab[((runningOrder[j - h]) + 1) << 8]
+ - ftab[(runningOrder[j - h]) << 8]) >
+ (ftab[((vv) + 1) << 8] - ftab[(vv) << 8])) {
+ runningOrder[j] = runningOrder[j - h];
j = j - h;
if (j <= (h - 1)) {
break;
@@ -1282,12 +1282,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
*/
for (j = 0; j <= 255; j++) {
sb = (ss << 8) + j;
- if(!((ftab[sb] & SETMASK) == SETMASK) ) {
+ if (!((ftab[sb] & SETMASK) == SETMASK)) {
int lo = ftab[sb] & CLEARMASK;
- int hi = (ftab[sb+1] & CLEARMASK) - 1;
+ int hi = (ftab[sb + 1] & CLEARMASK) - 1;
if (hi > lo) {
- qSort3 ( lo, hi, 2 );
- numQSorted += ( hi - lo + 1 );
+ qSort3(lo, hi, 2);
+ numQSorted += (hi - lo + 1);
if (workDone > workLimit && firstAttempt) {
return;
}
@@ -1308,7 +1308,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
if (i < 255) {
int bbStart = ftab[ss << 8] & CLEARMASK;
- int bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart;
+ int bbSize = (ftab[(ss + 1) << 8] & CLEARMASK) - bbStart;
int shifts = 0;
while ((bbSize >> shifts) > 65534) {
@@ -1324,7 +1324,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
}
- if (! ( ((bbSize-1) >> shifts) <= 65535 )) {
+ if (!(((bbSize - 1) >> shifts) <= 65535)) {
panic();
}
}
@@ -1338,11 +1338,11 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
for (j = ftab[ss << 8] & CLEARMASK;
- j < (ftab[(ss+1) << 8] & CLEARMASK); j++) {
+ j < (ftab[(ss + 1) << 8] & CLEARMASK); j++) {
c1 = block[zptr[j]];
- if ( ! bigDone[c1] ) {
+ if (!bigDone[c1]) {
zptr[copy[c1]] = zptr[j] == 0 ? last : zptr[j] - 1;
- copy[c1] ++;
+ copy[c1]++;
}
}
@@ -1363,9 +1363,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
for (i = 0; i <= last; i++) {
if (rNToGo == 0) {
- rNToGo = (char)rNums[rTPos];
+ rNToGo = (char) rNums[rTPos];
rTPos++;
- if(rTPos == 512) {
+ if (rTPos == 512) {
rTPos = 0;
}
}
@@ -1582,7 +1582,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
int EOB;
makeMaps();
- EOB = nInUse+1;
+ EOB = nInUse + 1;
for (i = 0; i <= EOB; i++) {
mtfFreq[i] = 0;
@@ -1602,7 +1602,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
j = 0;
tmp = yy[j];
- while ( ll_i != tmp ) {
+ while (ll_i != tmp) {
j++;
tmp2 = tmp;
tmp = yy[j];
@@ -1618,12 +1618,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
while (true) {
switch (zPend % 2) {
case 0:
- szptr[wr] = (short)RUNA;
+ szptr[wr] = (short) RUNA;
wr++;
mtfFreq[RUNA]++;
break;
case 1:
- szptr[wr] = (short)RUNB;
+ szptr[wr] = (short) RUNB;
wr++;
mtfFreq[RUNB]++;
break;
@@ -1635,7 +1635,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
};
zPend = 0;
}
- szptr[wr] = (short)(j + 1);
+ szptr[wr] = (short) (j + 1);
wr++;
mtfFreq[j + 1]++;
}
@@ -1646,12 +1646,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
while (true) {
switch (zPend % 2) {
case 0:
- szptr[wr] = (short)RUNA;
+ szptr[wr] = (short) RUNA;
wr++;
mtfFreq[RUNA]++;
break;
case 1:
- szptr[wr] = (short)RUNB;
+ szptr[wr] = (short) RUNB;
wr++;
mtfFreq[RUNB]++;
break;
@@ -1663,7 +1663,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
}
}
- szptr[wr] = (short)EOB;
+ szptr[wr] = (short) EOB;
wr++;
mtfFreq[EOB]++;
diff --git a/src/main/org/apache/tools/bzip2/CRC.java b/src/main/org/apache/tools/bzip2/CRC.java
index 8e55e03ba..f4822a4af 100644
--- a/src/main/org/apache/tools/bzip2/CRC.java
+++ b/src/main/org/apache/tools/bzip2/CRC.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -156,7 +156,7 @@ class CRC {
void updateCRC(int inCh) {
int temp = (globalCrc >> 24) ^ inCh;
- if(temp < 0) {
+ if (temp < 0) {
temp = 256 + temp;
}
globalCrc = (globalCrc << 8) ^ CRC.crc32Table[temp];
diff --git a/src/main/org/apache/tools/tar/TarEntry.java b/src/main/org/apache/tools/tar/TarEntry.java
index b247edde0..cdfac95cc 100644
--- a/src/main/org/apache/tools/tar/TarEntry.java
+++ b/src/main/org/apache/tools/tar/TarEntry.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -224,7 +224,7 @@ public class TarEntry implements TarConstants {
else if (osname.toLowerCase().indexOf("netware") > -1) {
int colon = name.indexOf(':');
if (colon != -1) {
- name=name.substring(colon+1);
+ name = name.substring(colon + 1);
}
}
}
@@ -517,7 +517,7 @@ public class TarEntry implements TarConstants {
* @return An array of TarEntry's for this entry's children.
*/
public TarEntry[] getDirectoryEntries() {
- if (this.file == null ||!this.file.isDirectory()) {
+ if (this.file == null || !this.file.isDirectory()) {
return new TarEntry[0];
}
diff --git a/src/main/org/apache/tools/zip/AsiExtraField.java b/src/main/org/apache/tools/zip/AsiExtraField.java
index 111c6d905..02bb0126d 100644
--- a/src/main/org/apache/tools/zip/AsiExtraField.java
+++ b/src/main/org/apache/tools/zip/AsiExtraField.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -147,12 +147,12 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
* @since 1.1
*/
public ZipShort getLocalFileDataLength() {
- return new ZipShort( 4 // CRC
- + 2 // Mode
- + 4 // SizDev
- + 2 // UID
- + 2 // GID
- + getLinkedFile().getBytes().length);
+ return new ZipShort(4 // CRC
+ + 2 // Mode
+ + 4 // SizDev
+ + 2 // UID
+ + 2 // GID
+ + getLinkedFile().getBytes().length);
}
/**
@@ -321,8 +321,8 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
throws ZipException {
long givenChecksum = (new ZipLong(data, offset)).getValue();
- byte[] tmp = new byte[length-4];
- System.arraycopy(data, offset+4, tmp, 0, length-4);
+ byte[] tmp = new byte[length - 4];
+ System.arraycopy(data, offset + 4, tmp, 0, length - 4);
crc.reset();
crc.update(tmp);
long realChecksum = crc.getValue();
diff --git a/src/main/org/apache/tools/zip/ExtraFieldUtils.java b/src/main/org/apache/tools/zip/ExtraFieldUtils.java
index 005e98809..04a587e39 100644
--- a/src/main/org/apache/tools/zip/ExtraFieldUtils.java
+++ b/src/main/org/apache/tools/zip/ExtraFieldUtils.java
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -127,25 +127,27 @@ public class ExtraFieldUtils {
public static ZipExtraField[] parse(byte[] data) throws ZipException {
Vector v = new Vector();
int start = 0;
- while (start <= data.length-4) {
+ while (start <= data.length - 4) {
ZipShort headerId = new ZipShort(data, start);
- int length = (new ZipShort(data, start+2)).getValue();
- if (start+4+length > data.length) {
- throw new ZipException("data starting at "+start+" is in unknown format");
+ int length = (new ZipShort(data, start + 2)).getValue();
+ if (start + 4 + length > data.length) {
+ throw new ZipException("data starting at " + start
+ + " is in unknown format");
}
try {
ZipExtraField ze = createExtraField(headerId);
- ze.parseFromLocalFileData(data, start+4, length);
+ ze.parseFromLocalFileData(data, start + 4, length);
v.addElement(ze);
} catch (InstantiationException ie) {
throw new ZipException(ie.getMessage());
} catch (IllegalAccessException iae) {
throw new ZipException(iae.getMessage());
}
- start += (length+4);
+ start += (length + 4);
}
if (start != data.length) { // array not exhausted
- throw new ZipException("data starting at "+start+" is in unknown format");
+ throw new ZipException("data starting at " + start
+ + " is in unknown format");
}
ZipExtraField[] result = new ZipExtraField[v.size()];
@@ -159,20 +161,20 @@ public class ExtraFieldUtils {
* @since 1.1
*/
public static byte[] mergeLocalFileDataData(ZipExtraField[] data) {
- int sum = 4*data.length;
- for (int i=0; i