You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2017/12/11 22:42:52 UTC
[4/6] ant git commit: Checkstyle: whitespace,
line continuation and modifier idiosyncrasies
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/types/CommandlineJava.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/CommandlineJava.java b/src/main/org/apache/tools/ant/types/CommandlineJava.java
index f588629..e6f82cf 100644
--- a/src/main/org/apache/tools/ant/types/CommandlineJava.java
+++ b/src/main/org/apache/tools/ant/types/CommandlineJava.java
@@ -385,15 +385,12 @@ public class CommandlineJava implements Cloneable {
javaCommand.setExecutable(module, false);
break;
case CLASS:
- javaCommand.setExecutable(createModuleClassPair(
- module,
+ javaCommand.setExecutable(createModuleClassPair(module,
javaCommand.getExecutable()), false);
break;
case MODULE:
- javaCommand.setExecutable(createModuleClassPair(
- module,
- parseClassFromModuleClassPair(javaCommand.getExecutable())),
- false);
+ javaCommand.setExecutable(createModuleClassPair(module,
+ parseClassFromModuleClassPair(javaCommand.getExecutable())), false);
break;
}
}
@@ -500,8 +497,7 @@ public class CommandlineJava implements Cloneable {
if (isCloneVm()) {
SysProperties clonedSysProperties = new SysProperties();
PropertySet ps = new PropertySet();
- PropertySet.BuiltinPropertySetName sys =
- new PropertySet.BuiltinPropertySetName();
+ PropertySet.BuiltinPropertySetName sys = new PropertySet.BuiltinPropertySetName();
sys.setValue("system");
ps.appendBuiltin(sys);
clonedSysProperties.addSyspropertyset(ps);
@@ -515,20 +511,17 @@ public class CommandlineJava implements Cloneable {
//main classpath
if (haveClasspath()) {
listIterator.add("-classpath");
- listIterator.add(
- classpath.concatSystemClasspath("ignore").toString());
+ listIterator.add(classpath.concatSystemClasspath("ignore").toString());
}
//module path
if (haveModulepath()) {
listIterator.add("--module-path");
- listIterator.add(
- modulepath.concatSystemClasspath("ignore").toString());
+ listIterator.add(modulepath.concatSystemClasspath("ignore").toString());
}
//upgrade module path
if (haveUpgrademodulepath()) {
listIterator.add("--upgrade-module-path");
- listIterator.add(
- upgrademodulepath.concatSystemClasspath("ignore").toString());
+ listIterator.add(upgrademodulepath.concatSystemClasspath("ignore").toString());
}
//now any assertions are added
if (getAssertions() != null) {
@@ -762,10 +755,8 @@ public class CommandlineJava implements Cloneable {
* @since Ant 1.6
*/
public boolean haveClasspath() {
- Path fullClasspath = classpath != null
- ? classpath.concatSystemClasspath("ignore") : null;
- return fullClasspath != null
- && fullClasspath.toString().trim().length() > 0;
+ Path fullClasspath = classpath != null ? classpath.concatSystemClasspath("ignore") : null;
+ return fullClasspath != null && fullClasspath.toString().trim().length() > 0;
}
/**
@@ -789,7 +780,7 @@ public class CommandlineJava implements Cloneable {
*/
public boolean haveModulepath() {
Path fullClasspath = modulepath != null
- ? modulepath.concatSystemClasspath("ignore") : null;
+ ? modulepath.concatSystemClasspath("ignore") : null;
return fullClasspath != null
&& fullClasspath.toString().trim().length() > 0;
}
@@ -802,8 +793,7 @@ public class CommandlineJava implements Cloneable {
public boolean haveUpgrademodulepath() {
Path fullClasspath = upgrademodulepath != null
? upgrademodulepath.concatSystemClasspath("ignore") : null;
- return fullClasspath != null
- && fullClasspath.toString().trim().length() > 0;
+ return fullClasspath != null && fullClasspath.toString().trim().length() > 0;
}
/**
@@ -816,8 +806,7 @@ public class CommandlineJava implements Cloneable {
private Path calculateBootclasspath(boolean log) {
if (vmVersion.startsWith("1.1")) {
if (bootclasspath != null && log) {
- bootclasspath.log("Ignoring bootclasspath as "
- + "the target VM doesn't support it.");
+ bootclasspath.log("Ignoring bootclasspath as the target VM doesn't support it.");
}
} else {
Path b = bootclasspath;
@@ -839,8 +828,7 @@ public class CommandlineJava implements Cloneable {
* @since 1.7
*/
private boolean isCloneVm() {
- return cloneVm
- || "true".equals(System.getProperty("ant.build.clonevm"));
+ return cloneVm || "true".equals(System.getProperty("ant.build.clonevm"));
}
/**
@@ -851,9 +839,7 @@ public class CommandlineJava implements Cloneable {
* @since 1.9.7
*/
private static String createModuleClassPair(final String module, final String classname) {
- return classname == null ?
- module :
- String.format("%s/%s", module, classname); //NOI18N
+ return classname == null ? module : String.format("%s/%s", module, classname); //NOI18N
}
/**
@@ -881,9 +867,7 @@ public class CommandlineJava implements Cloneable {
return null;
}
final String[] moduleAndClass = moduleClassPair.split("/"); //NOI18N
- return moduleAndClass.length == 2 ?
- moduleAndClass[1] :
- null;
+ return moduleAndClass.length == 2 ? moduleAndClass[1] : null;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/types/DataType.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/DataType.java b/src/main/org/apache/tools/ant/types/DataType.java
index c5ee1c9..7b2ec7a 100644
--- a/src/main/org/apache/tools/ant/types/DataType.java
+++ b/src/main/org/apache/tools/ant/types/DataType.java
@@ -363,7 +363,7 @@ public abstract class DataType extends ProjectComponent implements Cloneable {
}
private String displayName(Class<?> clazz) {
- return clazz.getName() + " (loaded via " + clazz.getClassLoader() +")";
+ return clazz.getName() + " (loaded via " + clazz.getClassLoader() + ")";
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/types/XMLCatalog.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/XMLCatalog.java b/src/main/org/apache/tools/ant/types/XMLCatalog.java
index 20bbe94..7001359 100644
--- a/src/main/org/apache/tools/ant/types/XMLCatalog.java
+++ b/src/main/org/apache/tools/ant/types/XMLCatalog.java
@@ -47,7 +47,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
-
/**
* <p>This data type provides a catalog of resource locations (such as
* DTDs and XML entities), based on the <a
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/types/optional/image/Text.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/optional/image/Text.java b/src/main/org/apache/tools/ant/types/optional/image/Text.java
index 869fbac..5ba010a 100644
--- a/src/main/org/apache/tools/ant/types/optional/image/Text.java
+++ b/src/main/org/apache/tools/ant/types/optional/image/Text.java
@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.types.optional.image;
-import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
@@ -95,7 +94,6 @@ public class Text extends ImageOperation implements DrawOperation {
public PlanarImage executeDrawOperation() {
log("\tCreating Text \"" + strText + "\"");
- Color couloir = ColorMapper.getColorByName(color);
int width = 1;
int height = 1;
@@ -120,7 +118,7 @@ public class Text extends ImageOperation implements DrawOperation {
RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setFont(f);
- graphics.setColor(couloir);
+ graphics.setColor(ColorMapper.getColorByName(color));
graphics.drawString(strText, 0, height - fmetrics.getMaxDescent());
PlanarImage image = PlanarImage.wrapRenderedImage(bi);
return image;
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java b/src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java
index d793890..1161558 100644
--- a/src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java
+++ b/src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java
@@ -187,7 +187,7 @@ public class MultiRootFileSet extends AbstractFileSet
/**
* What to return from the set: files, directories or both.
*/
- public static enum SetType {
+ public enum SetType {
file, dir, both
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
index c59be11..0899f91 100644
--- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
+++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
@@ -905,7 +905,7 @@ public class ModifiedSelector extends BaseExtendSelector
* @see EnumeratedAttribute#getValues()
*/
public String[] getValues() {
- return new String[] {"propertyfile" };
+ return new String[] {"propertyfile"};
}
}
@@ -935,7 +935,7 @@ public class ModifiedSelector extends BaseExtendSelector
* @see EnumeratedAttribute#getValues()
*/
public String[] getValues() {
- return new String[] {"hashvalue", "digest", "checksum" };
+ return new String[] {"hashvalue", "digest", "checksum"};
}
}
@@ -965,7 +965,7 @@ public class ModifiedSelector extends BaseExtendSelector
* @see EnumeratedAttribute#getValues()
*/
public String[] getValues() {
- return new String[] {"equal", "rule" };
+ return new String[] {"equal", "rule"};
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/DOMElementWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
index 1221cf2..2dad80f 100644
--- a/src/main/org/apache/tools/ant/util/DOMElementWriter.java
+++ b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
@@ -518,7 +518,8 @@ public class DOMElementWriter {
*/
public void encodedata(final Writer out, final String value) throws IOException {
final int len = value.length();
- int prevEnd = 0, cdataEndPos = value.indexOf("]]>");
+ int prevEnd = 0;
+ int cdataEndPos = value.indexOf("]]>");
while (prevEnd < len) {
final int end = (cdataEndPos < 0 ? len : cdataEndPos);
// Write out stretches of legal characters in the range [prevEnd, end).
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
index 2fc36b2..7206d77 100644
--- a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
+++ b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
@@ -545,8 +545,7 @@ public final class JavaEnvUtils {
tests.addElement("org.xml.sax.XMLReader");
}
if (isAtLeastJavaVersion(JAVA_1_5)) {
- tests.addElement(
- "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl");
+ tests.addElement("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl");
}
if (isAtLeastJavaVersion(JAVA_1_7)) {
tests.addElement("jdk.net.Sockets");
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
index 116a431..e4df722 100644
--- a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
+++ b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
@@ -357,7 +357,7 @@ public class LayoutPreservingProperties extends Properties {
line = new Blank();
} else {
line = new Pair(logicalLineBuffer.toString());
- final String key = unescape(((Pair)line).getName());
+ final String key = unescape(((Pair) line).getName());
if (keyedPairLines.containsKey(key)) {
// this key is already present, so we remove it and add
// the new one
@@ -474,7 +474,7 @@ public class LayoutPreservingProperties extends Properties {
buffy.append('\t');
} else if (c == 'u') {
// handle unicode escapes
- c = unescapeUnicode(ch, i+1);
+ c = unescapeUnicode(ch, i + 1);
i += 4;
buffy.append(c);
} else {
@@ -554,7 +554,7 @@ public class LayoutPreservingProperties extends Properties {
}
final int p = forEscaping.indexOf(c);
if (p != -1) {
- buffy.append("\\").append(escaped.substring(p,p+1));
+ buffy.append("\\").append(escaped.substring(p, p + 1));
} else if (c < 0x0020 || c > 0x007e) {
buffy.append(escapeUnicode(c));
} else {
@@ -715,7 +715,7 @@ public class LayoutPreservingProperties extends Properties {
value = null;
} else {
name = text.substring(0, pos);
- value = text.substring(pos+1, text.length());
+ value = text.substring(pos + 1, text.length());
}
// trim leading whitespace only
name = stripStart(name, " \t\f");
@@ -727,7 +727,7 @@ public class LayoutPreservingProperties extends Properties {
}
int i = 0;
- for (;i < s.length(); i++) {
+ for (; i < s.length(); i++) {
if (chars.indexOf(s.charAt(i)) == -1) {
break;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/MergingMapper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/MergingMapper.java b/src/main/org/apache/tools/ant/util/MergingMapper.java
index f148e8b..d61ae30 100644
--- a/src/main/org/apache/tools/ant/util/MergingMapper.java
+++ b/src/main/org/apache/tools/ant/util/MergingMapper.java
@@ -31,7 +31,8 @@ public class MergingMapper implements FileNameMapper {
protected String[] mergedFile = null;
// CheckStyle:VisibilityModifier ON
- public MergingMapper() {}
+ public MergingMapper() {
+ }
/**
* @param to String
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/ProcessUtil.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ProcessUtil.java b/src/main/org/apache/tools/ant/util/ProcessUtil.java
index 998c713..58086f3 100644
--- a/src/main/org/apache/tools/ant/util/ProcessUtil.java
+++ b/src/main/org/apache/tools/ant/util/ProcessUtil.java
@@ -54,7 +54,7 @@ public class ProcessUtil {
return fallback;
}
- public static void main(String [] args) {
+ public static void main(String[] args) {
System.out.println(getProcessId("<PID>"));
try {
Thread.sleep(120000);
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/ReaderInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ReaderInputStream.java b/src/main/org/apache/tools/ant/util/ReaderInputStream.java
index f327b77..21733b6 100644
--- a/src/main/org/apache/tools/ant/util/ReaderInputStream.java
+++ b/src/main/org/apache/tools/ant/util/ReaderInputStream.java
@@ -173,7 +173,7 @@ public class ReaderInputStream extends InputStream {
/**
* @return false - mark is not supported
*/
- public boolean markSupported () {
+ public boolean markSupported() {
return false; // would be imprecise
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/ReflectUtil.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ReflectUtil.java b/src/main/org/apache/tools/ant/util/ReflectUtil.java
index b10ef39..bc62fa0 100644
--- a/src/main/org/apache/tools/ant/util/ReflectUtil.java
+++ b/src/main/org/apache/tools/ant/util/ReflectUtil.java
@@ -91,7 +91,7 @@ public class ReflectUtil {
method = ((Class<?>) obj).getMethod(
methodName, (Class[]) null);
return method.invoke(obj, (Object[]) null);
- } catch (Exception t) {
+ } catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java
index 0c319ad..004cb6c 100644
--- a/src/main/org/apache/tools/ant/util/ResourceUtils.java
+++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java
@@ -72,7 +72,7 @@ public class ResourceUtils {
*/
public static final String ISO_8859_1 = "ISO-8859-1";
- private static final long MAX_IO_CHUNK_SIZE = 16*1024*1024l; // 16 MB
+ private static final long MAX_IO_CHUNK_SIZE = 16 * 1024 * 1024L; // 16 MB
/**
* Tells which source files should be reprocessed based on the
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/ant/util/optional/ScriptRunner.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/optional/ScriptRunner.java b/src/main/org/apache/tools/ant/util/optional/ScriptRunner.java
index 0f4cd1f..45c3ede 100644
--- a/src/main/org/apache/tools/ant/util/optional/ScriptRunner.java
+++ b/src/main/org/apache/tools/ant/util/optional/ScriptRunner.java
@@ -137,12 +137,11 @@ public class ScriptRunner extends ScriptRunnerBase {
* @return BuildException the converted exception.
*/
private BuildException getBuildException(BSFException be) {
- Throwable t = be;
Throwable te = be.getTargetException();
if (te instanceof BuildException) {
return (BuildException) te;
}
- return new BuildException(te == null ? t : te);
+ return new BuildException(te == null ? be : te);
}
private void declareBeans(BSFManager m) throws BSFException {
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/BlockSort.java b/src/main/org/apache/tools/bzip2/BlockSort.java
index 0a50fdf..e2aaf37 100644
--- a/src/main/org/apache/tools/bzip2/BlockSort.java
+++ b/src/main/org/apache/tools/bzip2/BlockSort.java
@@ -291,7 +291,7 @@ class BlockSort {
for (j = i + 1; j <= hi && ec_tmp > eclass[fmap[j]]; j++) {
fmap[j - 1] = fmap[j];
}
- fmap[j-1] = tmp;
+ fmap[j - 1] = tmp;
}
}
@@ -312,7 +312,9 @@ class BlockSort {
private void fvswap(int[] fmap, int yyp1, int yyp2, int yyn) {
while (yyn > 0) {
fswap(fmap, yyp1, yyp2);
- yyp1++; yyp2++; yyn--;
+ yyp1++;
+ yyp2++;
+ yyn--;
}
}
@@ -326,7 +328,7 @@ class BlockSort {
}
private int[] fpop(int sp) {
- return new int[] { stack_ll[sp], stack_hh[sp] };
+ return new int[] {stack_ll[sp], stack_hh[sp]};
}
/**
@@ -351,7 +353,8 @@ class BlockSort {
while (sp > 0) {
int[] s = fpop(--sp);
- lo = s[0]; hi = s[1];
+ lo = s[0];
+ hi = s[1];
if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
fallbackSimpleSort(fmap, eclass, lo, hi);
@@ -388,7 +391,8 @@ class BlockSort {
n = eclass[fmap[unLo]] - (int) med;
if (n == 0) {
fswap(fmap, unLo, ltLo);
- ltLo++; unLo++;
+ ltLo++;
+ unLo++;
continue;
}
if (n > 0) {
@@ -403,7 +407,8 @@ class BlockSort {
n = eclass[fmap[unHi]] - (int) med;
if (n == 0) {
fswap(fmap, unHi, gtHi);
- gtHi--; unHi--;
+ gtHi--;
+ unHi--;
continue;
}
if (n < 0) {
@@ -414,7 +419,9 @@ class BlockSort {
if (unLo > unHi) {
break;
}
- fswap(fmap, unLo, unHi); unLo++; unHi--;
+ fswap(fmap, unLo, unHi);
+ unLo++;
+ unHi--;
}
if (gtHi < ltLo) {
@@ -578,9 +585,9 @@ class BlockSort {
* Possibly because the number of elems to sort is usually small, typically
* <= 20.
*/
- private static final int[] INCS = { 1, 4, 13, 40, 121, 364, 1093, 3280,
- 9841, 29524, 88573, 265720, 797161,
- 2391484 };
+ private static final int[] INCS = {1, 4, 13, 40, 121, 364, 1093, 3280,
+ 9841, 29524, 88573, 265720, 797161,
+ 2391484};
/**
* This is the most hammered method of this class.
@@ -637,17 +644,17 @@ class BlockSort {
// unrolled version:
// start inline mainGTU
- boolean onceRunned = false;
+ boolean onceRun = false;
int a = 0;
HAMMER: while (true) {
- if (onceRunned) {
+ if (onceRun) {
fmap[j] = a;
if ((j -= h) <= mj) { //NOSONAR
break HAMMER;
}
} else {
- onceRunned = true;
+ onceRun = true;
}
a = fmap[j - h];
@@ -938,7 +945,7 @@ class BlockSort {
for (int i = 0; i < BZip2Constants.NUM_OVERSHOOT_BYTES; i++) {
block[lastShadow + i + 2] = block[(i % (lastShadow + 1)) + 1];
}
- for (int i = lastShadow + BZip2Constants.NUM_OVERSHOOT_BYTES +1; --i >= 0;) {
+ for (int i = lastShadow + BZip2Constants.NUM_OVERSHOOT_BYTES + 1; --i >= 0;) {
quadrant[i] = 0;
}
block[0] = block[lastShadow + 1];
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
index dd118ea..a5ca068 100644
--- a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
+++ b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
@@ -203,9 +203,10 @@ public class CBZip2OutputStream extends OutputStream
* Possibly because the number of elems to sort is usually small, typically
* <= 20.
*/
- private static final int[] INCS = { 1, 4, 13, 40, 121, 364, 1093, 3280,
- 9841, 29524, 88573, 265720, 797161,
- 2391484 };
+ @SuppressWarnings("unused")
+ private static final int[] INCS = {1, 4, 13, 40, 121, 364, 1093, 3280,
+ 9841, 29524, 88573, 265720, 797161,
+ 2391484};
/**
* This method is accessible by subclasses for historical
@@ -675,41 +676,34 @@ public class CBZip2OutputStream extends OutputStream
int runLengthShadow = this.runLength;
this.crc.updateCRC(currentCharShadow, runLengthShadow);
+ final byte[] block = dataShadow.block;
switch (runLengthShadow) {
- case 1:
- dataShadow.block[lastShadow + 2] = ch;
- this.last = lastShadow + 1;
- break;
-
- case 2:
- dataShadow.block[lastShadow + 2] = ch;
- dataShadow.block[lastShadow + 3] = ch;
- this.last = lastShadow + 2;
- break;
-
- case 3: {
- final byte[] block = dataShadow.block;
- block[lastShadow + 2] = ch;
- block[lastShadow + 3] = ch;
- block[lastShadow + 4] = ch;
- this.last = lastShadow + 3;
- }
- break;
-
- default: {
- runLengthShadow -= 4;
- dataShadow.inUse[runLengthShadow] = true;
- final byte[] block = dataShadow.block;
- block[lastShadow + 2] = ch;
- block[lastShadow + 3] = ch;
- block[lastShadow + 4] = ch;
- block[lastShadow + 5] = ch;
- block[lastShadow + 6] = (byte) runLengthShadow;
- this.last = lastShadow + 5;
- }
- break;
-
+ case 1:
+ block[lastShadow + 2] = ch;
+ this.last = lastShadow + 1;
+ break;
+ case 2:
+ block[lastShadow + 2] = ch;
+ block[lastShadow + 3] = ch;
+ this.last = lastShadow + 2;
+ break;
+ case 3:
+ block[lastShadow + 2] = ch;
+ block[lastShadow + 3] = ch;
+ block[lastShadow + 4] = ch;
+ this.last = lastShadow + 3;
+ break;
+ default:
+ runLengthShadow -= 4;
+ dataShadow.inUse[runLengthShadow] = true;
+ block[lastShadow + 2] = ch;
+ block[lastShadow + 3] = ch;
+ block[lastShadow + 4] = ch;
+ block[lastShadow + 5] = ch;
+ block[lastShadow + 6] = (byte) runLengthShadow;
+ this.last = lastShadow + 5;
+ break;
}
} else {
endBlock();
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/mail/MailMessage.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/mail/MailMessage.java b/src/main/org/apache/tools/mail/MailMessage.java
index 7287501..b1ca493 100644
--- a/src/main/org/apache/tools/mail/MailMessage.java
+++ b/src/main/org/apache/tools/mail/MailMessage.java
@@ -65,7 +65,7 @@ import java.util.Vector;
*
* Enumeration enum = req.getParameterNames();
* while (enum.hasMoreElements()) {
- * String name = (String)enum.nextElement();
+ * String name = (String) enum.nextElement();
* String value = req.getParameter(name);
* out.println(name + " = " + value);
* }
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/tar/TarBuffer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarBuffer.java b/src/main/org/apache/tools/tar/TarBuffer.java
index b089d9b..252d88c 100644
--- a/src/main/org/apache/tools/tar/TarBuffer.java
+++ b/src/main/org/apache/tools/tar/TarBuffer.java
@@ -333,7 +333,7 @@ public class TarBuffer {
}
if (outStream == null) {
- if (inStream == null){
+ if (inStream == null) {
throw new IOException("Output buffer is closed");
}
throw new IOException("writing to an input buffer");
@@ -373,7 +373,7 @@ public class TarBuffer {
}
if (outStream == null) {
- if (inStream == null){
+ if (inStream == null) {
throw new IOException("Output buffer is closed");
}
throw new IOException("writing to an input buffer");
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/tar/TarEntry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarEntry.java b/src/main/org/apache/tools/tar/TarEntry.java
index fad702f..c44e47f 100644
--- a/src/main/org/apache/tools/tar/TarEntry.java
+++ b/src/main/org/apache/tools/tar/TarEntry.java
@@ -989,34 +989,33 @@ public class TarEntry implements TarConstants {
int type = evaluateType(header);
switch (type) {
- case FORMAT_OLDGNU: {
- offset += ATIMELEN_GNU;
- offset += CTIMELEN_GNU;
- offset += OFFSETLEN_GNU;
- offset += LONGNAMESLEN_GNU;
- offset += PAD2LEN_GNU;
- offset += SPARSELEN_GNU;
- isExtended = TarUtils.parseBoolean(header, offset);
- offset += ISEXTENDEDLEN_GNU;
- realSize = TarUtils.parseOctal(header, offset, REALSIZELEN_GNU);
- offset += REALSIZELEN_GNU;
- break;
- }
- case FORMAT_POSIX:
- default: {
- String prefix = oldStyle
- ? TarUtils.parseName(header, offset, PREFIXLEN)
- : TarUtils.parseName(header, offset, PREFIXLEN, encoding);
- // SunOS tar -E does not add / to directory names, so fix
- // up to be consistent
- if (isDirectory() && !name.endsWith("/")) {
- name = name + "/";
+ case FORMAT_OLDGNU: {
+ offset += ATIMELEN_GNU;
+ offset += CTIMELEN_GNU;
+ offset += OFFSETLEN_GNU;
+ offset += LONGNAMESLEN_GNU;
+ offset += PAD2LEN_GNU;
+ offset += SPARSELEN_GNU;
+ isExtended = TarUtils.parseBoolean(header, offset);
+ offset += ISEXTENDEDLEN_GNU;
+ realSize = TarUtils.parseOctal(header, offset, REALSIZELEN_GNU);
+ offset += REALSIZELEN_GNU;
+ break;
}
- if (prefix.length() > 0) {
- name = prefix + "/" + name;
+ case FORMAT_POSIX:
+ default: {
+ String prefix = oldStyle ? TarUtils.parseName(header, offset, PREFIXLEN)
+ : TarUtils.parseName(header, offset, PREFIXLEN, encoding);
+ // SunOS tar -E does not add / to directory names, so fix
+ // up to be consistent
+ if (isDirectory() && !name.endsWith("/")) {
+ name = name + "/";
+ }
+ if (prefix.length() > 0) {
+ name = prefix + "/" + name;
+ }
}
}
- }
}
/**
@@ -1116,9 +1115,9 @@ public class TarEntry implements TarConstants {
final byte[] buffer1, final int offset1, final int length1,
final byte[] buffer2, final int offset2, final int length2,
boolean ignoreTrailingNulls) {
- int minLen=length1 < length2 ? length1 : length2;
- for (int i=0; i < minLen; i++) {
- if (buffer1[offset1+i] != buffer2[offset2+i]) {
+ int minLen = (length1 < length2) ? length1 : length2;
+ for (int i = 0; i < minLen; i++) {
+ if (buffer1[offset1 + i] != buffer2[offset2 + i]) {
return false;
}
}
@@ -1126,15 +1125,15 @@ public class TarEntry implements TarConstants {
return true;
}
if (ignoreTrailingNulls) {
- if (length1 > length2){
- for(int i = length2; i < length1; i++){
- if (buffer1[offset1+i] != 0) {
+ if (length1 > length2) {
+ for (int i = length2; i < length1; i++) {
+ if (buffer1[offset1 + i] != 0) {
return false;
}
}
} else {
- for (int i = length1; i < length2; i++){
- if (buffer2[offset2+i] != 0) {
+ for (int i = length1; i < length2; i++) {
+ if (buffer2[offset2 + i] != 0) {
return false;
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/tar/TarInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarInputStream.java b/src/main/org/apache/tools/tar/TarInputStream.java
index bacc200..9715992 100644
--- a/src/main/org/apache/tools/tar/TarInputStream.java
+++ b/src/main/org/apache/tools/tar/TarInputStream.java
@@ -331,11 +331,11 @@ public class TarInputStream extends FilterInputStream {
currEntry.setName(encoding.decode(longNameData));
}
- if (currEntry.isPaxHeader()){ // Process Pax headers
+ if (currEntry.isPaxHeader()) { // Process Pax headers
paxHeaders();
}
- if (currEntry.isGNUSparse()){ // Process sparse files
+ if (currEntry.isGNUSparse()) { // Process sparse files
readGNUSparse();
}
@@ -414,7 +414,7 @@ public class TarInputStream extends FilterInputStream {
return hasHitEOF ? null : headerBuf;
}
- private void paxHeaders() throws IOException{
+ private void paxHeaders() throws IOException {
Map<String, String> headers = parsePaxHeaders(this);
getNextEntry(); // Get the actual file entry
applyPaxHeadersToCurrentEntry(headers);
@@ -423,18 +423,18 @@ public class TarInputStream extends FilterInputStream {
Map<String, String> parsePaxHeaders(InputStream i) throws IOException {
Map<String, String> headers = new HashMap<String, String>();
// Format is "length keyword=value\n";
- while(true){ // get length
+ while (true) { // get length
int ch;
int len = 0;
int read = 0;
- while((ch = i.read()) != -1) {
+ while ((ch = i.read()) != -1) {
read++;
- if (ch == ' '){ // End of length string
+ if (ch == ' ') { // End of length string
// Get keyword
ByteArrayOutputStream coll = new ByteArrayOutputStream();
- while((ch = i.read()) != -1) {
+ while ((ch = i.read()) != -1) {
read++;
- if (ch == '='){ // end of keyword
+ if (ch == '=') { // end of keyword
String keyword = coll.toString("UTF-8");
// Get rest of entry
final int restLen = len - read;
@@ -463,7 +463,7 @@ public class TarInputStream extends FilterInputStream {
len *= 10;
len += ch - '0';
}
- if (ch == -1){ // EOF
+ if (ch == -1) { // EOF
break;
}
}
@@ -482,28 +482,28 @@ public class TarInputStream extends FilterInputStream {
* uid,uname
* SCHILY.devminor, SCHILY.devmajor: don't have setters/getters for those
*/
- for (Entry<String, String> ent : headers.entrySet()){
+ for (Entry<String, String> ent : headers.entrySet()) {
String key = ent.getKey();
String val = ent.getValue();
- if ("path".equals(key)){
+ if ("path".equals(key)) {
currEntry.setName(val);
- } else if ("linkpath".equals(key)){
+ } else if ("linkpath".equals(key)) {
currEntry.setLinkName(val);
- } else if ("gid".equals(key)){
+ } else if ("gid".equals(key)) {
currEntry.setGroupId(Long.parseLong(val));
- } else if ("gname".equals(key)){
+ } else if ("gname".equals(key)) {
currEntry.setGroupName(val);
- } else if ("uid".equals(key)){
+ } else if ("uid".equals(key)) {
currEntry.setUserId(Long.parseLong(val));
- } else if ("uname".equals(key)){
+ } else if ("uname".equals(key)) {
currEntry.setUserName(val);
- } else if ("size".equals(key)){
+ } else if ("size".equals(key)) {
currEntry.setSize(Long.parseLong(val));
- } else if ("mtime".equals(key)){
+ } else if ("mtime".equals(key)) {
currEntry.setModTime((long) (Double.parseDouble(val) * 1000));
- } else if ("SCHILY.devminor".equals(key)){
+ } else if ("SCHILY.devminor".equals(key)) {
currEntry.setDevMinor(Integer.parseInt(val));
- } else if ("SCHILY.devmajor".equals(key)){
+ } else if ("SCHILY.devmajor".equals(key)) {
currEntry.setDevMajor(Integer.parseInt(val));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/tar/TarOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarOutputStream.java b/src/main/org/apache/tools/tar/TarOutputStream.java
index f2f0943..217ed20 100644
--- a/src/main/org/apache/tools/tar/TarOutputStream.java
+++ b/src/main/org/apache/tools/tar/TarOutputStream.java
@@ -246,7 +246,7 @@ public class TarOutputStream extends FilterOutputStream {
*/
@Override
public void close() throws IOException {
- if(!finished) {
+ if (!finished) {
finish();
}
@@ -279,7 +279,7 @@ public class TarOutputStream extends FilterOutputStream {
* @throws IOException on error
*/
public void putNextEntry(TarEntry entry) throws IOException {
- if(finished) {
+ if (finished) {
throw new IOException("Stream has already been finished");
}
Map<String, String> paxHeaders = new HashMap<String, String>();
@@ -342,7 +342,7 @@ public class TarOutputStream extends FilterOutputStream {
if (finished) {
throw new IOException("Stream has already been finished");
}
- if (!haveUnclosedEntry){
+ if (!haveUnclosedEntry) {
throw new IOException("No current entry to close");
}
if (assemLen > 0) {
@@ -624,7 +624,7 @@ public class TarOutputStream extends FilterOutputStream {
* @param fieldName the name of the field
* @return whether a pax header has been written.
*/
- private boolean handleLongName(TarEntry entry , String name,
+ private boolean handleLongName(TarEntry entry, String name,
Map<String, String> paxHeaders,
String paxHeaderName, byte linkType, String fieldName)
throws IOException {
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/tar/TarUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarUtils.java b/src/main/org/apache/tools/tar/TarUtils.java
index 70e6a44..93d1583 100644
--- a/src/main/org/apache/tools/tar/TarUtils.java
+++ b/src/main/org/apache/tools/tar/TarUtils.java
@@ -46,7 +46,9 @@ public class TarUtils {
* Encapsulates the algorithms used up to Ant 1.8 as ZipEncoding.
*/
static final ZipEncoding FALLBACK_ENCODING = new ZipEncoding() {
- public boolean canEncode(final String name) { return true; }
+ public boolean canEncode(final String name) {
+ return true;
+ }
public ByteBuffer encode(final String name) {
final int length = name.length();
@@ -76,7 +78,7 @@ public class TarUtils {
};
/** Private constructor to prevent instantiation of this utility class. */
- private TarUtils(){
+ private TarUtils() {
}
/**
@@ -105,8 +107,8 @@ public class TarUtils {
int end = offset + length;
int start = offset;
- if (length < 2){
- throw new IllegalArgumentException("Length "+length+" must be at least 2");
+ if (length < 2) {
+ throw new IllegalArgumentException("Length " + length + " must be at least 2");
}
if (buffer[start] == 0) {
@@ -114,8 +116,8 @@ public class TarUtils {
}
// Skip leading spaces
- while (start < end){
- if (buffer[start] == ' '){
+ while (start < end) {
+ if (buffer[start] == ' ') {
start++;
} else {
break;
@@ -132,15 +134,16 @@ public class TarUtils {
trailer = buffer[end - 1];
}
- for ( ;start < end; start++) {
+ while (start < end) {
final byte currentByte = buffer[start];
// CheckStyle:MagicNumber OFF
- if (currentByte < '0' || currentByte > '7'){
+ if (currentByte < '0' || currentByte > '7') {
throw new IllegalArgumentException(
exceptionMessage(buffer, offset, length, start, currentByte));
}
result = (result << 3) + (currentByte - '0'); // convert from ASCII
// CheckStyle:MagicNumber ON
+ start++;
}
return result;
@@ -179,10 +182,9 @@ public class TarUtils {
final int length,
final boolean negative) {
if (length >= 9) {
- throw new IllegalArgumentException("At offset " + offset + ", "
- + length + " byte binary number"
- + " exceeds maximum signed long"
- + " value");
+ throw new IllegalArgumentException(String.format(
+ "At offset %d, %d byte binary number exceeds maximum signed long value",
+ offset, length));
}
long val = 0;
for (int i = 1; i < length; i++) {
@@ -208,10 +210,9 @@ public class TarUtils {
val = val.add(BigInteger.valueOf(-1)).not();
}
if (val.bitLength() > 63) {
- throw new IllegalArgumentException("At offset " + offset + ", "
- + length + " byte binary number"
- + " exceeds maximum signed long"
- + " value");
+ throw new IllegalArgumentException(String.format(
+ "At offset %d, %d byte binary number exceeds maximum signed long value",
+ offset, length));
}
return negative ? -val.longValue() : val.longValue();
}
@@ -242,9 +243,9 @@ public class TarUtils {
// can throw an IOException which parseOctal* doesn't declare
String string = new String(buffer, offset, length);
- string=string.replaceAll("\0", "{NUL}"); // Replace NULs to allow string to be printed
- final String s = "Invalid byte "+currentByte+" at offset "+(current-offset)+" in '"+string+"' len="+length;
- return s;
+ string = string.replaceAll("\0", "{NUL}"); // Replace NULs to allow string to be printed
+ return String.format("Invalid byte %s at offset %d in '%s' len=%d",
+ currentByte, current - offset, string, length);
}
/**
@@ -390,9 +391,10 @@ public class TarUtils {
val = val >>> 3;
// CheckStyle:MagicNumber ON
}
- if (val != 0){
- throw new IllegalArgumentException
- (value+"="+Long.toOctalString(value)+ " will not fit in octal number buffer of length "+length);
+ if (val != 0) {
+ throw new IllegalArgumentException(String.format(
+ "%d=%s will not fit in octal number buffer of length %d",
+ value, Long.toOctalString(value), length));
}
}
@@ -417,7 +419,7 @@ public class TarUtils {
*/
public static int formatOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
- int idx=length-2; // For space and trailing null
+ int idx = length - 2; // For space and trailing null
formatUnsignedOctalString(value, buf, offset, idx);
buf[offset + idx++] = (byte) ' '; // Trailing space
@@ -442,7 +444,7 @@ public class TarUtils {
*/
public static int formatLongOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
- final int idx=length-1; // For space
+ final int idx = length - 1; // For space
formatUnsignedOctalString(value, buf, offset, idx);
buf[offset + idx] = (byte) ' '; // Trailing space
@@ -538,11 +540,11 @@ public class TarUtils {
*/
public static int formatCheckSumOctalBytes(final long value, final byte[] buf, final int offset, final int length) {
- int idx=length-2; // for NUL and space
+ int idx = length - 2; // for NUL and space
formatUnsignedOctalString(value, buf, offset, idx);
- buf[offset + idx++] = 0; // Trailing null
- buf[offset + idx] = (byte) ' '; // Trailing space
+ buf[offset + idx++] = 0; // Trailing null
+ buf[offset + idx] = (byte) ' '; // Trailing space
return offset + length;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ExtraFieldUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ExtraFieldUtils.java b/src/main/org/apache/tools/zip/ExtraFieldUtils.java
index d7a6c9d..18bb850 100644
--- a/src/main/org/apache/tools/zip/ExtraFieldUtils.java
+++ b/src/main/org/apache/tools/zip/ExtraFieldUtils.java
@@ -140,45 +140,38 @@ public class ExtraFieldUtils {
ZipShort headerId = new ZipShort(data, start);
int length = (new ZipShort(data, start + 2)).getValue();
if (start + WORD + length > data.length) {
- switch(onUnparseableData.getKey()) {
- case UnparseableExtraField.THROW_KEY:
- throw new ZipException("bad extra field starting at "
- + start + ". Block length of "
- + length + " bytes exceeds remaining"
- + " data of "
- + (data.length - start - WORD)
- + " bytes.");
- case UnparseableExtraField.READ_KEY:
- UnparseableExtraFieldData field =
- new UnparseableExtraFieldData();
- if (local) {
- field.parseFromLocalFileData(data, start,
- data.length - start);
- } else {
- field.parseFromCentralDirectoryData(data, start,
- data.length - start);
- }
- v.add(field);
- //$FALL-THROUGH$
- case UnparseableExtraField.SKIP_KEY:
- // since we cannot parse the data we must assume
- // the extra field consumes the whole rest of the
- // available data
- break LOOP;
- default:
- throw new ZipException("unknown UnparseableExtraField key: "
- + onUnparseableData.getKey());
+ switch (onUnparseableData.getKey()) {
+ case UnparseableExtraField.THROW_KEY:
+ throw new ZipException("bad extra field starting at "
+ + start + ". Block length of " + length
+ + " bytes exceeds remaining data of "
+ + (data.length - start - WORD) + " bytes.");
+ case UnparseableExtraField.READ_KEY:
+ UnparseableExtraFieldData field = new UnparseableExtraFieldData();
+ if (local) {
+ field.parseFromLocalFileData(data, start, data.length - start);
+ } else {
+ field.parseFromCentralDirectoryData(data, start, data.length - start);
+ }
+ v.add(field);
+ //$FALL-THROUGH$
+ case UnparseableExtraField.SKIP_KEY:
+ // since we cannot parse the data we must assume
+ // the extra field consumes the whole rest of the
+ // available data
+ break LOOP;
+ default:
+ throw new ZipException("unknown UnparseableExtraField key: "
+ + onUnparseableData.getKey());
}
}
try {
ZipExtraField ze = createExtraField(headerId);
- if (local
- || !(ze instanceof CentralDirectoryParsingZipExtraField)) {
+ if (local || !(ze instanceof CentralDirectoryParsingZipExtraField)) {
ze.parseFromLocalFileData(data, start + WORD, length);
} else {
((CentralDirectoryParsingZipExtraField) ze)
- .parseFromCentralDirectoryData(data, start + WORD,
- length);
+ .parseFromCentralDirectoryData(data, start + WORD, length);
}
v.add(ze);
} catch (InstantiationException ie) {
@@ -201,9 +194,8 @@ public class ExtraFieldUtils {
*/
public static byte[] mergeLocalFileDataData(ZipExtraField[] data) {
final boolean lastIsUnparseableHolder = data.length > 0
- && data[data.length - 1] instanceof UnparseableExtraFieldData;
- int regularExtraFieldCount =
- lastIsUnparseableHolder ? data.length - 1 : data.length;
+ && data[data.length - 1] instanceof UnparseableExtraFieldData;
+ int regularExtraFieldCount = lastIsUnparseableHolder ? data.length - 1 : data.length;
int sum = WORD * regularExtraFieldCount;
for (ZipExtraField element : data) {
@@ -214,9 +206,9 @@ public class ExtraFieldUtils {
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
- 0, result, start, 2);
+ 0, result, start, 2);
System.arraycopy(data[i].getLocalFileDataLength().getBytes(),
- 0, result, start + 2, 2);
+ 0, result, start + 2, 2);
byte[] local = data[i].getLocalFileDataData();
System.arraycopy(local, 0, result, start + WORD, local.length);
start += (local.length + WORD);
@@ -237,8 +229,7 @@ public class ExtraFieldUtils {
public static byte[] mergeCentralDirectoryData(ZipExtraField[] data) {
final boolean lastIsUnparseableHolder = data.length > 0
&& data[data.length - 1] instanceof UnparseableExtraFieldData;
- int regularExtraFieldCount =
- lastIsUnparseableHolder ? data.length - 1 : data.length;
+ int regularExtraFieldCount = lastIsUnparseableHolder ? data.length - 1 : data.length;
int sum = WORD * regularExtraFieldCount;
for (ZipExtraField element : data) {
@@ -283,22 +274,19 @@ public class ExtraFieldUtils {
/**
* Throw an exception if field cannot be parsed.
*/
- public static final UnparseableExtraField THROW
- = new UnparseableExtraField(THROW_KEY);
+ public static final UnparseableExtraField THROW = new UnparseableExtraField(THROW_KEY);
/**
* Skip the extra field entirely and don't make its data
* available - effectively removing the extra field data.
*/
- public static final UnparseableExtraField SKIP
- = new UnparseableExtraField(SKIP_KEY);
+ public static final UnparseableExtraField SKIP = new UnparseableExtraField(SKIP_KEY);
/**
* Read the extra field data into an instance of {@link
* UnparseableExtraFieldData UnparseableExtraFieldData}.
*/
- public static final UnparseableExtraField READ
- = new UnparseableExtraField(READ_KEY);
+ public static final UnparseableExtraField READ = new UnparseableExtraField(READ_KEY);
private final int key;
@@ -311,6 +299,8 @@ public class ExtraFieldUtils {
*
* @return int
*/
- public int getKey() { return key; }
+ public int getKey() {
+ return key;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/FallbackZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/FallbackZipEncoding.java b/src/main/org/apache/tools/zip/FallbackZipEncoding.java
index 96cff33..7e0f315 100644
--- a/src/main/org/apache/tools/zip/FallbackZipEncoding.java
+++ b/src/main/org/apache/tools/zip/FallbackZipEncoding.java
@@ -85,7 +85,7 @@ class FallbackZipEncoding implements ZipEncoding {
if (this.charset == null) { // i.e. use default charset, see no-args constructor
return new String(data);
} else {
- return new String(data,this.charset);
+ return new String(data, this.charset);
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/GeneralPurposeBit.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/GeneralPurposeBit.java b/src/main/org/apache/tools/zip/GeneralPurposeBit.java
index 3246fbe..f5f353c 100644
--- a/src/main/org/apache/tools/zip/GeneralPurposeBit.java
+++ b/src/main/org/apache/tools/zip/GeneralPurposeBit.java
@@ -27,7 +27,7 @@ public final class GeneralPurposeBit implements Cloneable {
/**
* Indicates that the file is encrypted.
*/
- private static final int ENCRYPTION_FLAG = 1 << 0;
+ private static final int ENCRYPTION_FLAG = 1;
/**
* Indicates that a data descriptor stored after the file contents
@@ -155,13 +155,10 @@ public final class GeneralPurposeBit implements Cloneable {
*/
public void encode(byte[] buf, int offset) {
ZipShort.putShort((dataDescriptorFlag ? DATA_DESCRIPTOR_FLAG : 0)
- |
- (languageEncodingFlag ? UFT8_NAMES_FLAG : 0)
- |
- (encryptionFlag ? ENCRYPTION_FLAG : 0)
- |
- (strongEncryptionFlag ? STRONG_ENCRYPTION_FLAG : 0)
- , buf, offset);
+ | (languageEncodingFlag ? UFT8_NAMES_FLAG : 0)
+ | (encryptionFlag ? ENCRYPTION_FLAG : 0)
+ | (strongEncryptionFlag ? STRONG_ENCRYPTION_FLAG : 0),
+ buf, offset);
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/NioZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/NioZipEncoding.java b/src/main/org/apache/tools/zip/NioZipEncoding.java
index 462b519..f566615 100644
--- a/src/main/org/apache/tools/zip/NioZipEncoding.java
+++ b/src/main/org/apache/tools/zip/NioZipEncoding.java
@@ -75,7 +75,7 @@ class NioZipEncoding implements ZipEncoding {
+ (name.length() + 1) / 2);
while (cb.remaining() > 0) {
- final CoderResult res = enc.encode(cb, out,true);
+ final CoderResult res = enc.encode(cb, out, true);
if (res.isUnmappable() || res.isMalformed()) {
@@ -86,8 +86,8 @@ class NioZipEncoding implements ZipEncoding {
+ res.length() * 6);
}
- for (int i=0; i<res.length(); ++i) {
- ZipEncodingHelper.appendSurrogate(out,cb.get());
+ for (int i = 0; i < res.length(); ++i) {
+ ZipEncodingHelper.appendSurrogate(out, cb.get());
}
} else if (res.isOverflow()) {
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java b/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
index cd40070..261beec 100644
--- a/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
+++ b/src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
@@ -216,7 +216,7 @@ class Simple8BitZipEncoding implements ZipEncoding {
*/
public boolean canEncode(final String name) {
- for (int i=0;i<name.length();++i) {
+ for (int i = 0; i < name.length(); ++i) {
final char c = name.charAt(i);
@@ -235,17 +235,15 @@ class Simple8BitZipEncoding implements ZipEncoding {
ByteBuffer out = ByteBuffer.allocate(name.length()
+ 6 + (name.length() + 1) / 2);
- for (int i=0;i<name.length();++i) {
-
+ for (int i = 0; i < name.length(); ++i) {
final char c = name.charAt(i);
if (out.remaining() < 6) {
- out = ZipEncodingHelper.growBuffer(out,out.position() + 6);
+ out = ZipEncodingHelper.growBuffer(out, out.position() + 6);
}
- if (!this.pushEncodedChar(out,c)) {
-
- ZipEncodingHelper.appendSurrogate(out,c);
+ if (!this.pushEncodedChar(out, c)) {
+ ZipEncodingHelper.appendSurrogate(out, c);
}
}
@@ -258,9 +256,9 @@ class Simple8BitZipEncoding implements ZipEncoding {
* @see org.apache.tools.zip.ZipEncoding#decode(byte[])
*/
public String decode(final byte[] data) throws IOException {
- final char [] ret = new char[data.length];
+ final char[] ret = new char[data.length];
- for (int i=0;i<data.length;++i) {
+ for (int i = 0; i < data.length; ++i) {
ret[i] = this.decodeByte(data[i]);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java b/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
index ccc51fa..62be2a3 100644
--- a/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
+++ b/src/main/org/apache/tools/zip/UnicodeCommentExtraField.java
@@ -32,7 +32,7 @@ public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
public static final ZipShort UCOM_ID = new ZipShort(0x6375);
- public UnicodeCommentExtraField () {
+ public UnicodeCommentExtraField() {
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/UnixStat.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/UnixStat.java b/src/main/org/apache/tools/zip/UnixStat.java
index 2ca0674..0863759 100644
--- a/src/main/org/apache/tools/zip/UnixStat.java
+++ b/src/main/org/apache/tools/zip/UnixStat.java
@@ -30,7 +30,7 @@ public interface UnixStat {
*
* @since 1.1
*/
- int PERM_MASK = 07777;
+ int PERM_MASK = 07777;
/**
* Indicates symbolic links.
*
@@ -48,7 +48,7 @@ public interface UnixStat {
*
* @since 1.1
*/
- int DIR_FLAG = 040000;
+ int DIR_FLAG = 040000;
// ----------------------------------------------------------
// somewhat arbitrary choices that are quite common for shared
@@ -60,17 +60,17 @@ public interface UnixStat {
*
* @since 1.1
*/
- int DEFAULT_LINK_PERM = 0777;
+ int DEFAULT_LINK_PERM = 0777;
/**
* Default permissions for directories.
*
* @since 1.1
*/
- int DEFAULT_DIR_PERM = 0755;
+ int DEFAULT_DIR_PERM = 0755;
/**
* Default permissions for plain files.
*
* @since 1.1
*/
- int DEFAULT_FILE_PERM = 0644;
+ int DEFAULT_FILE_PERM = 0644;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
index 52df40d..34e2117 100644
--- a/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
+++ b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
@@ -28,7 +28,7 @@ import java.util.zip.ZipException;
public class UnsupportedZipFeatureException extends ZipException {
private final Feature reason;
- private transient final ZipEntry entry;
+ private final transient ZipEntry entry;
private static final long serialVersionUID = 20161221L;
/**
@@ -65,6 +65,7 @@ public class UnsupportedZipFeatureException extends ZipException {
/**
* ZIP Features that may or may not be supported.
*/
+ @SuppressWarnings("serial")
public static class Feature implements java.io.Serializable {
/**
* The entry is encrypted.
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java b/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java
index 2cc0a53..3107aaa 100644
--- a/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java
+++ b/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java
@@ -72,7 +72,8 @@ public class Zip64ExtendedInformationExtraField
*
* @param size the entry's original size
* @param compressedSize the entry's compressed size
- *
+ * @param relativeHeaderOffset ZipEightByteInteger
+ * @param diskStart ZipLong
* @throws IllegalArgumentException if size or compressedSize is null
*/
public Zip64ExtendedInformationExtraField(ZipEightByteInteger size,
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipEightByteInteger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipEightByteInteger.java b/src/main/org/apache/tools/zip/ZipEightByteInteger.java
index 8d582dd..ca29160 100644
--- a/src/main/org/apache/tools/zip/ZipEightByteInteger.java
+++ b/src/main/org/apache/tools/zip/ZipEightByteInteger.java
@@ -82,7 +82,7 @@ public final class ZipEightByteInteger {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger (byte[] bytes) {
+ public ZipEightByteInteger(byte[] bytes) {
this(bytes, 0);
}
@@ -91,7 +91,7 @@ public final class ZipEightByteInteger {
* @param bytes the bytes to store as a ZipEightByteInteger
* @param offset the offset to start
*/
- public ZipEightByteInteger (byte[] bytes, int offset) {
+ public ZipEightByteInteger(byte[] bytes, int offset) {
value = ZipEightByteInteger.getValue(bytes, offset);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipEncoding.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipEncoding.java b/src/main/org/apache/tools/zip/ZipEncoding.java
index 719caf5..1e0034a 100644
--- a/src/main/org/apache/tools/zip/ZipEncoding.java
+++ b/src/main/org/apache/tools/zip/ZipEncoding.java
@@ -80,5 +80,5 @@ public interface ZipEncoding {
* @return The decoded string.
* @throws IOException if something goes wrong
*/
- String decode(byte [] data) throws IOException;
+ String decode(byte[] data) throws IOException;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipEncodingHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipEncodingHelper.java b/src/main/org/apache/tools/zip/ZipEncodingHelper.java
index 4d3dab9..b9d4447 100644
--- a/src/main/org/apache/tools/zip/ZipEncodingHelper.java
+++ b/src/main/org/apache/tools/zip/ZipEncodingHelper.java
@@ -37,7 +37,7 @@ public abstract class ZipEncodingHelper {
*/
private static class SimpleEncodingHolder {
- private final char [] highChars;
+ private final char[] highChars;
private Simple8BitZipEncoding encoding;
/**
@@ -47,7 +47,7 @@ public abstract class ZipEncodingHelper {
*
* @see Simple8BitZipEncoding#Simple8BitZipEncoding(char[])
*/
- SimpleEncodingHolder(final char [] highChars) {
+ SimpleEncodingHolder(final char[] highChars) {
this.highChars = highChars;
}
@@ -142,7 +142,7 @@ public abstract class ZipEncodingHelper {
* @param b The original buffer.
* @param newCapacity The minimal requested new capacity.
* @return A byte buffer <code>r</code> with
- * <code>r.capacity() = max(b.capacity()*2,newCapacity)</code> and
+ * <code>r.capacity() = max(b.capacity() * 2,newCapacity)</code> and
* all the data contained in <code>b</code> copied to the beginning
* of <code>r</code>.
*
@@ -163,8 +163,7 @@ public abstract class ZipEncodingHelper {
* The hexadecimal digits <code>0,...,9,A,...,F</code> encoded as
* ASCII bytes.
*/
- private static final byte[] HEX_DIGITS =
- new byte [] {
+ private static final byte[] HEX_DIGITS = new byte[] {
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41,
0x42, 0x43, 0x44, 0x45, 0x46
};
@@ -181,9 +180,9 @@ public abstract class ZipEncodingHelper {
bb.put((byte) '%');
bb.put((byte) 'U');
- bb.put(HEX_DIGITS[(c >> 12)&0x0f]);
- bb.put(HEX_DIGITS[(c >> 8)&0x0f]);
- bb.put(HEX_DIGITS[(c >> 4)&0x0f]);
+ bb.put(HEX_DIGITS[(c >> 12) & 0x0f]);
+ bb.put(HEX_DIGITS[(c >> 8) & 0x0f]);
+ bb.put(HEX_DIGITS[(c >> 4) & 0x0f]);
bb.put(HEX_DIGITS[c & 0x0f]);
}
@@ -223,7 +222,7 @@ public abstract class ZipEncodingHelper {
final SimpleEncodingHolder h = simpleEncodings.get(name);
- if (h!=null) {
+ if (h != null) {
return h.getEncoding();
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipEntry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipEntry.java b/src/main/org/apache/tools/zip/ZipEntry.java
index eac5f63..4d619d3 100644
--- a/src/main/org/apache/tools/zip/ZipEntry.java
+++ b/src/main/org/apache/tools/zip/ZipEntry.java
@@ -110,8 +110,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
final byte[] extra = entry.getExtra();
if (extra != null) {
setExtraFields(ExtraFieldUtils.parse(extra, true,
- ExtraFieldUtils
- .UnparseableExtraField.READ));
+ ExtraFieldUtils.UnparseableExtraField.READ));
} else {
// initializes extra data to an empty byte array
setExtra();
@@ -137,8 +136,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
setExtraFields(getAllExtraFieldsNoCopy());
setPlatform(entry.getPlatform());
GeneralPurposeBit other = entry.getGeneralPurposeBit();
- setGeneralPurposeBit(other == null ? null :
- (GeneralPurposeBit) other.clone());
+ setGeneralPurposeBit(other == null ? null : (GeneralPurposeBit) other.clone());
}
/**
@@ -161,9 +159,8 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
* @param entryName String
*/
public ZipEntry(final File inputFile, final String entryName) {
- this(inputFile.isDirectory() && !entryName.endsWith("/") ?
- entryName + "/" : entryName);
- if (inputFile.isFile()){
+ this(inputFile.isDirectory() && !entryName.endsWith("/") ? entryName + "/" : entryName);
+ if (inputFile.isFile()) {
setSize(inputFile.length());
}
setTime(inputFile.lastModified());
@@ -205,8 +202,8 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
@Override
public void setMethod(final int method) {
if (method < 0) {
- throw new IllegalArgumentException(
- "ZIP compression method can not be negative: " + method);
+ throw new IllegalArgumentException("ZIP compression method can not be negative: "
+ + method);
}
this.method = method;
}
@@ -276,8 +273,8 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
* @since Ant 1.6
*/
public int getUnixMode() {
- return platform != PLATFORM_UNIX ? 0 :
- (int) ((getExternalAttributes() >> SHORT_SHIFT) & SHORT_MASK);
+ return platform != PLATFORM_UNIX ? 0
+ : (int) ((getExternalAttributes() >> SHORT_SHIFT) & SHORT_MASK);
}
/**
@@ -315,7 +312,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
if (field instanceof UnparseableExtraFieldData) {
unparseableExtra = (UnparseableExtraFieldData) field;
} else {
- newFields.add( field);
+ newFields.add(field);
}
}
extraFields = newFields.toArray(new ZipExtraField[newFields.size()]);
@@ -341,9 +338,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
* @since 1.1
*/
public ZipExtraField[] getExtraFields(final boolean includeUnparseable) {
- return includeUnparseable ?
- getAllExtraFields() :
- getParseableExtraFields();
+ return includeUnparseable ? getAllExtraFields() : getParseableExtraFields();
}
private ZipExtraField[] getParseableExtraFieldsNoCopy() {
@@ -355,36 +350,34 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
private ZipExtraField[] getParseableExtraFields() {
final ZipExtraField[] parseableExtraFields = getParseableExtraFieldsNoCopy();
- return (parseableExtraFields == extraFields)
- ? copyOf(parseableExtraFields) : parseableExtraFields;
+ return (parseableExtraFields == extraFields) ? copyOf(parseableExtraFields)
+ : parseableExtraFields;
}
- private ZipExtraField[] copyOf(ZipExtraField[] src){
+ private ZipExtraField[] copyOf(ZipExtraField[] src) {
return copyOf(src, src.length);
}
- private ZipExtraField[] copyOf(ZipExtraField[] src, int length){
+ private ZipExtraField[] copyOf(ZipExtraField[] src, int length) {
ZipExtraField[] cpy = new ZipExtraField[length];
System.arraycopy(src, 0, cpy, 0, Math.min(src.length, length));
return cpy;
}
private ZipExtraField[] getMergedFields() {
- final ZipExtraField[] zipExtraFields =
- copyOf(extraFields, extraFields.length + 1);
+ final ZipExtraField[] zipExtraFields = copyOf(extraFields, extraFields.length + 1);
zipExtraFields[extraFields.length] = unparseableExtra;
return zipExtraFields;
}
private ZipExtraField[] getUnparseableOnly() {
- return unparseableExtra == null
- ? noExtraFields : new ZipExtraField[] { unparseableExtra };
+ return unparseableExtra == null ? noExtraFields : new ZipExtraField[] {unparseableExtra};
}
private ZipExtraField[] getAllExtraFields() {
final ZipExtraField[] allExtraFieldsNoCopy = getAllExtraFieldsNoCopy();
- return (allExtraFieldsNoCopy == extraFields)
- ? copyOf(allExtraFieldsNoCopy) : allExtraFieldsNoCopy;
+ return (allExtraFieldsNoCopy == extraFields) ? copyOf(allExtraFieldsNoCopy)
+ : allExtraFieldsNoCopy;
}
/**
@@ -416,11 +409,10 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
if (extraFields == null) {
extraFields = new ZipExtraField[] {ze};
} else {
- if (getExtraField(ze.getHeaderId()) != null){
+ if (getExtraField(ze.getHeaderId()) != null) {
removeExtraField(ze.getHeaderId());
}
- final ZipExtraField[] zipExtraFields =
- copyOf(extraFields, extraFields.length + 1);
+ final ZipExtraField[] zipExtraFields = copyOf(extraFields, extraFields.length + 1);
zipExtraFields[extraFields.length] = ze;
extraFields = zipExtraFields;
}
@@ -441,14 +433,14 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
if (ze instanceof UnparseableExtraFieldData) {
unparseableExtra = (UnparseableExtraFieldData) ze;
} else {
- if (getExtraField(ze.getHeaderId()) != null){
+ if (getExtraField(ze.getHeaderId()) != null) {
removeExtraField(ze.getHeaderId());
}
ZipExtraField[] copy = extraFields;
- int newLen = extraFields != null ? extraFields.length + 1: 1;
+ int newLen = extraFields != null ? extraFields.length + 1 : 1;
extraFields = new ZipExtraField[newLen];
extraFields[0] = ze;
- if (copy != null){
+ if (copy != null) {
System.arraycopy(copy, 0, extraFields, 1, extraFields.length - 1);
}
}
@@ -467,7 +459,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
}
List<ZipExtraField> newResult = new ArrayList<ZipExtraField>();
for (ZipExtraField extraField : extraFields) {
- if (!type.equals(extraField.getHeaderId())){
+ if (!type.equals(extraField.getHeaderId())) {
newResult.add(extraField);
}
}
@@ -528,9 +520,8 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
@Override
public void setExtra(final byte[] extra) throws RuntimeException {
try {
- final ZipExtraField[] local =
- ExtraFieldUtils.parse(extra, true,
- ExtraFieldUtils.UnparseableExtraField.READ);
+ final ZipExtraField[] local = ExtraFieldUtils.parse(extra, true,
+ ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(local, true);
} catch (final ZipException e) {
// actually this is not be possible as of Ant 1.8.1
@@ -558,9 +549,8 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
*/
public void setCentralDirectoryExtra(final byte[] b) {
try {
- final ZipExtraField[] central =
- ExtraFieldUtils.parse(b, false,
- ExtraFieldUtils.UnparseableExtraField.READ);
+ final ZipExtraField[] central = ExtraFieldUtils.parse(b, false,
+ ExtraFieldUtils.UnparseableExtraField.READ);
mergeExtraFields(central, false);
} catch (final ZipException e) {
throw new RuntimeException(e.getMessage(), e); //NOSONAR
@@ -632,8 +622,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
* @param name the name to use
*/
protected void setName(String name) {
- if (name != null && getPlatform() == PLATFORM_FAT
- && name.indexOf("/") == -1) {
+ if (name != null && getPlatform() == PLATFORM_FAT && !name.contains("/")) {
name = name.replace('\\', '/');
}
this.name = name;
@@ -813,10 +802,8 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
&& getSize() == other.getSize()
&& getCrc() == other.getCrc()
&& getCompressedSize() == other.getCompressedSize()
- && Arrays.equals(getCentralDirectoryExtra(),
- other.getCentralDirectoryExtra())
- && Arrays.equals(getLocalFileDataExtra(),
- other.getLocalFileDataExtra())
+ && Arrays.equals(getCentralDirectoryExtra(), other.getCentralDirectoryExtra())
+ && Arrays.equals(getLocalFileDataExtra(), other.getLocalFileDataExtra())
&& gpb.equals(other.gpb);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipLong.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipLong.java b/src/main/org/apache/tools/zip/ZipLong.java
index 6180823..5932f84 100644
--- a/src/main/org/apache/tools/zip/ZipLong.java
+++ b/src/main/org/apache/tools/zip/ZipLong.java
@@ -75,7 +75,7 @@ public final class ZipLong implements Cloneable {
* @param bytes the bytes to store as a ZipLong
* @since 1.1
*/
- public ZipLong (byte[] bytes) {
+ public ZipLong(byte[] bytes) {
this(bytes, 0);
}
@@ -85,7 +85,7 @@ public final class ZipLong implements Cloneable {
* @param offset the offset to start
* @since 1.1
*/
- public ZipLong (byte[] bytes, int offset) {
+ public ZipLong(byte[] bytes, int offset) {
value = ZipLong.getValue(bytes, offset);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipOutputStream.java b/src/main/org/apache/tools/zip/ZipOutputStream.java
index 3001a72..f2117d8 100644
--- a/src/main/org/apache/tools/zip/ZipOutputStream.java
+++ b/src/main/org/apache/tools/zip/ZipOutputStream.java
@@ -519,7 +519,7 @@ public class ZipOutputStream extends FilterOutputStream {
int count = 0;
for (ZipEntry ze : entries) {
byteArrayOutputStream.write(createCentralFileHeader(ze));
- if (++count > NUM_PER_WRITE){
+ if (++count > NUM_PER_WRITE) {
writeCounted(byteArrayOutputStream.toByteArray());
byteArrayOutputStream.reset();
count = 0;
@@ -663,7 +663,7 @@ public class ZipOutputStream extends FilterOutputStream {
return requestedMode == Zip64Mode.Always || isTooLageForZip32(entry1);
}
- private boolean isTooLageForZip32(ZipEntry zipArchiveEntry){
+ private boolean isTooLageForZip32(ZipEntry zipArchiveEntry) {
return zipArchiveEntry.getSize() >= ZIP64_MAGIC
|| zipArchiveEntry.getCompressedSize() >= ZIP64_MAGIC;
}
@@ -941,7 +941,7 @@ public class ZipOutputStream extends FilterOutputStream {
* @param offset int
* @param length int
*/
- private void writeDeflated(byte[]b, int offset, int length)
+ private void writeDeflated(byte[] b, int offset, int length)
throws IOException {
if (length > 0 && !def.finished()) {
entry.bytesRead += length;
@@ -1070,7 +1070,7 @@ public class ZipOutputStream extends FilterOutputStream {
private byte[] createLocalFileHeader(ZipEntry ze, ByteBuffer name, boolean encodable) {
byte[] extra = ze.getLocalFileDataExtra();
final int nameLen = name.limit() - name.position();
- int len= LFH_FILENAME_OFFSET + nameLen + extra.length;
+ int len = LFH_FILENAME_OFFSET + nameLen + extra.length;
byte[] buf = new byte[len];
System.arraycopy(LFH_SIG, 0, buf, LFH_SIG_OFFSET, WORD);
@@ -1099,7 +1099,7 @@ public class ZipOutputStream extends FilterOutputStream {
// compressed length
// uncompressed length
- if (hasZip64Extra(entry.entry)){
+ if (hasZip64Extra(entry.entry)) {
// point to ZIP64 extended information extra field for
// sizes, may get rewritten once sizes are known if
// stream is seekable
@@ -1243,7 +1243,7 @@ public class ZipOutputStream extends FilterOutputStream {
ByteBuffer commentB = getEntryEncoding(ze).encode(comm);
final int nameLen = name.limit() - name.position();
final int commentLen = commentB.limit() - commentB.position();
- int len= CFH_FILENAME_OFFSET + nameLen + extra.length + commentLen;
+ int len = CFH_FILENAME_OFFSET + nameLen + extra.length + commentLen;
byte[] buf = new byte[len];
System.arraycopy(CFH_SIG, 0, buf, CFH_SIG_OFFSET, WORD);
@@ -1566,9 +1566,8 @@ public class ZipOutputStream extends FilterOutputStream {
}
// requires version 2 as we are going to store length info
// in the data descriptor
- return (isDeflatedToOutputStream(zipMethod)) ?
- DATA_DESCRIPTOR_MIN_VERSION :
- INITIAL_VERSION;
+ return (isDeflatedToOutputStream(zipMethod))
+ ? DATA_DESCRIPTOR_MIN_VERSION : INITIAL_VERSION;
}
private boolean isDeflatedToOutputStream(int zipMethod) {
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipShort.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipShort.java b/src/main/org/apache/tools/zip/ZipShort.java
index 2f5482f..ccbca3d 100644
--- a/src/main/org/apache/tools/zip/ZipShort.java
+++ b/src/main/org/apache/tools/zip/ZipShort.java
@@ -36,7 +36,7 @@ public final class ZipShort implements Cloneable {
* @param value the int to store as a ZipShort
* @since 1.1
*/
- public ZipShort (int value) {
+ public ZipShort(int value) {
this.value = value;
}
@@ -45,7 +45,7 @@ public final class ZipShort implements Cloneable {
* @param bytes the bytes to store as a ZipShort
* @since 1.1
*/
- public ZipShort (byte[] bytes) {
+ public ZipShort(byte[] bytes) {
this(bytes, 0);
}
@@ -55,7 +55,7 @@ public final class ZipShort implements Cloneable {
* @param offset the offset to start
* @since 1.1
*/
- public ZipShort (byte[] bytes, int offset) {
+ public ZipShort(byte[] bytes, int offset) {
value = ZipShort.getValue(bytes, offset);
}
@@ -80,7 +80,7 @@ public final class ZipShort implements Cloneable {
*/
public static void putShort(int value, byte[] buf, int offset) {
buf[offset] = (byte) (value & BYTE_MASK);
- buf[offset+1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
+ buf[offset + 1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/5eef12a9/src/main/org/apache/tools/zip/ZipUtil.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipUtil.java b/src/main/org/apache/tools/zip/ZipUtil.java
index 9926a29..ff35ca4 100644
--- a/src/main/org/apache/tools/zip/ZipUtil.java
+++ b/src/main/org/apache/tools/zip/ZipUtil.java
@@ -76,7 +76,7 @@ public abstract class ZipUtil {
int year = c.get(Calendar.YEAR);
if (year < 1980) {
- System.arraycopy(DOS_TIME_MIN, 0, buf, offset, DOS_TIME_MIN.length);// stop callers from changing the array
+ System.arraycopy(DOS_TIME_MIN, 0, buf, offset, DOS_TIME_MIN.length); // stop callers from changing the array
return;
}
int month = c.get(Calendar.MONTH) + 1;