diff options
author | Dominik Stadler <centic@apache.org> | 2016-09-21 05:45:57 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2016-09-21 05:45:57 +0000 |
commit | e6a2d46800706ee5230a6cb85574d6add22ab0af (patch) | |
tree | 8e6a0b8fdde17a29ba2cbb0610c5be7e0b6608f0 /src | |
parent | 55897d88158d09d847618a2db0b3c753c5b38d55 (diff) | |
download | poi-e6a2d46800706ee5230a6cb85574d6add22ab0af.tar.gz poi-e6a2d46800706ee5230a6cb85574d6add22ab0af.zip |
Compiler/IDE warnings, unnecessary keywords,
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
14 files changed, 111 insertions, 92 deletions
diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java index df3d572598..1eab8dec19 100644 --- a/src/java/org/apache/poi/ss/usermodel/CellStyle.java +++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java @@ -26,308 +26,308 @@ public interface CellStyle { * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#GENERAL} instead. */ @Removal(version="3.17") - static final short ALIGN_GENERAL = 0x0; //HorizontalAlignment.GENERAL.getCode(); + short ALIGN_GENERAL = 0x0; //HorizontalAlignment.GENERAL.getCode(); /** * left-justified horizontal alignment * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#LEFT} instead. */ @Removal(version="3.17") - static final short ALIGN_LEFT = 0x1; //HorizontalAlignment.LEFT.getCode(); + short ALIGN_LEFT = 0x1; //HorizontalAlignment.LEFT.getCode(); /** * center horizontal alignment * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#CENTER} instead. */ @Removal(version="3.17") - static final short ALIGN_CENTER = 0x2; //HorizontalAlignment.CENTER.getCode(); + short ALIGN_CENTER = 0x2; //HorizontalAlignment.CENTER.getCode(); /** * right-justified horizontal alignment * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#RIGHT} instead. */ @Removal(version="3.17") - static final short ALIGN_RIGHT = 0x3; //HorizontalAlignment.RIGHT.getCode(); + short ALIGN_RIGHT = 0x3; //HorizontalAlignment.RIGHT.getCode(); /** * fill? horizontal alignment * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#FILL} instead. */ @Removal(version="3.17") - static final short ALIGN_FILL = 0x4; //HorizontalAlignment.FILL.getCode(); + short ALIGN_FILL = 0x4; //HorizontalAlignment.FILL.getCode(); /** * justified horizontal alignment * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#JUSTIFY} instead. */ @Removal(version="3.17") - static final short ALIGN_JUSTIFY = 0x5; //HorizontalAlignment.JUSTIFY.getCode(); + short ALIGN_JUSTIFY = 0x5; //HorizontalAlignment.JUSTIFY.getCode(); /** * center-selection? horizontal alignment * @deprecated POI 3.15 beta 3. Use {@link HorizontalAlignment#CENTER_SELECTION} instead. */ @Removal(version="3.17") - static final short ALIGN_CENTER_SELECTION = 0x6; //HorizontalAlignment.CENTER_SELECTION.getCode(); + short ALIGN_CENTER_SELECTION = 0x6; //HorizontalAlignment.CENTER_SELECTION.getCode(); /** * top-aligned vertical alignment * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#TOP} instead. */ @Removal(version="3.17") - static final short VERTICAL_TOP = 0x0; //VerticalAlignment.TOP.getCode(); + short VERTICAL_TOP = 0x0; //VerticalAlignment.TOP.getCode(); /** * center-aligned vertical alignment * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#CENTER} instead. */ @Removal(version="3.17") - static final short VERTICAL_CENTER = 0x1; //VerticalAlignment.CENTER.getCode(); + short VERTICAL_CENTER = 0x1; //VerticalAlignment.CENTER.getCode(); /** * bottom-aligned vertical alignment * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#BOTTOM} instead. */ @Removal(version="3.17") - static final short VERTICAL_BOTTOM = 0x2; //VerticalAlignment.BOTTOM.getCode(); + short VERTICAL_BOTTOM = 0x2; //VerticalAlignment.BOTTOM.getCode(); /** * vertically justified vertical alignment * @deprecated POI 3.15 beta 3. Use {@link VerticalAlignment#JUSTIFY} instead. */ @Removal(version="3.17") - static final short VERTICAL_JUSTIFY = 0x3; //VerticalAlignment.JUSTIFY.getCode(); + short VERTICAL_JUSTIFY = 0x3; //VerticalAlignment.JUSTIFY.getCode(); /** * No border * @deprecated 3.15 beta 2. Use {@link BorderStyle#NONE} instead. */ @Removal(version="3.17") - static final short BORDER_NONE = 0x0; //BorderStyle.NONE.getCode(); + short BORDER_NONE = 0x0; //BorderStyle.NONE.getCode(); /** * Thin border * @deprecated 3.15 beta 2. Use {@link BorderStyle#THIN} instead. */ @Removal(version="3.17") - static final short BORDER_THIN = 0x1; //BorderStyle.THIN.getCode(); + short BORDER_THIN = 0x1; //BorderStyle.THIN.getCode(); /** * Medium border * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM} instead. */ @Removal(version="3.17") - static final short BORDER_MEDIUM = 0x2; //BorderStyle.MEDIUM.getCode(); + short BORDER_MEDIUM = 0x2; //BorderStyle.MEDIUM.getCode(); /** * dash border * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASHED} instead. */ @Removal(version="3.17") - static final short BORDER_DASHED = 0x3; //BorderStyle.DASHED.getCode(); + short BORDER_DASHED = 0x3; //BorderStyle.DASHED.getCode(); /** * dot border * @deprecated 3.15 beta 2. Use {@link BorderStyle#DOTTED} instead. */ @Removal(version="3.17") - static final short BORDER_DOTTED = 0x4; //BorderStyle.DOTTED.getCode(); + short BORDER_DOTTED = 0x4; //BorderStyle.DOTTED.getCode(); /** * Thick border * @deprecated 3.15 beta 2. Use {@link BorderStyle#THICK} instead. */ @Removal(version="3.17") - static final short BORDER_THICK = 0x5; //BorderStyle.THICK.getCode(); + short BORDER_THICK = 0x5; //BorderStyle.THICK.getCode(); /** * double-line border * @deprecated 3.15 beta 2. Use {@link BorderStyle#DOUBLE} instead. */ @Removal(version="3.17") - static final short BORDER_DOUBLE = 0x6; //BorderStyle.DOUBLE.getCode(); + short BORDER_DOUBLE = 0x6; //BorderStyle.DOUBLE.getCode(); /** * hair-line border * @deprecated 3.15 beta 2. Use {@link BorderStyle#HAIR} instead. */ @Removal(version="3.17") - static final short BORDER_HAIR = 0x7; //BorderStyle.HAIR.getCode(); + short BORDER_HAIR = 0x7; //BorderStyle.HAIR.getCode(); /** * Medium dashed border * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASHED} instead. */ @Removal(version="3.17") - static final short BORDER_MEDIUM_DASHED = 0x8; //BorderStyle.MEDIUM_DASHED.getCode(); + short BORDER_MEDIUM_DASHED = 0x8; //BorderStyle.MEDIUM_DASHED.getCode(); /** * dash-dot border * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT} instead. */ @Removal(version="3.17") - static final short BORDER_DASH_DOT = 0x9; //BorderStyle.DASH_DOT.getCode(); + short BORDER_DASH_DOT = 0x9; //BorderStyle.DASH_DOT.getCode(); /** * medium dash-dot border * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT} instead. */ @Removal(version="3.17") - static final short BORDER_MEDIUM_DASH_DOT = 0xA; //BorderStyle.MEDIUM_DASH_DOT.getCode(); + short BORDER_MEDIUM_DASH_DOT = 0xA; //BorderStyle.MEDIUM_DASH_DOT.getCode(); /** * dash-dot-dot border * @deprecated 3.15 beta 2. Use {@link BorderStyle#DASH_DOT_DOT} instead. */ @Removal(version="3.17") - static final short BORDER_DASH_DOT_DOT = 0xB; //BorderStyle.DASH_DOT_DOT.getCode(); + short BORDER_DASH_DOT_DOT = 0xB; //BorderStyle.DASH_DOT_DOT.getCode(); /** * medium dash-dot-dot border * @deprecated 3.15 beta 2. Use {@link BorderStyle#MEDIUM_DASH_DOT_DOT} instead. */ @Removal(version="3.17") - static final short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; //BorderStyle.MEDIUM_DASH_DOT_DOT.getCode(); + short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; //BorderStyle.MEDIUM_DASH_DOT_DOT.getCode(); /** * slanted dash-dot border * @deprecated 3.15 beta 2. Use {@link BorderStyle#SLANTED_DASH_DOT} instead. */ @Removal(version="3.17") - static final short BORDER_SLANTED_DASH_DOT = 0xD; //BorderStyle.SLANTED_DASH_DOT.getCode(); + short BORDER_SLANTED_DASH_DOT = 0xD; //BorderStyle.SLANTED_DASH_DOT.getCode(); /** * Fill Pattern: No background * @deprecated 3.15 beta 3. Use {@link FillPatternType#NO_FILL} instead. */ @Removal(version="3.17") - static final short NO_FILL = 0; //FillPatternType.NO_FILL.getCode(); + short NO_FILL = 0; //FillPatternType.NO_FILL.getCode(); /** * Fill Pattern: Solidly filled * @deprecated 3.15 beta 3. Use {@link FillPatternType#SOLID_FOREGROUND} instead. */ @Removal(version="3.17") - static final short SOLID_FOREGROUND = 1; //FillPatternType.SOLID_FOREGROUND.getCode(); + short SOLID_FOREGROUND = 1; //FillPatternType.SOLID_FOREGROUND.getCode(); /** * Fill Pattern: Small fine dots * @deprecated 3.15 beta 3. Use {@link FillPatternType#FINE_DOTS} instead. */ @Removal(version="3.17") - static final short FINE_DOTS = 2; //FillPatternType.FINE_DOTS.getCode(); + short FINE_DOTS = 2; //FillPatternType.FINE_DOTS.getCode(); /** * Fill Pattern: Wide dots * @deprecated 3.15 beta 3. Use {@link FillPatternType#ALT_BARS} instead. */ @Removal(version="3.17") - static final short ALT_BARS = 3; //FillPatternType.ALT_BARS.getCode(); + short ALT_BARS = 3; //FillPatternType.ALT_BARS.getCode(); /** * Fill Pattern: Sparse dots * @deprecated 3.15 beta 3. Use {@link FillPatternType#SPARSE_DOTS} instead. */ @Removal(version="3.17") - static final short SPARSE_DOTS = 4; //FillPatternType.SPARSE_DOTS.getCode(); + short SPARSE_DOTS = 4; //FillPatternType.SPARSE_DOTS.getCode(); /** * Fill Pattern: Thick horizontal bands * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_HORZ_BANDS} instead. */ @Removal(version="3.17") - static final short THICK_HORZ_BANDS = 5; //FillPatternType.THICK_HORZ_BANDS.getCode(); + short THICK_HORZ_BANDS = 5; //FillPatternType.THICK_HORZ_BANDS.getCode(); /** * Fill Pattern: Thick vertical bands * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_VERT_BANDS} instead. */ @Removal(version="3.17") - static final short THICK_VERT_BANDS = 6; //FillPatternType.THICK_VERT_BANDS.getCode(); + short THICK_VERT_BANDS = 6; //FillPatternType.THICK_VERT_BANDS.getCode(); /** * Fill Pattern: Thick backward facing diagonals * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_BACKWARD_DIAG} instead. */ @Removal(version="3.17") - static final short THICK_BACKWARD_DIAG = 7; //FillPatternType.THICK_BACKWARD_DIAG.getCode(); + short THICK_BACKWARD_DIAG = 7; //FillPatternType.THICK_BACKWARD_DIAG.getCode(); /** * Fill Pattern: Thick forward facing diagonals * @deprecated 3.15 beta 3. Use {@link FillPatternType#THICK_FORWARD_DIAG} instead. */ @Removal(version="3.17") - static final short THICK_FORWARD_DIAG = 8; //FillPatternType.THICK_FORWARD_DIAG.getCode(); + short THICK_FORWARD_DIAG = 8; //FillPatternType.THICK_FORWARD_DIAG.getCode(); /** * Fill Pattern: Large spots * @deprecated 3.15 beta 3. Use {@link FillPatternType#BIG_SPOTS} instead. */ @Removal(version="3.17") - static final short BIG_SPOTS = 9; //FillPatternType.BIG_SPOTS.getCode(); + short BIG_SPOTS = 9; //FillPatternType.BIG_SPOTS.getCode(); /** * Fill Pattern: Brick-like layout * @deprecated 3.15 beta 3. Use {@link FillPatternType#BRICKS} instead. */ @Removal(version="3.17") - static final short BRICKS = 10; //FillPatternType.BRICKS.getCode(); + short BRICKS = 10; //FillPatternType.BRICKS.getCode(); /** * Fill Pattern: Thin horizontal bands * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_HORZ_BANDS} instead. */ @Removal(version="3.17") - static final short THIN_HORZ_BANDS = 11; //FillPatternType.THIN_HORZ_BANDS.getCode(); + short THIN_HORZ_BANDS = 11; //FillPatternType.THIN_HORZ_BANDS.getCode(); /** * Fill Pattern: Thin vertical bands * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_VERT_BANDS} instead. */ @Removal(version="3.17") - static final short THIN_VERT_BANDS = 12; //FillPatternType.THIN_VERT_BANDS.getCode(); + short THIN_VERT_BANDS = 12; //FillPatternType.THIN_VERT_BANDS.getCode(); /** * Fill Pattern: Thin backward diagonal * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_BACKWARD_DIAG} instead. */ @Removal(version="3.17") - static final short THIN_BACKWARD_DIAG = 13; //FillPatternType.THIN_BACKWARD_DIAG.getCode(); + short THIN_BACKWARD_DIAG = 13; //FillPatternType.THIN_BACKWARD_DIAG.getCode(); /** * Fill Pattern: Thin forward diagonal * @deprecated 3.15 beta 3. Use {@link FillPatternType#THIN_FORWARD_DIAG} instead. */ @Removal(version="3.17") - static final short THIN_FORWARD_DIAG = 14; //FillPatternType.THIN_FORWARD_DIAG.getCode(); + short THIN_FORWARD_DIAG = 14; //FillPatternType.THIN_FORWARD_DIAG.getCode(); /** * Fill Pattern: Squares * @deprecated 3.15 beta 3. Use {@link FillPatternType#SQUARES} instead. */ @Removal(version="3.17") - static final short SQUARES = 15; //FillPatternType.SQUARES.getCode(); + short SQUARES = 15; //FillPatternType.SQUARES.getCode(); /** * Fill Pattern: Diamonds * @deprecated 3.15 beta 3. Use {@link FillPatternType#DIAMONDS} instead. */ @Removal(version="3.17") - static final short DIAMONDS = 16; //FillPatternType.DIAMONDS.getCode(); + short DIAMONDS = 16; //FillPatternType.DIAMONDS.getCode(); /** * Fill Pattern: Less Dots * @deprecated 3.15 beta 3. Use {@link FillPatternType#LESS_DOTS} instead. */ @Removal(version="3.17") - static final short LESS_DOTS = 17; //FillPatternType.LESS_DOTS.getCode(); + short LESS_DOTS = 17; //FillPatternType.LESS_DOTS.getCode(); /** * Fill Pattern: Least Dots * @deprecated 3.15 beta 3. Use {@link FillPatternType#LEAST_DOTS} instead. */ @Removal(version="3.17") - static final short LEAST_DOTS = 18; //FillPatternType.LEAST_DOTS.getCode(); + short LEAST_DOTS = 18; //FillPatternType.LEAST_DOTS.getCode(); /** * get the index within the Workbook (sequence within the collection of ExtnededFormat objects) @@ -353,7 +353,7 @@ public interface CellStyle { /** * Get the format string */ - public String getDataFormatString(); + String getDataFormatString(); /** * set the font for this style @@ -870,17 +870,17 @@ public interface CellStyle { * to be of the same type (HSSFCellStyle or * XSSFCellStyle) */ - public void cloneStyleFrom(CellStyle source); + void cloneStyleFrom(CellStyle source); /** * Controls if the Cell should be auto-sized * to shrink to fit if the text is too long */ - public void setShrinkToFit(boolean shrinkToFit); + void setShrinkToFit(boolean shrinkToFit); /** * Should the Cell be auto-sized by Excel to shrink * it to fit if this text is too long? */ - public boolean getShrinkToFit(); + boolean getShrinkToFit(); } diff --git a/src/java/org/apache/poi/ss/usermodel/CellValue.java b/src/java/org/apache/poi/ss/usermodel/CellValue.java index 301accfca8..b10210882a 100644 --- a/src/java/org/apache/poi/ss/usermodel/CellValue.java +++ b/src/java/org/apache/poi/ss/usermodel/CellValue.java @@ -18,6 +18,8 @@ package org.apache.poi.ss.usermodel; import org.apache.poi.ss.formula.eval.ErrorEval; +import org.apache.poi.util.Internal; +import org.apache.poi.util.Removal; /** * Mimics the 'data view' of a cell. This allows formula evaluator @@ -47,12 +49,15 @@ public final class CellValue { public CellValue(double numberValue) { this(CellType.NUMERIC, numberValue, false, null, 0); } + public static CellValue valueOf(boolean booleanValue) { return booleanValue ? TRUE : FALSE; } + public CellValue(String stringValue) { this(CellType.STRING, 0.0, false, stringValue, 0); } + public static CellValue getError(int errorCode) { return new CellValue(CellType.ERROR, 0.0, false, null, errorCode); } @@ -64,30 +69,44 @@ public final class CellValue { public boolean getBooleanValue() { return _booleanValue; } + /** * @return Returns the numberValue. */ public double getNumberValue() { return _numberValue; } + /** * @return Returns the stringValue. */ public String getStringValue() { return _textValue; } + + /** + * Return the cell type. + * + * @return the cell type + * @since POI 3.15 + * @deprecated POI 3.15 + * Will be renamed to <code>getCellTypeEnum()</code> when we make the CellType enum transition in POI 4.0. See bug 59791. + */ + @Internal(since="POI 3.15 beta 3") + @Removal(version="4.2") + public CellType getCellTypeEnum() { + return _cellType; + } + /** - * @return Returns the cellType. - * @since POI 3.15 - */ - public CellType getCellTypeEnum() { - return _cellType; - } - /** - * @return Returns the cellType. + * Return the cell type. + * + * Will return {@link CellType} in version 4.0 of POI. + * For forwards compatibility, do not hard-code cell type literals in your code. + * + * @return the cell type + * * @deprecated POI 3.15. Use {@link #getCellTypeEnum()} instead. - * In the future, the signature of this method will be changed to return a - * {@link CellType}. */ @Deprecated public int getCellType() { @@ -100,6 +119,7 @@ public final class CellValue { public byte getErrorValue() { return (byte) _errorCode; } + public String toString() { StringBuffer sb = new StringBuffer(64); sb.append(getClass().getName()).append(" ["); diff --git a/src/java/org/apache/poi/ss/usermodel/Workbook.java b/src/java/org/apache/poi/ss/usermodel/Workbook.java index e52615fb1a..85c7ca7248 100644 --- a/src/java/org/apache/poi/ss/usermodel/Workbook.java +++ b/src/java/org/apache/poi/ss/usermodel/Workbook.java @@ -35,22 +35,22 @@ import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; public interface Workbook extends Closeable, Iterable<Sheet> { /** Extended windows meta file */ - public static final int PICTURE_TYPE_EMF = 2; + int PICTURE_TYPE_EMF = 2; /** Windows Meta File */ - public static final int PICTURE_TYPE_WMF = 3; + int PICTURE_TYPE_WMF = 3; /** Mac PICT format */ - public static final int PICTURE_TYPE_PICT = 4; + int PICTURE_TYPE_PICT = 4; /** JPEG format */ - public static final int PICTURE_TYPE_JPEG = 5; + int PICTURE_TYPE_JPEG = 5; /** PNG format */ - public static final int PICTURE_TYPE_PNG = 6; + int PICTURE_TYPE_PNG = 6; /** Device independent bitmap */ - public static final int PICTURE_TYPE_DIB = 7; + int PICTURE_TYPE_DIB = 7; /** @@ -58,14 +58,14 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * * @see #setSheetHidden(int, int) */ - public static final int SHEET_STATE_VISIBLE = 0; + int SHEET_STATE_VISIBLE = 0; /** * Indicates the book window is hidden, but can be shown by the user via the user interface. * * @see #setSheetHidden(int, int) */ - public static final int SHEET_STATE_HIDDEN = 1; + int SHEET_STATE_HIDDEN = 1; /** * Indicates the sheet is hidden and cannot be shown in the user interface (UI). @@ -77,7 +77,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * * @see #setSheetHidden(int, int) */ - public static final int SHEET_STATE_VERY_HIDDEN = 2; + int SHEET_STATE_VERY_HIDDEN = 2; /** * Convenience method to get the active sheet. The active sheet is is the sheet @@ -169,7 +169,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { int getSheetIndex(Sheet sheet); /** - * Sreate an Sheet for this Workbook, adds it to the sheets and returns + * Create a Sheet for this Workbook, adds it to the sheets and returns * the high level representation. Use this to create new sheets. * * @return Sheet representing the new sheet. @@ -217,7 +217,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)} * for a safe way to create valid names * </p> - * @param sheetname sheetname to set for the sheet. + * @param sheetname The name to set for the sheet. * @return Sheet representing the new sheet. * @throws IllegalArgumentException if the name is null or invalid * or workbook already contains a sheet with this name @@ -617,7 +617,7 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * workbook values when the workbook is opened * @since 3.8 */ - public void setForceFormulaRecalculation(boolean value); + void setForceFormulaRecalculation(boolean value); /** * Whether Excel will be asked to recalculate all formulas when the workbook is opened. @@ -632,6 +632,5 @@ public interface Workbook extends Closeable, Iterable<Sheet> { * @return SpreadsheetVersion enum * @since 3.14 beta 2 */ - public SpreadsheetVersion getSpreadsheetVersion(); - + SpreadsheetVersion getSpreadsheetVersion(); } diff --git a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java index a67e83e246..cdd35b3594 100644 --- a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java @@ -33,7 +33,6 @@ import org.apache.poi.hsmf.datatypes.AttachmentChunks; import org.apache.poi.hsmf.extractor.OutlookTextExtactor; import org.apache.poi.hssf.extractor.ExcelExtractor; import org.apache.poi.hwpf.extractor.WordExtractor; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackageAccess; @@ -123,7 +122,7 @@ public class ExtractorFactory { return OLE2ExtractorFactory.getPreferEventExtractor(); } - public static POITextExtractor createExtractor(File f) throws IOException, InvalidFormatException, OpenXML4JException, XmlException { + public static POITextExtractor createExtractor(File f) throws IOException, OpenXML4JException, XmlException { NPOIFSFileSystem fs = null; try { fs = new NPOIFSFileSystem(f); @@ -163,7 +162,7 @@ public class ExtractorFactory { } } - public static POITextExtractor createExtractor(InputStream inp) throws IOException, InvalidFormatException, OpenXML4JException, XmlException { + public static POITextExtractor createExtractor(InputStream inp) throws IOException, OpenXML4JException, XmlException { // Figure out the kind of stream // If clearly doesn't do mark/reset, wrap up if (! inp.markSupported()) { diff --git a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java index 25efc1e559..6779d8a210 100644 --- a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java +++ b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureConfig.java @@ -64,7 +64,7 @@ public class SignatureConfig { private static final POILogger LOG = POILogFactory.getLogger(SignatureConfig.class);
- public static interface SignatureConfigurable {
+ public interface SignatureConfigurable {
void setSignatureConfig(SignatureConfig signatureConfig);
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java index 0c4e4971d5..70df3f806a 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java @@ -134,7 +134,7 @@ public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> { if (this instanceof PlaceableShape) {
PlaceableShape<?,?> ps = (PlaceableShape<?,?>)this;
- ps.setAnchor(((PlaceableShape<?,?>)sh).getAnchor());
+ ps.setAnchor(sh.getAnchor());
}
@@ -257,7 +257,7 @@ public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> { * Different types of placeholders are allowed and can be specified by using the placeholder
* type attribute for this element
*
- * @param placeholder
+ * @param placeholder The shape to use as placeholder or null if no placeholder should be set.
*/
protected void setPlaceholder(Placeholder placeholder) {
String xquery = "declare namespace p='"+PML_NS+"' .//*/p:nvPr";
@@ -494,7 +494,7 @@ public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> { int idx = (int)fillRef.getIdx();
CTSchemeColor phClr = fillRef.getSchemeClr();
CTStyleMatrix matrix = theme.getXmlObject().getThemeElements().getFmtScheme();
- XmlObject styleLst = null;
+ final XmlObject styleLst;
int childIdx;
if (idx >= 1 && idx <= 999) {
childIdx = idx-1;
diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java index 77c91cdcae..202b9e18e9 100644 --- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java +++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java @@ -55,6 +55,7 @@ import org.apache.poi.POIDataSamples; import org.apache.poi.POITestCase;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
+import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.poifs.crypt.dsig.DigestInfo;
import org.apache.poi.poifs.crypt.dsig.SignatureConfig;
import org.apache.poi.poifs.crypt.dsig.SignatureInfo;
@@ -99,7 +100,7 @@ public class TestSignatureInfo { public static void initBouncy() throws IOException {
CryptoFunctions.registerBouncyCastle();
- /*** TODO : set cal to now ... only set to fixed date for debugging ... */
+ // Set cal to now ... only set to fixed date for debugging ...
cal = LocaleUtil.getLocaleCalendar(LocaleUtil.TIMEZONE_UTC);
assertNotNull(cal);
// cal.set(2014, 7, 6, 21, 42, 12);
@@ -403,7 +404,9 @@ public class TestSignatureInfo { // verify
Iterator<SignaturePart> spIter = si.getSignatureParts().iterator();
- assertTrue(spIter.hasNext());
+ assertTrue("Had: " + si.getSignatureConfig().getOpcPackage().
+ getRelationshipsByType(PackageRelationshipTypes.DIGITAL_SIGNATURE_ORIGIN),
+ spIter.hasNext());
SignaturePart sp = spIter.next();
boolean valid = sp.validate();
assertTrue(valid);
diff --git a/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestProper.java b/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestProper.java index a24fd88795..921dc445eb 100644 --- a/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestProper.java +++ b/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestProper.java @@ -31,7 +31,6 @@ import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import junit.framework.AssertionFailedError; -import junit.framework.TestCase; import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java index 3f7be066d1..2c561b222d 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -1581,7 +1581,7 @@ public final class TestXSSFSheet extends BaseTestXSheet { System.out.println("Array formulas currently unsupported"); // FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula() /* - assertEquals("[Array Formula] N7 cell type", CellType.FORMULA, cell.getCellType()); + assertEquals("[Array Formula] N7 cell type", CellType.FORMULA, cell.getCellTypeEnum()); assertEquals("[Array Formula] N7 cell formula", "{SUM(H7:J7*{1,2,3})}", cell.getCellFormula()); */ @@ -1792,12 +1792,12 @@ public final class TestXSSFSheet extends BaseTestXSheet { // System.out.println("Array formulas currently unsupported"); /* // FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula() - assertEquals("[Array Formula] N10 cell type", CellType.FORMULA, cell.getCellType()); + assertEquals("[Array Formula] N10 cell type", CellType.FORMULA, cell.getCellTypeEnum()); assertEquals("[Array Formula] N10 cell formula", "{SUM(H10:J10*{1,2,3})}", cell.getCellFormula()); cell = CellUtil.getCell(destRow2, col); // FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula() - assertEquals("[Array Formula] N11 cell type", CellType.FORMULA, cell.getCellType()); + assertEquals("[Array Formula] N11 cell type", CellType.FORMULA, cell.getCellTypeEnum()); assertEquals("[Array Formula] N11 cell formula", "{SUM(H11:J11*{1,2,3})}", cell.getCellFormula()); */ diff --git a/src/scratchpad/src/org/apache/poi/hmef/Attachment.java b/src/scratchpad/src/org/apache/poi/hmef/Attachment.java index 89b063c263..59c90a4dc0 100644 --- a/src/scratchpad/src/org/apache/poi/hmef/Attachment.java +++ b/src/scratchpad/src/org/apache/poi/hmef/Attachment.java @@ -137,6 +137,8 @@ public final class Attachment { /** * Returns the contents of the attachment. + * + * @throws IllegalArgumentException if there is no AttachmentData available in this Attachment */ public byte[] getContents() { TNEFAttribute contents = getAttribute(TNEFProperty.ID_ATTACHDATA); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 2ce6e1de8a..65042127e8 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -1885,12 +1885,12 @@ public final class TestBugs extends BaseTestBugzillaIssues { // TODO - Fix these so they work... /*row = s.getRow(4); - assertEquals(CellType.FORMULA, row.getCell(1).getCellType()); + assertEquals(CellType.FORMULA, row.getCell(1).getCellTypeEnum()); assertEquals("'[$http://gagravarr.org/FormulaRefs2.xls]Sheet1'!B2", row.getCell(1).getCellFormula()); assertEquals(123.0, row.getCell(1).getNumericCellValue(), 0); row = s.getRow(5); - assertEquals(CellType.FORMULA, row.getCell(1).getCellType()); + assertEquals(CellType.FORMULA, row.getCell(1).getCellTypeEnum()); assertEquals("'[$http://example.com/FormulaRefs.xls]Sheet1'!B1", row.getCell(1).getCellFormula()); assertEquals(234.0, row.getCell(1).getNumericCellValue(), 0);*/ diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestIfError.java b/src/testcases/org/apache/poi/ss/formula/atp/TestIfError.java index ebf6951f01..3a0a5b9b76 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestIfError.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestIfError.java @@ -84,7 +84,7 @@ public class TestIfError extends TestCase { assertEquals("Checks that the cell is numeric", - CellType.STRING, evaluator.evaluate(cell2).getCellTypeEnum()); + CellType.STRING, evaluator.evaluate(cell2).getCellTypeEnum()); assertEquals("Rounds -10 to a nearest multiple of -3 (-9)", "Error in calculation", evaluator.evaluate(cell2).getStringValue()); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index f9725ba8ae..7e41827a75 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -33,12 +33,9 @@ import java.awt.font.FontRenderContext; import java.awt.font.TextAttribute; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; -import java.io.FileInputStream; import java.io.IOException; import java.text.AttributedString; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import static org.junit.Assert.*; diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java index 5e2ad4a8df..bbd95cccdc 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java @@ -570,7 +570,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas { assertEquals(cra.formatAsString(), mcell.getArrayFormulaRange().formatAsString()); assertEquals("A2:A4*B2:B4", mcell.getCellFormula()); assertTrue(mcell.isPartOfArrayFormulaGroup()); - assertEquals(CellType.FORMULA, mcell.getCellType()); + assertEquals(CellType.FORMULA, mcell.getCellTypeEnum()); } */ |