IDE and JavaDoc fixes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1850007 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2018-12-30 22:44:29 +00:00
parent 648c8fffa1
commit faf53dcdb4
7 changed files with 28 additions and 31 deletions

View File

@ -130,7 +130,7 @@ public final class SupBookRecord extends StandardRecord {
}
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("[SUPBOOK ");
if(isExternalReferences()) {
@ -158,8 +158,8 @@ public final class SupBookRecord extends StandardRecord {
sum += StringUtil.getEncodedSize(field_2_encoded_url);
for(int i=0; i<field_3_sheet_names.length; i++) {
sum += StringUtil.getEncodedSize(field_3_sheet_names[i]);
for (String field_3_sheet_name : field_3_sheet_names) {
sum += StringUtil.getEncodedSize(field_3_sheet_name);
}
return sum;
}
@ -170,8 +170,8 @@ public final class SupBookRecord extends StandardRecord {
if(isExternalReferences()) {
StringUtil.writeUnicodeString(out, field_2_encoded_url);
for(int i=0; i<field_3_sheet_names.length; i++) {
StringUtil.writeUnicodeString(out, field_3_sheet_names[i]);
for (String field_3_sheet_name : field_3_sheet_names) {
StringUtil.writeUnicodeString(out, field_3_sheet_name);
}
} else {
int field2val = _isAddInFunctions ? TAG_ADD_IN_FUNCTIONS : TAG_INTERNAL_REFERENCES;

View File

@ -17,7 +17,9 @@
package org.apache.poi.openxml4j.opc.compliance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -95,7 +97,7 @@ public final class TestOPCCompliancePartName {
try {
uri = new URI(s);
} catch (URISyntaxException e) {
assertTrue(s.equals("[Content_Types].xml"));
assertEquals("[Content_Types].xml", s);
continue;
}
assertFalse("This part name SHOULD NOT be valid: " + s,
@ -225,9 +227,9 @@ public final class TestOPCCompliancePartName {
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
assertTrue(p1.equals(p2));
assertTrue(p1.compareTo(p2) == 0);
assertTrue(p1.hashCode() == p2.hashCode());
assertEquals(p1, p2);
assertEquals(0, p1.compareTo(p2));
assertEquals(p1.hashCode(), p2.hashCode());
}
}
@ -244,9 +246,9 @@ public final class TestOPCCompliancePartName {
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
assertFalse(p1.equals(p2));
assertFalse(p1.compareTo(p2) == 0);
assertFalse(p1.hashCode() == p2.hashCode());
assertNotEquals(p1, p2);
assertNotEquals(0, p1.compareTo(p2));
assertNotEquals(p1.hashCode(), p2.hashCode());
}
}
}

View File

@ -875,7 +875,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// Column 1 has a font with regular colours
XSSFCell cr = r.getCell(1);
XSSFFont fr = wb.getFontAt(cr.getCellStyle().getFontIndex());
XSSFFont fr = wb.getFontAt(cr.getCellStyle().getFontIndexAsInt());
XSSFColor colr = fr.getXSSFColor();
// No theme, has colours
assertEquals(0, colr.getTheme());
@ -883,7 +883,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// Column 0 has a font with colours from a theme
XSSFCell ct = r.getCell(0);
XSSFFont ft = wb.getFontAt(ct.getCellStyle().getFontIndex());
XSSFFont ft = wb.getFontAt(ct.getCellStyle().getFontIndexAsInt());
XSSFColor colt = ft.getXSSFColor();
// Has a theme, which has the colours on it
assertEquals(9, colt.getTheme());

View File

@ -72,7 +72,7 @@ public final class TestNameRecord extends TestCase {
wb.createSheet("Sheet1");
name.setNameName("test");
name.setRefersToFormula("Sheet1!$B$3");
if (name.getRefersToFormula().equals("Sheet1!B3")) {
if ("Sheet1!B3".equals(name.getRefersToFormula())) {
fail("Identified bug 46174");
}
assertEquals("Sheet1!$B$3", name.getRefersToFormula());
@ -701,7 +701,7 @@ public final class TestNameRecord extends TestCase {
NameRecord record = new NameRecord();
assertEquals(0, record.getExternSheetNumber());
record.setNameDefinition(new Ptg[] {});
record.setNameDefinition(Ptg.EMPTY_PTG_ARRAY);
assertEquals(0, record.getExternSheetNumber());
record.setNameDefinition(new Ptg[] {new NamePtg(1)});

View File

@ -22,11 +22,9 @@ import org.apache.poi.hssf.HSSFITestDataProvider;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.model.HSSFFormulaParser;
import org.apache.poi.hssf.record.NameRecord;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.FormulaType;
import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.usermodel.BaseTestNamedRange;
import org.apache.poi.ss.util.AreaReference;
import org.apache.poi.ss.util.CellRangeAddress;
import org.junit.Test;
@ -126,7 +124,7 @@ public final class TestHSSFName extends BaseTestNamedRange {
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
HSSFName nm = wb2.getNameAt(wb2.getNameIndex("RangeTest"));
assertTrue("Name is "+nm.getNameName(),"RangeTest".equals(nm.getNameName()));
assertEquals("Name is " + nm.getNameName(), "RangeTest", nm.getNameName());
assertEquals(wb2.getSheetName(0)+"!$D$4:$E$8", nm.getRefersToFormula());
wb2.close();
wb1.close();

View File

@ -25,10 +25,7 @@ import java.io.InputStream;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.Entry;
import org.junit.BeforeClass;
import org.junit.Test;
/**

View File

@ -248,12 +248,12 @@ public abstract class BaseTestNamedRange {
// Read the Excel file and verify its content
Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
Name nm1 = wb2.getName("RangeTest1");
assertTrue("Name is "+nm1.getNameName(),"RangeTest1".equals(nm1.getNameName()));
assertTrue("Reference is "+nm1.getRefersToFormula(),(wb2.getSheetName(0)+"!$A$1:$L$41").equals(nm1.getRefersToFormula()));
assertEquals("Name is " + nm1.getNameName(), "RangeTest1", nm1.getNameName());
assertEquals("Reference is " + nm1.getRefersToFormula(), (wb2.getSheetName(0) + "!$A$1:$L$41"), nm1.getRefersToFormula());
Name nm2 = wb2.getName("RangeTest2");
assertTrue("Name is "+nm2.getNameName(),"RangeTest2".equals(nm2.getNameName()));
assertTrue("Reference is "+nm2.getRefersToFormula(),(wb2.getSheetName(1)+"!$A$1:$O$21").equals(nm2.getRefersToFormula()));
assertEquals("Name is " + nm2.getNameName(), "RangeTest2", nm2.getNameName());
assertEquals("Reference is " + nm2.getRefersToFormula(), (wb2.getSheetName(1) + "!$A$1:$O$21"), nm2.getRefersToFormula());
wb2.close();
wb1.close();
@ -464,12 +464,12 @@ public abstract class BaseTestNamedRange {
Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
Name nm =wb2.getName("RangeTest");
assertTrue("Name is "+nm.getNameName(),"RangeTest".equals(nm.getNameName()));
assertTrue("Reference is "+nm.getRefersToFormula(),(wb2.getSheetName(0)+"!$D$4:$E$8").equals(nm.getRefersToFormula()));
assertEquals("Name is " + nm.getNameName(), "RangeTest", nm.getNameName());
assertEquals("Reference is " + nm.getRefersToFormula(), (wb2.getSheetName(0) + "!$D$4:$E$8"), nm.getRefersToFormula());
nm = wb2.getName("AnotherTest");
assertTrue("Name is "+nm.getNameName(),"AnotherTest".equals(nm.getNameName()));
assertTrue("Reference is "+nm.getRefersToFormula(),newNamedRange2.getRefersToFormula().equals(nm.getRefersToFormula()));
assertEquals("Name is " + nm.getNameName(), "AnotherTest", nm.getNameName());
assertEquals("Reference is " + nm.getRefersToFormula(), newNamedRange2.getRefersToFormula(), nm.getRefersToFormula());
wb2.close();
wb1.close();
@ -695,7 +695,7 @@ public abstract class BaseTestNamedRange {
}
@Test
public void testInvalid() throws IOException {
public void testInvalid() {
Workbook wb = _testDataProvider.createWorkbook();
Name name = wb.createName();