diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-01-17 17:31:22 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-01-17 17:31:22 +0000 |
commit | 3778a3e9e24470499ebf0310a50848bdee266488 (patch) | |
tree | b368867c2860cb3a3d173370575fd853c28c240f /src/ooxml/testcases/org/apache/poi | |
parent | 8d0e84f2573db52a201e842fad51ed067d65cfb6 (diff) | |
download | poi-3778a3e9e24470499ebf0310a50848bdee266488.tar.gz poi-3778a3e9e24470499ebf0310a50848bdee266488.zip |
Sonar fixes
constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'
reorder "final static" -> "static final"
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885613 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi')
10 files changed, 26 insertions, 31 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestListParts.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestListParts.java index 2b24c2e5f3..8e97627336 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestListParts.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestListParts.java @@ -32,7 +32,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public final class TestListParts { - private static final POILogger logger = POILogFactory.getLogger(TestListParts.class); + private static final POILogger LOG = POILogFactory.getLogger(TestListParts.class); private TreeMap<PackagePartName, String> expectedValues; @@ -91,7 +91,7 @@ public final class TestListParts { for (PackagePart part : p.getParts()) { values.put(part.getPartName(), part.getContentType()); - logger.log(POILogger.DEBUG, part.getPartName()); + LOG.log(POILogger.DEBUG, part.getPartName()); } // Compare expected values with values return by the package diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java index 2e6df39dc4..07e9a17d21 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackage.java @@ -98,7 +98,7 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public final class TestPackage { - private static final POILogger logger = POILogFactory.getLogger(TestPackage.class); + private static final POILogger LOG = POILogFactory.getLogger(TestPackage.class); private static final String NS_OOXML_WP_MAIN = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; private static final String CONTENT_EXT_PROPS = "application/vnd.openxmlformats-officedocument.extended-properties+xml"; private static final POIDataSamples xlsSamples = POIDataSamples.getSpreadSheetInstance(); @@ -444,7 +444,7 @@ public final class TestPackage { for (PackagePart part : p.getParts()) { values.put(part.getPartName(), part.getContentType()); - logger.log(POILogger.DEBUG, part.getPartName()); + LOG.log(POILogger.DEBUG, part.getPartName()); } // Compare expected values with values return by the package @@ -478,7 +478,7 @@ public final class TestPackage { for (PackagePart part : p.getParts()) { values.put(part.getPartName(), part.getContentType()); - logger.log(POILogger.DEBUG, part.getPartName()); + LOG.log(POILogger.DEBUG, part.getPartName()); } // Compare expected values with values return by the package diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestRelationships.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestRelationships.java index 28e1941f89..38c13780b2 100644 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestRelationships.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestRelationships.java @@ -44,7 +44,7 @@ class TestRelationships { private static final String SHEET_WITH_COMMENTS = "/xl/worksheets/sheet1.xml"; - private static final POILogger logger = POILogFactory.getLogger(TestPackageCoreProperties.class); + private static final POILogger LOG = POILogFactory.getLogger(TestPackageCoreProperties.class); /** * Test relationships are correctly loaded. This at the moment fails (as of r499) @@ -56,7 +56,7 @@ class TestRelationships { void testLoadRelationships() throws Exception { InputStream is = openSampleStream("sample.xlsx"); try (OPCPackage pkg = OPCPackage.open(is)) { - logger.log(POILogger.DEBUG, "1: " + pkg); + LOG.log(POILogger.DEBUG, "1: " + pkg); PackageRelationshipCollection rels = pkg.getRelationshipsByType(PackageRelationshipTypes.CORE_DOCUMENT); PackageRelationship coreDocRelationship = rels.getRelationship(0); PackagePart corePart = pkg.getPart(coreDocRelationship); diff --git a/src/ooxml/testcases/org/apache/poi/sl/tests/draw/TestDrawPictureShape.java b/src/ooxml/testcases/org/apache/poi/sl/tests/draw/TestDrawPictureShape.java index 0baa8a25e7..9f5568c4c4 100644 --- a/src/ooxml/testcases/org/apache/poi/sl/tests/draw/TestDrawPictureShape.java +++ b/src/ooxml/testcases/org/apache/poi/sl/tests/draw/TestDrawPictureShape.java @@ -41,7 +41,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; class TestDrawPictureShape { - final static POIDataSamples ssSamples = POIDataSamples.getSlideShowInstance(); + static final POIDataSamples ssSamples = POIDataSamples.getSlideShowInstance(); private static boolean xslfOnly; diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java index d848ed8e65..749a8faeca 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java @@ -38,12 +38,7 @@ import org.apache.poi.sl.usermodel.TextParagraph.TextAlign; import org.apache.poi.xslf.XSLFTestDataSamples; import org.junit.jupiter.api.Test; -/** - * @author Yegor Kozlov - */ class TestXSLFTextParagraph { - // private static POILogger _logger = POILogFactory.getLogger(XSLFTextParagraph.class); - static class DrawTextParagraphProxy extends DrawTextParagraph { DrawTextParagraphProxy(XSLFTextParagraph p) { super(p); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java index 6d977db3da..f7161fd0e9 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java @@ -59,8 +59,8 @@ class TestAutoSizeColumnTracker { _columns.add(3); columns = Collections.unmodifiableSortedSet(_columns); } - private final static String SHORT_MESSAGE = "short"; - private final static String LONG_MESSAGE = "This is a test of a long message! This is a test of a long message!"; + private static final String SHORT_MESSAGE = "short"; + private static final String LONG_MESSAGE = "This is a test of a long message! This is a test of a long message!"; @BeforeEach void setUpSheetAndWorkbook() { diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestFormulaEvaluatorOnXSSF.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestFormulaEvaluatorOnXSSF.java index 6e81707be2..3d820ccb52 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestFormulaEvaluatorOnXSSF.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestFormulaEvaluatorOnXSSF.java @@ -58,7 +58,7 @@ import org.junit.jupiter.params.provider.MethodSource; * */ public final class TestFormulaEvaluatorOnXSSF { - private static final POILogger logger = POILogFactory.getLogger(TestFormulaEvaluatorOnXSSF.class); + private static final POILogger LOG = POILogFactory.getLogger(TestFormulaEvaluatorOnXSSF.class); private static XSSFWorkbook workbook; private static Sheet sheet; @@ -244,12 +244,12 @@ public final class TestFormulaEvaluatorOnXSSF { */ private static String getTargetFunctionName(Row r) { if(r == null) { - logger.log(POILogger.WARN, "Warning - given null row, can't figure out function name"); + LOG.log(POILogger.WARN, "Warning - given null row, can't figure out function name"); return null; } Cell cell = r.getCell(SS.COLUMN_INDEX_FUNCTION_NAME); if(cell == null) { - logger.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_FUNCTION_NAME + ", can't figure out function name"); + LOG.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_FUNCTION_NAME + ", can't figure out function name"); return null; } if(cell.getCellType() == CellType.BLANK) { diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestMultiSheetFormulaEvaluatorOnXSSF.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestMultiSheetFormulaEvaluatorOnXSSF.java index 03a91b904e..91045bfbb7 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestMultiSheetFormulaEvaluatorOnXSSF.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestMultiSheetFormulaEvaluatorOnXSSF.java @@ -49,7 +49,7 @@ import org.junit.jupiter.params.provider.MethodSource; * Tests formulas for multi sheet reference (i.e. SUM(Sheet1:Sheet5!A1)) */ public final class TestMultiSheetFormulaEvaluatorOnXSSF { - private static final POILogger logger = POILogFactory.getLogger(TestMultiSheetFormulaEvaluatorOnXSSF.class); + private static final POILogger LOG = POILogFactory.getLogger(TestMultiSheetFormulaEvaluatorOnXSSF.class); private static XSSFWorkbook workbook; private static Sheet sheet; @@ -211,12 +211,12 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF { */ private static String getTargetFunctionName(Row r) { if(r == null) { - logger.log(POILogger.WARN, "Warning - given null row, can't figure out function name"); + LOG.log(POILogger.WARN, "Warning - given null row, can't figure out function name"); return null; } Cell cell = r.getCell(SS.COLUMN_INDEX_FUNCTION_NAME); if(cell == null) { - logger.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_FUNCTION_NAME + ", can't figure out function name"); + LOG.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_FUNCTION_NAME + ", can't figure out function name"); return null; } @@ -232,12 +232,12 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF { */ private static String getTargetTestName(Row r) { if(r == null) { - logger.log(POILogger.WARN, "Warning - given null row, can't figure out test name"); + LOG.log(POILogger.WARN, "Warning - given null row, can't figure out test name"); return null; } Cell cell = r.getCell(SS.COLUMN_INDEX_TEST_NAME); if(cell == null) { - logger.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_TEST_NAME + ", can't figure out test name"); + LOG.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_TEST_NAME + ", can't figure out test name"); return null; } CellType ct = cell.getCellType(); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java index 47babc0925..a86d72282b 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java @@ -43,7 +43,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols; */ class TestXSSFColGrouping { - private static final POILogger logger = POILogFactory.getLogger(TestXSSFColGrouping.class); + private static final POILogger LOG = POILogFactory.getLogger(TestXSSFColGrouping.class); /** @@ -65,7 +65,7 @@ class TestXSSFColGrouping { sheet = wb2.getSheet("test"); CTCols cols = sheet.getCTWorksheet().getColsArray(0); - logger.log(POILogger.DEBUG, "test52186/cols:" + cols); + LOG.log(POILogger.DEBUG, "test52186/cols:" + cols); for (CTCol col : cols.getColArray()) { assertTrue(col.isSetWidth(), "Col width attribute is unset: " + col); } @@ -91,7 +91,7 @@ class TestXSSFColGrouping { sheet.setColumnGroupCollapsed(4, true); CTCols cols = sheet.getCTWorksheet().getColsArray(0); - logger.log(POILogger.DEBUG, "test52186_2/cols:" + cols); + LOG.log(POILogger.DEBUG, "test52186_2/cols:" + cols); try (XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1, "testNoColsWithoutWidthWhenGroupingAndCollapsing")) { sheet = wb2.getSheet("test"); @@ -125,7 +125,7 @@ class TestXSSFColGrouping { sheet.groupColumn((short) 2, (short) 3); sheet.getCTWorksheet().getColsArray(0); - logger.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_2_WRAPS/cols:" + cols); + LOG.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_2_WRAPS/cols:" + cols); assertEquals(0, cols.getColArray(0).getOutlineLevel()); assertEquals(2, cols.getColArray(0).getMin()); // 1 based @@ -173,7 +173,7 @@ class TestXSSFColGrouping { sheet.groupColumn((short) 1, (short) 5); cols = sheet.getCTWorksheet().getColsArray(0); - logger.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_1_WRAPS/cols:" + cols); + LOG.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_1_WRAPS/cols:" + cols); assertEquals(1, cols.getColArray(0).getOutlineLevel()); assertEquals(2, cols.getColArray(0).getMin()); // 1 based @@ -221,7 +221,7 @@ class TestXSSFColGrouping { sheet.groupColumn((short) 3, (short) 5); cols = sheet.getCTWorksheet().getColsArray(0); - logger.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_1_MINOR/cols:" + cols); + LOG.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_1_MINOR/cols:" + cols); assertEquals(0, cols.getColArray(0).getOutlineLevel()); assertEquals(3, cols.getColArray(0).getMin()); // 1 based @@ -270,7 +270,7 @@ class TestXSSFColGrouping { sheet.groupColumn((short) 1, (short) 3); cols = sheet.getCTWorksheet().getColsArray(0); - logger.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_2_MINOR/cols:" + cols); + LOG.log(POILogger.DEBUG, "testMergingOverlappingCols_OVERLAPS_2_MINOR/cols:" + cols); assertEquals(1, cols.getColArray(0).getOutlineLevel()); assertEquals(2, cols.getColArray(0).getMin()); // 1 based diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java index 320aacf44c..30d92dda2f 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java @@ -67,7 +67,7 @@ class TestXSSFConditionalFormatting extends BaseTestConditionalFormatting { testReadOffice2007("NewStyleConditionalFormattings.xlsx"); } - private final static java.awt.Color PEAK_ORANGE = new java.awt.Color(255, 239, 221); + private static final java.awt.Color PEAK_ORANGE = new java.awt.Color(255, 239, 221); @Test void testFontFormattingColor() { |