aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2018-12-25 09:59:58 +0000
committerDominik Stadler <centic@apache.org>2018-12-25 09:59:58 +0000
commit19884d0ca33018d1e417fafd253ec63cf8c31ccd (patch)
tree4d62b20301f3c4cb1c5995742d27fa6a6068dd34 /src/java
parent7421bc9a17d6f3803d2d9e44e6535d6004a6090b (diff)
downloadpoi-19884d0ca33018d1e417fafd253ec63cf8c31ccd.tar.gz
poi-19884d0ca33018d1e417fafd253ec63cf8c31ccd.zip
Code-style: Unify how arrays are specified from C-style to normal Java-style
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/ddf/EscherBitmapBlip.java2
-rw-r--r--src/java/org/apache/poi/ddf/EscherRecord.java2
-rw-r--r--src/java/org/apache/poi/hpsf/Section.java6
-rw-r--r--src/java/org/apache/poi/hpsf/Variant.java82
-rw-r--r--src/java/org/apache/poi/hssf/dev/BiffViewer.java2
-rw-r--r--src/java/org/apache/poi/hssf/dev/FormulaViewer.java2
-rw-r--r--src/java/org/apache/poi/hssf/model/InternalWorkbook.java6
-rw-r--r--src/java/org/apache/poi/hssf/record/BoundSheetRecord.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/FilePassRecord.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/WSBoolRecord.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java6
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java12
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java8
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/FontDetails.java2
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java2
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java14
-rw-r--r--src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java2
-rw-r--r--src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java4
-rw-r--r--src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java4
-rw-r--r--src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java64
-rw-r--r--src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java28
-rw-r--r--src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java2
-rw-r--r--src/java/org/apache/poi/poifs/crypt/Encryptor.java2
-rw-r--r--src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Decryptor.java18
-rw-r--r--src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4EncryptionVerifier.java18
-rw-r--r--src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Encryptor.java16
-rw-r--r--src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java18
-rw-r--r--src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentInputStream.java6
-rw-r--r--src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentOutputStream.java2
-rw-r--r--src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptionVerifier.java6
-rw-r--r--src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java20
-rw-r--r--src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java16
-rw-r--r--src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionVerifier.java20
-rw-r--r--src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptor.java10
-rw-r--r--src/java/org/apache/poi/poifs/crypt/xor/XORDecryptor.java10
-rw-r--r--src/java/org/apache/poi/poifs/crypt/xor/XOREncryptionVerifier.java4
-rw-r--r--src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java18
-rw-r--r--src/java/org/apache/poi/poifs/dev/POIFSLister.java2
-rw-r--r--src/java/org/apache/poi/poifs/dev/POIFSViewer.java2
-rw-r--r--src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java2
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/Ole10Native.java2
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java2
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/POIFSStream.java2
-rw-r--r--src/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java2
-rw-r--r--src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java2
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawFactory.java2
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java2
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawShape.java4
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawTableShape.java8
-rw-r--r--src/java/org/apache/poi/sl/draw/ImageRenderer.java2
-rw-r--r--src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java2
-rw-r--r--src/java/org/apache/poi/sl/image/ImageHeaderEMF.java2
-rw-r--r--src/java/org/apache/poi/sl/image/ImageHeaderPICT.java16
-rw-r--r--src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java52
-rw-r--r--src/java/org/apache/poi/sl/usermodel/PresetColor.java2
-rw-r--r--src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java4
-rw-r--r--src/java/org/apache/poi/sl/usermodel/StrokeStyle.java2
-rw-r--r--src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java4
-rw-r--r--src/java/org/apache/poi/ss/format/CellNumberFormatter.java4
-rw-r--r--src/java/org/apache/poi/ss/formula/CacheAreaEval.java4
-rw-r--r--src/java/org/apache/poi/ss/formula/OperationEvaluationContext.java4
-rw-r--r--src/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java6
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/Days360.java6
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java39
-rw-r--r--src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java4
-rw-r--r--src/java/org/apache/poi/ss/util/CellUtil.java3
-rw-r--r--src/java/org/apache/poi/util/IOUtils.java2
-rw-r--r--src/java/org/apache/poi/util/LittleEndianInputStream.java8
-rw-r--r--src/java/org/apache/poi/util/POILogger.java12
-rw-r--r--src/java/org/apache/poi/util/StringUtil.java4
70 files changed, 330 insertions, 324 deletions
diff --git a/src/java/org/apache/poi/ddf/EscherBitmapBlip.java b/src/java/org/apache/poi/ddf/EscherBitmapBlip.java
index 825a4b3906..05ad9ae66f 100644
--- a/src/java/org/apache/poi/ddf/EscherBitmapBlip.java
+++ b/src/java/org/apache/poi/ddf/EscherBitmapBlip.java
@@ -53,7 +53,7 @@ public class EscherBitmapBlip extends EscherBlipRecord {
System.arraycopy( field_1_UID, 0, data, pos, 16 );
data[pos + 16] = field_2_marker;
- byte pd[] = getPicturedata();
+ byte[] pd = getPicturedata();
System.arraycopy( pd, 0, data, pos + 17, pd.length );
listener.afterRecordSerialize(offset + getRecordSize(), getRecordId(), getRecordSize(), this);
diff --git a/src/java/org/apache/poi/ddf/EscherRecord.java b/src/java/org/apache/poi/ddf/EscherRecord.java
index c25d91902d..45fce36427 100644
--- a/src/java/org/apache/poi/ddf/EscherRecord.java
+++ b/src/java/org/apache/poi/ddf/EscherRecord.java
@@ -93,7 +93,7 @@ public abstract class EscherRecord implements Cloneable {
* @param offset the offset to start reading from
* @return value of instance part of options field
*/
- protected static short readInstance( byte data[], int offset ) {
+ protected static short readInstance(byte[] data, int offset ) {
final short options = LittleEndian.getShort( data, offset );
return fInstance.getShortValue( options );
}
diff --git a/src/java/org/apache/poi/hpsf/Section.java b/src/java/org/apache/poi/hpsf/Section.java
index 1411d0490f..0c1bcf263d 100644
--- a/src/java/org/apache/poi/hpsf/Section.java
+++ b/src/java/org/apache/poi/hpsf/Section.java
@@ -831,7 +831,7 @@ public class Section {
}
try {
- byte buf[] = IOUtils.safelyAllocate(nrBytes, MAX_RECORD_LENGTH);
+ byte[] buf = IOUtils.safelyAllocate(nrBytes, MAX_RECORD_LENGTH);
leis.readFully(buf, 0, nrBytes);
final String str = CodePageUtil.getStringFromCodePage(buf, 0, nrBytes, cp);
@@ -862,7 +862,7 @@ public class Section {
*/
private void writeDictionary(final OutputStream out, final int codepage)
throws IOException {
- final byte padding[] = new byte[4];
+ final byte[] padding = new byte[4];
final Map<Long,String> dic = getDictionary();
LittleEndian.putUInt(dic.size(), out);
@@ -873,7 +873,7 @@ public class Section {
length += LittleEndianConsts.INT_SIZE;
final String value = ls.getValue()+"\0";
- final byte bytes[] = CodePageUtil.getBytesInCodePage(value, codepage);
+ final byte[] bytes = CodePageUtil.getBytesInCodePage(value, codepage);
final int len = (codepage == CodePageUtil.CP_UNICODE) ? value.length() : bytes.length;
LittleEndian.putUInt( len, out );
diff --git a/src/java/org/apache/poi/hpsf/Variant.java b/src/java/org/apache/poi/hpsf/Variant.java
index 87acdc066a..f7b541b101 100644
--- a/src/java/org/apache/poi/hpsf/Variant.java
+++ b/src/java/org/apache/poi/hpsf/Variant.java
@@ -342,47 +342,47 @@ public class Variant
*/
public static final Integer LENGTH_8 = 8;
- private static final Object NUMBER_TO_NAME_LIST[][] = {
- { 0L, "VT_EMPTY", LENGTH_0 },
- { 1L, "VT_NULL", LENGTH_UNKNOWN },
- { 2L, "VT_I2", LENGTH_2 },
- { 3L, "VT_I4", LENGTH_4 },
- { 4L, "VT_R4", LENGTH_4 },
- { 5L, "VT_R8", LENGTH_8 },
- { 6L, "VT_CY", LENGTH_UNKNOWN },
- { 7L, "VT_DATE", LENGTH_UNKNOWN },
- { 8L, "VT_BSTR", LENGTH_UNKNOWN },
- { 9L, "VT_DISPATCH", LENGTH_UNKNOWN },
- { 10L, "VT_ERROR", LENGTH_UNKNOWN },
- { 11L, "VT_BOOL", LENGTH_UNKNOWN },
- { 12L, "VT_VARIANT", LENGTH_UNKNOWN },
- { 13L, "VT_UNKNOWN", LENGTH_UNKNOWN },
- { 14L, "VT_DECIMAL", LENGTH_UNKNOWN },
- { 16L, "VT_I1", LENGTH_UNKNOWN },
- { 17L, "VT_UI1", LENGTH_UNKNOWN },
- { 18L, "VT_UI2", LENGTH_UNKNOWN },
- { 19L, "VT_UI4", LENGTH_UNKNOWN },
- { 20L, "VT_I8", LENGTH_UNKNOWN },
- { 21L, "VT_UI8", LENGTH_UNKNOWN },
- { 22L, "VT_INT", LENGTH_UNKNOWN },
- { 23L, "VT_UINT", LENGTH_UNKNOWN },
- { 24L, "VT_VOID", LENGTH_UNKNOWN },
- { 25L, "VT_HRESULT", LENGTH_UNKNOWN },
- { 26L, "VT_PTR", LENGTH_UNKNOWN },
- { 27L, "VT_SAFEARRAY", LENGTH_UNKNOWN },
- { 28L, "VT_CARRAY", LENGTH_UNKNOWN },
- { 29L, "VT_USERDEFINED", LENGTH_UNKNOWN },
- { 30L, "VT_LPSTR", LENGTH_VARIABLE },
- { 31L, "VT_LPWSTR", LENGTH_UNKNOWN },
- { 64L, "VT_FILETIME", LENGTH_8 },
- { 65L, "VT_BLOB", LENGTH_UNKNOWN },
- { 66L, "VT_STREAM", LENGTH_UNKNOWN },
- { 67L, "VT_STORAGE", LENGTH_UNKNOWN },
- { 68L, "VT_STREAMED_OBJECT", LENGTH_UNKNOWN },
- { 69L, "VT_STORED_OBJECT", LENGTH_UNKNOWN },
- { 70L, "VT_BLOB_OBJECT", LENGTH_UNKNOWN },
- { 71L, "VT_CF", LENGTH_UNKNOWN },
- { 72L, "VT_CLSID", LENGTH_UNKNOWN }
+ private static final Object[][] NUMBER_TO_NAME_LIST = {
+ {0L, "VT_EMPTY", LENGTH_0},
+ {1L, "VT_NULL", LENGTH_UNKNOWN},
+ {2L, "VT_I2", LENGTH_2},
+ {3L, "VT_I4", LENGTH_4},
+ {4L, "VT_R4", LENGTH_4},
+ {5L, "VT_R8", LENGTH_8},
+ {6L, "VT_CY", LENGTH_UNKNOWN},
+ {7L, "VT_DATE", LENGTH_UNKNOWN},
+ {8L, "VT_BSTR", LENGTH_UNKNOWN},
+ {9L, "VT_DISPATCH", LENGTH_UNKNOWN},
+ {10L, "VT_ERROR", LENGTH_UNKNOWN},
+ {11L, "VT_BOOL", LENGTH_UNKNOWN},
+ {12L, "VT_VARIANT", LENGTH_UNKNOWN},
+ {13L, "VT_UNKNOWN", LENGTH_UNKNOWN},
+ {14L, "VT_DECIMAL", LENGTH_UNKNOWN},
+ {16L, "VT_I1", LENGTH_UNKNOWN},
+ {17L, "VT_UI1", LENGTH_UNKNOWN},
+ {18L, "VT_UI2", LENGTH_UNKNOWN},
+ {19L, "VT_UI4", LENGTH_UNKNOWN},
+ {20L, "VT_I8", LENGTH_UNKNOWN},
+ {21L, "VT_UI8", LENGTH_UNKNOWN},
+ {22L, "VT_INT", LENGTH_UNKNOWN},
+ {23L, "VT_UINT", LENGTH_UNKNOWN},
+ {24L, "VT_VOID", LENGTH_UNKNOWN},
+ {25L, "VT_HRESULT", LENGTH_UNKNOWN},
+ {26L, "VT_PTR", LENGTH_UNKNOWN},
+ {27L, "VT_SAFEARRAY", LENGTH_UNKNOWN},
+ {28L, "VT_CARRAY", LENGTH_UNKNOWN},
+ {29L, "VT_USERDEFINED", LENGTH_UNKNOWN},
+ {30L, "VT_LPSTR", LENGTH_VARIABLE},
+ {31L, "VT_LPWSTR", LENGTH_UNKNOWN},
+ {64L, "VT_FILETIME", LENGTH_8},
+ {65L, "VT_BLOB", LENGTH_UNKNOWN},
+ {66L, "VT_STREAM", LENGTH_UNKNOWN},
+ {67L, "VT_STORAGE", LENGTH_UNKNOWN},
+ {68L, "VT_STREAMED_OBJECT", LENGTH_UNKNOWN},
+ {69L, "VT_STORED_OBJECT", LENGTH_UNKNOWN},
+ {70L, "VT_BLOB_OBJECT", LENGTH_UNKNOWN},
+ {71L, "VT_CF", LENGTH_UNKNOWN},
+ {72L, "VT_CLSID", LENGTH_UNKNOWN}
};
/* Initialize the number-to-name and number-to-length map: */
diff --git a/src/java/org/apache/poi/hssf/dev/BiffViewer.java b/src/java/org/apache/poi/hssf/dev/BiffViewer.java
index 631be8fd2d..7234cde5f6 100644
--- a/src/java/org/apache/poi/hssf/dev/BiffViewer.java
+++ b/src/java/org/apache/poi/hssf/dev/BiffViewer.java
@@ -699,7 +699,7 @@ public final class BiffViewer {
return ib;
}
- private static void writeHex(char buf[], int startInBuf, int value, int nDigits) {
+ private static void writeHex(char[] buf, int startInBuf, int value, int nDigits) {
int acc = value;
for(int i=nDigits-1; i>=0; i--) {
int digit = acc & 0x0F;
diff --git a/src/java/org/apache/poi/hssf/dev/FormulaViewer.java b/src/java/org/apache/poi/hssf/dev/FormulaViewer.java
index c2d7934195..b5f0d3f5f0 100644
--- a/src/java/org/apache/poi/hssf/dev/FormulaViewer.java
+++ b/src/java/org/apache/poi/hssf/dev/FormulaViewer.java
@@ -210,7 +210,7 @@ public class FormulaViewer
* @param args pass one argument with the filename or --help
* @throws IOException if the file can't be read or contained errors
*/
- public static void main(String args[]) throws IOException
+ public static void main(String[] args) throws IOException
{
if ((args == null) || (args.length >2 )
|| args[ 0 ].equals("--help"))
diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
index 4ff370125c..da9ecab337 100644
--- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
+++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
@@ -1338,7 +1338,7 @@ public final class InternalWorkbook {
*/
private static FormatRecord createFormat(int id) {
// we'll need multiple editions for the different formats
- final int mappings[] = { 5, 6, 7, 8, 0x2a, 0x29, 0x2c, 0x2b };
+ final int[] mappings = {5, 6, 7, 8, 0x2a, 0x29, 0x2c, 0x2b};
if (id < 0 || id >= mappings.length) {
throw new IllegalArgumentException("Unexpected id " + id);
}
@@ -1433,8 +1433,8 @@ public final class InternalWorkbook {
*/
private static StyleRecord createStyle(int id) {
// we'll need multiple editions
- final int mappings[][] = {
- { 0x010, 3 }, { 0x011, 6 }, { 0x012, 4 }, { 0x013, 7 }, { 0x000, 0 }, { 0x014, 5 }
+ final int[][] mappings = {
+ {0x010, 3}, {0x011, 6}, {0x012, 4}, {0x013, 7}, {0x000, 0}, {0x014, 5}
};
if (id < 0 || id >= mappings.length) {
throw new IllegalArgumentException("Unexpected style id " + id);
diff --git a/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java b/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
index 61b92831c9..af6853eb2e 100644
--- a/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
+++ b/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
@@ -62,7 +62,7 @@ public final class BoundSheetRecord extends StandardRecord {
* @param in the record stream to read from
*/
public BoundSheetRecord(RecordInputStream in) {
- byte buf[] = new byte[LittleEndianConsts.INT_SIZE];
+ byte[] buf = new byte[LittleEndianConsts.INT_SIZE];
in.readPlain(buf, 0, buf.length);
field_1_position_of_BOF = LittleEndian.getInt(buf);
field_2_option_flags = in.readUShort();
diff --git a/src/java/org/apache/poi/hssf/record/FilePassRecord.java b/src/java/org/apache/poi/hssf/record/FilePassRecord.java
index 5955e6d135..3b54d058d2 100644
--- a/src/java/org/apache/poi/hssf/record/FilePassRecord.java
+++ b/src/java/org/apache/poi/hssf/record/FilePassRecord.java
@@ -88,7 +88,7 @@ public final class FilePassRecord extends StandardRecord implements Cloneable {
public void serialize(LittleEndianOutput out) {
out.writeShort(encryptionType);
- byte data[] = new byte[1024];
+ byte[] data = new byte[1024];
LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(data, 0); // NOSONAR
switch (encryptionInfo.getEncryptionMode()) {
diff --git a/src/java/org/apache/poi/hssf/record/WSBoolRecord.java b/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
index b3659db994..07afe95836 100644
--- a/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WSBoolRecord.java
@@ -55,7 +55,7 @@ public final class WSBoolRecord extends StandardRecord {
public WSBoolRecord(RecordInputStream in)
{
- byte data[] = in.readRemainder();
+ byte[] data = in.readRemainder();
field_1_wsbool =
data[ 1 ]; // backwards because theoretically this is one short field
field_2_wsbool =
diff --git a/src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java b/src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
index 99c5d46dc9..b9a7638789 100644
--- a/src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
+++ b/src/java/org/apache/poi/hssf/record/crypto/Biff8DecryptingStream.java
@@ -41,12 +41,12 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia
private static final int MAX_RECORD_LENGTH = 100_000;
private ChunkedCipherInputStream ccis;
- private final byte buffer[] = new byte[LittleEndianConsts.LONG_SIZE];
+ private final byte[] buffer = new byte[LittleEndianConsts.LONG_SIZE];
private boolean shouldSkipEncryptionOnCurrentRecord;
public Biff8DecryptingStream(InputStream in, int initialOffset, EncryptionInfo info) throws RecordFormatException {
try {
- byte initialBuf[] = IOUtils.safelyAllocate(initialOffset, MAX_RECORD_LENGTH);
+ byte[] initialBuf = IOUtils.safelyAllocate(initialOffset, MAX_RECORD_LENGTH);
InputStream stream;
if (initialOffset == 0) {
stream = in;
@@ -207,7 +207,7 @@ public final class Biff8DecryptingStream implements BiffHeaderInput, LittleEndia
}
@Override
- public void readPlain(byte b[], int off, int len) {
+ public void readPlain(byte[] b, int off, int len) {
ccis.readPlain(b, off, len);
}
diff --git a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
index ede62933ab..aedfcdaa22 100644
--- a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
+++ b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
@@ -244,8 +244,8 @@ public class EscherGraphics extends Graphics
}
@Override
- public void drawPolygon(int xPoints[], int yPoints[],
- int nPoints)
+ public void drawPolygon(int[] xPoints, int[] yPoints,
+ int nPoints)
{
int right = findBiggest(xPoints);
int bottom = findBiggest(yPoints);
@@ -269,8 +269,8 @@ public class EscherGraphics extends Graphics
@Override
@NotImplemented
- public void drawPolyline(int xPoints[], int yPoints[],
- int nPoints)
+ public void drawPolyline(int[] xPoints, int[] yPoints,
+ int nPoints)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"drawPolyline not supported");
@@ -401,8 +401,8 @@ public class EscherGraphics extends Graphics
* @see java.awt.Graphics#drawPolygon(int[], int[], int)
*/
@Override
- public void fillPolygon(int xPoints[], int yPoints[],
- int nPoints)
+ public void fillPolygon(int[] xPoints, int[] yPoints,
+ int nPoints)
{
int right = findBiggest(xPoints);
int bottom = findBiggest(yPoints);
diff --git a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
index 5235a70221..fe6770c4f1 100644
--- a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
+++ b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
@@ -243,13 +243,13 @@ public final class EscherGraphics2d extends Graphics2D {
// draw(new java.awt.geom.Ellipse2D.Float(x, y, width, height));
}
- public void drawPolygon(int xPoints[], int yPoints[],
- int nPoints)
+ public void drawPolygon(int[] xPoints, int[] yPoints,
+ int nPoints)
{
getEscherGraphics().drawPolygon(xPoints, yPoints, nPoints);
}
- public void drawPolyline(int xPoints[], int yPoints[], int nPoints)
+ public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
{
if(nPoints > 0)
{
@@ -343,7 +343,7 @@ public final class EscherGraphics2d extends Graphics2D {
* @param nPoints the total number of points in the polygon.
* @see java.awt.Graphics#drawPolygon(int[], int[], int)
*/
- public void fillPolygon(int xPoints[], int yPoints[], int nPoints)
+ public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
{
_escherGraphics.fillPolygon(xPoints, yPoints, nPoints);
}
diff --git a/src/java/org/apache/poi/hssf/usermodel/FontDetails.java b/src/java/org/apache/poi/hssf/usermodel/FontDetails.java
index dd049d2933..d40ec07fcd 100644
--- a/src/java/org/apache/poi/hssf/usermodel/FontDetails.java
+++ b/src/java/org/apache/poi/hssf/usermodel/FontDetails.java
@@ -151,7 +151,7 @@ public class FontDetails
int listSize = tok.countTokens();
if(max != -1 && listSize > max)
listSize = max;
- String list[] = new String[listSize];
+ String[] list = new String[listSize];
for(int i = 0; tok.hasMoreTokens(); i++)
{
if(max != -1 && i == listSize - 1)
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
index c3d9fdafe2..e10a3e973a 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
@@ -256,7 +256,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
public void setFileName(String data){
// TODO: add trailing \u0000?
- byte bytes[] = StringUtil.getToUnicodeLE(data);
+ byte[] bytes = StringUtil.getToUnicodeLE(data);
EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.BLIP__BLIPFILENAME, true, bytes);
setPropertyValue(prop);
}
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
index f889d2704d..c7019cfe38 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
@@ -1508,7 +1508,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
}
@SuppressWarnings("resource")
- void encryptBytes(byte buf[]) {
+ void encryptBytes(byte[] buf) {
EncryptionInfo ei = getEncryptionInfo();
if (ei == null) {
return;
@@ -1518,7 +1518,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
LittleEndianByteArrayInputStream plain = new LittleEndianByteArrayInputStream(buf, 0); // NOSONAR
LittleEndianByteArrayOutputStream leos = new LittleEndianByteArrayOutputStream(buf, 0); // NOSONAR
enc.setChunkSize(Biff8DecryptingStream.RC4_REKEYING_INTERVAL);
- byte tmp[] = new byte[1024];
+ byte[] tmp = new byte[1024];
try {
ChunkedCipherOutputStream os = enc.getDataStream(leos, initialOffset);
int totalBytes = 0;
@@ -1532,7 +1532,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
if (sid == BoundSheetRecord.sid) {
// special case for the field_1_position_of_BOF (=lbPlyPos) field of
// the BoundSheet8 record which must be unencrypted
- byte bsrBuf[] = IOUtils.safelyAllocate(len, MAX_RECORD_LENGTH);
+ byte[] bsrBuf = IOUtils.safelyAllocate(len, MAX_RECORD_LENGTH);
plain.readFully(bsrBuf);
os.writePlain(bsrBuf, 0, 4);
os.write(bsrBuf, 4, len-4);
@@ -1877,7 +1877,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
// remove first 22 bytes if file starts with magic bytes D7-CD-C6-9A
// see also http://de.wikipedia.org/wiki/Windows_Metafile#Hinweise_zur_WMF-Spezifikation
if (LittleEndian.getInt(pictureData) == 0x9AC6CDD7) {
- byte picDataNoHeader[] = new byte[pictureData.length-22];
+ byte[] picDataNoHeader = new byte[pictureData.length - 22];
System.arraycopy(pictureData, 22, picDataNoHeader, 0, pictureData.length-22);
pictureData = picDataNoHeader;
}
@@ -2260,15 +2260,15 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
// check if the password has been changed
EncryptionInfo ei = fpr.getEncryptionInfo();
EncryptionVerifier ver = ei.getVerifier();
- byte encVer[] = ver.getEncryptedVerifier();
+ byte[] encVer = ver.getEncryptedVerifier();
Decryptor dec = ei.getDecryptor();
Encryptor enc = ei.getEncryptor();
try {
if (encVer == null || !dec.verifyPassword(password)) {
enc.confirmPassword(password);
} else {
- byte verifier[] = dec.getVerifier();
- byte salt[] = ver.getSalt();
+ byte[] verifier = dec.getVerifier();
+ byte[] salt = ver.getSalt();
enc.confirmPassword(password, null, null, verifier, salt, null);
}
} catch (GeneralSecurityException e) {
diff --git a/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java b/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
index 0b84362670..40b0e28ddb 100644
--- a/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
+++ b/src/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
@@ -226,7 +226,7 @@ public abstract class ChunkedCipherInputStream extends LittleEndianInputStream {
*
*/
@Override
- public void readPlain(byte b[], int off, int len) {
+ public void readPlain(byte[] b, int off, int len) {
if (len <= 0) {
return;
}
diff --git a/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java b/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
index 0aa73fd670..b98e229d8e 100644
--- a/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
+++ b/src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java
@@ -220,7 +220,7 @@ public abstract class ChunkedCipherOutputStream extends FilterOutputStream {
* @throws ShortBufferException
*/
protected int invokeCipher(int posInChunk, boolean doFinal) throws GeneralSecurityException, IOException {
- byte plain[] = (plainByteFlags.isEmpty()) ? null : chunk.clone();
+ byte[] plain = (plainByteFlags.isEmpty()) ? null : chunk.clone();
int ciLen = (doFinal)
? cipher.doFinal(chunk, 0, posInChunk, chunk)
@@ -316,7 +316,7 @@ public abstract class ChunkedCipherOutputStream extends FilterOutputStream {
// encrypted within the EncryptedData field, not including the size of the StreamSize field.
// Note that the actual size of the \EncryptedPackage stream (1) can be larger than this
// value, depending on the block size of the chosen encryption algorithm
- byte buf[] = new byte[LittleEndianConsts.LONG_SIZE];
+ byte[] buf = new byte[LittleEndianConsts.LONG_SIZE];
LittleEndian.putLong(buf, 0, pos);
os.write(buf);
diff --git a/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java b/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java
index 6da96d8524..5ec778617c 100644
--- a/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java
+++ b/src/java/org/apache/poi/poifs/crypt/CipherAlgorithm.java
@@ -41,13 +41,13 @@ public enum CipherAlgorithm {
public final String jceId;
public final int ecmaId;
public final int defaultKeySize;
- public final int allowedKeySize[];
+ public final int[] allowedKeySize;
public final int blockSize;
public final int encryptedVerifierHashLength;
public final String xmlId;
public final boolean needsBouncyCastle;
- CipherAlgorithm(CipherProvider provider, String jceId, int ecmaId, int defaultKeySize, int allowedKeySize[], int blockSize, int encryptedVerifierHashLength, String xmlId, boolean needsBouncyCastle) {
+ CipherAlgorithm(CipherProvider provider, String jceId, int ecmaId, int defaultKeySize, int[] allowedKeySize, int blockSize, int encryptedVerifierHashLength, String xmlId, boolean needsBouncyCastle) {
this.provider = provider;
this.jceId = jceId;
this.ecmaId = ecmaId;
diff --git a/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java b/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
index 4a984929b6..d4908fcae5 100644
--- a/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
+++ b/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
@@ -84,7 +84,7 @@ public class CryptoFunctions {
* @param spinCount
* @return the hashed password
*/
- public static byte[] hashPassword(String password, HashAlgorithm hashAlgorithm, byte salt[], int spinCount) {
+ public static byte[] hashPassword(String password, HashAlgorithm hashAlgorithm, byte[] salt, int spinCount) {
return hashPassword(password, hashAlgorithm, salt, spinCount, true);
}
@@ -101,7 +101,7 @@ public class CryptoFunctions {
* if false the n-1 hash value is applied first
* @return the hashed password
*/
- public static byte[] hashPassword(String password, HashAlgorithm hashAlgorithm, byte salt[], int spinCount, boolean iteratorFirst) {
+ public static byte[] hashPassword(String password, HashAlgorithm hashAlgorithm, byte[] salt, int spinCount, boolean iteratorFirst) {
// If no password was given, use the default
if (password == null) {
password = Decryptor.DEFAULT_PASSWORD;
@@ -149,7 +149,7 @@ public class CryptoFunctions {
* </ul>
**/
public static byte[] generateIv(HashAlgorithm hashAlgorithm, byte[] salt, byte[] blockKey, int blockSize) {
- byte iv[] = salt;
+ byte[] iv = salt;
if (blockKey != null) {
MessageDigest hashAlgo = getMessageDigest(hashAlgorithm);
hashAlgo.update(salt);
@@ -333,34 +333,34 @@ public class CryptoFunctions {
}
}
- private static final int INITIAL_CODE_ARRAY[] = {
- 0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE,
- 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A,
- 0x4EC3
+ private static final int[] INITIAL_CODE_ARRAY = {
+ 0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE,
+ 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A,
+ 0x4EC3
};
- private static final byte PAD_ARRAY[] = {
- (byte)0xBB, (byte)0xFF, (byte)0xFF, (byte)0xBA, (byte)0xFF,
- (byte)0xFF, (byte)0xB9, (byte)0x80, (byte)0x00, (byte)0xBE,
- (byte)0x0F, (byte)0x00, (byte)0xBF, (byte)0x0F, (byte)0x00
+ private static final byte[] PAD_ARRAY = {
+ (byte) 0xBB, (byte) 0xFF, (byte) 0xFF, (byte) 0xBA, (byte) 0xFF,
+ (byte) 0xFF, (byte) 0xB9, (byte) 0x80, (byte) 0x00, (byte) 0xBE,
+ (byte) 0x0F, (byte) 0x00, (byte) 0xBF, (byte) 0x0F, (byte) 0x00
};
-
- private static final int ENCRYPTION_MATRIX[][] = {
- /* char 1 */ {0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09},
- /* char 2 */ {0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF},
- /* char 3 */ {0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0},
- /* char 4 */ {0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40},
- /* char 5 */ {0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5},
- /* char 6 */ {0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A},
- /* char 7 */ {0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9},
- /* char 8 */ {0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0},
- /* char 9 */ {0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC},
- /* char 10 */ {0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10},
- /* char 11 */ {0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168},
- /* char 12 */ {0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C},
- /* char 13 */ {0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD},
- /* char 14 */ {0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC},
- /* char 15 */ {0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4}
+
+ private static final int[][] ENCRYPTION_MATRIX = {
+ /* char 1 */ {0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09},
+ /* char 2 */ {0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF},
+ /* char 3 */ {0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0},
+ /* char 4 */ {0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40},
+ /* char 5 */ {0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5},
+ /* char 6 */ {0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A},
+ /* char 7 */ {0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9},
+ /* char 8 */ {0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0},
+ /* char 9 */ {0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC},
+ /* char 10 */ {0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10},
+ /* char 11 */ {0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168},
+ /* char 12 */ {0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C},
+ /* char 13 */ {0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD},
+ /* char 14 */ {0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC},
+ /* char 15 */ {0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4}
};
/**
@@ -514,11 +514,11 @@ public class CryptoFunctions {
if (password.length() > 15) {
password = password.substring(0, 15);
}
- byte passBytes[] = password.getBytes(Charset.forName("ASCII"));
+ byte[] passBytes = password.getBytes(Charset.forName("ASCII"));
// this code is based on the libre office implementation.
// The MS-OFFCRYPTO misses some infos about the various rotation sizes
- byte obfuscationArray[] = new byte[16];
+ byte[] obfuscationArray = new byte[16];
System.arraycopy(passBytes, 0, obfuscationArray, 0, passBytes.length);
System.arraycopy(PAD_ARRAY, 0, obfuscationArray, passBytes.length, PAD_ARRAY.length-passBytes.length+1);
@@ -526,8 +526,8 @@ public class CryptoFunctions {
// rotation of key values is application dependent - Excel = 2 / Word = 7
int nRotateSize = 2;
-
- byte baseKeyLE[] = { (byte)(xorKey & 0xFF), (byte)((xorKey >>> 8) & 0xFF) };
+
+ byte[] baseKeyLE = {(byte) (xorKey & 0xFF), (byte) ((xorKey >>> 8) & 0xFF)};
for (int i=0; i<obfuscationArray.length; i++) {
obfuscationArray[i] ^= baseKeyLE[i&1];
obfuscationArray[i] = rotateLeft(obfuscationArray[i], nRotateSize);
diff --git a/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java b/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
index 5f21b52b90..09a56e2e81 100644
--- a/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
+++ b/src/java/org/apache/poi/poifs/crypt/DataSpaceMapUtils.java
@@ -64,14 +64,14 @@ public class DataSpaceMapUtils {
}
public static DocumentEntry createEncryptionEntry(DirectoryEntry dir, String path, EncryptionRecord out) throws IOException {
- String parts[] = path.split("/");
+ String[] parts = path.split("/");
for (int i=0; i<parts.length-1; i++) {
dir = dir.hasEntry(parts[i])
? (DirectoryEntry)dir.getEntry(parts[i])
: dir.createDirectory(parts[i]);
}
-
- final byte buf[] = new byte[5000];
+
+ final byte[] buf = new byte[5000];
LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0);
out.write(bos);
@@ -93,9 +93,9 @@ public class DataSpaceMapUtils {
}
public static class DataSpaceMap implements EncryptionRecord {
- DataSpaceMapEntry entries[];
+ DataSpaceMapEntry[] entries;
- public DataSpaceMap(DataSpaceMapEntry entries[]) {
+ public DataSpaceMap(DataSpaceMapEntry[] entries) {
this.entries = entries.clone();
}
@@ -118,11 +118,11 @@ public class DataSpaceMapUtils {
}
public static class DataSpaceMapEntry implements EncryptionRecord {
- final int referenceComponentType[];
- final String referenceComponent[];
+ final int[] referenceComponentType;
+ final String[] referenceComponent;
final String dataSpaceName;
- public DataSpaceMapEntry(int referenceComponentType[], String referenceComponent[], String dataSpaceName) {
+ public DataSpaceMapEntry(int[] referenceComponentType, String[] referenceComponent, String dataSpaceName) {
this.referenceComponentType = referenceComponentType.clone();
this.referenceComponent = referenceComponent.clone();
this.dataSpaceName = dataSpaceName;
@@ -154,9 +154,9 @@ public class DataSpaceMapUtils {
}
public static class DataSpaceDefinition implements EncryptionRecord {
- String transformer[];
+ String[] transformer;
- public DataSpaceDefinition(String transformer[]) {
+ public DataSpaceDefinition(String[] transformer) {
this.transformer = transformer.clone();
}
@@ -322,7 +322,7 @@ public class DataSpaceMapUtils {
}
public static void writeUnicodeLPP4(LittleEndianOutput os, String string) {
- byte buf[] = StringUtil.getToUnicodeLE(string);
+ byte[] buf = StringUtil.getToUnicodeLE(string);
os.writeInt(buf.length);
os.write(buf);
if (buf.length%4==2) {
@@ -336,8 +336,8 @@ public class DataSpaceMapUtils {
/* int skip = */ is.readInt();
return length == 0 ? null : "";
}
-
- byte data[] = IOUtils.safelyAllocate(length, MAX_RECORD_LENGTH);
+
+ byte[] data = IOUtils.safelyAllocate(length, MAX_RECORD_LENGTH);
is.readFully(data);
// Padding (variable): A set of bytes that MUST be of correct size such that the size of the UTF-8-LP-P4
@@ -360,7 +360,7 @@ public class DataSpaceMapUtils {
os.writeInt(str == null ? 0 : 4);
os.writeInt(0);
} else {
- byte buf[] = str.getBytes(StandardCharsets.UTF_8);
+ byte[] buf = str.getBytes(StandardCharsets.UTF_8);
os.writeInt(buf.length);
os.write(buf);
int scratchBytes = buf.length%4;
diff --git a/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java b/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java
index 616dbcf19e..a00ac44c82 100644
--- a/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java
+++ b/src/java/org/apache/poi/poifs/crypt/EncryptionHeader.java
@@ -130,7 +130,7 @@ public abstract class EncryptionHeader implements Cloneable {
return keySalt;
}
- protected void setKeySalt(byte salt[]) {
+ protected void setKeySalt(byte[] salt) {
this.keySalt = (salt == null) ? null : salt.clone();
}
diff --git a/src/java/org/apache/poi/poifs/crypt/Encryptor.java b/src/java/org/apache/poi/poifs/crypt/Encryptor.java
index b86fef1edc..b62ad862fe 100644
--- a/src/java/org/apache/poi/poifs/crypt/Encryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/Encryptor.java
@@ -42,7 +42,7 @@ public abstract class Encryptor implements Cloneable {
throws IOException, GeneralSecurityException;
// for tests
- public abstract void confirmPassword(String password, byte keySpec[], byte keySalt[], byte verifier[], byte verifierSalt[], byte integritySalt[]);
+ public abstract void confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt);
public abstract void confirmPassword(String password);
diff --git a/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Decryptor.java b/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Decryptor.java
index 4e1964b28c..176e779b31 100644
--- a/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Decryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Decryptor.java
@@ -66,15 +66,15 @@ public class BinaryRC4Decryptor extends Decryptor implements Cloneable {
SecretKey skey = generateSecretKey(password, ver);
try {
Cipher cipher = initCipherForBlock(null, 0, getEncryptionInfo(), skey, Cipher.DECRYPT_MODE);
- byte encryptedVerifier[] = ver.getEncryptedVerifier();
- byte verifier[] = new byte[encryptedVerifier.length];
+ byte[] encryptedVerifier = ver.getEncryptedVerifier();
+ byte[] verifier = new byte[encryptedVerifier.length];
cipher.update(encryptedVerifier, 0, encryptedVerifier.length, verifier);
setVerifier(verifier);
- byte encryptedVerifierHash[] = ver.getEncryptedVerifierHash();
- byte verifierHash[] = cipher.doFinal(encryptedVerifierHash);
+ byte[] encryptedVerifierHash = ver.getEncryptedVerifierHash();
+ byte[] verifierHash = cipher.doFinal(encryptedVerifierHash);
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
- byte calcVerifierHash[] = hashAlg.digest(verifier);
+ byte[] calcVerifierHash = hashAlg.digest(verifier);
if (Arrays.equals(calcVerifierHash, verifierHash)) {
setSecretKey(skey);
return true;
@@ -96,9 +96,9 @@ public class BinaryRC4Decryptor extends Decryptor implements Cloneable {
throws GeneralSecurityException {
EncryptionVerifier ver = encryptionInfo.getVerifier();
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
- byte blockKey[] = new byte[4];
+ byte[] blockKey = new byte[4];
LittleEndian.putUInt(blockKey, 0, block);
- byte encKey[] = CryptoFunctions.generateKey(skey.getEncoded(), hashAlgo, blockKey, 16);
+ byte[] encKey = CryptoFunctions.generateKey(skey.getEncoded(), hashAlgo, blockKey, 16);
SecretKey key = new SecretKeySpec(encKey, skey.getAlgorithm());
if (cipher == null) {
EncryptionHeader em = encryptionInfo.getHeader();
@@ -115,8 +115,8 @@ public class BinaryRC4Decryptor extends Decryptor implements Cloneable {
}
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
- byte hash[] = hashAlg.digest(StringUtil.getToUnicodeLE(password));
- byte salt[] = ver.getSalt();
+ byte[] hash = hashAlg.digest(StringUtil.getToUnicodeLE(password));
+ byte[] salt = ver.getSalt();
hashAlg.reset();
for (int i = 0; i < 16; i++) {
hashAlg.update(hash, 0, 5);
diff --git a/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4EncryptionVerifier.java b/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4EncryptionVerifier.java
index b20ed0ce76..098a69452a 100644
--- a/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4EncryptionVerifier.java
+++ b/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4EncryptionVerifier.java
@@ -34,13 +34,13 @@ public class BinaryRC4EncryptionVerifier extends EncryptionVerifier implements E
}
protected BinaryRC4EncryptionVerifier(LittleEndianInput is) {
- byte salt[] = new byte[16];
+ byte[] salt = new byte[16];
is.readFully(salt);
setSalt(salt);
- byte encryptedVerifier[] = new byte[16];
+ byte[] encryptedVerifier = new byte[16];
is.readFully(encryptedVerifier);
setEncryptedVerifier(encryptedVerifier);
- byte encryptedVerifierHash[] = new byte[16];
+ byte[] encryptedVerifierHash = new byte[16];
is.readFully(encryptedVerifierHash);
setEncryptedVerifierHash(encryptedVerifierHash);
setSpinCount(-1);
@@ -51,7 +51,7 @@ public class BinaryRC4EncryptionVerifier extends EncryptionVerifier implements E
}
@Override
- protected void setSalt(byte salt[]) {
+ protected void setSalt(byte[] salt) {
if (salt == null || salt.length != 16) {
throw new EncryptedDocumentException("invalid verifier salt");
}
@@ -60,24 +60,24 @@ public class BinaryRC4EncryptionVerifier extends EncryptionVerifier implements E
}
@Override
- protected void setEncryptedVerifier(byte encryptedVerifier[]) {
+ protected void setEncryptedVerifier(byte[] encryptedVerifier) {
super.setEncryptedVerifier(encryptedVerifier);
}
@Override
- protected void setEncryptedVerifierHash(byte encryptedVerifierHash[]) {
+ protected void setEncryptedVerifierHash(byte[] encryptedVerifierHash) {
super.setEncryptedVerifierHash(encryptedVerifierHash);
}
@Override
public void write(LittleEndianByteArrayOutputStream bos) {
- byte salt[] = getSalt();
+ byte[] salt = getSalt();
assert (salt.length == 16);
bos.write(salt);
- byte encryptedVerifier[] = getEncryptedVerifier();
+ byte[] encryptedVerifier = getEncryptedVerifier();
assert (encryptedVerifier.length == 16);
bos.write(encryptedVerifier);
- byte encryptedVerifierHash[] = getEncryptedVerifierHash();
+ byte[] encryptedVerifierHash = getEncryptedVerifierHash();
assert (encryptedVerifierHash.length == 16);
bos.write(encryptedVerifierHash);
}
diff --git a/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Encryptor.java b/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Encryptor.java
index 6b40516ef3..6c67f32015 100644
--- a/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Encryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/binaryrc4/BinaryRC4Encryptor.java
@@ -49,30 +49,30 @@ public class BinaryRC4Encryptor extends Encryptor implements Cloneable {
@Override
public void confirmPassword(String password) {
Random r = new SecureRandom();
- byte salt[] = new byte[16];
- byte verifier[] = new byte[16];
+ byte[] salt = new byte[16];
+ byte[] verifier = new byte[16];
r.nextBytes(salt);
r.nextBytes(verifier);
confirmPassword(password, null, null, verifier, salt, null);
}
@Override
- public void confirmPassword(String password, byte keySpec[],
- byte keySalt[], byte verifier[], byte verifierSalt[],
- byte integritySalt[]) {
+ public void confirmPassword(String password, byte[] keySpec,
+ byte[] keySalt, byte[] verifier, byte[] verifierSalt,
+ byte[] integritySalt) {
BinaryRC4EncryptionVerifier ver = (BinaryRC4EncryptionVerifier)getEncryptionInfo().getVerifier();
ver.setSalt(verifierSalt);
SecretKey skey = BinaryRC4Decryptor.generateSecretKey(password, ver);
setSecretKey(skey);
try {
Cipher cipher = BinaryRC4Decryptor.initCipherForBlock(null, 0, getEncryptionInfo(), skey, Cipher.ENCRYPT_MODE);
- byte encryptedVerifier[] = new byte[16];
+ byte[] encryptedVerifier = new byte[16];
cipher.update(verifier, 0, 16, encryptedVerifier);
ver.setEncryptedVerifier(encryptedVerifier);
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
- byte calcVerifierHash[] = hashAlg.digest(verifier);
- byte encryptedVerifierHash[] = cipher.doFinal(calcVerifierHash);
+ byte[] calcVerifierHash = hashAlg.digest(verifier);
+ byte[] encryptedVerifierHash = cipher.doFinal(calcVerifierHash);
ver.setEncryptedVerifierHash(encryptedVerifierHash);
} catch (GeneralSecurityException e) {
throw new EncryptedDocumentException("Password confirmation failed", e);
diff --git a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
index d383ae4eab..550dcde2ee 100644
--- a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
@@ -74,15 +74,15 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
SecretKey skey = generateSecretKey(password, ver);
try {
Cipher cipher = initCipherForBlock(null, 0, getEncryptionInfo(), skey, Cipher.DECRYPT_MODE);
- byte encryptedVerifier[] = ver.getEncryptedVerifier();
- byte verifier[] = new byte[encryptedVerifier.length];
+ byte[] encryptedVerifier = ver.getEncryptedVerifier();
+ byte[] verifier = new byte[encryptedVerifier.length];
cipher.update(encryptedVerifier, 0, encryptedVerifier.length, verifier);
setVerifier(verifier);
- byte encryptedVerifierHash[] = ver.getEncryptedVerifierHash();
- byte verifierHash[] = cipher.doFinal(encryptedVerifierHash);
+ byte[] encryptedVerifierHash = ver.getEncryptedVerifierHash();
+ byte[] verifierHash = cipher.doFinal(encryptedVerifierHash);
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
- byte calcVerifierHash[] = hashAlg.digest(verifier);
+ byte[] calcVerifierHash = hashAlg.digest(verifier);
if (Arrays.equals(calcVerifierHash, verifierHash)) {
setSecretKey(skey);
return true;
@@ -106,11 +106,11 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
throws GeneralSecurityException {
EncryptionVerifier ver = encryptionInfo.getVerifier();
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
- byte blockKey[] = new byte[4];
+ byte[] blockKey = new byte[4];
LittleEndian.putUInt(blockKey, 0, block);
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
hashAlg.update(skey.getEncoded());
- byte encKey[] = hashAlg.digest(blockKey);
+ byte[] encKey = hashAlg.digest(blockKey);
EncryptionHeader header = encryptionInfo.getHeader();
int keyBits = header.getKeySize();
encKey = CryptoFunctions.getBlock0(encKey, keyBits / 8);
@@ -133,7 +133,7 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
hashAlg.update(ver.getSalt());
- byte hash[] = hashAlg.digest(StringUtil.getToUnicodeLE(password));
+ byte[] hash = hashAlg.digest(StringUtil.getToUnicodeLE(password));
return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
}
@@ -182,7 +182,7 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
}
sbis.setBlock(0);
int encryptedStreamDescriptorCount = (int) leis.readUInt();
- StreamDescriptorEntry entries[] = new StreamDescriptorEntry[encryptedStreamDescriptorCount];
+ StreamDescriptorEntry[] entries = new StreamDescriptorEntry[encryptedStreamDescriptorCount];
for (int i = 0; i < encryptedStreamDescriptorCount; i++) {
StreamDescriptorEntry entry = new StreamDescriptorEntry();
entries[i] = entry;
diff --git a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentInputStream.java b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentInputStream.java
index 5736649321..361578e967 100644
--- a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentInputStream.java
+++ b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentInputStream.java
@@ -33,7 +33,7 @@ import org.apache.poi.util.Internal;
/* package */ class CryptoAPIDocumentInputStream extends ByteArrayInputStream {
private Cipher cipher;
private final CryptoAPIDecryptor decryptor;
- private byte oneByte[] = { 0 };
+ private byte[] oneByte = {0};
public void seek(int newpos) {
if (newpos > count) {
@@ -64,7 +64,7 @@ import org.apache.poi.util.Internal;
}
@Override
- public synchronized int read(byte b[], int off, int len) {
+ public synchronized int read(byte[] b, int off, int len) {
int readLen = super.read(b, off, len);
if (readLen ==-1) {
return -1;
@@ -77,7 +77,7 @@ import org.apache.poi.util.Internal;
return readLen;
}
- public CryptoAPIDocumentInputStream(CryptoAPIDecryptor decryptor, byte buf[])
+ public CryptoAPIDocumentInputStream(CryptoAPIDecryptor decryptor, byte[] buf)
throws GeneralSecurityException {
super(buf);
this.decryptor = decryptor;
diff --git a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentOutputStream.java b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentOutputStream.java
index 5fa9564a41..fb6fb93e18 100644
--- a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentOutputStream.java
+++ b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDocumentOutputStream.java
@@ -31,7 +31,7 @@ import org.apache.poi.util.Internal;
/* package */ class CryptoAPIDocumentOutputStream extends ByteArrayOutputStream {
private final Cipher cipher;
private final CryptoAPIEncryptor encryptor;
- private final byte oneByte[] = { 0 };
+ private final byte[] oneByte = {0};
public CryptoAPIDocumentOutputStream(CryptoAPIEncryptor encryptor) throws GeneralSecurityException {
this.encryptor = encryptor;
diff --git a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptionVerifier.java b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptionVerifier.java
index f5482c58e7..9c43626f2d 100644
--- a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptionVerifier.java
+++ b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptionVerifier.java
@@ -37,17 +37,17 @@ public class CryptoAPIEncryptionVerifier extends StandardEncryptionVerifier impl
}
@Override
- protected void setSalt(byte salt[]) {
+ protected void setSalt(byte[] salt) {
super.setSalt(salt);
}
@Override
- protected void setEncryptedVerifier(byte encryptedVerifier[]) {
+ protected void setEncryptedVerifier(byte[] encryptedVerifier) {
super.setEncryptedVerifier(encryptedVerifier);
}
@Override
- protected void setEncryptedVerifierHash(byte encryptedVerifierHash[]) {
+ protected void setEncryptedVerifierHash(byte[] encryptedVerifierHash) {
super.setEncryptedVerifierHash(encryptedVerifierHash);
}
diff --git a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
index 9221d4a390..60b1be2841 100644
--- a/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIEncryptor.java
@@ -56,17 +56,17 @@ public class CryptoAPIEncryptor extends Encryptor implements Cloneable {
@Override
public void confirmPassword(String password) {
Random r = new SecureRandom();
- byte salt[] = new byte[16];
- byte verifier[] = new byte[16];
+ byte[] salt = new byte[16];
+ byte[] verifier = new byte[16];
r.nextBytes(salt);
r.nextBytes(verifier);
confirmPassword(password, null, null, verifier, salt, null);
}
@Override
- public void confirmPassword(String password, byte keySpec[],
- byte keySalt[], byte verifier[], byte verifierSalt[],
- byte integritySalt[]) {
+ public void confirmPassword(String password, byte[] keySpec,
+ byte[] keySalt, byte[] verifier, byte[] verifierSalt,
+ byte[] integritySalt) {
assert(verifier != null && verifierSalt != null);
CryptoAPIEncryptionVerifier ver = (CryptoAPIEncryptionVerifier)getEncryptionInfo().getVerifier();
ver.setSalt(verifierSalt);
@@ -74,13 +74,13 @@ public class CryptoAPIEncryptor extends Encryptor implements Cloneable {
setSecretKey(skey);
try {
Cipher cipher = initCipherForBlock(null, 0);
- byte encryptedVerifier[] = new byte[verifier.length];
+ byte[] encryptedVerifier = new byte[verifier.length];
cipher.update(verifier, 0, verifier.length, encryptedVerifier);
ver.setEncryptedVerifier(encryptedVerifier);
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
- byte calcVerifierHash[] = hashAlg.digest(verifier);
- byte encryptedVerifierHash[] = cipher.doFinal(calcVerifierHash);
+ byte[] calcVerifierHash = hashAlg.digest(verifier);
+ byte[] encryptedVerifierHash = cipher.doFinal(calcVerifierHash);
ver.setEncryptedVerifierHash(encryptedVerifierHash);
} catch (GeneralSecurityException e) {
throw new EncryptedDocumentException("Password confirmation failed", e);
@@ -121,7 +121,7 @@ public class CryptoAPIEncryptor extends Encryptor implements Cloneable {
public void setSummaryEntries(DirectoryNode dir, String encryptedStream, POIFSFileSystem entries)
throws IOException, GeneralSecurityException {
CryptoAPIDocumentOutputStream bos = new CryptoAPIDocumentOutputStream(this); // NOSONAR
- byte buf[] = new byte[8];
+ byte[] buf = new byte[8];
bos.write(buf, 0, 8); // skip header
List<StreamDescriptorEntry> descList = new ArrayList<>();
@@ -168,7 +168,7 @@ public class CryptoAPIEncryptor extends Encryptor implements Cloneable {
bos.write(buf, 0, 1);
LittleEndian.putUInt(buf, 0, sde.reserved2);
bos.write(buf, 0, 4);
- byte nameBytes[] = StringUtil.getToUnicodeLE(sde.streamName);
+ byte[] nameBytes = StringUtil.getToUnicodeLE(sde.streamName);
bos.write(nameBytes, 0, nameBytes.length);
LittleEndian.putShort(buf, 0, (short)0); // null-termination
bos.write(buf, 0, 2);
diff --git a/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java b/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java
index 682d77190b..67da57129a 100644
--- a/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java
@@ -56,13 +56,13 @@ public class StandardDecryptor extends Decryptor implements Cloneable {
Cipher cipher = getCipher(skey);
try {
- byte encryptedVerifier[] = ver.getEncryptedVerifier();
- byte verifier[] = cipher.doFinal(encryptedVerifier);
+ byte[] encryptedVerifier = ver.getEncryptedVerifier();
+ byte[] verifier = cipher.doFinal(encryptedVerifier);
setVerifier(verifier);
MessageDigest sha1 = CryptoFunctions.getMessageDigest(ver.getHashAlgorithm());
byte[] calcVerifierHash = sha1.digest(verifier);
- byte encryptedVerifierHash[] = ver.getEncryptedVerifierHash();
- byte decryptedVerifierHash[] = cipher.doFinal(encryptedVerifierHash);
+ byte[] encryptedVerifierHash = ver.getEncryptedVerifierHash();
+ byte[] decryptedVerifierHash = cipher.doFinal(encryptedVerifierHash);
// see 2.3.4.9 Password Verification (Standard Encryption)
// ... The number of bytes used by the encrypted Verifier hash MUST be 32 ...
@@ -83,14 +83,14 @@ public class StandardDecryptor extends Decryptor implements Cloneable {
protected static SecretKey generateSecretKey(String password, EncryptionVerifier ver, int keySize) {
HashAlgorithm hashAlgo = ver.getHashAlgorithm();
- byte pwHash[] = hashPassword(password, hashAlgo, ver.getSalt(), ver.getSpinCount());
+ byte[] pwHash = hashPassword(password, hashAlgo, ver.getSalt(), ver.getSpinCount());
byte[] blockKey = new byte[4];
LittleEndian.putInt(blockKey, 0, 0);
byte[] finalHash = CryptoFunctions.generateKey(pwHash, hashAlgo, blockKey, hashAlgo.hashSize);
- byte x1[] = fillAndXor(finalHash, (byte) 0x36);
- byte x2[] = fillAndXor(finalHash, (byte) 0x5c);
+ byte[] x1 = fillAndXor(finalHash, (byte) 0x36);
+ byte[] x2 = fillAndXor(finalHash, (byte) 0x5c);
byte[] x3 = new byte[x1.length + x2.length];
System.arraycopy(x1, 0, x3, 0, x1.length);
@@ -101,7 +101,7 @@ public class StandardDecryptor extends Decryptor implements Cloneable {
return new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
}
- protected static byte[] fillAndXor(byte hash[], byte fillByte) {
+ protected static byte[] fillAndXor(byte[] hash, byte fillByte) {
byte[] buff = new byte[64];
Arrays.fill(buff, fillByte);
diff --git a/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionVerifier.java b/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionVerifier.java
index 4fd284a86c..a60feae30a 100644
--- a/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionVerifier.java
+++ b/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionVerifier.java
@@ -38,17 +38,17 @@ public class StandardEncryptionVerifier extends EncryptionVerifier implements En
throw new RuntimeException("Salt size != 16 !?");
}
- byte salt[] = new byte[16];
+ byte[] salt = new byte[16];
is.readFully(salt);
setSalt(salt);
-
- byte encryptedVerifier[] = new byte[16];
+
+ byte[] encryptedVerifier = new byte[16];
is.readFully(encryptedVerifier);
setEncryptedVerifier(encryptedVerifier);
verifierHashSize = is.readInt();
- byte encryptedVerifierHash[] = new byte[header.getCipherAlgorithm().encryptedVerifierHashLength];
+ byte[] encryptedVerifierHash = new byte[header.getCipherAlgorithm().encryptedVerifierHashLength];
is.readFully(encryptedVerifierHash);
setEncryptedVerifierHash(encryptedVerifierHash);
@@ -69,7 +69,7 @@ public class StandardEncryptionVerifier extends EncryptionVerifier implements En
// make method visible for this package
@Override
- protected void setSalt(byte salt[]) {
+ protected void setSalt(byte[] salt) {
if (salt == null || salt.length != 16) {
throw new EncryptedDocumentException("invalid verifier salt");
}
@@ -78,26 +78,26 @@ public class StandardEncryptionVerifier extends EncryptionVerifier implements En
// make method visible for this package
@Override
- protected void setEncryptedVerifier(byte encryptedVerifier[]) {
+ protected void setEncryptedVerifier(byte[] encryptedVerifier) {
super.setEncryptedVerifier(encryptedVerifier);
}
// make method visible for this package
@Override
- protected void setEncryptedVerifierHash(byte encryptedVerifierHash[]) {
+ protected void setEncryptedVerifierHash(byte[] encryptedVerifierHash) {
super.setEncryptedVerifierHash(encryptedVerifierHash);
}
@Override
public void write(LittleEndianByteArrayOutputStream bos) {
// see [MS-OFFCRYPTO] - 2.3.4.9
- byte salt[] = getSalt();
+ byte[] salt = getSalt();
assert(salt.length == 16);
bos.writeInt(salt.length); // salt size
bos.write(salt);
// The resulting Verifier value MUST be an array of 16 bytes.
- byte encryptedVerifier[] = getEncryptedVerifier();
+ byte[] encryptedVerifier = getEncryptedVerifier();
assert(encryptedVerifier.length == 16);
bos.write(encryptedVerifier);
@@ -111,7 +111,7 @@ public class StandardEncryptionVerifier extends EncryptionVerifier implements En
// Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption
// algorithm is AES, the length MUST be 32 bytes. After decrypting the EncryptedVerifierHash
// field, only the first VerifierHashSize bytes MUST be used.
- byte encryptedVerifierHash[] = getEncryptedVerifierHash();
+ byte[] encryptedVerifierHash = getEncryptedVerifierHash();
assert(encryptedVerifierHash.length == getCipherAlgorithm().encryptedVerifierHashLength);
bos.write(encryptedVerifierHash);
}
diff --git a/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptor.java b/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptor.java
index 274a778cca..7de19b9a7b 100644
--- a/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptor.java
@@ -78,7 +78,7 @@ public class StandardEncryptor extends Encryptor implements Cloneable {
* see [MS-OFFCRYPTO] - 2.3.4.7 ECMA-376 Document Encryption Key Generation
*/
@Override
- public void confirmPassword(String password, byte keySpec[], byte keySalt[], byte verifier[], byte verifierSalt[], byte integritySalt[]) {
+ public void confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt) {
StandardEncryptionVerifier ver = (StandardEncryptionVerifier)getEncryptionInfo().getVerifier();
ver.setSalt(verifierSalt);
@@ -87,9 +87,9 @@ public class StandardEncryptor extends Encryptor implements Cloneable {
Cipher cipher = getCipher(secretKey, null);
try {
- byte encryptedVerifier[] = cipher.doFinal(verifier);
+ byte[] encryptedVerifier = cipher.doFinal(verifier);
MessageDigest hashAlgo = CryptoFunctions.getMessageDigest(ver.getHashAlgorithm());
- byte calcVerifierHash[] = hashAlgo.digest(verifier);
+ byte[] calcVerifierHash = hashAlgo.digest(verifier);
// 2.3.3 EncryptionVerifier ...
// An array of bytes that contains the encrypted form of the
@@ -98,8 +98,8 @@ public class StandardEncryptor extends Encryptor implements Cloneable {
// Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption
// algorithm is AES, the length MUST be 32 bytes. After decrypting the EncryptedVerifierHash
// field, only the first VerifierHashSize bytes MUST be used.
- int encVerHashSize = ver.getCipherAlgorithm().encryptedVerifierHashLength;
- byte encryptedVerifierHash[] = cipher.doFinal(Arrays.copyOf(calcVerifierHash, encVerHashSize));
+ int encVerHashSize = ver.getCipherAlgorithm().encryptedVerifierHashLength;
+ byte[] encryptedVerifierHash = cipher.doFinal(Arrays.copyOf(calcVerifierHash, encVerHashSize));
ver.setEncryptedVerifier(encryptedVerifier);
ver.setEncryptedVerifierHash(encryptedVerifierHash);
diff --git a/src/java/org/apache/poi/poifs/crypt/xor/XORDecryptor.java b/src/java/org/apache/poi/poifs/crypt/xor/XORDecryptor.java
index 26fc78d8b7..66664b9d4a 100644
--- a/src/java/org/apache/poi/poifs/crypt/xor/XORDecryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/xor/XORDecryptor.java
@@ -48,7 +48,7 @@ public class XORDecryptor extends Decryptor implements Cloneable {
int keyComp = CryptoFunctions.createXorKey1(password);
int verifierComp = CryptoFunctions.createXorVerifier1(password);
if (keyVer == keyComp && verifierVer == verifierComp) {
- byte xorArray[] = CryptoFunctions.createXorArray1(password);
+ byte[] xorArray = CryptoFunctions.createXorArray1(password);
setSecretKey(new SecretKeySpec(xorArray, "XOR"));
return true;
} else {
@@ -119,9 +119,9 @@ public class XORDecryptor extends Decryptor implements Cloneable {
@Override
protected int invokeCipher(int totalBytes, boolean doFinal) {
final int pos = (int)getPos();
- final byte xorArray[] = getEncryptionInfo().getDecryptor().getSecretKey().getEncoded();
- final byte chunk[] = getChunk();
- final byte plain[] = getPlain();
+ final byte[] xorArray = getEncryptionInfo().getDecryptor().getSecretKey().getEncoded();
+ final byte[] chunk = getChunk();
+ final byte[] plain = getPlain();
final int posInChunk = pos & getChunkMask();
/*
@@ -164,7 +164,7 @@ public class XORDecryptor extends Decryptor implements Cloneable {
@Override
public void setNextRecordSize(int recordSize) {
final int pos = (int)getPos();
- final byte chunk[] = getChunk();
+ final byte[] chunk = getChunk();
final int chunkMask = getChunkMask();
recordStart = pos;
recordEnd = recordStart+recordSize;
diff --git a/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptionVerifier.java b/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptionVerifier.java
index ba0645cb77..d3a18e1398 100644
--- a/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptionVerifier.java
+++ b/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptionVerifier.java
@@ -35,7 +35,7 @@ public class XOREncryptionVerifier extends EncryptionVerifier implements Encrypt
* See [MS-OFFCRYPTO], 2.3.6.2 section, the first step of initializing XOR
* array where it describes the generation of 16-bit XorKey value.
*/
- byte key[] = new byte[2];
+ byte[] key = new byte[2];
is.readFully(key);
setEncryptedKey(key);
@@ -43,7 +43,7 @@ public class XOREncryptionVerifier extends EncryptionVerifier implements Encrypt
* verificationBytes (2 bytes): An unsigned integer that specifies
* the password verification identifier.
*/
- byte verifier[] = new byte[2];
+ byte[] verifier = new byte[2];
is.readFully(verifier);
setEncryptedVerifier(verifier);
}
diff --git a/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java b/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java
index 754d9df118..04cd5a8543 100644
--- a/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java
+++ b/src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java
@@ -41,9 +41,9 @@ public class XOREncryptor extends Encryptor implements Cloneable {
public void confirmPassword(String password) {
int keyComp = CryptoFunctions.createXorKey1(password);
int verifierComp = CryptoFunctions.createXorVerifier1(password);
- byte xorArray[] = CryptoFunctions.createXorArray1(password);
-
- byte shortBuf[] = new byte[2];
+ byte[] xorArray = CryptoFunctions.createXorArray1(password);
+
+ byte[] shortBuf = new byte[2];
XOREncryptionVerifier ver = (XOREncryptionVerifier)getEncryptionInfo().getVerifier();
LittleEndian.putUShort(shortBuf, 0, keyComp);
ver.setEncryptedKey(shortBuf);
@@ -53,9 +53,9 @@ public class XOREncryptor extends Encryptor implements Cloneable {
}
@Override
- public void confirmPassword(String password, byte keySpec[],
- byte keySalt[], byte verifier[], byte verifierSalt[],
- byte integritySalt[]) {
+ public void confirmPassword(String password, byte[] keySpec,
+ byte[] keySalt, byte[] verifier, byte[] verifierSalt,
+ byte[] integritySalt) {
confirmPassword(password);
}
@@ -137,9 +137,9 @@ public class XOREncryptor extends Encryptor implements Cloneable {
final int start = Math.max(posInChunk-(recordEnd-recordStart), 0);
final BitSet plainBytes = getPlainByteFlags();
- final byte xorArray[] = getEncryptionInfo().getEncryptor().getSecretKey().getEncoded();
- final byte chunk[] = getChunk();
- final byte plain[] = (plainBytes.isEmpty()) ? null : chunk.clone();
+ final byte[] xorArray = getEncryptionInfo().getEncryptor().getSecretKey().getEncoded();
+ final byte[] chunk = getChunk();
+ final byte[] plain = (plainBytes.isEmpty()) ? null : chunk.clone();
/*
* From: http://social.msdn.microsoft.com/Forums/en-US/3dadbed3-0e68-4f11-8b43-3a2328d9ebd5
diff --git a/src/java/org/apache/poi/poifs/dev/POIFSLister.java b/src/java/org/apache/poi/poifs/dev/POIFSLister.java
index 65c1e2c9ba..345d3c6a2c 100644
--- a/src/java/org/apache/poi/poifs/dev/POIFSLister.java
+++ b/src/java/org/apache/poi/poifs/dev/POIFSLister.java
@@ -38,7 +38,7 @@ public class POIFSLister {
*
* @param args the names of the files to be displayed
*/
- public static void main(final String args[]) throws IOException {
+ public static void main(final String[] args) throws IOException {
if (args.length == 0) {
System.err.println("Must specify at least one file to view");
System.exit(1);
diff --git a/src/java/org/apache/poi/poifs/dev/POIFSViewer.java b/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
index ee53fb19eb..18095397f6 100644
--- a/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
+++ b/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
@@ -41,7 +41,7 @@ public final class POIFSViewer {
* @param args the names of the files to be displayed
*/
- public static void main(final String args[]) {
+ public static void main(final String[] args) {
if (args.length == 0) {
System.err.println("Must specify at least one file to view");
System.exit(1);
diff --git a/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java b/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
index 90779546cf..718709f51f 100644
--- a/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
+++ b/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReader.java
@@ -179,7 +179,7 @@ public class POIFSReader
* @exception IOException if the files can't be read or have invalid content
*/
- public static void main(String args[]) throws IOException {
+ public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.err.println("at least one argument required: input filename(s)");
System.exit(1);
diff --git a/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java b/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
index 2e6cfcd55e..57084e6391 100644
--- a/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
+++ b/src/java/org/apache/poi/poifs/filesystem/Ole10Native.java
@@ -428,7 +428,7 @@ public class Ole10Native {
this.unknown1 = unknown1;
}
- public void setDataBuffer(byte dataBuffer[]) {
+ public void setDataBuffer(byte[] dataBuffer) {
this.dataBuffer = dataBuffer.clone();
}
}
diff --git a/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
index 2f7eb77a2b..36c7648377 100644
--- a/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
+++ b/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java
@@ -787,7 +787,7 @@ public class POIFSFileSystem extends BlockStore
* @param args names of the files; arg[ 0 ] is the input file,
* arg[ 1 ] is the output file
*/
- public static void main(String args[]) throws IOException {
+ public static void main(String[] args) throws IOException {
if (args.length != 2) {
System.err.println(
"two arguments required: input filename and output filename");
diff --git a/src/java/org/apache/poi/poifs/filesystem/POIFSStream.java b/src/java/org/apache/poi/poifs/filesystem/POIFSStream.java
index 7af205accf..f5bbf5bd4b 100644
--- a/src/java/org/apache/poi/poifs/filesystem/POIFSStream.java
+++ b/src/java/org/apache/poi/poifs/filesystem/POIFSStream.java
@@ -177,7 +177,7 @@ public class POIFSStream implements Iterable<ByteBuffer>
}
protected class StreamBlockByteBuffer extends OutputStream {
- byte oneByte[] = new byte[1];
+ byte[] oneByte = new byte[1];
ByteBuffer buffer;
// Make sure we don't encounter a loop whilst overwriting
// the existing blocks
diff --git a/src/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java b/src/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java
index 665ccf5bdc..e5ffbb3ada 100644
--- a/src/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java
+++ b/src/java/org/apache/poi/poifs/macros/VBAMacroExtractor.java
@@ -34,7 +34,7 @@ import org.apache.poi.util.StringUtil;
* @since 3.15-beta2
*/
public class VBAMacroExtractor {
- public static void main(String args[]) throws IOException {
+ public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.err.println("Use:");
System.err.println(" VBAMacroExtractor <office.doc> [output]");
diff --git a/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java b/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java
index c37ce006a0..145791f401 100644
--- a/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java
+++ b/src/java/org/apache/poi/sl/draw/BitmapImageRenderer.java
@@ -72,7 +72,7 @@ public class BitmapImageRenderer implements ImageRenderer {
}
@Override
- public void loadImage(byte data[], String contentType) throws IOException {
+ public void loadImage(byte[] data, String contentType) throws IOException {
img = readImage(new ByteArrayInputStream(data), contentType);
}
diff --git a/src/java/org/apache/poi/sl/draw/DrawFactory.java b/src/java/org/apache/poi/sl/draw/DrawFactory.java
index 99c9942b67..6a032d6c6e 100644
--- a/src/java/org/apache/poi/sl/draw/DrawFactory.java
+++ b/src/java/org/apache/poi/sl/draw/DrawFactory.java
@@ -211,7 +211,7 @@ public class DrawFactory {
}
}
-
+
/**
* Return a FontManager, either registered beforehand or a default implementation
*
diff --git a/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java b/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java
index a428943699..7dcd704c4e 100644
--- a/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java
+++ b/src/java/org/apache/poi/sl/draw/DrawFontManagerDefault.java
@@ -76,7 +76,7 @@ public class DrawFontManagerDefault implements DrawFontManager {
public static String mapSymbolChars(String text) {
// wingdings doesn't contain high-surrogates, so chars are ok
boolean changed = false;
- char chrs[] = text.toCharArray();
+ char[] chrs = text.toCharArray();
for (int i=0; i<chrs.length; i++) {
// only change valid chars
if ((0x20 <= chrs[i] && chrs[i] <= 0x7f) ||
diff --git a/src/java/org/apache/poi/sl/draw/DrawShape.java b/src/java/org/apache/poi/sl/draw/DrawShape.java
index 0c6054c8a9..67162ac4a8 100644
--- a/src/java/org/apache/poi/sl/draw/DrawShape.java
+++ b/src/java/org/apache/poi/sl/draw/DrawShape.java
@@ -65,7 +65,7 @@ public class DrawShape implements Drawable {
final Rectangle2D anchor = getAnchor(graphics, ps);
- char cmds[] = isHSLF ? new char[]{ 'h','v','r' } : new char[]{ 'r','h','v' };
+ char[] cmds = isHSLF ? new char[]{'h', 'v', 'r'} : new char[]{'r', 'h', 'v'};
for (char ch : cmds) {
switch (ch) {
case 'h':
@@ -232,7 +232,7 @@ public class DrawShape implements Drawable {
lineDash = LineDash.SOLID;
}
- int dashPatI[] = lineDash.pattern;
+ int[] dashPatI = lineDash.pattern;
final float dash_phase = 0;
float[] dashPatF = null;
if (dashPatI != null) {
diff --git a/src/java/org/apache/poi/sl/draw/DrawTableShape.java b/src/java/org/apache/poi/sl/draw/DrawTableShape.java
index 703fb04d82..1974f0d9a7 100644
--- a/src/java/org/apache/poi/sl/draw/DrawTableShape.java
+++ b/src/java/org/apache/poi/sl/draw/DrawTableShape.java
@@ -165,7 +165,7 @@ public class DrawTableShape extends DrawShape {
final int rows = table.getNumberOfRows();
final int cols = table.getNumberOfColumns();
- BorderEdge edges[] = { BorderEdge.top, BorderEdge.left, null, null };
+ BorderEdge[] edges = {BorderEdge.top, BorderEdge.left, null, null};
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
edges[2] = (col == cols - 1) ? BorderEdge.right : null;
@@ -189,7 +189,7 @@ public class DrawTableShape extends DrawShape {
final int rows = table.getNumberOfRows();
final int cols = table.getNumberOfColumns();
- BorderEdge edges[] = new BorderEdge[4];
+ BorderEdge[] edges = new BorderEdge[4];
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
edges[0] = (col == 0) ? BorderEdge.left : null;
@@ -215,7 +215,7 @@ public class DrawTableShape extends DrawShape {
final int rows = table.getNumberOfRows();
final int cols = table.getNumberOfColumns();
- BorderEdge edges[] = new BorderEdge[2];
+ BorderEdge[] edges = new BorderEdge[2];
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
edges[0] = (col > 0 && col < cols - 1) ? BorderEdge.right : null;
@@ -232,7 +232,7 @@ public class DrawTableShape extends DrawShape {
* @param edges the border edges
* @param args the border attributes
*/
- private static void setEdges(TableCell<?,?> cell, BorderEdge edges[], Object... args) {
+ private static void setEdges(TableCell<?,?> cell, BorderEdge[] edges, Object... args) {
if (cell == null) {
return;
}
diff --git a/src/java/org/apache/poi/sl/draw/ImageRenderer.java b/src/java/org/apache/poi/sl/draw/ImageRenderer.java
index b2355b3012..330c02ab01 100644
--- a/src/java/org/apache/poi/sl/draw/ImageRenderer.java
+++ b/src/java/org/apache/poi/sl/draw/ImageRenderer.java
@@ -96,7 +96,7 @@ public interface ImageRenderer {
* @param data the raw image bytes
* @param contentType the content type
*/
- void loadImage(byte data[], String contentType) throws IOException;
+ void loadImage(byte[] data, String contentType) throws IOException;
/**
* @return the dimension of the buffered image
diff --git a/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java b/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java
index 3ecc6e55c7..c6283b6759 100644
--- a/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java
+++ b/src/java/org/apache/poi/sl/image/ImageHeaderBitmap.java
@@ -35,7 +35,7 @@ public class ImageHeaderBitmap {
private final Dimension size;
- public ImageHeaderBitmap(byte data[], int offset) {
+ public ImageHeaderBitmap(byte[] data, int offset) {
BufferedImage img = null;
try {
img = ImageIO.read(new ByteArrayInputStream(data, offset, data.length-offset));
diff --git a/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java b/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java
index fc7be14fed..48bf45564b 100644
--- a/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java
+++ b/src/java/org/apache/poi/sl/image/ImageHeaderEMF.java
@@ -36,7 +36,7 @@ public class ImageHeaderEMF {
// rectangle that can be drawn around the image stored in the metafile.
private final Rectangle deviceBounds;
- public ImageHeaderEMF(final byte data[], final int off) {
+ public ImageHeaderEMF(final byte[] data, final int off) {
int offset = off;
int type = (int)LittleEndian.getUInt(data, offset); offset += 4;
if (type != 1) {
diff --git a/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java b/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java
index ff121e3e7c..bf9cacefaf 100644
--- a/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java
+++ b/src/java/org/apache/poi/sl/image/ImageHeaderPICT.java
@@ -32,17 +32,17 @@ public class ImageHeaderPICT {
public static final double DEFAULT_RESOLUTION = Units.POINT_DPI;
- private static final byte V2_HEADER[] = {
- 0x00, 0x11, // v2 version opcode
- 0x02, (byte)0xFF, // version number of new picture
- 0x0C, 0x00, // header opcode
- (byte)0xFF, (byte)0xFE, 0x00, 0x00 // pic size dummy
+ private static final byte[] V2_HEADER = {
+ 0x00, 0x11, // v2 version opcode
+ 0x02, (byte) 0xFF, // version number of new picture
+ 0x0C, 0x00, // header opcode
+ (byte) 0xFF, (byte) 0xFE, 0x00, 0x00 // pic size dummy
};
private final Rectangle bounds;
private final double hRes, vRes;
- public ImageHeaderPICT(byte data[], final int off) {
+ public ImageHeaderPICT(byte[] data, final int off) {
// http://mirrors.apple2.org.za/apple.cabi.net/Graphics/PICT.and_QT.INFO/PICT.file.format.TI.txt
int offset = off;
// low order 16 bits of picture size - can be ignored
@@ -86,13 +86,13 @@ public class ImageHeaderPICT {
return bounds;
}
- private static int readUnsignedShort(byte data[], int offset) {
+ private static int readUnsignedShort(byte[] data, int offset) {
int b0 = data[offset] & 0xFF;
int b1 = data[offset+1] & 0xFF;
return b0 << 8 | b1;
}
- private static double readFixedPoint(byte data[], int offset) {
+ private static double readFixedPoint(byte[] data, int offset) {
int b0 = data[offset] & 0xFF;
int b1 = data[offset+1] & 0xFF;
int b2 = data[offset+2] & 0xFF;
diff --git a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java
index 0abd5d62a5..939add734f 100644
--- a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java
+++ b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java
@@ -245,31 +245,31 @@ public enum AutoNumberingScheme {
//M (1000), CM (900), D (500), CD (400), C (100), XC (90), L (50), XL (40), X (10), IX (9), V (5), IV (4) and I (1).
final int[] VALUES = new int[]{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
final String[] ROMAN = new String[]{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
- final String conciseList[][] = {
- {"XLV", "VL"}, //45
- {"XCV", "VC"}, //95
- {"CDL", "LD"}, //450
- {"CML", "LM"}, //950
- {"CMVC", "LMVL"}, //995
- {"CDXC", "LDXL"}, //490
- {"CDVC", "LDVL"}, //495
- {"CMXC", "LMXL"}, //990
- {"XCIX", "VCIV"}, //99
- {"XLIX", "VLIV"}, //49
- {"XLIX", "IL"}, //49
- {"XCIX", "IC"}, //99
- {"CDXC", "XD"}, //490
- {"CDVC", "XDV"}, //495
- {"CDIC", "XDIX"}, //499
- {"LMVL", "XMV"}, //995
- {"CMIC", "XMIX"}, //999
- {"CMXC", "XM"}, // 990
- {"XDV", "VD"}, //495
- {"XDIX", "VDIV"}, //499
- {"XMV", "VM"}, // 995
- {"XMIX", "VMIV"}, //999
- {"VDIV", "ID"}, //499
- {"VMIV", "IM"} //999
+ final String[][] conciseList = {
+ {"XLV", "VL"}, //45
+ {"XCV", "VC"}, //95
+ {"CDL", "LD"}, //450
+ {"CML", "LM"}, //950
+ {"CMVC", "LMVL"}, //995
+ {"CDXC", "LDXL"}, //490
+ {"CDVC", "LDVL"}, //495
+ {"CMXC", "LMXL"}, //990
+ {"XCIX", "VCIV"}, //99
+ {"XLIX", "VLIV"}, //49
+ {"XLIX", "IL"}, //49
+ {"XCIX", "IC"}, //99
+ {"CDXC", "XD"}, //490
+ {"CDVC", "XDV"}, //495
+ {"CDIC", "XDIX"}, //499
+ {"LMVL", "XMV"}, //995
+ {"CMIC", "XMIX"}, //999
+ {"CMXC", "XM"}, // 990
+ {"XDV", "VD"}, //495
+ {"XDIX", "VDIV"}, //499
+ {"XMV", "VM"}, // 995
+ {"XMIX", "VMIV"}, //999
+ {"VDIV", "ID"}, //499
+ {"VMIV", "IM"} //999
};
StringBuilder sb = new StringBuilder();
@@ -280,7 +280,7 @@ public enum AutoNumberingScheme {
}
}
String result = sb.toString();
- for (String cc[] : conciseList) {
+ for (String[] cc : conciseList) {
result = result.replace(cc[0], cc[1]);
}
return result;
diff --git a/src/java/org/apache/poi/sl/usermodel/PresetColor.java b/src/java/org/apache/poi/sl/usermodel/PresetColor.java
index 9c4df2f9f6..2538d1b828 100644
--- a/src/java/org/apache/poi/sl/usermodel/PresetColor.java
+++ b/src/java/org/apache/poi/sl/usermodel/PresetColor.java
@@ -273,7 +273,7 @@ public enum PresetColor {
}
public static PresetColor valueOfNativeId(int nativeId) {
- PresetColor vals[] = values();
+ PresetColor[] vals = values();
return (0 < nativeId && nativeId <= vals.length) ? vals[nativeId-1] : null;
}
}
diff --git a/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java b/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
index 81f297e2cc..460e93bb23 100644
--- a/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
+++ b/src/java/org/apache/poi/sl/usermodel/SlideShowFactory.java
@@ -294,10 +294,10 @@ public class SlideShowFactory {
private static <
S extends Shape<S,P>,
P extends TextParagraph<S,P,? extends TextRun>
- > SlideShow<S,P> createSlideShow(String factoryClass, Object args[]) throws IOException, EncryptedDocumentException {
+ > SlideShow<S,P> createSlideShow(String factoryClass, Object[] args) throws IOException, EncryptedDocumentException {
try {
Class<?> clazz = SlideShowFactory.class.getClassLoader().loadClass(factoryClass);
- Class<?> argsClz[] = new Class<?>[args.length];
+ Class<?>[] argsClz = new Class<?>[args.length];
int i=0;
for (Object o : args) {
Class<?> c = o.getClass();
diff --git a/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java b/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java
index b26658fe8b..500dffde4e 100644
--- a/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java
+++ b/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java
@@ -81,7 +81,7 @@ public interface StrokeStyle {
/** PS_DASHDOTDOT system dash style / native 5 */
SYS_DASH_DOT_DOT(5, 11, 2,2,1,1,1,1);
- public final int pattern[];
+ public final int[] pattern;
public final int nativeId;
public final int ooxmlId;
diff --git a/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java b/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
index 965a4d1a9e..adba13d520 100644
--- a/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
+++ b/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
@@ -234,7 +234,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
}
// TODO: investigate if this is just an EMF-hack or if other formats are also embedded in EMF
- byte pictureBytes[] = pd.getData();
+ byte[] pictureBytes = pd.getData();
int idxStart = indexOf(pictureBytes, 0, "%PDF-".getBytes(LocaleUtil.CHARSET_1252));
if (idxStart == -1) {
return null;
@@ -283,7 +283,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
}
DocumentInputStream dis = dn.createDocumentInputStream("package");
- byte data[] = IOUtils.toByteArray(dis);
+ byte[] data = IOUtils.toByteArray(dis);
dis.close();
return new EmbeddedData(dn.getName()+ext, data, contentType);
diff --git a/src/java/org/apache/poi/ss/format/CellNumberFormatter.java b/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
index 764456a369..2511917e25 100644
--- a/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
+++ b/src/java/org/apache/poi/ss/format/CellNumberFormatter.java
@@ -185,8 +185,8 @@ public class CellNumberFormatter extends CellFormatter {
} else {
afterFractional = null;
}
-
- double scaleByRef[] = { ph.getScale() };
+
+ double[] scaleByRef = {ph.getScale()};
showGroupingSeparator = interpretIntegerCommas(descBuf, specials, decimalPoint, integerEnd(), fractionalEnd(), scaleByRef);
if (exponent == null) {
scale = scaleByRef[0];
diff --git a/src/java/org/apache/poi/ss/formula/CacheAreaEval.java b/src/java/org/apache/poi/ss/formula/CacheAreaEval.java
index 50a5e06b0c..2716e24084 100644
--- a/src/java/org/apache/poi/ss/formula/CacheAreaEval.java
+++ b/src/java/org/apache/poi/ss/formula/CacheAreaEval.java
@@ -63,8 +63,8 @@ public final class CacheAreaEval extends AreaEvalBase {
int height = area.getLastRow() - area.getFirstRow() + 1;
int width = area.getLastColumn() - area.getFirstColumn() + 1;
-
- ValueEval newVals[] = new ValueEval[height * width];
+
+ ValueEval[] newVals = new ValueEval[height * width];
int startRow = area.getFirstRow() - getFirstRow();
int startCol = area.getFirstColumn() - getFirstColumn();
diff --git a/src/java/org/apache/poi/ss/formula/OperationEvaluationContext.java b/src/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
index 2fd24fe5c9..5be4108d12 100644
--- a/src/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
+++ b/src/java/org/apache/poi/ss/formula/OperationEvaluationContext.java
@@ -347,8 +347,8 @@ public final class OperationEvaluationContext {
public ValueEval getAreaValueEval(int firstRowIndex, int firstColumnIndex,
int lastRowIndex, int lastColumnIndex, Object[][] tokens) {
-
- ValueEval values[] = new ValueEval[tokens.length * tokens[0].length];
+
+ ValueEval[] values = new ValueEval[tokens.length * tokens[0].length];
int index = 0;
for (int jdx = 0; jdx < tokens.length; jdx++) {
diff --git a/src/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java b/src/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java
index e5e1315832..7bec3599b6 100644
--- a/src/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java
+++ b/src/java/org/apache/poi/ss/formula/eval/TwoOperandNumericOperation.java
@@ -33,7 +33,7 @@ public abstract class TwoOperandNumericOperation extends Fixed2ArgFunction imple
return OperandResolver.coerceValueToDouble(ve);
}
- public ValueEval evaluateArray(ValueEval args[], int srcRowIndex, int srcColumnIndex) {
+ public ValueEval evaluateArray(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length != 2) {
return ErrorEval.VALUE_INVALID;
}
@@ -73,8 +73,8 @@ public abstract class TwoOperandNumericOperation extends Fixed2ArgFunction imple
protected double[][] evaluate(double[][] d1, double[][] d2) throws IllegalArgumentException, EvaluationException {
int width = (d1[0].length < d2[0].length) ? d1[0].length : d2[0].length;
int height = (d1.length < d2.length) ? d1.length : d2.length;
-
- double result[][] = new double[height][width];
+
+ double[][] result = new double[height][width];
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
diff --git a/src/java/org/apache/poi/ss/formula/functions/Days360.java b/src/java/org/apache/poi/ss/formula/functions/Days360.java
index 025c28bcdb..6a5dabcf49 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Days360.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Days360.java
@@ -92,8 +92,8 @@ public class Days360 extends Var2or3ArgFunction {
private static double evaluate(double d0, double d1, boolean method) {
Calendar realStart = getDate(d0);
Calendar realEnd = getDate(d1);
- int startingDate[] = getStartingDate(realStart, method);
- int endingDate[] = getEndingDate(realEnd, startingDate, method);
+ int[] startingDate = getStartingDate(realStart, method);
+ int[] endingDate = getEndingDate(realEnd, startingDate, method);
return
(endingDate[0]*360+endingDate[1]*30+endingDate[2])-
(startingDate[0]*360+startingDate[1]*30+startingDate[2]);
@@ -115,7 +115,7 @@ public class Days360 extends Var2or3ArgFunction {
return new int[]{yyyy,mm,dd};
}
- private static int[] getEndingDate(Calendar realEnd, int startingDate[], boolean method) {
+ private static int[] getEndingDate(Calendar realEnd, int[] startingDate, boolean method) {
int yyyy = realEnd.get(Calendar.YEAR);
int mm = realEnd.get(Calendar.MONTH);
int dd = Math.min(30, realEnd.get(Calendar.DAY_OF_MONTH));
diff --git a/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java b/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
index b6c8aba976..4159ddcd98 100644
--- a/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
+++ b/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java
@@ -96,12 +96,13 @@ public abstract class MatrixFunction implements Function{
@Override
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) {
if (arg0 instanceof AreaEval) {
- double result[], resultArray[][];
+ double[] result;
+ double[][] resultArray;
int width, height;
try {
- double values[] = collectValues(arg0);
- double array[][] = fillDoubleArray(values,((AreaEval) arg0).getHeight(),((AreaEval) arg0).getWidth());
+ double[] values = collectValues(arg0);
+ double[][] array = fillDoubleArray(values, ((AreaEval) arg0).getHeight(), ((AreaEval) arg0).getWidth());
resultArray = evaluate(array);
width = resultArray[0].length;
height = resultArray.length;
@@ -112,8 +113,8 @@ public abstract class MatrixFunction implements Function{
catch(EvaluationException e){
return e.getErrorEval();
}
-
- ValueEval vals[] = new ValueEval[result.length];
+
+ ValueEval[] vals = new ValueEval[result.length];
for (int idx = 0; idx < result.length; idx++) {
vals[idx] = new NumberEval(result[idx]);
@@ -130,10 +131,10 @@ public abstract class MatrixFunction implements Function{
}
}
else {
- double result[][];
+ double[][] result;
try {
double value = NumericFunction.singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex);
- double temp[][] = {{value}};
+ double[][] temp = {{value}};
result = evaluate(temp);
NumericFunction.checkValue(result[0][0]);
}
@@ -156,15 +157,17 @@ public abstract class MatrixFunction implements Function{
@Override
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {
- double result[];
+ double[] result;
int width, height;
try {
- double array0[][], array1[][], resultArray[][];
-
+ double[][] array0;
+ double[][] array1;
+ double[][] resultArray;
+
if (arg0 instanceof AreaEval) {
try {
- double values[] = collectValues(arg0);
+ double[] values = collectValues(arg0);
array0 = fillDoubleArray(values, ((AreaEval) arg0).getHeight(), ((AreaEval) arg0).getWidth());
}
catch(EvaluationException e) {
@@ -183,7 +186,7 @@ public abstract class MatrixFunction implements Function{
if (arg1 instanceof AreaEval) {
try {
- double values[] = collectValues(arg1);
+ double[] values = collectValues(arg1);
array1 = fillDoubleArray(values, ((AreaEval) arg1).getHeight(),((AreaEval) arg1).getWidth());
}
catch (EvaluationException e) {
@@ -212,9 +215,9 @@ public abstract class MatrixFunction implements Function{
catch (IllegalArgumentException e) {
return ErrorEval.VALUE_INVALID;
}
-
-
- ValueEval vals[] = new ValueEval[result.length];
+
+
+ ValueEval[] vals = new ValueEval[result.length];
for (int idx = 0; idx < result.length; idx++) {
vals[idx] = new NumberEval(result[idx]);
@@ -308,8 +311,8 @@ public abstract class MatrixFunction implements Function{
if (d1.length != d1[0].length) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
-
- double result[][] = new double[1][1];
+
+ double[][] result = new double[1][1];
Array2DRowRealMatrix temp = new Array2DRowRealMatrix(d1);
result[0][0] = (new LUDecomposition(temp)).getDeterminant();
return result;
@@ -320,7 +323,7 @@ public abstract class MatrixFunction implements Function{
private final MutableValueCollector instance = new MutableValueCollector(false, false);
protected double[] collectValues(ValueEval arg) throws EvaluationException {
- double values[] = instance.collectValues(arg);
+ double[] values = instance.collectValues(arg);
/* handle case where MMULT is operating on an array that is not completely filled*/
if (arg instanceof AreaEval && values.length == 1)
diff --git a/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java b/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
index 832795a07f..45fa47d3ed 100644
--- a/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
+++ b/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
@@ -319,10 +319,10 @@ public class WorkbookFactory {
* Uses reflection, so that this class can be in the Core non-OOXML
* POI jar without errors / broken references to the OOXML / XSSF code.
*/
- private static Workbook createWorkbook(String factoryClass, Object args[]) throws IOException, EncryptedDocumentException {
+ private static Workbook createWorkbook(String factoryClass, Object[] args) throws IOException, EncryptedDocumentException {
try {
Class<?> clazz = WorkbookFactory.class.getClassLoader().loadClass(factoryClass);
- Class<?> argsClz[] = new Class<?>[args.length];
+ Class<?>[] argsClz = new Class<?>[args.length];
int i=0;
for (Object o : args) {
Class<?> c = o.getClass();
diff --git a/src/java/org/apache/poi/ss/util/CellUtil.java b/src/java/org/apache/poi/ss/util/CellUtil.java
index 3bcef4beb4..9dabd2b631 100644
--- a/src/java/org/apache/poi/ss/util/CellUtil.java
+++ b/src/java/org/apache/poi/ss/util/CellUtil.java
@@ -100,10 +100,9 @@ public final class CellUtil {
BORDER_RIGHT,
BORDER_TOP
)));
-
- private static UnicodeMapping unicodeMappings[];
+ private static UnicodeMapping[] unicodeMappings;
private static final class UnicodeMapping {
diff --git a/src/java/org/apache/poi/util/IOUtils.java b/src/java/org/apache/poi/util/IOUtils.java
index 3dd4cb0d57..5372d5bc9c 100644
--- a/src/java/org/apache/poi/util/IOUtils.java
+++ b/src/java/org/apache/poi/util/IOUtils.java
@@ -86,7 +86,7 @@ public final class IOUtils {
if (readBytes < limit) {
bos.write(new byte[limit-readBytes]);
}
- byte peekedBytes[] = bos.toByteArray();
+ byte[] peekedBytes = bos.toByteArray();
if(stream instanceof PushbackInputStream) {
PushbackInputStream pin = (PushbackInputStream)stream;
pin.unread(peekedBytes, 0, readBytes);
diff --git a/src/java/org/apache/poi/util/LittleEndianInputStream.java b/src/java/org/apache/poi/util/LittleEndianInputStream.java
index 6199c4dd12..9a9652eb32 100644
--- a/src/java/org/apache/poi/util/LittleEndianInputStream.java
+++ b/src/java/org/apache/poi/util/LittleEndianInputStream.java
@@ -57,7 +57,7 @@ public class LittleEndianInputStream extends FilterInputStream implements Little
@Override
public int readUByte() {
- byte buf[] = new byte[1];
+ byte[] buf = new byte[1];
try {
checkEOF(read(buf), 1);
} catch (IOException e) {
@@ -84,7 +84,7 @@ public class LittleEndianInputStream extends FilterInputStream implements Little
@Override
public int readInt() {
- byte buf[] = new byte[LittleEndianConsts.INT_SIZE];
+ byte[] buf = new byte[LittleEndianConsts.INT_SIZE];
try {
checkEOF(read(buf), buf.length);
} catch (IOException e) {
@@ -108,7 +108,7 @@ public class LittleEndianInputStream extends FilterInputStream implements Little
@Override
public long readLong() {
- byte buf[] = new byte[LittleEndianConsts.LONG_SIZE];
+ byte[] buf = new byte[LittleEndianConsts.LONG_SIZE];
try {
checkEOF(read(buf), LittleEndianConsts.LONG_SIZE);
} catch (IOException e) {
@@ -124,7 +124,7 @@ public class LittleEndianInputStream extends FilterInputStream implements Little
@Override
public int readUShort() {
- byte buf[] = new byte[LittleEndianConsts.SHORT_SIZE];
+ byte[] buf = new byte[LittleEndianConsts.SHORT_SIZE];
try {
checkEOF(read(buf), LittleEndianConsts.SHORT_SIZE);
} catch (IOException e) {
diff --git a/src/java/org/apache/poi/util/POILogger.java b/src/java/org/apache/poi/util/POILogger.java
index c54c754255..5603b2d074 100644
--- a/src/java/org/apache/poi/util/POILogger.java
+++ b/src/java/org/apache/poi/util/POILogger.java
@@ -32,10 +32,14 @@ public abstract class POILogger {
public static final int ERROR = 7;
public static final int FATAL = 9;
- /** Short strings for numeric log level. Use level as array index. */
- protected static final String LEVEL_STRINGS_SHORT[] = {"?", "D", "?", "I", "?", "W", "?", "E", "?", "F", "?"};
- /** Long strings for numeric log level. Use level as array index. */
- protected static final String LEVEL_STRINGS[] = {"?0?", "DEBUG", "?2?", "INFO", "?4?", "WARN", "?6?", "ERROR", "?8?", "FATAL", "?10+?"};
+ /**
+ * Short strings for numeric log level. Use level as array index.
+ */
+ protected static final String[] LEVEL_STRINGS_SHORT = {"?", "D", "?", "I", "?", "W", "?", "E", "?", "F", "?"};
+ /**
+ * Long strings for numeric log level. Use level as array index.
+ */
+ protected static final String[] LEVEL_STRINGS = {"?0?", "DEBUG", "?2?", "INFO", "?4?", "WARN", "?6?", "ERROR", "?8?", "FATAL", "?10+?"};
/**
diff --git a/src/java/org/apache/poi/util/StringUtil.java b/src/java/org/apache/poi/util/StringUtil.java
index 2017abf125..8e23e80eea 100644
--- a/src/java/org/apache/poi/util/StringUtil.java
+++ b/src/java/org/apache/poi/util/StringUtil.java
@@ -407,7 +407,7 @@ public class StringUtil {
}
}
- private static final int symbolMap_f020[] = {
+ private static final int[] symbolMap_f020 = {
' ', // 0xf020 space
'!', // 0xf021 exclam
8704, // 0xf022 universal
@@ -506,7 +506,7 @@ public class StringUtil {
' ', // 0xf07f not defined
};
- private static final int symbolMap_f0a0[] = {
+ private static final int[] symbolMap_f0a0 = {
8364, // 0xf0a0 not defined / euro symbol
978, // 0xf0a1 upsilon1 (upper)
8242, // 0xf0a2 minute