mirror of https://github.com/apache/poi.git
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:
parent
648c8fffa1
commit
faf53dcdb4
|
@ -130,7 +130,7 @@ public final class SupBookRecord extends StandardRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("[SUPBOOK ");
|
sb.append("[SUPBOOK ");
|
||||||
|
|
||||||
if(isExternalReferences()) {
|
if(isExternalReferences()) {
|
||||||
|
@ -158,8 +158,8 @@ public final class SupBookRecord extends StandardRecord {
|
||||||
|
|
||||||
sum += StringUtil.getEncodedSize(field_2_encoded_url);
|
sum += StringUtil.getEncodedSize(field_2_encoded_url);
|
||||||
|
|
||||||
for(int i=0; i<field_3_sheet_names.length; i++) {
|
for (String field_3_sheet_name : field_3_sheet_names) {
|
||||||
sum += StringUtil.getEncodedSize(field_3_sheet_names[i]);
|
sum += StringUtil.getEncodedSize(field_3_sheet_name);
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
@ -170,8 +170,8 @@ public final class SupBookRecord extends StandardRecord {
|
||||||
if(isExternalReferences()) {
|
if(isExternalReferences()) {
|
||||||
StringUtil.writeUnicodeString(out, field_2_encoded_url);
|
StringUtil.writeUnicodeString(out, field_2_encoded_url);
|
||||||
|
|
||||||
for(int i=0; i<field_3_sheet_names.length; i++) {
|
for (String field_3_sheet_name : field_3_sheet_names) {
|
||||||
StringUtil.writeUnicodeString(out, field_3_sheet_names[i]);
|
StringUtil.writeUnicodeString(out, field_3_sheet_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int field2val = _isAddInFunctions ? TAG_ADD_IN_FUNCTIONS : TAG_INTERNAL_REFERENCES;
|
int field2val = _isAddInFunctions ? TAG_ADD_IN_FUNCTIONS : TAG_INTERNAL_REFERENCES;
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.opc.compliance;
|
package org.apache.poi.openxml4j.opc.compliance;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ public final class TestOPCCompliancePartName {
|
||||||
try {
|
try {
|
||||||
uri = new URI(s);
|
uri = new URI(s);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
assertTrue(s.equals("[Content_Types].xml"));
|
assertEquals("[Content_Types].xml", s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assertFalse("This part name SHOULD NOT be valid: " + s,
|
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) {
|
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
|
||||||
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
|
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
|
||||||
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
|
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
|
||||||
assertTrue(p1.equals(p2));
|
assertEquals(p1, p2);
|
||||||
assertTrue(p1.compareTo(p2) == 0);
|
assertEquals(0, p1.compareTo(p2));
|
||||||
assertTrue(p1.hashCode() == p2.hashCode());
|
assertEquals(p1.hashCode(), p2.hashCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,9 +246,9 @@ public final class TestOPCCompliancePartName {
|
||||||
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
|
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
|
||||||
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
|
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
|
||||||
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
|
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
|
||||||
assertFalse(p1.equals(p2));
|
assertNotEquals(p1, p2);
|
||||||
assertFalse(p1.compareTo(p2) == 0);
|
assertNotEquals(0, p1.compareTo(p2));
|
||||||
assertFalse(p1.hashCode() == p2.hashCode());
|
assertNotEquals(p1.hashCode(), p2.hashCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -875,7 +875,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||||
|
|
||||||
// Column 1 has a font with regular colours
|
// Column 1 has a font with regular colours
|
||||||
XSSFCell cr = r.getCell(1);
|
XSSFCell cr = r.getCell(1);
|
||||||
XSSFFont fr = wb.getFontAt(cr.getCellStyle().getFontIndex());
|
XSSFFont fr = wb.getFontAt(cr.getCellStyle().getFontIndexAsInt());
|
||||||
XSSFColor colr = fr.getXSSFColor();
|
XSSFColor colr = fr.getXSSFColor();
|
||||||
// No theme, has colours
|
// No theme, has colours
|
||||||
assertEquals(0, colr.getTheme());
|
assertEquals(0, colr.getTheme());
|
||||||
|
@ -883,7 +883,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||||
|
|
||||||
// Column 0 has a font with colours from a theme
|
// Column 0 has a font with colours from a theme
|
||||||
XSSFCell ct = r.getCell(0);
|
XSSFCell ct = r.getCell(0);
|
||||||
XSSFFont ft = wb.getFontAt(ct.getCellStyle().getFontIndex());
|
XSSFFont ft = wb.getFontAt(ct.getCellStyle().getFontIndexAsInt());
|
||||||
XSSFColor colt = ft.getXSSFColor();
|
XSSFColor colt = ft.getXSSFColor();
|
||||||
// Has a theme, which has the colours on it
|
// Has a theme, which has the colours on it
|
||||||
assertEquals(9, colt.getTheme());
|
assertEquals(9, colt.getTheme());
|
||||||
|
|
|
@ -72,7 +72,7 @@ public final class TestNameRecord extends TestCase {
|
||||||
wb.createSheet("Sheet1");
|
wb.createSheet("Sheet1");
|
||||||
name.setNameName("test");
|
name.setNameName("test");
|
||||||
name.setRefersToFormula("Sheet1!$B$3");
|
name.setRefersToFormula("Sheet1!$B$3");
|
||||||
if (name.getRefersToFormula().equals("Sheet1!B3")) {
|
if ("Sheet1!B3".equals(name.getRefersToFormula())) {
|
||||||
fail("Identified bug 46174");
|
fail("Identified bug 46174");
|
||||||
}
|
}
|
||||||
assertEquals("Sheet1!$B$3", name.getRefersToFormula());
|
assertEquals("Sheet1!$B$3", name.getRefersToFormula());
|
||||||
|
@ -701,7 +701,7 @@ public final class TestNameRecord extends TestCase {
|
||||||
NameRecord record = new NameRecord();
|
NameRecord record = new NameRecord();
|
||||||
assertEquals(0, record.getExternSheetNumber());
|
assertEquals(0, record.getExternSheetNumber());
|
||||||
|
|
||||||
record.setNameDefinition(new Ptg[] {});
|
record.setNameDefinition(Ptg.EMPTY_PTG_ARRAY);
|
||||||
assertEquals(0, record.getExternSheetNumber());
|
assertEquals(0, record.getExternSheetNumber());
|
||||||
|
|
||||||
record.setNameDefinition(new Ptg[] {new NamePtg(1)});
|
record.setNameDefinition(new Ptg[] {new NamePtg(1)});
|
||||||
|
|
|
@ -22,11 +22,9 @@ import org.apache.poi.hssf.HSSFITestDataProvider;
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
||||||
import org.apache.poi.hssf.record.NameRecord;
|
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.FormulaType;
|
||||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||||
import org.apache.poi.ss.usermodel.BaseTestNamedRange;
|
import org.apache.poi.ss.usermodel.BaseTestNamedRange;
|
||||||
import org.apache.poi.ss.util.AreaReference;
|
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -126,7 +124,7 @@ public final class TestHSSFName extends BaseTestNamedRange {
|
||||||
|
|
||||||
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
|
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
|
||||||
HSSFName nm = wb2.getNameAt(wb2.getNameIndex("RangeTest"));
|
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());
|
assertEquals(wb2.getSheetName(0)+"!$D$4:$E$8", nm.getRefersToFormula());
|
||||||
wb2.close();
|
wb2.close();
|
||||||
wb1.close();
|
wb1.close();
|
||||||
|
|
|
@ -25,10 +25,7 @@ import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.poi.hpsf.SummaryInformation;
|
import org.apache.poi.hpsf.SummaryInformation;
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
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.DirectoryNode;
|
||||||
import org.apache.poi.poifs.filesystem.Entry;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -248,12 +248,12 @@ public abstract class BaseTestNamedRange {
|
||||||
// Read the Excel file and verify its content
|
// Read the Excel file and verify its content
|
||||||
Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
|
Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
|
||||||
Name nm1 = wb2.getName("RangeTest1");
|
Name nm1 = wb2.getName("RangeTest1");
|
||||||
assertTrue("Name is "+nm1.getNameName(),"RangeTest1".equals(nm1.getNameName()));
|
assertEquals("Name is " + nm1.getNameName(), "RangeTest1", nm1.getNameName());
|
||||||
assertTrue("Reference is "+nm1.getRefersToFormula(),(wb2.getSheetName(0)+"!$A$1:$L$41").equals(nm1.getRefersToFormula()));
|
assertEquals("Reference is " + nm1.getRefersToFormula(), (wb2.getSheetName(0) + "!$A$1:$L$41"), nm1.getRefersToFormula());
|
||||||
|
|
||||||
Name nm2 = wb2.getName("RangeTest2");
|
Name nm2 = wb2.getName("RangeTest2");
|
||||||
assertTrue("Name is "+nm2.getNameName(),"RangeTest2".equals(nm2.getNameName()));
|
assertEquals("Name is " + nm2.getNameName(), "RangeTest2", nm2.getNameName());
|
||||||
assertTrue("Reference is "+nm2.getRefersToFormula(),(wb2.getSheetName(1)+"!$A$1:$O$21").equals(nm2.getRefersToFormula()));
|
assertEquals("Reference is " + nm2.getRefersToFormula(), (wb2.getSheetName(1) + "!$A$1:$O$21"), nm2.getRefersToFormula());
|
||||||
|
|
||||||
wb2.close();
|
wb2.close();
|
||||||
wb1.close();
|
wb1.close();
|
||||||
|
@ -464,12 +464,12 @@ public abstract class BaseTestNamedRange {
|
||||||
|
|
||||||
Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
|
Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
|
||||||
Name nm =wb2.getName("RangeTest");
|
Name nm =wb2.getName("RangeTest");
|
||||||
assertTrue("Name is "+nm.getNameName(),"RangeTest".equals(nm.getNameName()));
|
assertEquals("Name is " + nm.getNameName(), "RangeTest", nm.getNameName());
|
||||||
assertTrue("Reference is "+nm.getRefersToFormula(),(wb2.getSheetName(0)+"!$D$4:$E$8").equals(nm.getRefersToFormula()));
|
assertEquals("Reference is " + nm.getRefersToFormula(), (wb2.getSheetName(0) + "!$D$4:$E$8"), nm.getRefersToFormula());
|
||||||
|
|
||||||
nm = wb2.getName("AnotherTest");
|
nm = wb2.getName("AnotherTest");
|
||||||
assertTrue("Name is "+nm.getNameName(),"AnotherTest".equals(nm.getNameName()));
|
assertEquals("Name is " + nm.getNameName(), "AnotherTest", nm.getNameName());
|
||||||
assertTrue("Reference is "+nm.getRefersToFormula(),newNamedRange2.getRefersToFormula().equals(nm.getRefersToFormula()));
|
assertEquals("Reference is " + nm.getRefersToFormula(), newNamedRange2.getRefersToFormula(), nm.getRefersToFormula());
|
||||||
|
|
||||||
wb2.close();
|
wb2.close();
|
||||||
wb1.close();
|
wb1.close();
|
||||||
|
@ -695,7 +695,7 @@ public abstract class BaseTestNamedRange {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalid() throws IOException {
|
public void testInvalid() {
|
||||||
Workbook wb = _testDataProvider.createWorkbook();
|
Workbook wb = _testDataProvider.createWorkbook();
|
||||||
|
|
||||||
Name name = wb.createName();
|
Name name = wb.createName();
|
||||||
|
|
Loading…
Reference in New Issue