This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new e716544 Fix some generics. Remove unused exceptions deep in pack200
(maintains binary compatibility but not source compatibility).
e716544 is described below
commit e716544cda2457e73d10d9b32ae939d6f7b11461
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Aug 5 13:31:22 2021 -0400
Fix some generics. Remove unused exceptions deep in pack200 (maintains
binary compatibility but not source compatibility).
---
.../commons/compress/harmony/pack200/NewAttributeBands.java | 12 +++++-------
.../commons/compress/harmony/pack200/Pack200Exception.java | 2 +-
.../apache/commons/compress/harmony/unpack200/Archive.java | 3 +--
.../compress/harmony/unpack200/AttributeLayoutMap.java | 2 +-
.../commons/compress/harmony/unpack200/ClassBands.java | 9 ++++-----
.../compress/harmony/unpack200/NewAttributeBands.java | 10 ++++------
.../apache/commons/compress/harmony/unpack200/Segment.java | 7 +++----
.../commons/compress/harmony/unpack200/SegmentHeader.java | 3 +--
.../harmony/unpack200/bytecode/forms/ByteCodeForm.java | 4 ++--
9 files changed, 22 insertions(+), 30 deletions(-)
diff --git
a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java
b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java
index 984d913..8a34a1d 100644
---
a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java
+++
b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java
@@ -206,18 +206,16 @@ public class NewAttributeBands extends BandSet {
stream.reset();
lastPIntegral = new Integral("P" + (char) stream.read());
return lastPIntegral;
- } else {
- lastPIntegral = new Integral("PO" + (char) stream.read(),
lastPIntegral);
- return lastPIntegral;
}
+ lastPIntegral = new Integral("PO" + (char) stream.read(),
lastPIntegral);
+ return lastPIntegral;
case 'O':
stream.mark(1);
if (stream.read() != 'S') {
stream.reset();
return new Integral("O" + (char) stream.read(), lastPIntegral);
- } else {
- return new Integral("OS" + (char) stream.read(),
lastPIntegral);
}
+ return new Integral("OS" + (char) stream.read(), lastPIntegral);
// Replication
case 'N':
@@ -695,7 +693,7 @@ public class NewAttributeBands extends BandSet {
private int backwardsCallableIndex;
- public Callable(final List body) throws IOException {
+ public Callable(final List body) {
this.body = body;
}
@@ -765,7 +763,7 @@ public class NewAttributeBands extends BandSet {
return tags.contains(Integer.valueOf((int) l));
}
- public UnionCase(final List tags, final List body) throws IOException {
+ public UnionCase(final List tags, final List body) {
this.tags = tags;
this.body = body;
}
diff --git
a/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
b/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
index 7355b47..16a5a2f 100644
---
a/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
+++
b/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
@@ -24,7 +24,7 @@ public class Pack200Exception extends Exception {
private static final long serialVersionUID = 5168177401552611803L;
/**
- * Create a new Pack200 exception with the given message
+ * Creates a new Pack200 exception with the given message
*
* @param message the text message to display
*/
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
index cc059f4..cf998a3 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/Archive.java
@@ -79,9 +79,8 @@ public class Archive {
*
* @param inputStream TODO
* @param outputStream TODO
- * @throws IOException TODO
*/
- public Archive(final InputStream inputStream, final JarOutputStream
outputStream) throws IOException {
+ public Archive(final InputStream inputStream, final JarOutputStream
outputStream) {
this.inputStream = inputStream;
this.outputStream = outputStream;
}
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/AttributeLayoutMap.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/AttributeLayoutMap.java
index 8f6d03c..9ca62e7 100644
---
a/src/main/java/org/apache/commons/compress/harmony/unpack200/AttributeLayoutMap.java
+++
b/src/main/java/org/apache/commons/compress/harmony/unpack200/AttributeLayoutMap.java
@@ -149,7 +149,7 @@ public class AttributeLayoutMap {
layoutsToBands.put(layout, newBands);
}
- public AttributeLayout getAttributeLayout(final String name, final int
context) throws Pack200Exception {
+ public AttributeLayout getAttributeLayout(final String name, final int
context) {
final Map map = layouts[context];
for (final Iterator iter = map.values().iterator(); iter.hasNext();) {
final AttributeLayout layout = (AttributeLayout) iter.next();
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java
index 579140f..46d67fe 100644
---
a/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java
+++
b/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java
@@ -402,8 +402,7 @@ public class ClassBands extends BandSet {
}
}
- private int getCallCount(final int[][] methodAttrIndexes, final long[][]
flags, final int context)
- throws Pack200Exception {
+ private int getCallCount(final int[][] methodAttrIndexes, final long[][]
flags, final int context) {
int callCount = 0;
for (int i = 0; i < methodAttrIndexes.length; i++) {
for (int j = 0; j < methodAttrIndexes[i].length; j++) {
@@ -1088,7 +1087,7 @@ public class ClassBands extends BandSet {
return classFlags;
}
- public long[] getClassFlags() throws Pack200Exception {
+ public long[] getClassFlags() {
if (classAccessFlags == null) {
long mask = 0x7FFF;
for (int i = 0; i < 16; i++) {
@@ -1141,7 +1140,7 @@ public class ClassBands extends BandSet {
return methodDescrInts;
}
- public long[][] getFieldFlags() throws Pack200Exception {
+ public long[][] getFieldFlags() {
if (fieldAccessFlags == null) {
long mask = 0x7FFF;
for (int i = 0; i < 16; i++) {
@@ -1189,7 +1188,7 @@ public class ClassBands extends BandSet {
return methodDescr;
}
- public long[][] getMethodFlags() throws Pack200Exception {
+ public long[][] getMethodFlags() {
if (methodAccessFlags == null) {
long mask = 0x7FFF;
for (int i = 0; i < 16; i++) {
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
index f2f0811..c484df0 100644
---
a/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
+++
b/src/main/java/org/apache/commons/compress/harmony/unpack200/NewAttributeBands.java
@@ -225,17 +225,15 @@ public class NewAttributeBands extends BandSet {
if (stream.read() != 'O') {
stream.reset();
return new Integral("P" + (char) stream.read());
- } else {
- return new Integral("PO" + (char) stream.read());
}
+ return new Integral("PO" + (char) stream.read());
case 'O':
stream.mark(1);
if (stream.read() != 'S') {
stream.reset();
return new Integral("O" + (char) stream.read());
- } else {
- return new Integral("OS" + (char) stream.read());
}
+ return new Integral("OS" + (char) stream.read());
// Replication
case 'N':
@@ -738,7 +736,7 @@ public class NewAttributeBands extends BandSet {
private boolean isFirstCallable;
- public Callable(final List body) throws IOException {
+ public Callable(final List body) {
this.body = body;
}
@@ -830,7 +828,7 @@ public class NewAttributeBands extends BandSet {
return tags.contains(Integer.valueOf((int) l));
}
- public UnionCase(final List tags, final List body) throws IOException {
+ public UnionCase(final List tags, final List body) {
this.tags = tags;
this.body = body;
}
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java
index 764f2e3..4702396 100644
--- a/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java
+++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java
@@ -105,7 +105,7 @@ public class Segment {
private InputStream internalBuffer;
- private ClassFile buildClassFile(final int classNum) throws
Pack200Exception {
+ private ClassFile buildClassFile(final int classNum) {
final ClassFile classFile = new ClassFile();
final int[] major = classBands.getClassVersionMajor();
final int[] minor = classBands.getClassVersionMinor();
@@ -467,7 +467,7 @@ public class Segment {
parseSegment();
}
- void unpackWrite(final JarOutputStream out) throws IOException,
Pack200Exception {
+ void unpackWrite(final JarOutputStream out) throws IOException {
writeJar(out);
if (logStream != null) {
logStream.close();
@@ -482,9 +482,8 @@ public class Segment {
*
* @param out the JarOutputStream to write data to
* @throws IOException if an error occurs while reading or writing to the
streams
- * @throws Pack200Exception if an error occurs while processing data
*/
- public void writeJar(final JarOutputStream out) throws IOException,
Pack200Exception {
+ public void writeJar(final JarOutputStream out) throws IOException {
final String[] fileName = fileBands.getFileName();
final int[] fileModtime = fileBands.getFileModtime();
final long[] fileSize = fileBands.getFileSize();
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java
index 858bbeb..8713845 100644
---
a/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java
+++
b/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentHeader.java
@@ -362,9 +362,8 @@ public class SegmentHeader {
* @param in the input stream to read from
* @param data the byte array to read into
* @throws IOException if a problem occurs during reading from the
underlying stream
- * @throws Pack200Exception if a problem occurs with an unexpected value
or unsupported codec
*/
- private void readFully(final InputStream in, final byte[] data) throws
IOException, Pack200Exception {
+ private void readFully(final InputStream in, final byte[] data) throws
IOException {
int total = in.read(data);
if (total == -1) {
throw new EOFException("Failed to read any data from input
stream");
diff --git
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ByteCodeForm.java
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ByteCodeForm.java
index 2c32d97..6c76948 100644
---
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ByteCodeForm.java
+++
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/ByteCodeForm.java
@@ -28,7 +28,7 @@ public abstract class ByteCodeForm {
protected static final boolean WIDENED = true;
protected static final ByteCodeForm[] byteCodeArray = new
ByteCodeForm[256];
- protected static final Map byteCodesByName = new HashMap(256);
+ protected static final Map<String, ByteCodeForm> byteCodesByName = new
HashMap<>(256);
static {
byteCodeArray[0] = new NoArgumentForm(0, "nop");
byteCodeArray[1] = new NoArgumentForm(1, "aconst_null");
@@ -364,7 +364,7 @@ public abstract class ByteCodeForm {
}
public static ByteCodeForm get(final int opcode) {
- return (ByteCodeForm) byteCodeArray[opcode];
+ return byteCodeArray[opcode];
}
@Override