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
This commit is contained in:
Andreas Beeker 2021-01-17 17:31:22 +00:00
parent 8d0e84f257
commit 3778a3e9e2
282 changed files with 1023 additions and 1059 deletions

View File

@ -93,7 +93,6 @@ public class TestAllFiles {
final List<Arguments> result = new ArrayList<>(100);
for (String file : scanner.getIncludedFiles()) {
// if (!file.contains("44958.xls")) continue;
for (FileHandlerKnown handler : sm.getHandler(file)) {
ExcInfo info1 = sm.getExcInfo(file, testName, handler);
if (info1 == null || info1.isValid(testName, handler.name())) {

View File

@ -60,7 +60,7 @@ public abstract class POIDocument implements Closeable {
private DirectoryNode directory;
/** For our own logging use */
private static final POILogger logger = POILogFactory.getLogger(POIDocument.class);
private static final POILogger LOG = POILogFactory.getLogger(POIDocument.class);
/* Have the property streams been read yet? (Only done on-demand) */
private boolean initialized;
@ -162,12 +162,12 @@ public abstract class POIDocument implements Closeable {
if (clazz.isInstance(ps)) {
return (T)ps;
} else if (ps != null) {
logger.log(POILogger.WARN, localName+" property set came back with wrong class - "+ps.getClass().getName());
LOG.log(POILogger.WARN, localName+" property set came back with wrong class - "+ps.getClass().getName());
} else {
logger.log(POILogger.WARN, localName+" property set came back as null");
LOG.log(POILogger.WARN, localName+" property set came back as null");
}
} catch (IOException e) {
logger.log(POILogger.ERROR, "can't retrieve property set", e);
LOG.log(POILogger.ERROR, "can't retrieve property set", e);
}
return null;
}
@ -333,9 +333,9 @@ public abstract class POIDocument implements Closeable {
// Create or Update the Property Set stream in the POIFS
outFS.createOrUpdateDocument(bIn, name);
logger.log(POILogger.INFO, "Wrote property set ", name, " of size ", data.length);
LOG.log(POILogger.INFO, "Wrote property set ", name, " of size ", data.length);
} catch(WritingNotSupportedException ignored) {
logger.log( POILogger.ERROR, "Couldn't write property set with name ", name, " as not supported by HPSF yet");
LOG.log( POILogger.ERROR, "Couldn't write property set with name ", name, " as not supported by HPSF yet");
}
}

View File

@ -26,12 +26,12 @@ package org.apache.poi.ddf;
public class EscherPropertyMetaData
{
// Escher property types.
public final static byte TYPE_UNKNOWN = (byte) 0;
public final static byte TYPE_BOOLEAN = (byte) 1;
public final static byte TYPE_RGB = (byte) 2;
public final static byte TYPE_SHAPEPATH = (byte) 3;
public final static byte TYPE_SIMPLE = (byte)4;
public final static byte TYPE_ARRAY = (byte)5;
public static final byte TYPE_UNKNOWN = (byte) 0;
public static final byte TYPE_BOOLEAN = (byte) 1;
public static final byte TYPE_RGB = (byte) 2;
public static final byte TYPE_SHAPEPATH = (byte) 3;
public static final byte TYPE_SIMPLE = (byte)4;
public static final byte TYPE_ARRAY = (byte)5;
private String description;
private byte type;

View File

@ -34,7 +34,7 @@ public class CodePageString {
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
private final static POILogger LOG = POILogFactory.getLogger( CodePageString.class );
private static final POILogger LOG = POILogFactory.getLogger( CodePageString.class );
private byte[] _value;

View File

@ -23,7 +23,7 @@ import org.apache.poi.util.POILogger;
@Internal
public class VariantBool {
private final static POILogger LOG = POILogFactory.getLogger( VariantBool.class );
private static final POILogger LOG = POILogFactory.getLogger( VariantBool.class );
static final int SIZE = 2;

View File

@ -58,7 +58,7 @@ public class VariantSupport extends Variant {
Variant.VT_CF, Variant.VT_BOOL };
private static final POILogger logger = POILogFactory.getLogger(VariantSupport.class);
private static final POILogger LOG = POILogFactory.getLogger(VariantSupport.class);
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
@ -114,7 +114,7 @@ public class VariantSupport extends Variant {
Long vt = Long.valueOf(ex.getVariantType());
if (!unsupportedMessage.contains(vt))
{
logger.log( POILogger.ERROR, ex.getMessage());
LOG.log( POILogger.ERROR, ex.getMessage());
unsupportedMessage.add(vt);
}
}

View File

@ -57,7 +57,7 @@ import org.apache.poi.util.SuppressForbidden;
*/
public final class BiffViewer {
private static final char[] NEW_LINE_CHARS = System.getProperty("line.separator").toCharArray();
private static final POILogger logger = POILogFactory.getLogger(BiffViewer.class);
private static final POILogger LOG = POILogFactory.getLogger(BiffViewer.class);
private BiffViewer() {
// no instances of this class
@ -81,7 +81,7 @@ public final class BiffViewer {
try {
hasNext = recStream.hasNextRecord();
} catch (LeftoverDataException e) {
logger.log(POILogger.ERROR, "Discarding ", recStream.remaining(), " bytes and continuing", e);
LOG.log(POILogger.ERROR, "Discarding ", recStream.remaining(), " bytes and continuing", e);
recStream.readRemainder();
hasNext = recStream.hasNextRecord();
}

View File

@ -28,7 +28,6 @@ import org.apache.poi.hssf.record.ExtendedFormatRecord;
import org.apache.poi.hssf.record.FormatRecord;
import org.apache.poi.hssf.record.FormulaRecord;
import org.apache.poi.hssf.record.NumberRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFDataFormatter;
import org.apache.poi.util.LocaleUtil;
@ -41,7 +40,7 @@ import org.apache.poi.util.POILogger;
* ids.
*/
public class FormatTrackingHSSFListener implements HSSFListener {
private final static POILogger logger = POILogFactory.getLogger(FormatTrackingHSSFListener.class);
private static final POILogger LOG = POILogFactory.getLogger(FormatTrackingHSSFListener.class);
private final HSSFListener _childListener;
private final HSSFDataFormatter _formatter;
private final NumberFormat _defaultFormat;
@ -155,7 +154,7 @@ public class FormatTrackingHSSFListener implements HSSFListener {
if (formatIndex >= HSSFDataFormat.getNumberOfBuiltinBuiltinFormats()) {
FormatRecord tfr = _customFormatRecords.get(Integer.valueOf(formatIndex));
if (tfr == null) {
logger.log( POILogger.ERROR, "Requested format at index ", formatIndex,
LOG.log( POILogger.ERROR, "Requested format at index ", formatIndex,
", but it wasn't found");
} else {
format = tfr.getFormatString();
@ -192,7 +191,7 @@ public class FormatTrackingHSSFListener implements HSSFListener {
public int getFormatIndex(CellValueRecordInterface cell) {
ExtendedFormatRecord xfr = _xfRecords.get(cell.getXFIndex());
if (xfr == null) {
logger.log( POILogger.ERROR, "Cell ", cell.getRow(), ",", cell.getColumn(),
LOG.log( POILogger.ERROR, "Cell ", cell.getRow(), ",", cell.getColumn(),
" uses XF with index ", cell.getXFIndex(), ", but we don't have that");
return -1;
}

View File

@ -61,7 +61,7 @@ import org.apache.poi.util.IOUtils;
*/
public class OldExcelExtractor implements POITextExtractor {
private final static int FILE_PASS_RECORD_SID = 0x2f;
private static final int FILE_PASS_RECORD_SID = 0x2f;
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.LittleEndianOutput;
*/
public final class ArrayRecord extends SharedValueRecordBase {
public final static short sid = 0x0221;
public static final short sid = 0x0221;
private static final int OPT_ALWAYS_RECALCULATE = 0x0001;
private static final int OPT_CALCULATE_ON_OPEN = 0x0002;

View File

@ -285,7 +285,7 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord {
template_params = IOUtils.safelyAllocate(template_param_length, MAX_RECORD_LENGTH);
in.readFully(template_params);
} else {
logger.log(POILogger.WARN, "CF Rule v12 template params length should be 0 or 16, found " + template_param_length);
LOG.log(POILogger.WARN, "CF Rule v12 template params length should be 0 or 16, found " + template_param_length);
in.readRemainder();
}

View File

@ -95,7 +95,7 @@ public abstract class CFRuleBase extends StandardRecord {
public static final int TEMPLATE_ABOVE_OR_EQUAL_TO_AVERAGE = 0x001D;
public static final int TEMPLATE_BELOW_OR_EQUAL_TO_AVERAGE = 0x001E;
protected static final POILogger logger = POILogFactory.getLogger(CFRuleBase.class);
protected static final POILogger LOG = POILogFactory.getLogger(CFRuleBase.class);
static final BitField modificationBits = bf(0x003FFFFF); // Bits: font,align,bord,patt,prot
static final BitField alignHor = bf(0x00000001); // 0 = Horizontal alignment modified

View File

@ -35,7 +35,7 @@ import org.apache.poi.util.POILogger;
public final class DimensionsRecord extends StandardRecord {
private static final POILogger logger = POILogFactory.getLogger(DimensionsRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(DimensionsRecord.class);
public static final short sid = 0x200;
private int field_1_first_row;
@ -63,7 +63,7 @@ public final class DimensionsRecord extends StandardRecord {
field_5_zero = in.readShort();
//POI-61045 -- in practice, there can be an extra 2 bytes
if (in.available() == 2) {
logger.log(POILogger.INFO, "DimensionsRecord has extra 2 bytes.");
LOG.log(POILogger.INFO, "DimensionsRecord has extra 2 bytes.");
in.readShort();
}
}

View File

@ -43,7 +43,7 @@ import org.apache.poi.util.StringUtil;
* stored in a separate entry within the OLE2 compound file.
*/
public final class EmbeddedObjectRefSubRecord extends SubRecord {
private static POILogger logger = POILogFactory.getLogger(EmbeddedObjectRefSubRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(EmbeddedObjectRefSubRecord.class);
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
@ -157,7 +157,7 @@ public final class EmbeddedObjectRefSubRecord extends SubRecord {
int nUnexpectedPadding = remaining - dataLenAfterFormula;
if (nUnexpectedPadding > 0) {
logger.log( POILogger.ERROR, "Discarding ", nUnexpectedPadding, " unexpected padding bytes");
LOG.log( POILogger.ERROR, "Discarding ", nUnexpectedPadding, " unexpected padding bytes");
readRawData(in, nUnexpectedPadding);
remaining-=nUnexpectedPadding;
}

View File

@ -39,7 +39,7 @@ import org.apache.poi.util.POILogger;
* up with a {@link FeatHdrRecord}.
*/
public final class FeatRecord extends StandardRecord {
private static final POILogger logger = POILogFactory.getLogger(FeatRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(FeatRecord.class);
public static final short sid = 0x0868;
// SIDs from newer versions
public static final short v11_sid = 0x0872;
@ -108,7 +108,7 @@ public final class FeatRecord extends StandardRecord {
sharedFeature = new FeatSmartTag(in);
break;
default:
logger.log( POILogger.ERROR, "Unknown Shared Feature ", isf_sharedFeatureType, " found!");
LOG.log( POILogger.ERROR, "Unknown Shared Feature ", isf_sharedFeatureType, " found!");
}
}

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.StringUtil;
*/
public final class FormatRecord extends StandardRecord {
private static final POILogger logger = POILogFactory.getLogger(FormatRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(FormatRecord.class);
public static final short sid = 0x041E;
@ -149,7 +149,7 @@ public final class FormatRecord extends StandardRecord {
}
if (ris.available() > 0) {
logger.log(POILogger.INFO, "FormatRecord has ", ris.available(), " unexplained bytes. Silently skipping");
LOG.log(POILogger.INFO, "FormatRecord has ", ris.available(), " unexplained bytes. Silently skipping");
//swallow what's left
while (ris.available() > 0) {
ris.readByte();

View File

@ -45,7 +45,7 @@ import org.apache.poi.util.StringUtil;
*/
public final class HyperlinkRecord extends StandardRecord {
public static final short sid = 0x01B8;
private static final POILogger logger = POILogFactory.getLogger(HyperlinkRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(HyperlinkRecord.class);
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
@ -403,7 +403,7 @@ public final class HyperlinkRecord extends StandardRecord {
}
if (in.remaining() > 0) {
logger.log(POILogger.WARN,
LOG.log(POILogger.WARN,
"Hyperlink data remains: " + in.remaining() +
" : " +HexDump.toHex(in.readRemainder())
);

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.RecordFormatException;
* @see org.apache.poi.hssf.record.LabelSSTRecord
*/
public final class LabelRecord extends Record implements CellValueRecordInterface {
private static final POILogger logger = POILogFactory.getLogger(LabelRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(LabelRecord.class);
public static final short sid = 0x0204;
@ -77,7 +77,7 @@ public final class LabelRecord extends Record implements CellValueRecordInterfac
}
if (in.remaining() > 0) {
logger.log(POILogger.INFO,
LOG.log(POILogger.INFO,
"LabelRecord data remains: ", in.remaining(),
" : ", HexDump.toHex(in.readRemainder())
);

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.RecordFormatException;
* didn't use {@link LabelSSTRecord}
*/
public final class OldLabelRecord extends OldCellRecord {
private static final POILogger logger = POILogFactory.getLogger(OldLabelRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(OldLabelRecord.class);
//arbitrarily set, may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
@ -62,7 +62,7 @@ public final class OldLabelRecord extends OldCellRecord {
in.read(field_5_bytes, 0, field_4_string_len);
if (in.remaining() > 0) {
logger.log(POILogger.INFO,
LOG.log(POILogger.INFO,
"LabelRecord data remains: ", in.remaining(),
" : ", HexDump.toHex(in.readRemainder())
);

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.POILogger;
*/
class SSTDeserializer
{
private static POILogger logger = POILogFactory.getLogger(SSTDeserializer.class);
private static final POILogger LOG = POILogFactory.getLogger(SSTDeserializer.class);
private IntMapper<UnicodeString> strings;
public SSTDeserializer( IntMapper<UnicodeString> strings )
@ -51,7 +51,7 @@ class SSTDeserializer
// Extract exactly the count of strings from the SST record.
UnicodeString str;
if (in.available() == 0 && !in.hasNextRecord()) {
logger.log(POILogger.ERROR, "Ran out of data before creating all the strings! String at index ", i);
LOG.log(POILogger.ERROR, "Ran out of data before creating all the strings! String at index ", i);
str = new UnicodeString("");
} else {
str = new UnicodeString(in);

View File

@ -32,7 +32,7 @@ import org.apache.poi.util.StringUtil;
*/
public final class SupBookRecord extends StandardRecord {
private static final POILogger logger = POILogFactory.getLogger(SupBookRecord.class);
private static final POILogger LOG = POILogFactory.getLogger(SupBookRecord.class);
public static final short sid = 0x01AE;
@ -222,12 +222,12 @@ public final class SupBookRecord extends StandardRecord {
break;
case CH_LONG_VOLUME:
//Don't known to handle...
logger.log(POILogger.WARN, "Found unexpected key: ChLongVolume - IGNORING");
LOG.log(POILogger.WARN, "Found unexpected key: ChLongVolume - IGNORING");
break;
case CH_STARTUP_DIR:
case CH_ALT_STARTUP_DIR:
case CH_LIB_DIR:
logger.log(POILogger.WARN, "EXCEL.EXE path unkown - using this directoy instead: .");
LOG.log(POILogger.WARN, "EXCEL.EXE path unkown - using this directoy instead: .");
sb.append(".").append(PATH_SEPERATOR);
break;
default:

View File

@ -52,7 +52,7 @@ import org.apache.poi.util.RecordFormatException;
public final class CFRecordsAggregate extends RecordAggregate implements GenericRecord {
/** Excel 97-2003 allows up to 3 conditional formating rules */
private static final int MAX_97_2003_CONDTIONAL_FORMAT_RULES = 3;
private static final POILogger logger = POILogFactory.getLogger(CFRecordsAggregate.class);
private static final POILogger LOG = POILogFactory.getLogger(CFRecordsAggregate.class);
private final CFHeaderBase header;
@ -72,7 +72,7 @@ public final class CFRecordsAggregate extends RecordAggregate implements Generic
throw new IllegalArgumentException("rules must not be null");
}
if(pRules.length > MAX_97_2003_CONDTIONAL_FORMAT_RULES) {
logger.log(POILogger.WARN, "Excel versions before 2007 require that "
LOG.log(POILogger.WARN, "Excel versions before 2007 require that "
+ "No more than " + MAX_97_2003_CONDTIONAL_FORMAT_RULES
+ " rules may be specified, " + pRules.length + " were found,"
+ " this file will cause problems with old Excel versions");
@ -181,7 +181,7 @@ public final class CFRecordsAggregate extends RecordAggregate implements Generic
throw new IllegalArgumentException("r must not be null");
}
if(rules.size() >= MAX_97_2003_CONDTIONAL_FORMAT_RULES) {
logger.log(POILogger.WARN, "Excel versions before 2007 cannot cope with"
LOG.log(POILogger.WARN, "Excel versions before 2007 cannot cope with"
+ " any more than " + MAX_97_2003_CONDTIONAL_FORMAT_RULES
+ " - this file will cause problems with old Excel versions");
}

View File

@ -34,7 +34,7 @@ import org.apache.poi.util.StringUtil;
@Internal
public class ExtRst implements Comparable<ExtRst>, GenericRecord {
private static final POILogger _logger = POILogFactory.getLogger(ExtRst.class);
private static final POILogger LOG = POILogFactory.getLogger(ExtRst.class);
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
@ -78,7 +78,7 @@ public class ExtRst implements Comparable<ExtRst>, GenericRecord {
// Spot corrupt records
if(reserved != 1) {
_logger.log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found ", reserved, " - ignoring");
LOG.log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found ", reserved, " - ignoring");
// Grab all the remaining data, and ignore it
for(int i=0; i<expectedLength-2; i++) {
in.readByte();
@ -121,7 +121,7 @@ public class ExtRst implements Comparable<ExtRst>, GenericRecord {
int extraDataLength = runData - (numRuns*6);
if(extraDataLength < 0) {
_logger.log( POILogger.WARN, "Warning - ExtRst overran by ", (0-extraDataLength), " bytes");
LOG.log( POILogger.WARN, "Warning - ExtRst overran by ", (0-extraDataLength), " bytes");
extraDataLength = 0;
}
extraData = IOUtils.safelyAllocate(extraDataLength, MAX_RECORD_LENGTH);

View File

@ -43,7 +43,7 @@ import org.apache.poi.util.POILogger;
* This is often called a XLUnicodeRichExtendedString in MS documentation.<p>
*/
public class UnicodeString implements Comparable<UnicodeString>, Duplicatable, GenericRecord {
private static final POILogger _logger = POILogFactory.getLogger(UnicodeString.class);
private static final POILogger LOG = POILogFactory.getLogger(UnicodeString.class);
private static final BitField highByte = BitFieldFactory.getInstance(0x1);
// 0x2 is reserved
@ -102,7 +102,7 @@ public class UnicodeString implements Comparable<UnicodeString>, Duplicatable, G
if (isExtendedText() && (extensionLength > 0)) {
field_5_ext_rst = new ExtRst(new ContinuableRecordInput(in), extensionLength);
if(field_5_ext_rst.getDataSize()+4 != extensionLength) {
_logger.log(POILogger.WARN, "ExtRst was supposed to be " + extensionLength + " bytes long, but seems to actually be " + (field_5_ext_rst.getDataSize() + 4));
LOG.log(POILogger.WARN, "ExtRst was supposed to be " + extensionLength + " bytes long, but seems to actually be " + (field_5_ext_rst.getDataSize() + 4));
}
}
}

View File

@ -59,8 +59,9 @@ import java.text.AttributedCharacterIterator;
* <code>HSSFClientAnchor.getAnchorHeightInPoints()</code>.
* </blockquote>
*/
public class EscherGraphics extends Graphics
{
public class EscherGraphics extends Graphics {
private static final POILogger LOG = POILogFactory.getLogger(EscherGraphics.class);
private final HSSFShapeGroup escherGroup;
private final HSSFWorkbook workbook;
private float verticalPointsPerPixel = 1.0f;
@ -68,7 +69,6 @@ public class EscherGraphics extends Graphics
private Color foreground;
private Color background = Color.white;
private Font font;
private static final POILogger logger = POILogFactory.getLogger(EscherGraphics.class);
/**
* Construct an escher graphics object.
@ -135,14 +135,14 @@ public class EscherGraphics extends Graphics
@NotImplemented
public void clipRect(int x, int y, int width, int height)
{
logger.log(POILogger.WARN,"clipRect not supported");
LOG.log(POILogger.WARN,"clipRect not supported");
}
@Override
@NotImplemented
public void copyArea(int x, int y, int width, int height, int dx, int dy)
{
logger.log(POILogger.WARN,"copyArea not supported");
LOG.log(POILogger.WARN,"copyArea not supported");
}
@Override
@ -162,7 +162,7 @@ public class EscherGraphics extends Graphics
public void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
logger.log(POILogger.WARN,"drawArc not supported");
LOG.log(POILogger.WARN,"drawArc not supported");
}
@Override
@ -173,7 +173,7 @@ public class EscherGraphics extends Graphics
Color bgcolor,
ImageObserver observer)
{
logger.log(POILogger.WARN,"drawImage not supported");
LOG.log(POILogger.WARN,"drawImage not supported");
return true;
}
@ -185,7 +185,7 @@ public class EscherGraphics extends Graphics
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
logger.log(POILogger.WARN,"drawImage not supported");
LOG.log(POILogger.WARN,"drawImage not supported");
return true;
}
@ -266,14 +266,14 @@ public class EscherGraphics extends Graphics
public void drawPolyline(int[] xPoints, int[] yPoints,
int nPoints)
{
logger.log(POILogger.WARN,"drawPolyline not supported");
LOG.log(POILogger.WARN,"drawPolyline not supported");
}
@Override
@NotImplemented
public void drawRect(int x, int y, int width, int height)
{
logger.log(POILogger.WARN,"drawRect not supported");
LOG.log(POILogger.WARN,"drawRect not supported");
}
@Override
@ -281,7 +281,7 @@ public class EscherGraphics extends Graphics
public void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
logger.log(POILogger.WARN,"drawRoundRect not supported");
LOG.log(POILogger.WARN,"drawRoundRect not supported");
}
@Override
@ -349,16 +349,16 @@ public class EscherGraphics extends Graphics
public void drawString(AttributedCharacterIterator iterator,
int x, int y)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"drawString not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"drawString not supported");
}
@Override
public void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"fillArc not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"fillArc not supported");
}
@Override
@ -442,8 +442,8 @@ public class EscherGraphics extends Graphics
public void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"fillRoundRect not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"fillRoundRect not supported");
}
@Override
@ -488,7 +488,7 @@ public class EscherGraphics extends Graphics
@NotImplemented
public void setClip(Shape shape)
{
logger.log(POILogger.WARN,"setClip not supported");
LOG.log(POILogger.WARN,"setClip not supported");
}
@Override
@ -507,21 +507,21 @@ public class EscherGraphics extends Graphics
@NotImplemented
public void setPaintMode()
{
logger.log(POILogger.WARN,"setPaintMode not supported");
LOG.log(POILogger.WARN,"setPaintMode not supported");
}
@Override
@NotImplemented
public void setXORMode(Color color)
{
logger.log(POILogger.WARN,"setXORMode not supported");
LOG.log(POILogger.WARN,"setXORMode not supported");
}
@Override
@NotImplemented
public void translate(int x, int y)
{
logger.log(POILogger.WARN,"translate not supported");
LOG.log(POILogger.WARN,"translate not supported");
}
public Color getBackground()

View File

@ -69,13 +69,14 @@ import java.util.Map;
* </blockquote>
*/
public final class EscherGraphics2d extends Graphics2D {
private static final POILogger LOG = POILogFactory.getLogger(EscherGraphics2d.class);
private EscherGraphics _escherGraphics;
private BufferedImage _img;
private AffineTransform _trans;
private Stroke _stroke;
private Paint _paint;
private Shape _deviceclip;
private POILogger logger = POILogFactory.getLogger(getClass());
/**
* Constructs one escher graphics object from an escher graphics object.
@ -152,8 +153,8 @@ public final class EscherGraphics2d extends Graphics2D {
}
else
{
if (logger.check(POILogger.WARN))
logger.log(POILogger.WARN, "draw not fully supported");
if (LOG.check(POILogger.WARN))
LOG.log(POILogger.WARN, "draw not fully supported");
}
}
@ -171,22 +172,22 @@ public final class EscherGraphics2d extends Graphics2D {
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, Color bgColor, ImageObserver imageobserver)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"drawImage() not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"drawImage() not supported");
return true;
}
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, ImageObserver imageobserver)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"drawImage() not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"drawImage() not supported");
return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, imageobserver);
}
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, Color bgColor, ImageObserver imageobserver)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"drawImage() not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"drawImage() not supported");
return true;
}
@ -310,8 +311,8 @@ public final class EscherGraphics2d extends Graphics2D {
public void fill(Shape shape)
{
if (logger.check( POILogger.WARN ))
logger.log(POILogger.WARN,"fill(Shape) not supported");
if (LOG.check( POILogger.WARN ))
LOG.log(POILogger.WARN,"fill(Shape) not supported");
}
public void fillArc(int i, int j, int k, int l, int i1, int j1)

View File

@ -78,9 +78,9 @@ public class HSSFCell extends CellBase {
public static final int LAST_COLUMN_NUMBER = SpreadsheetVersion.EXCEL97.getLastColumnIndex(); // 2^8 - 1
private static final String LAST_COLUMN_NAME = SpreadsheetVersion.EXCEL97.getLastColumnName();
public final static short ENCODING_UNCHANGED = -1;
public final static short ENCODING_COMPRESSED_UNICODE = 0;
public final static short ENCODING_UTF_16 = 1;
public static final short ENCODING_UNCHANGED = -1;
public static final short ENCODING_COMPRESSED_UNICODE = 0;
public static final short ENCODING_UTF_16 = 1;
private final HSSFWorkbook _book;
private final HSSFSheet _sheet;

View File

@ -39,12 +39,12 @@ import org.apache.poi.ss.util.CellAddress;
*/
public class HSSFComment extends HSSFTextbox implements Comment {
private final static int FILL_TYPE_SOLID = 0;
private final static int FILL_TYPE_PICTURE = 3;
private static final int FILL_TYPE_SOLID = 0;
private static final int FILL_TYPE_PICTURE = 3;
private final static int GROUP_SHAPE_PROPERTY_DEFAULT_VALUE = 655362;
private final static int GROUP_SHAPE_HIDDEN_MASK = 0x1000002;
private final static int GROUP_SHAPE_NOT_HIDDEN_MASK = 0xFEFFFFFD;
private static final int GROUP_SHAPE_PROPERTY_DEFAULT_VALUE = 655362;
private static final int GROUP_SHAPE_HIDDEN_MASK = 0x1000002;
private static final int GROUP_SHAPE_NOT_HIDDEN_MASK = 0xFEFFFFFD;
/*
* TODO - make HSSFComment more consistent when created vs read from file.

View File

@ -36,17 +36,17 @@ public final class HSSFFont implements Font {
/**
* Normal boldness (not bold)
*/
final static short BOLDWEIGHT_NORMAL = 0x190;
static final short BOLDWEIGHT_NORMAL = 0x190;
/**
* Bold boldness (bold)
*/
final static short BOLDWEIGHT_BOLD = 0x2bc;
static final short BOLDWEIGHT_BOLD = 0x2bc;
/**
* Arial font
*/
public final static String FONT_ARIAL = "Arial";
public static final String FONT_ARIAL = "Arial";
private FontRecord font;

View File

@ -41,8 +41,9 @@ import org.apache.poi.util.POILogger;
*
*/
public class HSSFPolygon extends HSSFSimpleShape {
private static POILogger logger = POILogFactory.getLogger(HSSFPolygon.class);
public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 0x1E;
public static final short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 0x1E;
private static final POILogger LOG = POILogFactory.getLogger(HSSFPolygon.class);
public HSSFPolygon(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord _textObjectRecord) {
super(spContainer, objRecord, _textObjectRecord);
@ -173,11 +174,11 @@ public class HSSFPolygon extends HSSFSimpleShape {
*/
public void setPoints(int[] xPoints, int[] yPoints) {
if (xPoints.length != yPoints.length){
logger.log( POILogger.ERROR, "xPoint.length must be equal to yPoints.length");
LOG.log( POILogger.ERROR, "xPoint.length must be equal to yPoints.length");
return;
}
if (xPoints.length == 0){
logger.log( POILogger.ERROR, "HSSFPolygon must have at least one point");
LOG.log( POILogger.ERROR, "HSSFPolygon must have at least one point");
}
EscherArrayProperty verticesProp = new EscherArrayProperty(EscherPropertyTypes.GEOMETRY__VERTICES, false, 0);
verticesProp.setNumberOfElementsInArray(xPoints.length+1);

View File

@ -39,7 +39,7 @@ import org.apache.poi.util.Configurator;
public final class HSSFRow implements Row, Comparable<HSSFRow> {
// used for collections
public final static int INITIAL_CAPACITY = Configurator.getIntValue("HSSFRow.ColInitialCapacity", 5);
public static final int INITIAL_CAPACITY = Configurator.getIntValue("HSSFRow.ColInitialCapacity", 5);
private int rowNum;
private HSSFCell[] cells;

View File

@ -80,8 +80,8 @@ public abstract class HSSFShape implements Shape {
private final ObjRecord _objRecord;
private final EscherOptRecord _optRecord;
public final static int NO_FILLHITTEST_TRUE = 0x00110000;
public final static int NO_FILLHITTEST_FALSE = 0x00010000;
public static final int NO_FILLHITTEST_TRUE = 0x00110000;
public static final int NO_FILLHITTEST_FALSE = 0x00010000;
/**
* creates shapes from existing file

View File

@ -101,7 +101,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
* rows. It is currently set to 20. If you generate larger sheets you may benefit
* by setting this to a higher number and recompiling a custom edition of HSSFSheet.
*/
public final static int INITIAL_CAPACITY = Configurator.getIntValue("HSSFSheet.RowInitialCapacity", 20);
public static final int INITIAL_CAPACITY = Configurator.getIntValue("HSSFSheet.RowInitialCapacity", 20);
/**
* reference to the low level {@link InternalSheet} object

View File

@ -47,32 +47,32 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape
// The commented out ones haven't been tested yet or aren't supported
// by HSSFSimpleShape.
public final static short OBJECT_TYPE_LINE = HSSFShapeTypes.Line;
public final static short OBJECT_TYPE_RECTANGLE = HSSFShapeTypes.Rectangle;
public final static short OBJECT_TYPE_OVAL = HSSFShapeTypes.Ellipse;
public final static short OBJECT_TYPE_ARC = HSSFShapeTypes.Arc;
// public final static short OBJECT_TYPE_CHART = 5;
// public final static short OBJECT_TYPE_TEXT = 6;
// public final static short OBJECT_TYPE_BUTTON = 7;
public final static short OBJECT_TYPE_PICTURE = HSSFShapeTypes.PictureFrame;
public static final short OBJECT_TYPE_LINE = HSSFShapeTypes.Line;
public static final short OBJECT_TYPE_RECTANGLE = HSSFShapeTypes.Rectangle;
public static final short OBJECT_TYPE_OVAL = HSSFShapeTypes.Ellipse;
public static final short OBJECT_TYPE_ARC = HSSFShapeTypes.Arc;
// public static final short OBJECT_TYPE_CHART = 5;
// public static final short OBJECT_TYPE_TEXT = 6;
// public static final short OBJECT_TYPE_BUTTON = 7;
public static final short OBJECT_TYPE_PICTURE = HSSFShapeTypes.PictureFrame;
// public final static short OBJECT_TYPE_POLYGON = 9;
// public final static short OBJECT_TYPE_CHECKBOX = 11;
// public final static short OBJECT_TYPE_OPTION_BUTTON = 12;
// public final static short OBJECT_TYPE_EDIT_BOX = 13;
// public final static short OBJECT_TYPE_LABEL = 14;
// public final static short OBJECT_TYPE_DIALOG_BOX = 15;
// public final static short OBJECT_TYPE_SPINNER = 16;
// public final static short OBJECT_TYPE_SCROLL_BAR = 17;
// public final static short OBJECT_TYPE_LIST_BOX = 18;
// public final static short OBJECT_TYPE_GROUP_BOX = 19;
public final static short OBJECT_TYPE_COMBO_BOX = HSSFShapeTypes.HostControl;
public final static short OBJECT_TYPE_COMMENT = HSSFShapeTypes.TextBox;
public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
// public static final short OBJECT_TYPE_POLYGON = 9;
// public static final short OBJECT_TYPE_CHECKBOX = 11;
// public static final short OBJECT_TYPE_OPTION_BUTTON = 12;
// public static final short OBJECT_TYPE_EDIT_BOX = 13;
// public static final short OBJECT_TYPE_LABEL = 14;
// public static final short OBJECT_TYPE_DIALOG_BOX = 15;
// public static final short OBJECT_TYPE_SPINNER = 16;
// public static final short OBJECT_TYPE_SCROLL_BAR = 17;
// public static final short OBJECT_TYPE_LIST_BOX = 18;
// public static final short OBJECT_TYPE_GROUP_BOX = 19;
public static final short OBJECT_TYPE_COMBO_BOX = HSSFShapeTypes.HostControl;
public static final short OBJECT_TYPE_COMMENT = HSSFShapeTypes.TextBox;
public static final short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
public final static int WRAP_SQUARE = 0;
public final static int WRAP_BY_POINTS = 1;
public final static int WRAP_NONE = 2;
public static final int WRAP_SQUARE = 0;
public static final int WRAP_BY_POINTS = 1;
public static final int WRAP_NONE = 2;
private TextObjectRecord _textObjectRecord;

View File

@ -38,25 +38,25 @@ import org.apache.poi.hssf.record.TextObjectRecord;
* A textbox is a shape that may hold a rich text string.
*/
public class HSSFTextbox extends HSSFSimpleShape {
public final static short OBJECT_TYPE_TEXT = 6;
public static final short OBJECT_TYPE_TEXT = 6;
/**
* How to align text horizontally
*/
public final static short HORIZONTAL_ALIGNMENT_LEFT = 1;
public final static short HORIZONTAL_ALIGNMENT_CENTERED = 2;
public final static short HORIZONTAL_ALIGNMENT_RIGHT = 3;
public final static short HORIZONTAL_ALIGNMENT_JUSTIFIED = 4;
public final static short HORIZONTAL_ALIGNMENT_DISTRIBUTED = 7;
public static final short HORIZONTAL_ALIGNMENT_LEFT = 1;
public static final short HORIZONTAL_ALIGNMENT_CENTERED = 2;
public static final short HORIZONTAL_ALIGNMENT_RIGHT = 3;
public static final short HORIZONTAL_ALIGNMENT_JUSTIFIED = 4;
public static final short HORIZONTAL_ALIGNMENT_DISTRIBUTED = 7;
/**
* How to align text vertically
*/
public final static short VERTICAL_ALIGNMENT_TOP = 1;
public final static short VERTICAL_ALIGNMENT_CENTER = 2;
public final static short VERTICAL_ALIGNMENT_BOTTOM = 3;
public final static short VERTICAL_ALIGNMENT_JUSTIFY = 4;
public final static short VERTICAL_ALIGNMENT_DISTRIBUTED = 7;
public static final short VERTICAL_ALIGNMENT_TOP = 1;
public static final short VERTICAL_ALIGNMENT_CENTER = 2;
public static final short VERTICAL_ALIGNMENT_BOTTOM = 3;
public static final short VERTICAL_ALIGNMENT_JUSTIFY = 4;
public static final short VERTICAL_ALIGNMENT_DISTRIBUTED = 7;
public HSSFTextbox(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord) {
super(spContainer, objRecord, textObjectRecord);

View File

@ -156,7 +156,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
* since you're never allowed to have more or less than three sheets!
*/
public final static int INITIAL_CAPACITY = Configurator.getIntValue("HSSFWorkbook.SheetInitialCapacity", 3);
public static final int INITIAL_CAPACITY = Configurator.getIntValue("HSSFWorkbook.SheetInitialCapacity", 3);
/**
* this is the reference to the low level Workbook object

View File

@ -35,7 +35,7 @@ import org.apache.poi.util.POILogger;
// {@link org.apache.poi.xssf.usermodel.helpers.XSSFColumnShifter}
@Beta
public final class HSSFColumnShifter extends ColumnShifter {
private static final POILogger logger = POILogFactory.getLogger(HSSFColumnShifter.class);
private static final POILogger LOG = POILogFactory.getLogger(HSSFColumnShifter.class);
public HSSFColumnShifter(HSSFSheet sh) {
super(sh);

View File

@ -33,7 +33,7 @@ import org.apache.poi.util.POILogger;
// non-Javadoc: When possible, code should be implemented in the RowShifter abstract class to avoid duplication with
// {@link org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter}
public final class HSSFRowShifter extends RowShifter {
private static final POILogger logger = POILogFactory.getLogger(HSSFRowShifter.class);
private static final POILogger LOG = POILogFactory.getLogger(HSSFRowShifter.class);
public HSSFRowShifter(HSSFSheet sh) {
super(sh);

View File

@ -54,7 +54,7 @@ import org.apache.poi.util.POILogger;
import org.apache.poi.util.TempFile;
public class StandardEncryptor extends Encryptor {
private static final POILogger logger = POILogFactory.getLogger(StandardEncryptor.class);
private static final POILogger LOG = POILogFactory.getLogger(StandardEncryptor.class);
protected StandardEncryptor() {}
@ -193,7 +193,7 @@ public class StandardEncryptor extends Encryptor {
IOUtils.copy(fis, leos);
}
if (!fileOut.delete()) {
logger.log(POILogger.ERROR, "Can't delete temporary encryption file: ", fileOut);
LOG.log(POILogger.ERROR, "Can't delete temporary encryption file: ", fileOut);
}
leos.close();

View File

@ -105,7 +105,7 @@ public enum FileMagic {
UNKNOWN(new byte[0]);
// update this if a longer pattern is added
final static int MAX_PATTERN_LENGTH = 44;
static final int MAX_PATTERN_LENGTH = 44;
final byte[][] magic;

View File

@ -37,7 +37,7 @@ import org.apache.poi.util.POILogger;
* A POIFS {@link DataSource} backed by a File
*/
public class FileBackedDataSource extends DataSource implements Closeable {
private final static POILogger logger = POILogFactory.getLogger(FileBackedDataSource.class);
private static final POILogger LOG = POILogFactory.getLogger(FileBackedDataSource.class);
private final FileChannel channel;
private Long channelSize;
@ -195,10 +195,10 @@ public class FileBackedDataSource extends DataSource implements Closeable {
try {
CleanerUtil.getCleaner().freeBuffer(buffer);
} catch (IOException e) {
logger.log(POILogger.WARN, "Failed to unmap the buffer", e);
LOG.log(POILogger.WARN, "Failed to unmap the buffer", e);
}
} else {
logger.log(POILogger.DEBUG, CleanerUtil.UNMAP_NOT_SUPPORTED_REASON);
LOG.log(POILogger.DEBUG, CleanerUtil.UNMAP_NOT_SUPPORTED_REASON);
}
}
}

View File

@ -41,8 +41,7 @@ import org.apache.poi.util.POILogger;
* chain of blocks.
*/
public final class PropertyTable implements BATManaged {
private static final POILogger _logger =
POILogFactory.getLogger(PropertyTable.class);
private static final POILogger LOG = POILogFactory.getLogger(PropertyTable.class);
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
@ -97,7 +96,7 @@ public final class PropertyTable implements BATManaged {
// Looks to be a truncated block
// This isn't allowed, but some third party created files
// sometimes do this, and we can normally read anyway
_logger.log(POILogger.WARN, "Short Property Block, ", bb.remaining(),
LOG.log(POILogger.WARN, "Short Property Block, ", bb.remaining(),
" bytes instead of the expected " + _bigBigBlockSize.getBigBlockSize());
toRead = bb.remaining();
}
@ -248,7 +247,7 @@ public final class PropertyTable implements BATManaged {
if (! Property.isValidIndex(index))
return false;
if (index < 0 || index >= _properties.size()) {
_logger.log(POILogger.WARN, "Property index " + index +
LOG.log(POILogger.WARN, "Property index " + index +
"outside the valid range 0.."+_properties.size());
return false;
}

View File

@ -49,7 +49,7 @@ import org.apache.poi.util.POILogger;
* For now this class renders only images supported by the javax.imageio.ImageIO framework.
**/
public class BitmapImageRenderer implements ImageRenderer {
private final static POILogger LOG = POILogFactory.getLogger(BitmapImageRenderer.class);
private static final POILogger LOG = POILogFactory.getLogger(BitmapImageRenderer.class);
protected BufferedImage img;

View File

@ -36,7 +36,7 @@ import org.apache.poi.util.POILogger;
import org.apache.poi.util.XMLHelper;
public final class PresetGeometries {
private final static POILogger LOG = POILogFactory.getLogger(PresetGeometries.class);
private static final POILogger LOG = POILogFactory.getLogger(PresetGeometries.class);
private final Map<String, CustomGeometry> map = new TreeMap<>();

View File

@ -55,7 +55,7 @@ class PresetParser {
}
}
private final static POILogger LOG = POILogFactory.getLogger(PresetParser.class);
private static final POILogger LOG = POILogFactory.getLogger(PresetParser.class);
private Mode mode;

View File

@ -24,6 +24,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -91,13 +92,8 @@ import org.apache.poi.util.LocaleUtil;
* native character numbers, as documented at https://help.libreoffice.org/Common/Number_Format_Codes
*/
public class CellFormat {
private final Locale locale;
private final String format;
private final CellFormatPart posNumFmt;
private final CellFormatPart zeroNumFmt;
private final CellFormatPart negNumFmt;
private final CellFormatPart textFmt;
private final int formatPartCount;
/** The logger to use in the formatting code. */
private static final Logger LOG = Logger.getLogger(CellFormat.class.getName());
private static final Pattern ONE_PART = Pattern.compile(
CellFormatPart.FORMAT_PAT.pattern() + "(;|$)",
@ -115,7 +111,15 @@ public class CellFormat {
"###################################################" +
"###################################################";
private static String QUOTE = "\"";
private static final String QUOTE = "\"";
private final Locale locale;
private final String format;
private final CellFormatPart posNumFmt;
private final CellFormatPart zeroNumFmt;
private final CellFormatPart negNumFmt;
private final CellFormatPart textFmt;
private final int formatPartCount;
private static CellFormat createGeneralFormat(final Locale locale) {
return new CellFormat(locale, "General") {
@ -187,8 +191,7 @@ public class CellFormat {
parts.add(new CellFormatPart(locale, valueDesc));
} catch (RuntimeException e) {
CellFormatter.logger.log(Level.WARNING,
"Invalid format: " + CellFormatter.quote(m.group()), e);
LOG.log(Level.WARNING, "Invalid format: " + CellFormatter.quote(m.group()), e);
parts.add(null);
}
}

View File

@ -26,10 +26,10 @@ import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.apache.poi.ss.format.CellFormatter.logger;
import static org.apache.poi.ss.format.CellFormatter.quote;
/**
@ -49,13 +49,16 @@ import static org.apache.poi.ss.format.CellFormatter.quote;
* @author Ken Arnold, Industrious Media LLC
*/
public class CellFormatPart {
private static final Logger LOG = Logger.getLogger(CellFormat.class.getName());
static final Map<String, Color> NAMED_COLORS;
private final Color color;
private CellFormatCondition condition;
private final CellFormatter format;
private final CellFormatType type;
static final Map<String, Color> NAMED_COLORS;
static {
NAMED_COLORS = new TreeMap<>(
String.CASE_INSENSITIVE_ORDER);
@ -253,8 +256,9 @@ public class CellFormatPart {
if (cdesc == null || cdesc.length() == 0)
return null;
Color c = NAMED_COLORS.get(cdesc);
if (c == null)
logger.warning("Unknown color: " + quote(cdesc));
if (c == null) {
LOG.warning("Unknown color: " + quote(cdesc));
}
return c;
}

View File

@ -23,10 +23,11 @@ import org.apache.poi.util.LocaleUtil;
/**
* This is the abstract supertype for the various cell formatters.
*
* @author Ken Arnold, Industrious Media LLC
*/
public abstract class CellFormatter {
/** The logger to use in the formatting code. */
private static final Logger LOG = Logger.getLogger(CellFormatter.class.getName());
/** The original specified format. */
protected final String format;
protected final Locale locale;
@ -51,10 +52,6 @@ public abstract class CellFormatter {
this.format = format;
}
/** The logger to use in the formatting code. */
static final Logger logger = Logger.getLogger(
CellFormatter.class.getName());
/**
* Format a value according the format string.
* <p/>

View File

@ -93,7 +93,7 @@ import org.apache.poi.util.POILogger;
*/
@Internal
public final class FormulaParser {
private final static POILogger log = POILogFactory.getLogger(FormulaParser.class);
private static final POILogger log = POILogFactory.getLogger(FormulaParser.class);
private final String _formulaString;
private final int _formulaLength;
/** points at the next character to be read (after the {@link #look} codepoint) */
@ -101,9 +101,9 @@ public final class FormulaParser {
private ParseNode _rootNode;
private final static char TAB = '\t'; // HSSF + XSSF
private final static char CR = '\r'; // Normally just XSSF
private final static char LF = '\n'; // Normally just XSSF
private static final char TAB = '\t'; // HSSF + XSSF
private static final char CR = '\r'; // Normally just XSSF
private static final char LF = '\n'; // Normally just XSSF
/**
* Lookahead unicode codepoint
@ -585,11 +585,11 @@ public final class FormulaParser {
private final static String specHeaders = "Headers";
private final static String specAll = "All";
private final static String specData = "Data";
private final static String specTotals = "Totals";
private final static String specThisRow = "This Row";
private static final String specHeaders = "Headers";
private static final String specAll = "All";
private static final String specData = "Data";
private static final String specTotals = "Totals";
private static final String specThisRow = "This Row";
/**
* Parses a structured reference, returns it as area reference.

View File

@ -26,8 +26,8 @@ import org.apache.poi.util.POILogger;
* This class is a type-safe wrapper for a 16-bit int value performing a similar job to
* <tt>ErrorEval</tt>.
*/
public class ErrorConstant {
private static final POILogger logger = POILogFactory.getLogger(ErrorConstant.class);
public final class ErrorConstant {
private static final POILogger LOG = POILogFactory.getLogger(ErrorConstant.class);
private static final ErrorConstant NULL = new ErrorConstant(FormulaError.NULL.getCode());
private static final ErrorConstant DIV_0 = new ErrorConstant(FormulaError.DIV0.getCode());
private static final ErrorConstant VALUE = new ErrorConstant(FormulaError.VALUE.getCode());
@ -66,7 +66,7 @@ public class ErrorConstant {
default: break;
}
}
logger.log( POILogger.WARN, "Warning - unexpected error code (", errorCode, ")");
LOG.log( POILogger.WARN, "Warning - unexpected error code (", errorCode, ")");
return new ErrorConstant(errorCode);
}

View File

@ -52,9 +52,9 @@ public class Dec2Bin extends Var1or2ArgFunction implements FreeRefFunction {
public static final FreeRefFunction instance = new Dec2Bin();
private final static long MIN_VALUE = -512;
private final static long MAX_VALUE = 511;
private final static int DEFAULT_PLACES_VALUE = 10;
private static final long MIN_VALUE = -512;
private static final long MAX_VALUE = 511;
private static final int DEFAULT_PLACES_VALUE = 10;
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval numberVE, ValueEval placesVE) {
ValueEval veText1;

View File

@ -56,9 +56,9 @@ public final class Dec2Hex extends Var1or2ArgFunction implements FreeRefFunction
public static final FreeRefFunction instance = new Dec2Hex();
private final static long MIN_VALUE = Long.parseLong("-549755813888");
private final static long MAX_VALUE = Long.parseLong("549755813887");
private final static int DEFAULT_PLACES_VALUE = 10;
private static final long MIN_VALUE = Long.parseLong("-549755813888");
private static final long MAX_VALUE = Long.parseLong("549755813887");
private static final int DEFAULT_PLACES_VALUE = 10;
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval number, ValueEval places) {
ValueEval veText1;

View File

@ -44,8 +44,8 @@ public final class Delta extends Fixed2ArgFunction implements FreeRefFunction {
public static final FreeRefFunction instance = new Delta();
private final static NumberEval ONE = new NumberEval(1);
private final static NumberEval ZERO = new NumberEval(0);
private static final NumberEval ONE = new NumberEval(1);
private static final NumberEval ZERO = new NumberEval(0);
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg1, ValueEval arg2) {
try {

View File

@ -391,7 +391,7 @@ public abstract class NumericFunction implements Function {
};
public static final Function POISSON = new Fixed3ArgFunction() {
private final static double DEFAULT_RETURN_RESULT =1;
private static final double DEFAULT_RETURN_RESULT =1;
/**
* This checks is x = 0 and the mean = 0.

View File

@ -21,9 +21,9 @@ package org.apache.poi.ss.formula.ptg;
* Addition operator PTG the "+" binomial operator.
*/
public final class AddPtg extends ValueOperatorPtg {
public final static byte sid = 0x03;
public static final byte sid = 0x03;
private final static String ADD = "+";
private static final String ADD = "+";
public static final AddPtg instance = new AddPtg();

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.LittleEndianOutput;
* Common superclass of 2-D area refs
*/
public abstract class Area2DPtgBase extends AreaPtgBase {
private final static int SIZE = 9;
private static final int SIZE = 9;
protected Area2DPtgBase(int firstRow, int lastRow, int firstColumn, int lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) {
super(firstRow, lastRow, firstColumn, lastColumn, firstRowRelative, lastRowRelative, firstColRelative, lastColRelative);

View File

@ -37,8 +37,8 @@ import org.apache.poi.util.LittleEndianOutput;
* The XSSF equivalent is {@link Area3DPxg}
*/
public final class Area3DPtg extends AreaPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final static byte sid = 0x3b;
private final static int SIZE = 11; // 10 + 1 for Ptg
public static final byte sid = 0x3b;
private static final int SIZE = 11; // 10 + 1 for Ptg
private int field_1_index_extern_sheet;

View File

@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput;
* AreaErr - handles deleted cell area references.
*/
public final class AreaErrPtg extends OperandPtg {
public final static byte sid = 0x2B;
public static final byte sid = 0x2B;
private final int unused1;
private final int unused2;

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianInput;
* @author Jason Height (jheight at chariot dot net dot au)
*/
public final class AreaNPtg extends Area2DPtgBase {
public final static short sid = 0x2D;
public static final short sid = 0x2D;
public AreaNPtg(AreaNPtg other) {
super(other);

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianInput;
* Specifies a rectangular area of cells A1:A4 for instance.
*/
public final class AreaPtg extends Area2DPtgBase {
public final static short sid = 0x25;
public static final short sid = 0x25;
public AreaPtg(int firstRow, int lastRow, int firstColumn, int lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative) {
super(firstRow, lastRow, firstColumn, lastColumn, firstRowRelative, lastRowRelative, firstColRelative, lastColRelative);

View File

@ -34,9 +34,9 @@ import org.apache.poi.util.LittleEndianOutput;
*/
public abstract class AreaPtgBase extends OperandPtg implements AreaI {
private final static BitField rowRelative = BitFieldFactory.getInstance(0x8000);
private final static BitField colRelative = BitFieldFactory.getInstance(0x4000);
private final static BitField columnMask = BitFieldFactory.getInstance(0x3FFF);
private static final BitField rowRelative = BitFieldFactory.getInstance(0x8000);
private static final BitField colRelative = BitFieldFactory.getInstance(0x4000);
private static final BitField columnMask = BitFieldFactory.getInstance(0x3FFF);
/** zero based, unsigned 16 bit */
private int field_1_first_row;

View File

@ -36,8 +36,8 @@ import org.apache.poi.util.LittleEndianOutput;
* in SUM functions (i.e. SUM(A1:A3) causes an area PTG then an ATTR with the SUM option set)
*/
public final class AttrPtg extends ControlPtg {
public final static byte sid = 0x19;
private final static int SIZE = 4;
public static final byte sid = 0x19;
private static final int SIZE = 4;
// flags 'volatile' and 'space', can be combined.
// OOO spec says other combinations are theoretically possible but not likely to occur.

View File

@ -18,9 +18,9 @@
package org.apache.poi.ss.formula.ptg;
public final class ConcatPtg extends ValueOperatorPtg {
public final static byte sid = 0x08;
public static final byte sid = 0x08;
private final static String CONCAT = "&";
private static final String CONCAT = "&";
public static final ConcatPtg instance = new ConcatPtg();

View File

@ -34,7 +34,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @version 1.0-pre
*/
public final class DeletedArea3DPtg extends OperandPtg implements WorkbookDependentFormula {
public final static byte sid = 0x3d;
public static final byte sid = 0x3d;
private final int field_1_index_extern_sheet;
private final int unused1;
private final int unused2;

View File

@ -35,7 +35,7 @@ import org.apache.poi.util.LittleEndianOutput;
* @since 1.0-pre
*/
public final class DeletedRef3DPtg extends OperandPtg implements WorkbookDependentFormula {
public final static byte sid = 0x3c;
public static final byte sid = 0x3c;
private final int field_1_index_extern_sheet;
private final int unused1;

View File

@ -21,7 +21,7 @@ package org.apache.poi.ss.formula.ptg;
* This PTG implements the standard binomial divide "/"
*/
public final class DividePtg extends ValueOperatorPtg {
public final static byte sid = 0x06;
public static final byte sid = 0x06;
public static final DividePtg instance = new DividePtg();

View File

@ -22,7 +22,7 @@ package org.apache.poi.ss.formula.ptg;
* @author andy
*/
public final class EqualPtg extends ValueOperatorPtg {
public final static byte sid = 0x0b;
public static final byte sid = 0x0b;
public static final EqualPtg instance = new EqualPtg();

View File

@ -25,8 +25,8 @@ import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianOutput;
public final class ExpPtg extends ControlPtg {
private final static int SIZE = 5;
public final static short sid = 0x1;
private static final int SIZE = 5;
public static final short sid = 0x1;
private final int field_1_first_row;
private final int field_2_first_col;

View File

@ -24,8 +24,8 @@ import org.apache.poi.util.LittleEndianOutput;
public final class FuncPtg extends AbstractFunctionPtg {
public final static byte sid = 0x21;
public final static int SIZE = 3;
public static final byte sid = 0x21;
public static final int SIZE = 3;
public static FuncPtg create(LittleEndianInput in) {
return create(in.readUShort());

View File

@ -28,8 +28,8 @@ import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianOutput;
public final class FuncVarPtg extends AbstractFunctionPtg {
public final static byte sid = 0x22;
private final static int SIZE = 4;
public static final byte sid = 0x22;
private static final int SIZE = 4;
// See spec at 2.5.198.63 PtgFuncVar
private static final BitField ceFunc = BitFieldFactory.getInstance(0xF000);

View File

@ -22,8 +22,8 @@ package org.apache.poi.ss.formula.ptg;
* PTG class to implement greater or equal to
*/
public final class GreaterEqualPtg extends ValueOperatorPtg {
public final static int SIZE = 1;
public final static byte sid = 0x0c;
public static final int SIZE = 1;
public static final byte sid = 0x0c;
public static final GreaterEqualPtg instance = new GreaterEqualPtg();

View File

@ -22,8 +22,8 @@ package org.apache.poi.ss.formula.ptg;
* Greater than operator PTG ">"
*/
public final class GreaterThanPtg extends ValueOperatorPtg {
public final static byte sid = 0x0D;
private final static String GREATERTHAN = ">";
public static final byte sid = 0x0D;
private static final String GREATERTHAN = ">";
public static final GreaterThanPtg instance = new GreaterThanPtg();

View File

@ -42,8 +42,8 @@ public final class IntPtg extends ScalarConstantPtg {
return i >= MIN_VALUE && i <= MAX_VALUE;
}
public final static int SIZE = 3;
public final static byte sid = 0x1e;
public static final int SIZE = 3;
public static final byte sid = 0x1e;
private final int field_1_value;
public IntPtg(LittleEndianInput in) {

View File

@ -20,7 +20,7 @@ package org.apache.poi.ss.formula.ptg;
import org.apache.poi.util.LittleEndianOutput;
public final class IntersectionPtg extends OperationPtg {
public final static byte sid = 0x0f;
public static final byte sid = 0x0f;
public static final IntersectionPtg instance = new IntersectionPtg();

View File

@ -25,7 +25,7 @@ package org.apache.poi.ss.formula.ptg;
* Ptg class to implement less than or equal
*/
public final class LessEqualPtg extends ValueOperatorPtg {
public final static byte sid = 0x0a;
public static final byte sid = 0x0a;
public static final LessEqualPtg instance = new LessEqualPtg();

View File

@ -24,10 +24,10 @@ package org.apache.poi.ss.formula.ptg;
*/
public final class LessThanPtg extends ValueOperatorPtg {
/** the sid for the less than operator as hex */
public final static byte sid = 0x09;
public static final byte sid = 0x09;
/** identifier for LESS THAN char */
private final static String LESSTHAN = "<";
private static final String LESSTHAN = "<";
public static final LessThanPtg instance = new LessThanPtg();

View File

@ -25,8 +25,8 @@ import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianOutput;
public final class MemAreaPtg extends OperandPtg {
public final static short sid = 0x26;
private final static int SIZE = 7;
public static final short sid = 0x26;
private static final int SIZE = 7;
private final int field_1_reserved;
private final int field_2_subex_len;

View File

@ -25,8 +25,8 @@ import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianOutput;
public final class MemErrPtg extends OperandPtg {
public final static short sid = 0x27;
private final static int SIZE = 7;
public static final short sid = 0x27;
private static final int SIZE = 7;
private int field_1_reserved;
private short field_2_subex_len;

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
public final class MemFuncPtg extends OperandPtg {
public final static byte sid = 0x29;
public static final byte sid = 0x29;
private final int field_1_len_ref_subexpression;
/**

View File

@ -27,8 +27,8 @@ import org.apache.poi.util.LittleEndianOutput;
*/
public final class MissingArgPtg extends ScalarConstantPtg {
private final static int SIZE = 1;
public final static byte sid = 0x16;
private static final int SIZE = 1;
public static final byte sid = 0x16;
public static final Ptg instance = new MissingArgPtg();

View File

@ -21,7 +21,7 @@ package org.apache.poi.ss.formula.ptg;
* Implements the standard mathematical multiplication "*"
*/
public final class MultiplyPtg extends ValueOperatorPtg {
public final static byte sid = 0x05;
public static final byte sid = 0x05;
public static final MultiplyPtg instance = new MultiplyPtg();

View File

@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndianOutput;
* See the spec at 2.5.198.76 PtgName
*/
public final class NamePtg extends OperandPtg implements WorkbookDependentFormula {
public final static short sid = 0x23;
private final static int SIZE = 5;
public static final short sid = 0x23;
private static final int SIZE = 5;
/** one-based index to defined name record */
private int field_1_label_index;

View File

@ -35,8 +35,8 @@ import org.apache.poi.util.LittleEndianOutput;
* is {@link NameXPxg}
*/
public final class NameXPtg extends OperandPtg implements WorkbookDependentFormula {
public final static short sid = 0x39;
private final static int SIZE = 7;
public static final short sid = 0x39;
private static final int SIZE = 7;
/** index to REF entry in externsheet record */
private final int _sheetRefIndex;

View File

@ -21,7 +21,7 @@ package org.apache.poi.ss.formula.ptg;
* Ptg class to implement not equal
*/
public final class NotEqualPtg extends ValueOperatorPtg {
public final static byte sid = 0x0e;
public static final byte sid = 0x0e;
public static final NotEqualPtg instance = new NotEqualPtg();

View File

@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndianOutput;
* field using IEEE notation
*/
public final class NumberPtg extends ScalarConstantPtg {
public final static int SIZE = 9;
public final static byte sid = 0x1f;
public static final int SIZE = 9;
public static final byte sid = 0x1f;
private final double field_1_value;
public NumberPtg(LittleEndianInput in) {

View File

@ -25,9 +25,9 @@ import java.util.function.Supplier;
* @author andy
*/
public abstract class OperationPtg extends Ptg {
public final static int TYPE_UNARY = 0;
public final static int TYPE_BINARY = 1;
public final static int TYPE_FUNCTION = 2;
public static final int TYPE_UNARY = 0;
public static final int TYPE_BINARY = 1;
public static final int TYPE_FUNCTION = 2;
protected OperationPtg() {}

View File

@ -29,8 +29,8 @@ import org.apache.poi.util.LittleEndianOutput;
*/
public final class ParenthesisPtg extends ControlPtg {
private final static int SIZE = 1;
public final static byte sid = 0x15;
private static final int SIZE = 1;
public static final byte sid = 0x15;
public static final ParenthesisPtg instance = new ParenthesisPtg();

View File

@ -21,10 +21,10 @@ package org.apache.poi.ss.formula.ptg;
* Percent PTG.
*/
public final class PercentPtg extends ValueOperatorPtg {
public final static int SIZE = 1;
public final static byte sid = 0x14;
public static final int SIZE = 1;
public static final byte sid = 0x14;
private final static String PERCENT = "%";
private static final String PERCENT = "%";
public static final PercentPtg instance = new PercentPtg();

View File

@ -18,7 +18,7 @@
package org.apache.poi.ss.formula.ptg;
public final class PowerPtg extends ValueOperatorPtg {
public final static byte sid = 0x07;
public static final byte sid = 0x07;
public static final PowerPtg instance = new PowerPtg();

View File

@ -21,8 +21,8 @@ import org.apache.poi.util.LittleEndianOutput;
public final class RangePtg extends OperationPtg {
public final static int SIZE = 1;
public final static byte sid = 0x11;
public static final int SIZE = 1;
public static final byte sid = 0x11;
public static final RangePtg instance = new RangePtg();

View File

@ -22,7 +22,7 @@ import org.apache.poi.util.LittleEndianInput;
import org.apache.poi.util.LittleEndianOutput;
abstract class Ref2DPtgBase extends RefPtgBase {
private final static int SIZE = 5;
private static final int SIZE = 5;
protected Ref2DPtgBase(int row, int column, boolean isRowRelative, boolean isColumnRelative) {
setRow(row);

View File

@ -37,9 +37,9 @@ import org.apache.poi.util.LittleEndianOutput;
* is {@link Ref3DPxg}
*/
public final class Ref3DPtg extends RefPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final static byte sid = 0x3a;
public static final byte sid = 0x3a;
private final static int SIZE = 7; // 6 + 1 for Ptg
private static final int SIZE = 7; // 6 + 1 for Ptg
private int field_1_index_extern_sheet;
public Ref3DPtg(Ref3DPtg other) {

View File

@ -30,8 +30,8 @@ import org.apache.poi.util.LittleEndianOutput;
*/
public final class RefErrorPtg extends OperandPtg {
private final static int SIZE = 5;
public final static byte sid = 0x2A;
private static final int SIZE = 5;
public static final byte sid = 0x2A;
private int field_1_reserved;
public RefErrorPtg() {

View File

@ -21,7 +21,7 @@ import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.LittleEndianInput;
public final class RefNPtg extends Ref2DPtgBase {
public final static byte sid = 0x2C;
public static final byte sid = 0x2C;
public RefNPtg(LittleEndianInput in) {
super(in);

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianInput;
* ReferencePtg - handles references (such as A1, A2, IA4)
*/
public final class RefPtg extends Ref2DPtgBase {
public final static byte sid = 0x24;
public static final byte sid = 0x24;
/**
* Takes in a String representation of a cell reference and fills out the

View File

@ -30,7 +30,7 @@ import org.apache.poi.util.StringUtil;
* &lt;length 2 bytes&gt;char[]
*/
public final class StringPtg extends ScalarConstantPtg {
public final static byte sid = 0x17;
public static final byte sid = 0x17;
/** the character (") used in formulas to delimit string literals */
private static final char FORMULA_DELIMITER = '"';

View File

@ -18,7 +18,7 @@
package org.apache.poi.ss.formula.ptg;
public final class SubtractPtg extends ValueOperatorPtg {
public final static byte sid = 0x04;
public static final byte sid = 0x04;
public static final SubtractPtg instance = new SubtractPtg();

View File

@ -39,8 +39,8 @@ import org.apache.poi.util.LittleEndianOutput;
* See page 811 of the june 08 binary docs.
*/
public final class TblPtg extends ControlPtg {
private final static int SIZE = 5;
public final static short sid = 0x02;
private static final int SIZE = 5;
public static final short sid = 0x02;
/** The row number of the upper left corner */
private final int field_1_first_row;

View File

@ -21,9 +21,9 @@ package org.apache.poi.ss.formula.ptg;
* Unary Plus operator - does not have any effect on the operand
*/
public final class UnaryMinusPtg extends ValueOperatorPtg {
public final static byte sid = 0x13;
public static final byte sid = 0x13;
private final static String MINUS = "-";
private static final String MINUS = "-";
public static final UnaryMinusPtg instance = new UnaryMinusPtg();

View File

@ -21,9 +21,9 @@ package org.apache.poi.ss.formula.ptg;
* Unary Plus operator - does not have any effect on the operand
*/
public final class UnaryPlusPtg extends ValueOperatorPtg {
public final static byte sid = 0x12;
public static final byte sid = 0x12;
private final static String ADD = "+";
private static final String ADD = "+";
public static final UnaryPlusPtg instance = new UnaryPlusPtg();

Some files were not shown because too many files have changed in this diff Show More