Sonar fixes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884807 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2020-12-26 00:08:19 +00:00
parent be1afe5ff5
commit d121353f61
61 changed files with 378 additions and 330 deletions

View File

@ -52,15 +52,17 @@ import org.openxmlformats.schemas.presentationml.x2006.main.STTLTimeNodeFillType
import org.openxmlformats.schemas.presentationml.x2006.main.STTLTimeNodeRestartType;
import org.openxmlformats.schemas.presentationml.x2006.main.STTLTimeNodeType;
public class LinkVideoToPptx {
public final class LinkVideoToPptx {
private LinkVideoToPptx() {}
public static void main(String[] args) throws IOException, URISyntaxException {
XMLSlideShow pptx = new XMLSlideShow();
try (XMLSlideShow pptx = new XMLSlideShow()) {
String videoFileName = "file_example_MP4_640_3MG.mp4";
XSLFSlide slide1 = pptx.createSlide();
PackagePart pp = slide1.getPackagePart();
URI mp4uri = new URI("./"+videoFileName);
URI mp4uri = new URI("./" + videoFileName);
PackageRelationship prsEmbed1 = pp.addRelationship(mp4uri, TargetMode.EXTERNAL, "http://schemas.microsoft.com/office/2007/relationships/media");
PackageRelationship prsExec1 = pp.addRelationship(mp4uri, TargetMode.EXTERNAL, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video");
@ -70,7 +72,7 @@ public class LinkVideoToPptx {
XSLFPictureShape pic1 = slide1.createPicture(snap);
pic1.setAnchor(new Rectangle(100, 100, 500, 400));
CTPicture xpic1 = (CTPicture)pic1.getXmlObject();
CTPicture xpic1 = (CTPicture) pic1.getXmlObject();
CTHyperlink link1 = xpic1.getNvPicPr().getCNvPr().addNewHlinkClick();
link1.setId("");
link1.setAction("ppaction://media");
@ -114,4 +116,5 @@ public class LinkVideoToPptx {
pptx.write(fos);
}
}
}
}

View File

@ -30,9 +30,9 @@ import org.apache.tools.ant.taskdefs.Typedef;
public class ExcelAntUserDefinedFunction extends Typedef {
public String functionAlias ;
private String functionAlias ;
public String className ;
private String className ;
public ExcelAntUserDefinedFunction() {}

View File

@ -178,6 +178,7 @@ public final class ExtractorFactory {
return createExtractor(file, getCurrentUserPassword());
}
@SuppressWarnings({"java:S2095"})
public static POITextExtractor createExtractor(File file, String password) throws IOException {
if (file.length() == 0) {
throw new EmptyFileException();
@ -318,6 +319,6 @@ public final class ExtractorFactory {
}
public static void removeProvider(Class<? extends ExtractorProvider> provider){
Singleton.INSTANCE.provider.removeIf(p -> p.getClass().getName().equals(provider.getName()));
Singleton.INSTANCE.provider.removeIf(p -> p.getClass().isAssignableFrom(provider));
}
}

View File

@ -41,6 +41,7 @@ public class MainExtractorFactory implements ExtractorProvider {
return FileMagic.OLE2 == fm;
}
@SuppressWarnings({"java:S2095"})
@Override
public POITextExtractor create(File file, String password) throws IOException {
return create(new POIFSFileSystem(file, true).getRoot(), password);

View File

@ -37,7 +37,6 @@ public class ReSave {
public static void main(String[] args) throws Exception {
boolean initDrawing = false;
boolean saveToMemory = false;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
for(String filename : args) {
if(filename.equals("-dg")) {
initDrawing = true;
@ -45,9 +44,8 @@ public class ReSave {
saveToMemory = true;
} else {
System.out.print("reading " + filename + "...");
FileInputStream is = new FileInputStream(filename);
HSSFWorkbook wb = new HSSFWorkbook(is);
try {
try (FileInputStream is = new FileInputStream(filename);
HSSFWorkbook wb = new HSSFWorkbook(is)) {
System.out.println("done");
for(int i = 0; i < wb.getNumberOfSheets(); i++){
@ -57,25 +55,15 @@ public class ReSave {
}
}
OutputStream os;
if (saveToMemory) {
bos.reset();
os = bos;
} else {
String outputFile = filename.replace(".xls", "-saved.xls");
if (!saveToMemory) {
System.out.print("saving to " + outputFile + "...");
os = new FileOutputStream(outputFile);
}
try {
try (OutputStream os = saveToMemory ? new ByteArrayOutputStream() : new FileOutputStream(outputFile)) {
wb.write(os);
} finally {
os.close();
}
System.out.println("done");
} finally {
wb.close();
is.close();
}
}
}

View File

@ -1052,7 +1052,7 @@ public final class InternalWorkbook {
// Can be a few short if new sheets were added
if(records.getTabpos() > 0) {
TabIdRecord tir = ( TabIdRecord ) records.get(records.getTabpos());
if(tir._tabids.length < boundsheets.size()) {
if(tir.getTabIdSize() < boundsheets.size()) {
fixTabIdRecord();
}
}

View File

@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianOutput;
*/
public final class GridsetRecord extends StandardRecord {
public static final short sid = 0x82;
public short field_1_gridset_flag;
private short field_1_gridset_flag;
public GridsetRecord() {}

View File

@ -53,9 +53,9 @@ public abstract class PageBreakRecord extends StandardRecord {
public static final class Break implements GenericRecord {
public static final int ENCODED_SIZE = 6;
public int main;
public int subFrom;
public int subTo;
private int main;
private int subFrom;
private int subTo;
public Break(Break other) {
main = other.main;
@ -75,6 +75,18 @@ public abstract class PageBreakRecord extends StandardRecord {
subTo = in.readUShort();
}
public int getMain() {
return main;
}
public int getSubFrom() {
return subFrom;
}
public int getSubTo() {
return subTo;
}
public void serialize(LittleEndianOutput out) {
out.writeShort(main + 1);
out.writeShort(subFrom);

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.LittleEndianOutput;
public final class PrecisionRecord extends StandardRecord {
public static final short sid = 0xE;
public short field_1_precision;
private short field_1_precision;
public PrecisionRecord() {}

View File

@ -30,7 +30,7 @@ public final class TabIdRecord extends StandardRecord {
public static final short sid = 0x013D;
private static final short[] EMPTY_SHORT_ARRAY = { };
public short[] _tabids;
private short[] _tabids;
public TabIdRecord() {
_tabids = EMPTY_SHORT_ARRAY;
@ -63,6 +63,14 @@ public final class TabIdRecord extends StandardRecord {
}
}
public int getTabIdSize() {
return _tabids.length;
}
public short getTabIdAt(int index) {
return _tabids[index];
}
protected int getDataSize() {
return _tabids.length * 2;
}

View File

@ -486,7 +486,7 @@ public final class PageSettingsBlock extends RecordAggregate {
while(iterator.hasNext())
{
PageBreakRecord.Break breakItem = iterator.next();
int breakLocation = breakItem.main;
int breakLocation = breakItem.getMain();
boolean inStart = (breakLocation >= start);
boolean inEnd = (breakLocation <= stop);
if(inStart && inEnd) {
@ -497,8 +497,8 @@ public final class PageSettingsBlock extends RecordAggregate {
iterator = shiftedBreak.iterator();
while (iterator.hasNext()) {
PageBreakRecord.Break breakItem = iterator.next();
breaks.removeBreak(breakItem.main);
breaks.addBreak((short)(breakItem.main+count), breakItem.subFrom, breakItem.subTo);
breaks.removeBreak(breakItem.getMain());
breaks.addBreak((short)(breakItem.getMain()+count), breakItem.getSubFrom(), breakItem.getSubTo());
}
}

View File

@ -59,4 +59,14 @@ public class PhRun {
public int hashCode() {
return Objects.hash(phoneticTextFirstCharacterOffset, realTextFirstCharacterOffset, realTextLength);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhRun phRun = (PhRun) o;
return phoneticTextFirstCharacterOffset == phRun.phoneticTextFirstCharacterOffset
&& realTextFirstCharacterOffset == phRun.realTextFirstCharacterOffset
&& realTextLength == phRun.realTextLength;
}
}

View File

@ -57,11 +57,4 @@ public interface POIFSConstants
int END_OF_CHAIN = -2;
/** Indicates the sector is not used (0xFFFFFFFF) */
int UNUSED_BLOCK = -1;
/** The first 4 bytes of an OOXML file, used in detection */
byte[] OOXML_FILE_HEADER =
new byte[] { 0x50, 0x4b, 0x03, 0x04 };
/** The first 5 bytes of a raw XML file, used in detection */
byte[] RAW_XML_FILE_HEADER =
new byte[] { 0x3c, 0x3f, 0x78, 0x6d, 0x6c };
} // end public interface POIFSConstants;
}

View File

@ -205,6 +205,7 @@ public class AgileDecryptor extends Decryptor {
}
}
@SuppressWarnings({"java:S2095"})
@Override
public InputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException {
DocumentInputStream dis = dir.createDocumentInputStream(DEFAULT_POIFS_ENTRY);

View File

@ -140,7 +140,7 @@ public class BinaryRC4Decryptor extends Decryptor {
}
@Override
@SuppressWarnings("resource")
@SuppressWarnings({"java:S2095","resource"})
public ChunkedCipherInputStream getDataStream(DirectoryNode dir) throws IOException,
GeneralSecurityException {
DocumentInputStream dis = dir.createDocumentInputStream(DEFAULT_POIFS_ENTRY);

View File

@ -17,9 +17,6 @@
package org.apache.poi.poifs.filesystem;
import static org.apache.poi.poifs.common.POIFSConstants.OOXML_FILE_HEADER;
import static org.apache.poi.poifs.common.POIFSConstants.RAW_XML_FILE_HEADER;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@ -39,24 +36,24 @@ import org.apache.poi.util.LocaleUtil;
public enum FileMagic {
/** OLE2 / BIFF8+ stream used for Office 97 and higher documents */
OLE2(HeaderBlockConstants._signature),
/** OOXML / ZIP stream */
OOXML(OOXML_FILE_HEADER),
/** XML file */
XML(RAW_XML_FILE_HEADER),
/** OOXML / ZIP stream - The first 4 bytes of an OOXML file, used in detection */
OOXML(0x50, 0x4b, 0x03, 0x04),
/** XML file - The first 5 bytes of a raw XML file, used in detection */
XML(0x3c, 0x3f, 0x78, 0x6d, 0x6c),
/** BIFF2 raw stream - for Excel 2 */
BIFF2(new byte[]{
BIFF2(
0x09, 0x00, // sid=0x0009
0x04, 0x00, // size=0x0004
0x00, 0x00, // unused
'?', 0x00 // '?' = multiple values
}),
),
/** BIFF3 raw stream - for Excel 3 */
BIFF3(new byte[]{
BIFF3(
0x09, 0x02, // sid=0x0209
0x06, 0x00, // size=0x0006
0x00, 0x00, // unused
'?', 0x00 // '?' = multiple values
}),
),
/** BIFF4 raw stream - for Excel 4 */
BIFF4(new byte[]{
0x09, 0x04, // sid=0x0409
@ -81,7 +78,7 @@ public enum FileMagic {
HTML("<!DOCTYP",
"<html","\n\r<html","\r\n<html","\r<html","\n<html",
"<HTML","\r\n<HTML","\n\r<HTML","\r<HTML","\n<HTML"),
WORD2(new byte[]{ (byte)0xdb, (byte)0xa5, 0x2d, 0x00}),
WORD2(0xdb, 0xa5, 0x2d, 0x00),
/** JPEG image */
JPEG(
new byte[]{ (byte)0xFF, (byte)0xD8, (byte)0xFF, (byte)0xDB },
@ -91,20 +88,18 @@ public enum FileMagic {
/** GIF image */
GIF("GIF87a","GIF89a"),
/** PNG Image */
PNG(new byte[]{ (byte)0x89, 'P', 'N', 'G', 0x0D, 0x0A, 0x1A, 0x0A }),
PNG(0x89, 'P', 'N', 'G', 0x0D, 0x0A, 0x1A, 0x0A),
/** TIFF Image */
TIFF("II*\u0000", "MM\u0000*" ),
/** WMF image with a placeable header */
WMF(new byte[]{ (byte)0xD7, (byte)0xCD, (byte)0xC6, (byte)0x9A }),
WMF(0xD7, 0xCD, 0xC6, 0x9A),
/** EMF image */
EMF(new byte[]{
1, 0, 0, 0,
EMF(1, 0, 0, 0,
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?',
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?',
' ', 'E', 'M', 'F'
}),
' ', 'E', 'M', 'F'),
/** BMP image */
BMP(new byte[]{'B','M'}),
BMP('B','M'),
// keep UNKNOWN always as last enum!
/** UNKNOWN magic */
UNKNOWN(new byte[0]);
@ -119,6 +114,14 @@ public enum FileMagic {
LittleEndian.putLong(this.magic[0], 0, magic);
}
FileMagic(int... magic) {
byte[] one = new byte[magic.length];
for (int i=0; i<magic.length; i++) {
one[i] = (byte)(magic[i] & 0xFF);
}
this.magic = new byte[][]{ one };
}
FileMagic(byte[]... magic) {
this.magic = magic;
}

View File

@ -204,6 +204,7 @@ public class POIFSFileSystem extends BlockStore
this(channel, null, readOnly, false);
}
@SuppressWarnings("java:S2095")
private POIFSFileSystem(FileChannel channel, File srcFile, boolean readOnly, boolean closeChannelOnError)
throws IOException {
this(false);

View File

@ -177,7 +177,7 @@ public class DrawTextParagraph implements Drawable {
penY -= line.getLayout().getAscent();
}
penX = x + (isHSLF ? leftMargin : leftMargin);
penX = x + leftMargin;
if (lastLine == null) {
if (!isEmptyParagraph()) {
// TODO: find out character style for empty, but bulleted/numbered lines

View File

@ -298,7 +298,7 @@ public final class SlideShowFactory {
Singleton.INSTANCE.provider.add(provider);
}
public static void removeProvider(Class<? extends SlideShowProvider> provider){
Singleton.INSTANCE.provider.removeIf(p -> p.getClass().getName().equals(provider.getName()));
public static void removeProvider(Class<? extends SlideShowProvider<?,?>> provider){
Singleton.INSTANCE.provider.removeIf(p -> p.getClass().isAssignableFrom(provider));
}
}

View File

@ -18,8 +18,8 @@
package org.apache.poi.ss.formula;
public class SheetIdentifier {
public String _bookName;
public NameIdentifier _sheetIdentifier;
private final String _bookName;
private final NameIdentifier _sheetIdentifier;
public SheetIdentifier(String bookName, NameIdentifier sheetIdentifier) {
_bookName = bookName;

View File

@ -18,7 +18,7 @@
package org.apache.poi.ss.formula;
public class SheetRangeIdentifier extends SheetIdentifier {
public NameIdentifier _lastSheetIdentifier;
private final NameIdentifier _lastSheetIdentifier;
public SheetRangeIdentifier(String bookName, NameIdentifier firstSheetIdentifier, NameIdentifier lastSheetIdentifier) {
super(bookName, firstSheetIdentifier);

View File

@ -324,7 +324,7 @@ final class YearFracCalculator {
/** day of month */
public final int day;
/** milliseconds since 1970 */
public long tsMilliseconds;
public final long tsMilliseconds;
public SimpleDate(Calendar cal) {
year = cal.get(Calendar.YEAR);

View File

@ -107,7 +107,7 @@ public final class LinearRegressionFunction extends Fixed2ArgFunction {
}
public enum FUNCTION {INTERCEPT, SLOPE}
public FUNCTION function;
private final FUNCTION function;
public LinearRegressionFunction(FUNCTION function) {
this.function = function;

View File

@ -60,11 +60,10 @@ import org.apache.poi.ss.formula.eval.ValueEval;
*/
public final class Trend implements Function {
MatrixFunction.MutableValueCollector collector = new MatrixFunction.MutableValueCollector(false, false);
private static final class TrendResults {
public double[] vals;
public int resultWidth;
public int resultHeight;
private final double[] vals;
private final int resultWidth;
private final int resultHeight;
public TrendResults(double[] vals, int resultWidth, int resultHeight) {
this.vals = vals;
@ -149,7 +148,7 @@ public final class Trend implements Function {
}
double[] oneD = new double[twoD.length * twoD[0].length];
for (int i = 0; i < twoD.length; i++) {
System.arraycopy(twoD[i], 0, oneD, i * twoD[0].length + 0, twoD[0].length);
System.arraycopy(twoD[i], 0, oneD, i * twoD[0].length, twoD[0].length);
}
return oneD;
}
@ -335,7 +334,7 @@ public final class Trend implements Function {
if(isAllColumnsSame(x)){
double[] result = new double[newX.length];
double avg = Arrays.stream(y).average().orElse(0);
for(int i = 0; i < result.length; i++) result[i] = avg;
Arrays.fill(result, avg);
return new TrendResults(result, resultWidth, resultHeight);
}

View File

@ -305,6 +305,6 @@ public final class WorkbookFactory {
}
public static void removeProvider(Class<? extends WorkbookProvider> provider){
Singleton.INSTANCE.provider.removeIf(p -> p.getClass().getName().equals(provider.getName()));
Singleton.INSTANCE.provider.removeIf(p -> p.getClass().isAssignableFrom(provider));
}
}

View File

@ -17,6 +17,10 @@
package org.apache.poi.ss.util.cellwalk;
import static org.apache.commons.math3.util.ArithmeticUtils.addAndCheck;
import static org.apache.commons.math3.util.ArithmeticUtils.mulAndCheck;
import static org.apache.commons.math3.util.ArithmeticUtils.subAndCheck;
import org.apache.commons.math3.util.ArithmeticUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
@ -26,13 +30,11 @@ import org.apache.poi.ss.util.CellRangeAddress;
/**
* Traverse cell range.
*
* @author Roman Kashitsyn
*/
public class CellWalk {
private Sheet sheet;
private CellRangeAddress range;
private final Sheet sheet;
private final CellRangeAddress range;
private boolean traverseEmptyCells;
@ -74,8 +76,8 @@ public class CellWalk {
int lastColumn = range.getLastColumn();
final int width = lastColumn - firstColumn + 1;
SimpleCellWalkContext ctx = new SimpleCellWalkContext();
Row currentRow = null;
Cell currentCell = null;
Row currentRow;
Cell currentCell;
for (ctx.rowNumber = firstRow; ctx.rowNumber <= lastRow; ++ctx.rowNumber) {
currentRow = sheet.getRow(ctx.rowNumber);
@ -92,10 +94,9 @@ public class CellWalk {
continue;
}
long rowSize = ArithmeticUtils.mulAndCheck(
(long)ArithmeticUtils.subAndCheck(ctx.rowNumber, firstRow), (long)width);
long rowSize = mulAndCheck(subAndCheck(ctx.rowNumber, firstRow), (long)width);
ctx.ordinalNumber = ArithmeticUtils.addAndCheck(rowSize, (ctx.colNumber - firstColumn + 1));
ctx.ordinalNumber = addAndCheck(rowSize, (ctx.colNumber - firstColumn + 1));
handler.onCell(currentCell, ctx);
}
@ -108,13 +109,11 @@ public class CellWalk {
/**
* Inner class to hold walk context.
*
* @author Roman Kashitsyn
*/
private static class SimpleCellWalkContext implements CellWalkContext {
public long ordinalNumber;
public int rowNumber;
public int colNumber;
private long ordinalNumber;
private int rowNumber;
private int colNumber;
@Override
public long getOrdinalNumber() {

View File

@ -37,11 +37,11 @@ public final class DrawingDump {
}
public static void main( String[] args ) throws IOException {
OutputStreamWriter osw = new OutputStreamWriter(System.out, Charset.defaultCharset());
try (OutputStreamWriter osw = new OutputStreamWriter(System.out, Charset.defaultCharset());
PrintWriter pw = new PrintWriter(osw);
POIFSFileSystem fs = new POIFSFileSystem(new File(args[0]));
HSSFWorkbook wb = new HSSFWorkbook(fs);
try {
HSSFWorkbook wb = new HSSFWorkbook(fs)) {
pw.println( "Drawing group:" );
wb.dumpDrawingGroupRecords(true);
@ -51,9 +51,6 @@ public final class DrawingDump {
pw.println( "Sheet " + i + "(" + sheet.getSheetName() + "):" );
((HSSFSheet) sheet).dumpDrawingRecords(true, pw);
}
} finally {
wb.close();
fs.close();
}
}
}

View File

@ -162,13 +162,13 @@ public final class IOUtils {
* @return A byte array with the read bytes.
* @throws IOException If reading data fails or EOF is encountered too early for the given length.
*/
public static byte[] toByteArray(InputStream stream, final long length, final int maxLength) throws IOException {
public static byte[] toByteArray(InputStream stream, final int length, final int maxLength) throws IOException {
if (length < 0L || maxLength < 0L) {
throw new RecordFormatException("Can't allocate an array of length < 0");
}
if (length > (long)Integer.MAX_VALUE) {
throw new RecordFormatException("Can't allocate an array > "+Integer.MAX_VALUE);
}
// if (length > (long)Integer.MAX_VALUE) {
// throw new RecordFormatException("Can't allocate an array > "+Integer.MAX_VALUE);
// }
if ((length != Integer.MAX_VALUE) || (maxLength != Integer.MAX_VALUE)) {
checkLength(length, maxLength);
}

View File

@ -124,7 +124,6 @@ public final class POIXMLExtractorFactory implements ExtractorProvider {
return ExtractorFactory.createExtractor(f, password);
}
OPCPackage pkg = null;
try {
pkg = OPCPackage.open(f.toString(), PackageAccess.READ);
@ -136,7 +135,9 @@ public final class POIXMLExtractorFactory implements ExtractorProvider {
} catch (InvalidFormatException ife) {
throw new IOException(ife);
} catch (IOException e) {
if (pkg != null) {
pkg.revert();
}
throw e;
}
}

View File

@ -19,28 +19,12 @@ package org.apache.poi.ooxml.util;
import java.util.LinkedList;
import java.util.ListIterator;
/**
* <p>
* 24.08.2009<br>
* </p>
*
* @author Stefan Stern<br>
*/
public class IdentifierManager {
public static final long MAX_ID = Long.MAX_VALUE - 1;
public static final long MIN_ID = 0L;
/**
*
*/
private final long upperbound;
/**
*
*/
private final long lowerbound;
/**
@ -245,20 +229,14 @@ public class IdentifierManager {
}
private static class Segment {
private long start;
private long end;
public Segment(long start, long end) {
this.start = start;
this.end = end;
}
public long start;
public long end;
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
public String toString() {
return "[" + start + "; " + end + "]";
}

View File

@ -386,7 +386,7 @@ public abstract class SignatureLine {
int mpos = measurer.getPosition();
int limit = text.indexOf('\n', mpos);
limit = (limit == -1) ? text.length() : limit+1;
TextLayout textLayout = measurer.nextLayout(bi.getWidth()-10, limit, false);
TextLayout textLayout = measurer.nextLayout(bi.getWidth()-10f, limit, false);
if (lineNr != 1) {
y += textLayout.getAscent();
}

View File

@ -62,8 +62,8 @@ enum GeometryRowTypes {
SPLINE_START("SplineStart", SplineStart::new)
;
public String rowType;
public Function<RowType, ? extends GeometryRow> constructor;
private final String rowType;
private final Function<RowType, ? extends GeometryRow> constructor;
GeometryRowTypes(String rowType, Function<RowType, ? extends GeometryRow> constructor) {
this.rowType = rowType;

View File

@ -50,8 +50,8 @@ enum XDGFSectionTypes {
ANNOTATION("Annotation", GenericSection::new),
ACTION_TAG("ActionTag", GenericSection::new);
public String sectionType;
public BiFunction<SectionType, XDGFSheet, ? extends XDGFSection> constructor;
private final String sectionType;
private final BiFunction<SectionType, XDGFSheet, ? extends XDGFSection> constructor;
XDGFSectionTypes(String sectionType, BiFunction<SectionType, XDGFSheet, ? extends XDGFSection> constructor) {
this.sectionType = sectionType;

View File

@ -126,8 +126,6 @@ public class EllipticalArcTo implements GeometryRow {
_master = (EllipticalArcTo) row;
}
public static int draw;
@Override
public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) {

View File

@ -809,6 +809,7 @@ public class DummyGraphics2d extends Graphics2D {
log.println( "finalize():" );
g2D.dispose();
dispose();
super.finalize();
}
public Shape getClip() {

View File

@ -30,7 +30,7 @@ import org.apache.poi.util.LittleEndianConsts;
*/
@Internal
class XSSFBCellHeader {
public static int length = 8;
public static final int length = 8;
/**
*

View File

@ -237,17 +237,17 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
}
return null;
}
if (sheet._sheetIdentifier == null) {
if (sheet.getSheetIdentifier() == null) {
// Workbook + Named Range only
int bookIndex = resolveBookIndex(sheet._bookName);
int bookIndex = resolveBookIndex(sheet.getBookName());
return new NameXPxg(bookIndex, null, name);
}
// Use the sheetname and process
String sheetName = sheet._sheetIdentifier.getName();
String sheetName = sheet.getSheetIdentifier().getName();
if (sheet._bookName != null) {
int bookIndex = resolveBookIndex(sheet._bookName);
if (sheet.getBookName() != null) {
int bookIndex = resolveBookIndex(sheet.getBookName());
return new NameXPxg(bookIndex, sheetName, name);
} else {
return new NameXPxg(sheetName, name);
@ -255,8 +255,8 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
}
@Override
public Ptg get3DReferencePtg(CellReference cell, SheetIdentifier sheet) {
if (sheet._bookName != null) {
int bookIndex = resolveBookIndex(sheet._bookName);
if (sheet.getBookName() != null) {
int bookIndex = resolveBookIndex(sheet.getBookName());
return new Ref3DPxg(bookIndex, sheet, cell);
} else {
return new Ref3DPxg(sheet, cell);
@ -264,8 +264,8 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork
}
@Override
public Ptg get3DReferencePtg(AreaReference area, SheetIdentifier sheet) {
if (sheet._bookName != null) {
int bookIndex = resolveBookIndex(sheet._bookName);
if (sheet.getBookName() != null) {
int bookIndex = resolveBookIndex(sheet.getBookName());
return new Area3DPxg(bookIndex, sheet, area);
} else {
return new Area3DPxg(sheet, area);

View File

@ -165,10 +165,8 @@ public class TestExtractorFactory {
@Test
public void testPOIFSInvalid() {
IOException ex = assertThrows(
IOException.class,
() -> ExtractorFactory.createExtractor(new POIFSFileSystem(txt))
);
// Not really an Extractor test, but we'll leave it to test POIFS reaction anyway ...
IOException ex = assertThrows(IOException.class, () -> new POIFSFileSystem(txt));
assertTrue(ex.getMessage().contains("Invalid header signature; read 0x3D20726F68747541, expected 0xE11AB1A1E011CFD0"));
}

View File

@ -65,6 +65,7 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider {
return FileMagic.OLE2 == fm;
}
@SuppressWarnings("java:S2095")
@Override
public POITextExtractor create(File file, String password) throws IOException {
return create(new POIFSFileSystem(file, true).getRoot(), password);

View File

@ -355,7 +355,7 @@ public class HemfPlusBrush {
size += LittleEndianConsts.INT_SIZE;
}
brushBytes = IOUtils.toByteArray(leis, dataSize-size, MAX_OBJECT_SIZE);
brushBytes = IOUtils.toByteArray(leis, (int)(dataSize-size), MAX_OBJECT_SIZE);
return dataSize;
}

View File

@ -708,7 +708,7 @@ public final class HemfPlusDraw {
// If the CMAP_LOOKUP flag in the optionsFlags field is set, each value in this array specifies a
// Unicode character. Otherwise, each value specifies an index to a character glyph in the EmfPlusFont
// object specified by the ObjectId value in Flags field.
byte[] glyphBuf = IOUtils.toByteArray(leis, glyphCount*2L, MAX_OBJECT_SIZE);
byte[] glyphBuf = IOUtils.toByteArray(leis, glyphCount*2, MAX_OBJECT_SIZE);
glyphs = StringUtil.getFromUnicodeLE(glyphBuf);
size += glyphBuf.length;

View File

@ -265,7 +265,7 @@ public class HemfPlusObject {
long size = graphicsVersion.init(leis);
objectDataBytes = IOUtils.toByteArray(leis, dataSize - size, MAX_OBJECT_SIZE);
objectDataBytes = IOUtils.toByteArray(leis, (int)(dataSize - size), MAX_OBJECT_SIZE);
return dataSize;
}

View File

@ -35,7 +35,7 @@ public class ExEmbed extends RecordContainer {
private final byte[] _header;
// Links to our more interesting children
public org.apache.poi.hslf.record.RecordAtom embedAtom;
private org.apache.poi.hslf.record.RecordAtom embedAtom;
private ExOleObjAtom oleObjAtom;
private CString menuName;
private CString progId;

View File

@ -37,7 +37,7 @@ import org.apache.poi.util.LittleEndian;
public final class TextHeaderAtom extends RecordAtom implements ParentAwareRecord {
public static final long _type = RecordTypes.TextHeaderAtom.typeID;
private byte[] _header;
public org.apache.poi.hslf.record.RecordContainer parentRecord;
private org.apache.poi.hslf.record.RecordContainer parentRecord;
/** The kind of text it is */
private int textType;

View File

@ -54,15 +54,15 @@ public class AttachmentChunks implements ChunkGroup {
* This is in WMF Format. You'll probably want to pass it to Apache Batik to
* turn it into a SVG that you can then display.
*/
public ByteChunk attachRenderingWMF;
private ByteChunk attachRenderingWMF;
/**
* What the POIFS name of this attachment is.
*/
private String poifsName;
private final String poifsName;
/** Holds all the chunks that were found. */
private List<Chunk> allChunks = new ArrayList<>();
private final List<Chunk> allChunks = new ArrayList<>();
public AttachmentChunks(String poifsName) {
this.poifsName = poifsName;

View File

@ -39,10 +39,14 @@ public final class NameIdChunks implements ChunkGroup {
PS_PUBLIC_STRINGS("00020329-0000-0000-C000-000000000046"),
PS_INTERNET_HEADERS("00020386-0000-0000-C000-000000000046");
public ClassID classID;
private final ClassID classID;
PropertySetType(String uuid) {
classID = new ClassID(uuid);
}
public ClassID getClassID() {
return classID;
}
}
public enum PredefinedPropertySet {
@ -61,10 +65,14 @@ public final class NameIdChunks implements ChunkGroup {
PSETID_XML_EXTRACTED_ENTITIES("23239608-685D-4732-9C55-4C95CB4E8E33"),
PSETID_ATTACHMENT("96357F7F-59E1-47D0-99A7-46515C183B54");
public ClassID classID;
private final ClassID classID;
PredefinedPropertySet(String uuid) {
classID = new ClassID(uuid);
}
public ClassID getClassID() {
return classID;
}
}
private ByteChunk guidStream;

View File

@ -45,35 +45,35 @@ public final class RecipientChunks implements ChunkGroupWithProperties {
public static final MAPIProperty RECIPIENT_DISPLAY_NAME = MAPIProperty.RECIPIENT_DISPLAY_NAME;
/** Our 0 based position in the list of recipients */
public int recipientNumber;
private int recipientNumber;
/** TODO */
public ByteChunk recipientSearchChunk;
private ByteChunk recipientSearchChunk;
/**
* The "name", which could be their name if an internal person, or their
* email address if an external person
*/
public StringChunk recipientNameChunk;
private StringChunk recipientNameChunk;
/**
* The email address of the recipient, which could be in SMTP or SEARCH
* format, but isn't always present...
*/
public StringChunk recipientEmailChunk;
private StringChunk recipientEmailChunk;
/**
* The smtp destination email address of the recipient, but isn't always
* present...
*/
public StringChunk recipientSMTPChunk;
private StringChunk recipientSMTPChunk;
/**
* Normally EX or SMTP. Will generally affect where the email address ends
* up.
*/
public StringChunk deliveryTypeChunk;
private StringChunk deliveryTypeChunk;
/**
* The display name of the recipient. Normally seems to hold the same value
* as in recipientNameChunk
*/
public StringChunk recipientDisplayNameChunk;
private StringChunk recipientDisplayNameChunk;
/**
* Holds the fixed sized properties, and the pointers to the data of
* variable sized ones
@ -93,6 +93,34 @@ public final class RecipientChunks implements ChunkGroupWithProperties {
}
}
public int getRecipientNumber() {
return recipientNumber;
}
public ByteChunk getRecipientSearchChunk() {
return recipientSearchChunk;
}
public StringChunk getRecipientNameChunk() {
return recipientNameChunk;
}
public StringChunk getRecipientEmailChunk() {
return recipientEmailChunk;
}
public StringChunk getRecipientSMTPChunk() {
return recipientSMTPChunk;
}
public StringChunk getDeliveryTypeChunk() {
return deliveryTypeChunk;
}
public StringChunk getRecipientDisplayNameChunk() {
return recipientDisplayNameChunk;
}
/**
* Tries to find their name, in whichever chunk holds it.
*/

View File

@ -256,7 +256,7 @@ public class HwmfGraphics implements HwmfCharsetAware {
protected Paint getHatchedFill() {
HwmfDrawProperties prop = getProperties();
BufferedImage pattern = getPatternFromLong(
prop.getBrushHatch().pattern,
prop.getBrushHatch().getPattern(),
prop.getBackgroundColor().getColor(),
prop.getBrushColor().getColor(),
prop.getBkMode() == HwmfBkMode.TRANSPARENT

View File

@ -97,14 +97,18 @@ public enum HwmfBinaryRasterOp {
/** 1, Pixel is always 1 */
R2_WHITE(0x0010, HwmfBinaryRasterOp::R2_WHITE);
public int opIndex;
private BiConsumer<int[],int[]> op;
private final int opIndex;
private final BiConsumer<int[],int[]> op;
HwmfBinaryRasterOp(int opIndex, BiConsumer<int[],int[]> op) {
this.opIndex = opIndex;
this.op = op;
}
public int getOpIndex() {
return opIndex;
}
public static HwmfBinaryRasterOp valueOf(int opIndex) {
for (HwmfBinaryRasterOp bb : HwmfBinaryRasterOp.values()) {
if (bb.opIndex == opIndex) {

View File

@ -164,8 +164,8 @@ public class HwmfEscape implements HwmfRecord {
/** Enables applications to include private procedures and other arbitrary data in documents. */
SPCLPASSTHROUGH2(0x11D8, WmfEscapeUnknownData::new);
public int flag;
public final Supplier<? extends HwmfEscape.HwmfEscapeData> constructor;
private final int flag;
private final Supplier<? extends HwmfEscape.HwmfEscapeData> constructor;
EscapeFunction(int flag, Supplier<? extends HwmfEscape.HwmfEscapeData> constructor) {
@ -173,6 +173,14 @@ public class HwmfEscape implements HwmfRecord {
this.constructor = constructor;
}
public int getFlag() {
return flag;
}
public Supplier<? extends HwmfEscapeData> getConstructor() {
return constructor;
}
static EscapeFunction valueOf(int flag) {
for (EscapeFunction hs : values()) {
if (hs.flag == flag) return hs;
@ -247,7 +255,7 @@ public class HwmfEscape implements HwmfRecord {
@Override
public int init(LittleEndianInputStream leis, long recordSize, EscapeFunction escapeFunction) throws IOException {
this.escapeFunction = escapeFunction;
escapeDataBytes = IOUtils.toByteArray(leis,recordSize,MAX_OBJECT_SIZE);
escapeDataBytes = IOUtils.toByteArray(leis,(int)recordSize,MAX_OBJECT_SIZE);
return (int)recordSize;
}
@ -290,7 +298,7 @@ public class HwmfEscape implements HwmfRecord {
if (commentIdentifier != EMF_COMMENT_IDENTIFIER) {
// there are some WMF implementation using this record as a MFCOMMENT or similar
// if the commentIdentifier doesn't match, then return immediately
emfData = IOUtils.toByteArray(leis, recordSize-LittleEndianConsts.INT_SIZE, MAX_OBJECT_SIZE);
emfData = IOUtils.toByteArray(leis, (int)(recordSize-LittleEndianConsts.INT_SIZE), MAX_OBJECT_SIZE);
remainingBytes = emfData.length;
return (int)recordSize;
}

View File

@ -47,14 +47,22 @@ public enum HwmfHatchStyle {
HS_DITHEREDBKCLR(0x000B, 0xAA55AA55AA55AA55L)
;
int flag;
public long pattern;
private final int flag;
private final long pattern;
HwmfHatchStyle(int flag, long pattern) {
this.flag = flag;
this.pattern = pattern;
}
public int getFlag() {
return flag;
}
public long getPattern() {
return pattern;
}
public static HwmfHatchStyle valueOf(int flag) {
for (HwmfHatchStyle hs : values()) {
if (hs.flag == flag) return hs;

View File

@ -129,6 +129,7 @@ public class HwmfPenStyle implements Duplicatable, GenericRecord {
public final int wmfFlag;
public final float[] dashes;
HwmfLineDash(int wmfFlag, float... dashes) {
this.wmfFlag = wmfFlag;
this.dashes = dashes;

View File

@ -370,7 +370,7 @@ public enum HwmfTernaryRasterOp {
private static final String OPS = "nxoa";
public int opValue;
private final int opValue;
HwmfTernaryRasterOp(int opValue) {
this.opValue=opValue;

View File

@ -19,14 +19,12 @@ package org.apache.poi.hwpf.converter;
import org.apache.poi.util.Beta;
@Beta
public interface FontReplacer
{
public class Triplet
{
public interface FontReplacer {
class Triplet {
public String fontName;
public boolean bold;
public boolean italic;
}
public Triplet update( Triplet original );
Triplet update(Triplet original);
}

View File

@ -46,11 +46,11 @@ public final class Picture {
private static final POILogger log = POILogFactory
.getLogger( Picture.class );
public static final byte[] COMPRESSED1 = { (byte) 0xFE, 0x78, (byte) 0xDA };
private static final byte[] COMPRESSED1 = { (byte) 0xFE, 0x78, (byte) 0xDA };
public static final byte[] COMPRESSED2 = { (byte) 0xFE, 0x78, (byte) 0x9C };
private static final byte[] COMPRESSED2 = { (byte) 0xFE, 0x78, (byte) 0x9C };
public static final byte[] IHDR = new byte[] { 'I', 'H', 'D', 'R' };
private static final byte[] IHDR = new byte[] { 'I', 'H', 'D', 'R' };
@Deprecated
private static final byte[] PNG = new byte[] { (byte) 0x89, 0x50, 0x4E,

View File

@ -214,18 +214,18 @@ public final class TestBasics {
@Test
public void testEncoding() throws Exception {
assertEquals(2, cyrillic.getRecipientDetailsChunks().length);
assertEquals("CP1252", cyrillic.getRecipientDetailsChunks()[0].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("CP1252", cyrillic.getRecipientDetailsChunks()[1].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("CP1252", cyrillic.getRecipientDetailsChunks()[0].getRecipientDisplayNameChunk().get7BitEncoding());
assertEquals("CP1252", cyrillic.getRecipientDetailsChunks()[1].getRecipientDisplayNameChunk().get7BitEncoding());
cyrillic.guess7BitEncoding();
assertEquals("Cp1251", cyrillic.getRecipientDetailsChunks()[0].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("Cp1251", cyrillic.getRecipientDetailsChunks()[1].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("Cp1251", cyrillic.getRecipientDetailsChunks()[0].getRecipientDisplayNameChunk().get7BitEncoding());
assertEquals("Cp1251", cyrillic.getRecipientDetailsChunks()[1].getRecipientDisplayNameChunk().get7BitEncoding());
// Override it, check it's taken
cyrillic.set7BitEncoding("UTF-8");
assertEquals("UTF-8", cyrillic.getRecipientDetailsChunks()[0].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("UTF-8", cyrillic.getRecipientDetailsChunks()[1].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("UTF-8", cyrillic.getRecipientDetailsChunks()[0].getRecipientDisplayNameChunk().get7BitEncoding());
assertEquals("UTF-8", cyrillic.getRecipientDetailsChunks()[1].getRecipientDisplayNameChunk().get7BitEncoding());
// Check with a file that has no headers
@ -235,10 +235,10 @@ public final class TestBasics {
assertTrue(html.contains("text/html; charset=big5"), "Charset not found:\n" + html);
// Defaults to CP1251
assertEquals("CP1252", chinese.getRecipientDetailsChunks()[0].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("CP1252", chinese.getRecipientDetailsChunks()[0].getRecipientDisplayNameChunk().get7BitEncoding());
// But after guessing goes to the correct one, cp950 (Windows Traditional Chinese)
chinese.guess7BitEncoding();
assertEquals("cp950", chinese.getRecipientDetailsChunks()[0].recipientDisplayNameChunk.get7BitEncoding());
assertEquals("cp950", chinese.getRecipientDetailsChunks()[0].getRecipientDisplayNameChunk().get7BitEncoding());
}
}

View File

@ -59,7 +59,7 @@ public class TestNameIdChunks {
*/
@Test
public void testReadKeywords() {
long keywordsPropTag = keywordsMsg.getNameIdChunks().getPropertyTag(PS_PUBLIC_STRINGS.classID, "Keywords", 0);
long keywordsPropTag = keywordsMsg.getNameIdChunks().getPropertyTag(PS_PUBLIC_STRINGS.getClassID(), "Keywords", 0);
assertEquals(0x8003, keywordsPropTag);
String[] exp = { "TODO", "Currently Important", "Currently To Do", "Test" };
String[] act = getValues(keywordsPropTag);
@ -72,7 +72,7 @@ public class TestNameIdChunks {
*/
@Test
public void testCurrentVersionName() {
long testPropTag = keywordsMsg.getNameIdChunks().getPropertyTag(PSETID_COMMON.classID, null, 0x8554);
long testPropTag = keywordsMsg.getNameIdChunks().getPropertyTag(PSETID_COMMON.getClassID(), null, 0x8554);
assertEquals(0x8006, testPropTag);
String[] exp = { "16.0" };
String[] act = getValues(testPropTag);

View File

@ -72,8 +72,8 @@ public final class TestSorters {
new RecipientChunks("__recip_version1.0_#00000000"),
};
Arrays.sort(chunks, new RecipientChunksSorter());
assertEquals(0, chunks[0].recipientNumber);
assertEquals(1, chunks[1].recipientNumber);
assertEquals(0, chunks[0].getRecipientNumber());
assertEquals(1, chunks[1].getRecipientNumber());
// Lots, with gaps
chunks = new RecipientChunks[] {
@ -87,13 +87,13 @@ public final class TestSorters {
new RecipientChunks("__recip_version1.0_#00000000"),
};
Arrays.sort(chunks, new RecipientChunksSorter());
assertEquals(0, chunks[0].recipientNumber);
assertEquals(1, chunks[1].recipientNumber);
assertEquals(5, chunks[2].recipientNumber);
assertEquals(9, chunks[3].recipientNumber);
assertEquals(0xFF, chunks[4].recipientNumber);
assertEquals(0x205, chunks[5].recipientNumber);
assertEquals(0x404, chunks[6].recipientNumber);
assertEquals(0x20001, chunks[7].recipientNumber);
assertEquals(0, chunks[0].getRecipientNumber());
assertEquals(1, chunks[1].getRecipientNumber());
assertEquals(5, chunks[2].getRecipientNumber());
assertEquals(9, chunks[3].getRecipientNumber());
assertEquals(0xFF, chunks[4].getRecipientNumber());
assertEquals(0x205, chunks[5].getRecipientNumber());
assertEquals(0x404, chunks[6].getRecipientNumber());
assertEquals(0x20001, chunks[7].getRecipientNumber());
}
}

View File

@ -90,11 +90,11 @@ public final class TestPOIFSChunkParser {
assertTrue(groups[2] instanceof NameIdChunks);
RecipientChunks recips = (RecipientChunks)groups[1];
assertEquals("kevin.roast@alfresco.org", recips.recipientSMTPChunk.getValue());
assertEquals("kevin.roast@alfresco.org", recips.getRecipientSMTPChunk().getValue());
assertEquals("/O=HOSTEDSERVICE2/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Kevin.roast@ben",
recips.recipientEmailChunk.getValue());
recips.getRecipientEmailChunk().getValue());
String search = new String(recips.recipientSearchChunk.getValue(), StandardCharsets.US_ASCII);
String search = new String(recips.getRecipientSearchChunk().getValue(), StandardCharsets.US_ASCII);
assertEquals("CN=KEVIN.ROAST@BEN\0", search.substring(search.length()-19));
// Now via MAPIMessage
@ -102,17 +102,17 @@ public final class TestPOIFSChunkParser {
assertNotNull(msg.getRecipientDetailsChunks());
assertEquals(1, msg.getRecipientDetailsChunks().length);
assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].recipientSMTPChunk.getValue());
assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].getRecipientSMTPChunk().getValue());
assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].getRecipientEmailAddress());
assertEquals("Kevin Roast", msg.getRecipientDetailsChunks()[0].getRecipientName());
assertEquals("kevin.roast@alfresco.org", msg.getRecipientEmailAddress());
// Try both SMTP and EX files for recipient
assertEquals("EX", msg.getRecipientDetailsChunks()[0].deliveryTypeChunk.getValue());
assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].recipientSMTPChunk.getValue());
assertEquals("EX", msg.getRecipientDetailsChunks()[0].getDeliveryTypeChunk().getValue());
assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].getRecipientSMTPChunk().getValue());
assertEquals("/O=HOSTEDSERVICE2/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Kevin.roast@ben",
msg.getRecipientDetailsChunks()[0].recipientEmailChunk.getValue());
msg.getRecipientDetailsChunks()[0].getRecipientEmailChunk().getValue());
msg.close();
simple.close();
@ -123,10 +123,10 @@ public final class TestPOIFSChunkParser {
assertNotNull(msg.getRecipientDetailsChunks());
assertEquals(1, msg.getRecipientDetailsChunks().length);
assertEquals("SMTP", msg.getRecipientDetailsChunks()[0].deliveryTypeChunk.getValue());
assertNull(msg.getRecipientDetailsChunks()[0].recipientSMTPChunk);
assertNull(msg.getRecipientDetailsChunks()[0].recipientNameChunk);
assertEquals("travis@overwrittenstack.com", msg.getRecipientDetailsChunks()[0].recipientEmailChunk.getValue());
assertEquals("SMTP", msg.getRecipientDetailsChunks()[0].getDeliveryTypeChunk().getValue());
assertNull(msg.getRecipientDetailsChunks()[0].getRecipientSMTPChunk());
assertNull(msg.getRecipientDetailsChunks()[0].getRecipientNameChunk());
assertEquals("travis@overwrittenstack.com", msg.getRecipientDetailsChunks()[0].getRecipientEmailChunk().getValue());
assertEquals("travis@overwrittenstack.com", msg.getRecipientEmailAddress());
msg.close();
@ -166,12 +166,12 @@ public final class TestPOIFSChunkParser {
(RecipientChunks)groups[7],
};
assertEquals(6, chunks.length);
assertEquals(0, chunks[0].recipientNumber);
assertEquals(2, chunks[1].recipientNumber);
assertEquals(4, chunks[2].recipientNumber);
assertEquals(5, chunks[3].recipientNumber);
assertEquals(3, chunks[4].recipientNumber);
assertEquals(1, chunks[5].recipientNumber);
assertEquals(0, chunks[0].getRecipientNumber());
assertEquals(2, chunks[1].getRecipientNumber());
assertEquals(4, chunks[2].getRecipientNumber());
assertEquals(5, chunks[3].getRecipientNumber());
assertEquals(3, chunks[4].getRecipientNumber());
assertEquals(1, chunks[5].getRecipientNumber());
// Check
assertEquals("'Ashutosh Dandavate'", chunks[0].getRecipientName());

View File

@ -1640,8 +1640,8 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
}
assertNotNull(tr);
assertEquals(1, tr._tabids.length);
assertEquals(0, tr._tabids[0]);
assertEquals(1, tr.getTabIdSize());
assertEquals(0, tr.getTabIdAt(0));
// Ensure the print setup
assertEquals("new_sheet!$A$1:$C$1", wb2.getPrintArea(0));

View File

@ -263,7 +263,7 @@ public final class TestSumifs {
HSSFSheet example3 = wb.getSheet("Example 3");
HSSFCell ex3cell = example3.getRow(5).getCell(2);
fe.evaluate(ex3cell);
assertEquals(8,8, ex3cell.getNumericCellValue());
assertEquals(8.8, ex3cell.getNumericCellValue(), 0);
HSSFSheet example4 = wb.getSheet("Example 4");
HSSFCell ex4cell = example4.getRow(8).getCell(2);