<path id="main.classpath">
<pathelement location="${main.commons-logging.jar}"/>
<pathelement location="${main.commons-codec.jar}"/>
- <pathelement location="${main.log4j.jar}"/>
+ <pathelement location="${main.commons-collections4.jar}"/>
+ </path>
+
+ <!-- some libraries should only be required for compiling/running tests -->
+ <path id="test.jar.classpath">
<pathelement location="${main.junit.jar}"/>
<pathelement location="${main.jmh.jar}"/>
<pathelement location="${main.jmhAnnotation.jar}"/>
<pathelement location="${main.hamcrest.jar}"/>
- <pathelement location="${main.commons-collections4.jar}"/>
</path>
<path id="scratchpad.classpath">
<path id="test.ooxml.classpath">
<path refid="ooxml.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/>
<pathelement location="${main.output.test.dir}"/>
<pathelement location="${integration.src.test}"/>
<path refid="scratchpad.classpath"/>
<path refid="ooxml.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement location="${main.output.test.dir}"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${integration.output.test.dir}"/>
<path id="test.excelant.classpath">
<path refid="ooxml.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${excelant.output.dir}"/>
<pathelement location="${excelant.output.test.dir}"/>
includeantruntime="false">
<!-- debug="${compile.debug}" -->
<classpath refid="ooxml.classpath"/>
+
+ <!-- unfortunately JUnit is required here for OOXMLLite, we should rather move OOXMLLite
+ to test or a separate folder to clean up dependencies -->
+ <classpath location="${main.junit.jar}"/>
</javac>
<jar basedir="${xmlbean.classes.dir}" destfile="@{classes-jar}" excludes="org/apache/**" level="9" />
includeantruntime="false">
<classpath>
<path refid="main.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement path="${main.output.dir}"/>
</classpath>
</javac>
includeantruntime="false">
<classpath>
<path refid="scratchpad.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${main.output.test.dir}"/>
</classpath>
<classpath>
<path refid="ooxml.classpath"/>
<path refid="ooxml.xmlsec.classpath"/>
+
+ <!-- unfortunately JUnit is required here for OOXMLLite, we should rather move OOXMLLite
+ to test or a separate folder to clean up dependencies -->
+ <pathelement location="${main.junit.jar}"/>
</classpath>
</javac>
<!-- compile the tests -->
includeantruntime="false">
<classpath>
<path refid="excelant.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement location="${excelant.output.dir}"/>
<pathelement path="${main.output.test.dir}"/>
</classpath>
<classpath>
<path refid="scratchpad.classpath"/>
<path refid="ooxml.classpath"/>
+ <path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${main.output.test.dir}"/>
<pathelement location="${examples.output.dir}"/>
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/>
+ <classpath refid="test.jar.classpath"/>
<syspropertyset refid="junit.properties"/>
<jvmarg value="-ea"/>
<jvmarg value="-Xmx256m"/>
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="scratchpad.test.failed">
<classpath refid="test.scratchpad.classpath"/>
+ <classpath refid="test.jar.classpath"/>
<syspropertyset refid="junit.properties"/>
<jvmarg value="-ea"/>
<!-- jvmarg value="-Duser.timezone=UTC"/ -->
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}.exec">
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="ooxml.test.failed">
- <classpath refid="@{classpath}"/>
+ <classpath>
+ <path refid="@{classpath}"/>
+ <path refid="test.jar.classpath"/>
+ </classpath>
<syspropertyset refid="junit.properties"/>
<jvmarg value="${maxpermsize}"/>
<jvmarg value="-Xmx768M"/>
failureproperty="ooxml.xmlsec.test.failed">
<classpath>
<path refid="@{classpath}"/>
+ <path refid="test.jar.classpath"/>
<path refid="ooxml.xmlsec.classpath"/>
</classpath>
<syspropertyset refid="junit.properties"/>
package org.apache.poi.xwpf.usermodel.examples;
-import static org.junit.Assert.assertEquals;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
this.docFile = new File(filename);
FileInputStream fis = null;
if (!this.docFile.exists()) {
- throw new FileNotFoundException("The Word dcoument " + filename + " does not exist.");
+ throw new FileNotFoundException("The Word document " + filename + " does not exist.");
}
try {
// Open the Word document file and instantiate the XWPFDocument
}
/**
- * Called to update the embedded Excel workbook. As the format and structire
+ * Called to update the embedded Excel workbook. As the format and structure
* of the workbook are known in advance, all this code attempts to do is
* write a new value into the first cell on the first row of the first
* worksheet. Prior to executing this method, that cell will contain the
* @throws org.apache.poi.openxml4j.exceptions.OpenXML4JException
* Rather
* than use the specific classes (HSSF/XSSF) to handle the embedded
- * workbook this method uses those defeined in the SS stream. As
+ * workbook this method uses those defined in the SS stream. As
* a result, it might be the case that a SpreadsheetML file is
* opened for processing, throwing this exception if that file is
* invalid.
* @throws org.apache.poi.openxml4j.exceptions.OpenXML4JException
* Rather
* than use the specific classes (HSSF/XSSF) to handle the embedded
- * workbook this method uses those defeined in the SS stream. As
+ * workbook this method uses those defined in the SS stream. As
* a result, it might be the case that a SpreadsheetML file is
* opened for processing, throwing this exception if that file is
* invalid.
Sheet sheet = workbook.getSheetAt(SHEET_NUM);
Row row = sheet.getRow(ROW_NUM);
Cell cell = row.getCell(CELL_NUM);
- assertEquals(cell.getNumericCellValue(), NEW_VALUE, 0.0001);
+ if(cell.getNumericCellValue() != NEW_VALUE) {
+ throw new IllegalStateException("Failed to validate document content.");
+ }
} finally {
IOUtils.closeQuietly(workbook);
IOUtils.closeQuietly(is);
/**
* Code to test updating of the embedded Excel workbook.
- *
- * @param args
- * @throws OpenXML4JException
*/
public static void main(String[] args) throws IOException, OpenXML4JException {
UpdateEmbeddedDoc ued = new UpdateEmbeddedDoc(args[0]);
import org.junit.Test;
public class HWPFFileHandler extends POIFSFileHandler {
- @Override
- public void handleFile(InputStream stream, String path) throws Exception {
- HWPFDocument doc = new HWPFDocument(stream);
- assertNotNull(doc.getBookmarks());
- assertNotNull(doc.getCharacterTable());
- assertNotNull(doc.getEndnotes());
-
- handlePOIDocument(doc);
- }
+ @Override
+ public void handleFile(InputStream stream, String path) throws Exception {
+ HWPFDocument doc = new HWPFDocument(stream);
+ assertNotNull(doc.getBookmarks());
+ assertNotNull(doc.getCharacterTable());
+ assertNotNull(doc.getEndnotes());
+
+ handlePOIDocument(doc);
+ }
- // a test-case to test this locally without executing the full TestAllFiles
- @Override
+ // a test-case to test this locally without executing the full TestAllFiles
+ @Override
@Test
- public void test() throws Exception {
+ public void test() throws Exception {
File file = new File("test-data/document/52117.doc");
InputStream stream = new FileInputStream(file);
- try {
- handleFile(stream, file.getPath());
- } finally {
- stream.close();
- }
-
- handleExtracting(file);
-
- stream = new FileInputStream(file);
- try {
- WordExtractor extractor = new WordExtractor(stream);
- try {
- assertNotNull(extractor.getText());
- } finally {
- extractor.close();
- }
- } finally {
- stream.close();
- }
- }
+ try {
+ handleFile(stream, file.getPath());
+ } finally {
+ stream.close();
+ }
+
+ handleExtracting(file);
+
+ stream = new FileInputStream(file);
+ try {
+ WordExtractor extractor = new WordExtractor(stream);
+ try {
+ assertNotNull(extractor.getText());
+ } finally {
+ extractor.close();
+ }
+ } finally {
+ stream.close();
+ }
+ }
- @Test
- public void testExtractingOld() throws Exception {
- File file = new File("test-data/document/52117.doc");
- handleExtracting(file);
- }
+ @Test
+ public void testExtractingOld() throws Exception {
+ File file = new File("test-data/document/52117.doc");
+ handleExtracting(file);
+ }
}
public void evaluateAll() {}
@Override
public int evaluateFormulaCell(Cell cell) {
+ //noinspection deprecation
return cell.getCachedFormulaResultType();
}
/**
AttributedString str = new AttributedString(txt);
copyAttributes(font, str, 0, txt.length());
- if (rt.numFormattingRuns() > 0) {
+ /*if (rt.numFormattingRuns() > 0) {
// TODO: support rich text fragments
- }
+ }*/
width = getCellWidth(defaultCharWidth, colspan, style, width, str);
}
/**
* Copy text attributes from the supplied Font to Java2D AttributedString
*/
- private static void copyAttributes(Font font, AttributedString str, int startIdx, int endIdx) {
+ private static void copyAttributes(Font font, AttributedString str, @SuppressWarnings("SameParameterValue") int startIdx, int endIdx) {
str.addAttribute(TextAttribute.FAMILY, font.getFontName(), startIdx, endIdx);
str.addAttribute(TextAttribute.SIZE, (float)font.getFontHeightInPoints());
if (font.getBold()) str.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIdx, endIdx);
* Use this where you want to know if the given cell is explicitly defined
* or not.
*
- * @param sheet
- * @param rowIx
- * @param colIx
+ * @param sheet The workbook sheet to look at.
+ * @param rowIx The 0-based index of the row.
+ * @param colIx The 0-based index of the cell.
* @return cell at the given location, or null if not defined
* @throws NullPointerException if sheet is null
*/
* then will return the cell itself.
* <p>If there is no cell defined at the given co-ordinates, will return
* null.
- *
- * @param sheet
- * @param rowIx
- * @param colIx
+ *
+ * @param sheet The workbook sheet to look at.
+ * @param rowIx The 0-based index of the row.
+ * @param colIx The 0-based index of the cell.
* @return cell at the given location, its base merged cell, or null if not defined
* @throws NullPointerException if sheet is null
*/
+++ /dev/null
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.openxml4j.opc.internal.marshallers;
-
-import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
-import org.apache.poi.openxml4j.opc.PackagingURIHelper;
-import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
-import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import static org.apache.poi.openxml4j.opc.PackagingURIHelper.PACKAGE_RELATIONSHIPS_ROOT_URI;
-import static org.junit.Assert.assertTrue;
-
-public class TestZipPackagePropertiesMarshaller {
- private PartMarshaller marshaller = new ZipPackagePropertiesMarshaller();
-
- @Test(expected=IllegalArgumentException.class)
- public void nonZipOutputStream() throws OpenXML4JException {
- OutputStream notAZipOutputStream = new ByteArrayOutputStream(0);
- marshaller.marshall(null, notAZipOutputStream);
- }
-
- @Test
- public void withZipOutputStream() throws Exception {
- assertTrue(marshaller.marshall(new PackagePropertiesPart(null, PackagingURIHelper.createPartName(PACKAGE_RELATIONSHIPS_ROOT_URI)),
- new ZipOutputStream(new ByteArrayOutputStream())));
- }
-
- @Test
- public void writingFails() throws Exception {
- assertTrue(marshaller.marshall(new PackagePropertiesPart(null, PackagingURIHelper.createPartName(PACKAGE_RELATIONSHIPS_ROOT_URI)),
- new ZipOutputStream(new ByteArrayOutputStream())));
- }
-
- @Test(expected=OpenXML4JException.class)
- public void ioException() throws Exception {
- marshaller.marshall(new PackagePropertiesPart(null, PackagingURIHelper.createPartName(PACKAGE_RELATIONSHIPS_ROOT_URI)),
- new ZipOutputStream(new ByteArrayOutputStream()) {
- @Override
- public void putNextEntry(ZipEntry e) throws IOException {
- throw new IOException("TestException");
- }
- });
- }
-}
copyFile(cls.getResourceAsStream('/' + classRef), destFile);
if(cls.isInterface()){
- /**
- * Copy classes and interfaces declared as members of this class
- */
+ /// Copy classes and interfaces declared as members of this class
for(Class<?> fc : cls.getDeclaredClasses()){
className = fc.getName();
classRef = className.replace('.', '/') + ".class";
}
} catch (Throwable e) { // NOSONAR
System.out.println("Class " + cls + " is not in classpath");
- return;
}
}
}
// bug 60128
@Test
- public void testCorruptFile() throws IOException {
+ public void testCorruptFile() throws IOException, InvalidFormatException {
OPCPackage pkg = null;
File file = OpenXML4JTestDataSamples.getSampleFile("invalid.xlsx");
try {
pkg = OPCPackage.open(file, PackageAccess.READ);
- } catch (Exception e) {
- System.out.println(e.getClass().getName());
+ } catch (NotOfficeXmlFileException e) {
+ /*System.out.println(e.getClass().getName());
System.out.println(e.getMessage());
- e.printStackTrace();
+ e.printStackTrace();*/
+ // ignore exception
} finally {
if (pkg != null) {
pkg.close();
--- /dev/null
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.openxml4j.opc.internal.marshallers;
+
+import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
+import org.apache.poi.openxml4j.opc.PackagingURIHelper;
+import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
+import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import static org.apache.poi.openxml4j.opc.PackagingURIHelper.PACKAGE_RELATIONSHIPS_ROOT_URI;
+import static org.junit.Assert.assertTrue;
+
+public class TestZipPackagePropertiesMarshaller {
+ private PartMarshaller marshaller = new ZipPackagePropertiesMarshaller();
+
+ @Test(expected=IllegalArgumentException.class)
+ public void nonZipOutputStream() throws OpenXML4JException {
+ OutputStream notAZipOutputStream = new ByteArrayOutputStream(0);
+ marshaller.marshall(null, notAZipOutputStream);
+ }
+
+ @Test
+ public void withZipOutputStream() throws Exception {
+ assertTrue(marshaller.marshall(new PackagePropertiesPart(null, PackagingURIHelper.createPartName(PACKAGE_RELATIONSHIPS_ROOT_URI)),
+ new ZipOutputStream(new ByteArrayOutputStream())));
+ }
+
+ @Test
+ public void writingFails() throws Exception {
+ assertTrue(marshaller.marshall(new PackagePropertiesPart(null, PackagingURIHelper.createPartName(PACKAGE_RELATIONSHIPS_ROOT_URI)),
+ new ZipOutputStream(new ByteArrayOutputStream())));
+ }
+
+ @Test(expected=OpenXML4JException.class)
+ public void ioException() throws Exception {
+ marshaller.marshall(new PackagePropertiesPart(null, PackagingURIHelper.createPartName(PACKAGE_RELATIONSHIPS_ROOT_URI)),
+ new ZipOutputStream(new ByteArrayOutputStream()) {
+ @Override
+ public void putNextEntry(ZipEntry e) throws IOException {
+ throw new IOException("TestException");
+ }
+ });
+ }
+}
import java.nio.charset.Charset;
-import org.apache.poi.util.BitField;
-import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
@Internal
-public final class PieceDescriptor
-{
-
- short descriptor;
- private static BitField fNoParaLast = BitFieldFactory.getInstance(0x01);
- private static BitField fPaphNil = BitFieldFactory.getInstance(0x02);
- private static BitField fCopied = BitFieldFactory.getInstance(0x04);
- int fc;
- PropertyModifier prm;
- boolean unicode = false;
- private final Charset charset;
-
+public final class PieceDescriptor {
+ private final short descriptor;
+ int fc; // used from the outside?!?
+ private final PropertyModifier prm;
+ private final boolean unicode;
+ private final Charset charset;
public PieceDescriptor(byte[] buf, int offset) {
this(buf, offset, null);
}
/**
- *
* This initializer should only be used for HWPFOldDocuments.
*
- * @param buf
- * @param offset
+ * @param buf The buffer to read data from
+ * @param offset The offset into the buffer to start reading from
* @param charset which charset to use if this is not unicode
*/
- public PieceDescriptor(byte[] buf, int offset, Charset charset) {
- descriptor = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
- fc = LittleEndian.getInt(buf, offset);
- offset += LittleEndian.INT_SIZE;
- prm = new PropertyModifier(LittleEndian.getShort(buf, offset));
- if (charset == null) {
- // see if this piece uses unicode.
- //From the documentation: If the second most significant bit
- //is clear, then this indicates the actual file offset of the Unicode character (two bytes). If the
- //second most significant bit is set, then the actual address of the codepage-1252
- //compressed version of the Unicode character (one byte), is actually at the offset indicated
- //by clearing this bit and dividing by two.
- if ((fc & 0x40000000) == 0) {
- unicode = true;
- this.charset = null;
+ public PieceDescriptor(byte[] buf, int offset, Charset charset) {
+ descriptor = LittleEndian.getShort(buf, offset);
+ offset += LittleEndian.SHORT_SIZE;
+ fc = LittleEndian.getInt(buf, offset);
+ offset += LittleEndian.INT_SIZE;
+ prm = new PropertyModifier(LittleEndian.getShort(buf, offset));
+ if (charset == null) {
+ // see if this piece uses unicode.
+ //From the documentation: If the second most significant bit
+ //is clear, then this indicates the actual file offset of the Unicode character (two bytes). If the
+ //second most significant bit is set, then the actual address of the codepage-1252
+ //compressed version of the Unicode character (one byte), is actually at the offset indicated
+ //by clearing this bit and dividing by two.
+ if ((fc & 0x40000000) == 0) {
+ unicode = true;
+ this.charset = null;
+ } else {
+ unicode = false;
+ fc &= ~(0x40000000);//gives me FC in doc stream
+ fc /= 2;
+ this.charset = StringUtil.WIN_1252;
+ }
} else {
- unicode = false;
- fc &= ~(0x40000000);//gives me FC in doc stream
- fc /= 2;
- this.charset = StringUtil.WIN_1252;
+ if (charset == StringUtil.UTF16LE) {
+ unicode = true;
+ } else {
+ unicode = false;
+ }
+ this.charset = charset;
}
- } else {
- if (charset == StringUtil.UTF16LE) {
- unicode = true;
- }
- this.charset = charset;
- }
-
- }
-
- public int getFilePosition()
- {
- return fc;
- }
-
- public void setFilePosition(int pos)
- {
- fc = pos;
- }
-
- public boolean isUnicode()
- {
- return unicode;
- }
-
- /**
- *
- * @return charset to use if this is not a Unicode PieceDescriptor
- * this can be <code>null</code>
- */
- public Charset getCharset() {
- return charset;
- }
- public PropertyModifier getPrm()
- {
- return prm;
}
- protected byte[] toByteArray()
- {
- // set up the fc
- int tempFc = fc;
- if (!unicode)
- {
- tempFc *= 2;
- tempFc |= (0x40000000);
+ public int getFilePosition() {
+ return fc;
}
- int offset = 0;
- byte[] buf = new byte[8];
- LittleEndian.putShort(buf, offset, descriptor);
- offset += LittleEndian.SHORT_SIZE;
- LittleEndian.putInt(buf, offset, tempFc);
- offset += LittleEndian.INT_SIZE;
- LittleEndian.putShort(buf, offset, prm.getValue());
-
- return buf;
-
- }
+ public void setFilePosition(int pos) {
+ fc = pos;
+ }
- public static int getSizeInBytes()
- {
- return 8;
- }
+ public boolean isUnicode() {
+ return unicode;
+ }
@Override
- public int hashCode()
- {
+ public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + descriptor;
return result;
}
+ /**
+ * @return charset to use if this is not a Unicode PieceDescriptor
+ * this can be <code>null</code>
+ */
+ public Charset getCharset() {
+ return charset;
+ }
+
+ public PropertyModifier getPrm() {
+ return prm;
+ }
+
+ protected byte[] toByteArray() {
+ // set up the fc
+ int tempFc = fc;
+ if (!unicode) {
+ tempFc *= 2;
+ tempFc |= (0x40000000);
+ }
+
+ int offset = 0;
+ byte[] buf = new byte[8];
+ LittleEndian.putShort(buf, offset, descriptor);
+ offset += LittleEndian.SHORT_SIZE;
+ LittleEndian.putInt(buf, offset, tempFc);
+ offset += LittleEndian.INT_SIZE;
+ LittleEndian.putShort(buf, offset, prm.getValue());
+
+ return buf;
+ }
+
+ public static int getSizeInBytes() {
+ return 8;
+ }
+
@Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- if ( obj == null )
+ if (obj == null)
return false;
- if ( getClass() != obj.getClass() )
+ if (getClass() != obj.getClass())
return false;
PieceDescriptor other = (PieceDescriptor) obj;
- if ( descriptor != other.descriptor )
+ if (descriptor != other.descriptor)
return false;
- if ( prm == null )
- {
- if ( other.prm != null )
+ if (prm == null) {
+ if (other.prm != null)
return false;
- }
- else if ( !prm.equals( other.prm ) )
+ } else if (!prm.equals(other.prm))
return false;
- if ( unicode != other.unicode )
+ if (unicode != other.unicode)
return false;
return true;
}
@Override
- public String toString()
- {
+ public String toString() {
return "PieceDescriptor (pos: " + getFilePosition() + "; "
- + ( isUnicode() ? "unicode" : "non-unicode" ) + "; prm: "
+ + (isUnicode() ? "unicode" : "non-unicode") + "; prm: "
+ getPrm() + ")";
}
}
import static org.junit.Assume.assumeTrue;
/**
- * Common superclass for testing {@link org.apache.poi.xssf.usermodel.XSSFCell} and
- * {@link org.apache.poi.hssf.usermodel.HSSFCell}
+ * Common superclass for testing {@link HSSFCell}, org.apache.poi.xssf.usermodel.XSSFCell and
+ * org.apache.poi.xssf.streaming.SXSSFCell
*/
public abstract class BaseTestSheet {
private static final int ROW_COUNT = 40000;
//should exist now!
assertTrue("there isn't more than one merged region in there", 1 <= sheet.getNumMergedRegions());
region = sheet.getMergedRegion(0);
- assertEquals("the merged row to doesnt match the one we put in ", 4, region.getLastRow());
+ assertEquals("the merged row to doesn't match the one we put in ", 4, region.getLastRow());
wb.close();
}