diff options
author | Dominik Stadler <centic@apache.org> | 2018-12-25 09:59:58 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2018-12-25 09:59:58 +0000 |
commit | 19884d0ca33018d1e417fafd253ec63cf8c31ccd (patch) | |
tree | 4d62b20301f3c4cb1c5995742d27fa6a6068dd34 /src/testcases/org | |
parent | 7421bc9a17d6f3803d2d9e44e6535d6004a6090b (diff) | |
download | poi-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/testcases/org')
15 files changed, 86 insertions, 83 deletions
diff --git a/src/testcases/org/apache/poi/hpsf/TestVariantSupport.java b/src/testcases/org/apache/poi/hpsf/TestVariantSupport.java index ce8ba23c6e..26ca734f77 100644 --- a/src/testcases/org/apache/poi/hpsf/TestVariantSupport.java +++ b/src/testcases/org/apache/poi/hpsf/TestVariantSupport.java @@ -75,27 +75,27 @@ public class TestVariantSupport { public void newNumberTypes() throws Exception { ClipboardData cd = new ClipboardData(); cd.setValue(new byte[10]); - - Object exp[][] = { - { Variant.VT_CF, cd.toByteArray() }, - { Variant.VT_BOOL, true }, - { Variant.VT_LPSTR, "codepagestring" }, - { Variant.VT_LPWSTR, "widestring" }, - { Variant.VT_I2, -1 }, // int, not short ... :( - { Variant.VT_UI2, 0xFFFF }, - { Variant.VT_I4, -1 }, - { Variant.VT_UI4, 0xFFFFFFFFL }, - { Variant.VT_I8, -1L }, - { Variant.VT_UI8, BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.TEN) }, - { Variant.VT_R4, -999.99f }, - { Variant.VT_R8, -999.99d }, + + Object[][] exp = { + {Variant.VT_CF, cd.toByteArray()}, + {Variant.VT_BOOL, true}, + {Variant.VT_LPSTR, "codepagestring"}, + {Variant.VT_LPWSTR, "widestring"}, + {Variant.VT_I2, -1}, // int, not short ... :( + {Variant.VT_UI2, 0xFFFF}, + {Variant.VT_I4, -1}, + {Variant.VT_UI4, 0xFFFFFFFFL}, + {Variant.VT_I8, -1L}, + {Variant.VT_UI8, BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.TEN)}, + {Variant.VT_R4, -999.99f}, + {Variant.VT_R8, -999.99d}, }; HSSFWorkbook wb = new HSSFWorkbook(); POIFSFileSystem poifs = new POIFSFileSystem(); DocumentSummaryInformation dsi = PropertySetFactory.newDocumentSummaryInformation(); CustomProperties cpList = new CustomProperties(); - for (Object o[] : exp) { + for (Object[] o : exp) { int type = (Integer)o[0]; Property p = new Property(PropertyIDMap.PID_MAX+type, type, o[1]); cpList.put("testprop"+type, new CustomProperty(p, "testprop"+type)); @@ -110,7 +110,7 @@ public class TestVariantSupport { dsi = (DocumentSummaryInformation)PropertySetFactory.create(poifs.getRoot(), DocumentSummaryInformation.DEFAULT_STREAM_NAME); cpList = dsi.getCustomProperties(); int i=0; - for (Object o[] : exp) { + for (Object[] o : exp) { Object obj = cpList.get("testprop"+o[0]); if (o[1] instanceof byte[]) { assertArrayEquals("property "+i, (byte[])o[1], (byte[])obj); diff --git a/src/testcases/org/apache/poi/hssf/record/common/TestUnicodeString.java b/src/testcases/org/apache/poi/hssf/record/common/TestUnicodeString.java index c1c585db4e..b50d529844 100644 --- a/src/testcases/org/apache/poi/hssf/record/common/TestUnicodeString.java +++ b/src/testcases/org/apache/poi/hssf/record/common/TestUnicodeString.java @@ -319,7 +319,7 @@ public final class TestUnicodeString { @Test public void extRstEqualsAndHashCode() { - byte buf[] = new byte[200]; + byte[] buf = new byte[200]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0); String str = "\u1d02\u1d12\u1d22"; bos.writeShort(1); diff --git a/src/testcases/org/apache/poi/hssf/record/pivot/TestExtendedPivotTableViewFieldsRecord.java b/src/testcases/org/apache/poi/hssf/record/pivot/TestExtendedPivotTableViewFieldsRecord.java index 76095dc231..bf79bcb0d7 100644 --- a/src/testcases/org/apache/poi/hssf/record/pivot/TestExtendedPivotTableViewFieldsRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/pivot/TestExtendedPivotTableViewFieldsRecord.java @@ -55,7 +55,7 @@ public final class TestExtendedPivotTableViewFieldsRecord extends TestCase { public void testOlderFormat_bug46918() { // There are 10 SXVDEX records in the file (not uploaded) that originated bugzilla 46918 // They all had the following hex encoding: - byte data[] = HexRead.readFromString("00 01 0A 00 1E 14 00 0A FF FF FF FF 00 00"); + byte[] data = HexRead.readFromString("00 01 0A 00 1E 14 00 0A FF FF FF FF 00 00"); RecordInputStream in = TestcaseRecordInputStream.create(data); ExtendedPivotTableViewFieldsRecord rec; @@ -68,8 +68,8 @@ public final class TestExtendedPivotTableViewFieldsRecord extends TestCase { throw e; } - byte expReserData[] = HexRead.readFromString("1E 14 00 0A FF FF FF FF 00 00" + - "FF FF 00 00 00 00 00 00 00 00"); + byte[] expReserData = HexRead.readFromString("1E 14 00 0A FF FF FF FF 00 00" + + "FF FF 00 00 00 00 00 00 00 00"); TestcaseRecordInputStream.confirmRecordEncoding(ExtendedPivotTableViewFieldsRecord.sid, expReserData, rec.serialize()); } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/DummyGraphics2d.java b/src/testcases/org/apache/poi/hssf/usermodel/DummyGraphics2d.java index 093d2083a8..6275fc0d02 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/DummyGraphics2d.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/DummyGraphics2d.java @@ -429,7 +429,7 @@ public class DummyGraphics2d extends Graphics2D { g2D.drawArc( x, y, width, height, startAngle, arcAngle ); } - public void drawBytes(byte data[], int offset, int length, int x, int y) { + public void drawBytes(byte[] data, int offset, int length, int x, int y) { String l = "drawBytes(byte[],int,int,int,int):" + "\n data = " + Arrays.toString(data) + @@ -441,7 +441,7 @@ public class DummyGraphics2d extends Graphics2D { g2D.drawBytes( data, offset, length, x, y ); } - public void drawChars(char data[], int offset, int length, int x, int y) { + public void drawChars(char[] data, int offset, int length, int x, int y) { String l = "drawChars(data,int,int,int,int):" + "\n data = " + Arrays.toString(data) + @@ -568,7 +568,7 @@ public class DummyGraphics2d extends Graphics2D { g2D.drawPolygon( p ); } - public void drawPolygon(int xPoints[], int yPoints[], int nPoints) { + public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) { String l = "drawPolygon(int[],int[],int):" + "\n xPoints = " + Arrays.toString(xPoints) + @@ -578,7 +578,7 @@ public class DummyGraphics2d extends Graphics2D { g2D.drawPolygon( xPoints, yPoints, nPoints ); } - public void drawPolyline(int xPoints[], int yPoints[], int nPoints) { + public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) { String l = "drawPolyline(int[],int[],int):" + "\n xPoints = " + Arrays.toString(xPoints) + @@ -676,7 +676,7 @@ public class DummyGraphics2d extends Graphics2D { g2D.fillPolygon( p ); } - public void fillPolygon(int xPoints[], int yPoints[], int nPoints) { + public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) { String l = "fillPolygon(int[],int[],int):" + "\n xPoints = " + Arrays.toString(xPoints) + diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java index 09387f5f7c..21e47f8a56 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java @@ -247,11 +247,11 @@ public final class TestHSSFPicture extends BaseTestPicture { // test if inserted EscherMetafileBlip will be read again HSSFWorkbook wb = new HSSFWorkbook(); - byte pictureDataEmf[] = POIDataSamples.getDocumentInstance().readFile("vector_image.emf"); + byte[] pictureDataEmf = POIDataSamples.getDocumentInstance().readFile("vector_image.emf"); int indexEmf = wb.addPicture(pictureDataEmf, HSSFWorkbook.PICTURE_TYPE_EMF); - byte pictureDataPng[] = POIDataSamples.getSpreadSheetInstance().readFile("logoKarmokar4.png"); + byte[] pictureDataPng = POIDataSamples.getSpreadSheetInstance().readFile("logoKarmokar4.png"); int indexPng = wb.addPicture(pictureDataPng, HSSFWorkbook.PICTURE_TYPE_PNG); - byte pictureDataWmf[] = POIDataSamples.getSlideShowInstance().readFile("santa.wmf"); + byte[] pictureDataWmf = POIDataSamples.getSlideShowInstance().readFile("santa.wmf"); int indexWmf = wb.addPicture(pictureDataWmf, HSSFWorkbook.PICTURE_TYPE_WMF); HSSFSheet sheet = wb.createSheet(); @@ -281,10 +281,10 @@ public final class TestHSSFPicture extends BaseTestPicture { wb = HSSFTestDataSamples.writeOutAndReadBack(wb); - byte pictureDataOut[] = wb.getAllPictures().get(0).getData(); + byte[] pictureDataOut = wb.getAllPictures().get(0).getData(); assertArrayEquals(pictureDataEmf, pictureDataOut); - byte wmfNoHeader[] = new byte[pictureDataWmf.length-22]; + byte[] wmfNoHeader = new byte[pictureDataWmf.length - 22]; System.arraycopy(pictureDataWmf, 22, wmfNoHeader, 0, pictureDataWmf.length-22); pictureDataOut = wb.getAllPictures().get(2).getData(); assertArrayEquals(wmfNoHeader, pictureDataOut); diff --git a/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java b/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java index 943de4ad23..583ef24f50 100644 --- a/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java +++ b/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java @@ -50,9 +50,9 @@ public class TestXorEncryption { int key = CryptoFunctions.createXorKey1("abc"); assertEquals(20810, key); assertEquals(52250, verifier); - - byte xorArrAct[] = CryptoFunctions.createXorArray1("abc"); - byte xorArrExp[] = HexRead.readFromString("AC-CC-A4-AB-D6-BA-C3-BA-D6-A3-2B-45-D3-79-29-BB"); + + byte[] xorArrAct = CryptoFunctions.createXorArray1("abc"); + byte[] xorArrExp = HexRead.readFromString("AC-CC-A4-AB-D6-BA-C3-BA-D6-A3-2B-45-D3-79-29-BB"); assertThat(xorArrExp, equalTo(xorArrAct)); } diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java b/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java index 51a7d34d74..ad686358d0 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestOle10Native.java @@ -50,14 +50,14 @@ public class TestOle10Native { @Test public void testFiles() throws IOException, Ole10NativeException { - File files[] = { - // bug 51891 - POIDataSamples.getPOIFSInstance().getFile("multimedia.doc"), - // tika bug 1072 - POIDataSamples.getPOIFSInstance().getFile("20-Force-on-a-current-S00.doc"), - // other files containing ole10native records ... - POIDataSamples.getDocumentInstance().getFile("Bug53380_3.doc"), - POIDataSamples.getDocumentInstance().getFile("Bug47731.doc") + File[] files = { + // bug 51891 + POIDataSamples.getPOIFSInstance().getFile("multimedia.doc"), + // tika bug 1072 + POIDataSamples.getPOIFSInstance().getFile("20-Force-on-a-current-S00.doc"), + // other files containing ole10native records ... + POIDataSamples.getDocumentInstance().getFile("Bug53380_3.doc"), + POIDataSamples.getDocumentInstance().getFile("Bug47731.doc") }; for (File f : files) { diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSStream.java b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSStream.java index 2add416529..eb88186a8e 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSStream.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSStream.java @@ -2612,7 +2612,7 @@ public final class TestPOIFSStream { public void NPOIFSReadCopyWritePOIFSRead() throws IOException { File testFile = POIDataSamples.getSpreadSheetInstance().getFile("Simple.xls"); POIFSFileSystem src = new POIFSFileSystem(testFile); - byte wbDataExp[] = IOUtils.toByteArray(src.createDocumentInputStream("Workbook")); + byte[] wbDataExp = IOUtils.toByteArray(src.createDocumentInputStream("Workbook")); POIFSFileSystem nfs = new POIFSFileSystem(); EntryUtils.copyNodes(src.getRoot(), nfs.getRoot()); @@ -2623,7 +2623,7 @@ public final class TestPOIFSStream { nfs.close(); POIFSFileSystem pfs = new POIFSFileSystem(new ByteArrayInputStream(bos.toByteArray())); - byte wbDataAct[] = IOUtils.toByteArray(pfs.createDocumentInputStream("Workbook")); + byte[] wbDataAct = IOUtils.toByteArray(pfs.createDocumentInputStream("Workbook")); assertThat(wbDataExp, equalTo(wbDataAct)); pfs.close(); diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java index 365d1352cc..aba965bbf6 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java @@ -50,25 +50,25 @@ public class TestWorkdayFunction { @Test public void testFailWhenNoArguments() { - ValueEval ve[] = new ValueEval[0]; + ValueEval[] ve = new ValueEval[0]; assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, null)); } @Test public void testFailWhenLessThan2Arguments() { - ValueEval ve[] = new ValueEval[1]; + ValueEval[] ve = new ValueEval[1]; assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, null)); } @Test public void testFailWhenMoreThan3Arguments() { - ValueEval ve[] = new ValueEval[4]; + ValueEval[] ve = new ValueEval[4]; assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, null)); } @Test public void testFailWhenArgumentsAreNotDatesNorNumbers() { - ValueEval ve[] = { new StringEval("Potato"), new StringEval("Cucumber") }; + ValueEval[] ve = {new StringEval("Potato"), new StringEval("Cucumber")}; assertEquals(VALUE_INVALID, WorkdayFunction.instance.evaluate(ve, EC)); } @@ -76,7 +76,7 @@ public class TestWorkdayFunction { public void testReturnWorkdays() { Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 3, 30); Date expDate = expCal.getTime(); - ValueEval ve[] = { new StringEval(STARTING_DATE), new NumberEval(151) }; + ValueEval[] ve = {new StringEval(STARTING_DATE), new NumberEval(151)}; Date actDate = DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue()); assertEquals(expDate, actDate); } @@ -86,7 +86,7 @@ public class TestWorkdayFunction { Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 8, 27); Date expDate = expCal.getTime(); - ValueEval ve[] = { new StringEval("2013/09/30"), new NumberEval(-1) }; + ValueEval[] ve = {new StringEval("2013/09/30"), new NumberEval(-1)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); assertEquals(41544.0, numberValue, 0); @@ -98,8 +98,8 @@ public class TestWorkdayFunction { public void testReturnWorkdaysSpanningAWeekendAddingDays() { Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 8, 30); Date expDate = expCal.getTime(); - - ValueEval ve[] = { new StringEval("2013/09/27"), new NumberEval(1) }; + + ValueEval[] ve = {new StringEval("2013/09/27"), new NumberEval(1)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); assertEquals(41547.0, numberValue, 0); @@ -111,8 +111,8 @@ public class TestWorkdayFunction { public void testReturnWorkdaysWhenStartIsWeekendAddingDays() { Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 9, 7); Date expDate = expCal.getTime(); - - ValueEval ve[] = { new StringEval("2013/10/06"), new NumberEval(1) }; + + ValueEval[] ve = {new StringEval("2013/10/06"), new NumberEval(1)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); assertEquals(41554.0, numberValue, 0); @@ -124,8 +124,8 @@ public class TestWorkdayFunction { public void testReturnWorkdaysWhenStartIsWeekendSubtractingDays() { Calendar expCal = LocaleUtil.getLocaleCalendar(2013, 9, 4); Date expDate = expCal.getTime(); - - ValueEval ve[] = { new StringEval("2013/10/06"), new NumberEval(-1) }; + + ValueEval[] ve = {new StringEval("2013/10/06"), new NumberEval(-1)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); assertEquals(41551.0, numberValue, 0); @@ -137,8 +137,8 @@ public class TestWorkdayFunction { public void testReturnWorkdaysWithDaysTruncated() { Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 3, 30); Date expDate = expCal.getTime(); - - ValueEval ve[] = { new StringEval(STARTING_DATE), new NumberEval(151.99999) }; + + ValueEval[] ve = {new StringEval(STARTING_DATE), new NumberEval(151.99999)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); Date actDate = DateUtil.getJavaDate(numberValue); @@ -149,8 +149,8 @@ public class TestWorkdayFunction { public void testReturnRetroativeWorkday() { Calendar expCal = LocaleUtil.getLocaleCalendar(2008, 8, 23); Date expDate = expCal.getTime(); - - ValueEval ve[] = { new StringEval(STARTING_DATE), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY) }; + + ValueEval[] ve = {new StringEval(STARTING_DATE), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); Date actDate = DateUtil.getJavaDate(numberValue); @@ -161,10 +161,10 @@ public class TestWorkdayFunction { public void testReturnNetworkdaysWithManyHolidays() { Calendar expCal = LocaleUtil.getLocaleCalendar(2009, 4, 5); Date expDate = expCal.getTime(); - - ValueEval ve[] = { - new StringEval(STARTING_DATE), new NumberEval(151), - new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY) }; + + ValueEval[] ve = { + new StringEval(STARTING_DATE), new NumberEval(151), + new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY)}; double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(ve, EC)).getNumberValue(); Date actDate = DateUtil.getJavaDate(numberValue); diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java b/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java index 71c49cf753..8fbfa69961 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestEOMonth.java @@ -68,7 +68,7 @@ public class TestEOMonth { } private void checkValue(double startDate, int monthInc, double expectedResult) { - ValueEval ve[] = {new NumberEval(startDate), new NumberEval(monthInc)}; + ValueEval[] ve = {new NumberEval(startDate), new NumberEval(monthInc)}; NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec); assertEquals(expectedResult, result.getNumberValue(), 0); } @@ -107,10 +107,10 @@ public class TestEOMonth { cal.clear(Calendar.SECOND); cal.clear(Calendar.MILLISECOND); Date expDate = cal.getTime(); - - ValueEval ve[] = { - new NumberEval(DateUtil.getExcelDate(startDate)), - new NumberEval(offset) + + ValueEval[] ve = { + new NumberEval(DateUtil.getExcelDate(startDate)), + new NumberEval(offset) }; NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec); Date actDate = DateUtil.getJavaDate(result.getNumberValue()); @@ -121,14 +121,14 @@ public class TestEOMonth { @Test public void testBug56688() { - ValueEval ve[] = {new NumberEval(DATE_1902_09_26), new RefEvalImplementation(new NumberEval(0))}; + ValueEval[] ve = {new NumberEval(DATE_1902_09_26), new RefEvalImplementation(new NumberEval(0))}; NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec); assertEquals(DATE_1902_09_30, result.getNumberValue(), 0); } @Test public void testRefEvalStartDate() { - ValueEval ve[] = {new RefEvalImplementation(new NumberEval(DATE_1902_09_26)), new NumberEval(0)}; + ValueEval[] ve = {new RefEvalImplementation(new NumberEval(DATE_1902_09_26)), new NumberEval(0)}; NumberEval result = (NumberEval) eOMonth.evaluate(ve, ec); assertEquals(DATE_1902_09_30, result.getNumberValue(), 0); } diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java index 90300bf240..dc47830727 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java @@ -70,8 +70,11 @@ public class TestFinanceLib extends AbstractNumericTestCase { } public void testNpv() { - double r, v[], npv, x; - + double r; + double[] v; + double npv; + double x; + r = 1; v = new double[]{100, 200, 300, 400}; npv = FinanceLib.npv(r, v); x = 162.5; diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java index 9054c6b0ae..41ca4b8e98 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java @@ -66,7 +66,7 @@ public final class TestSubtotal { } AreaEval arg1 = EvalFactory.createAreaEval("C1:D5", values); - ValueEval args[] = { new NumberEval(function), arg1 }; + ValueEval[] args = {new NumberEval(function), arg1}; ValueEval result = new Subtotal().evaluate(args, 0, 0); diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestDateUtil.java b/src/testcases/org/apache/poi/ss/usermodel/TestDateUtil.java index 40dfd698fc..c721774461 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/TestDateUtil.java +++ b/src/testcases/org/apache/poi/ss/usermodel/TestDateUtil.java @@ -82,11 +82,11 @@ public class TestDateUtil { Calendar expCal = LocaleUtil.getLocaleCalendar(1900, 0, 0); - Calendar actCal[] = { - DateUtil.getJavaCalendar(dateValue), - DateUtil.getJavaCalendar(dateValue, use1904windowing), - DateUtil.getJavaCalendar(dateValue, use1904windowing, tz), - DateUtil.getJavaCalendar(dateValue, use1904windowing, tz, roundSeconds) + Calendar[] actCal = { + DateUtil.getJavaCalendar(dateValue), + DateUtil.getJavaCalendar(dateValue, use1904windowing), + DateUtil.getJavaCalendar(dateValue, use1904windowing, tz), + DateUtil.getJavaCalendar(dateValue, use1904windowing, tz, roundSeconds) }; assertEquals(expCal, actCal[0]); assertEquals(expCal, actCal[1]); diff --git a/src/testcases/org/apache/poi/util/TestHexDump.java b/src/testcases/org/apache/poi/util/TestHexDump.java index af3d8877b0..198b8bc7a2 100644 --- a/src/testcases/org/apache/poi/util/TestHexDump.java +++ b/src/testcases/org/apache/poi/util/TestHexDump.java @@ -53,8 +53,8 @@ public class TestHexDump { byte[] testArray = testArray(); ByteArrayOutputStream streamAct = new ByteArrayOutputStream(); HexDump.dump(testArray, 0, streamAct, 0); - byte bytesAct[] = streamAct.toByteArray(); - byte bytesExp[] = toHexDump(0,0); + byte[] bytesAct = streamAct.toByteArray(); + byte[] bytesExp = toHexDump(0, 0); assertEquals("array size mismatch", bytesExp.length, bytesAct.length); assertArrayEquals("array mismatch", bytesExp, bytesAct); @@ -123,7 +123,7 @@ public class TestHexDump { private byte[] toHexDump(long offset, int index) { StringBuilder strExp = new StringBuilder(), chrs = new StringBuilder(); - Object obj[] = new Object[33]; + Object[] obj = new Object[33]; StringBuilder format = new StringBuilder(); for (int j = 0; j < 16 && (index + j*16) < 256; j++) { diff --git a/src/testcases/org/apache/poi/util/TestLittleEndian.java b/src/testcases/org/apache/poi/util/TestLittleEndian.java index 67741921a7..24072fa656 100644 --- a/src/testcases/org/apache/poi/util/TestLittleEndian.java +++ b/src/testcases/org/apache/poi/util/TestLittleEndian.java @@ -43,7 +43,7 @@ public final class TestLittleEndian { testdata[0] = 0x01; testdata[1] = (byte) 0xFF; testdata[2] = 0x02; - short expected[] = new short[2]; + short[] expected = new short[2]; expected[0] = ( short ) 0xFF01; expected[1] = 0x02FF; @@ -164,7 +164,7 @@ public final class TestLittleEndian { expected[1] = (byte) 0xFF; expected[2] = 0x02; byte[] received = new byte[ LittleEndianConsts.SHORT_SIZE + 1 ]; - short testdata[] = new short[2]; + short[] testdata = new short[2]; testdata[0] = ( short ) 0xFF01; testdata[1] = 0x02FF; |