Author: fanningpj
Date: Mon Oct 23 20:27:47 2017
New Revision: 1813085
URL: http://svn.apache.org/viewvc?rev=1813085&view=rev
Log:
Remove more deprecated code
Modified:
poi/trunk/src/java/org/apache/poi/util/TempFile.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java
Modified: poi/trunk/src/java/org/apache/poi/util/TempFile.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/TempFile.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/TempFile.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/TempFile.java Mon Oct 23 20:27:47
2017
@@ -69,9 +69,4 @@ public final class TempFile {
public static File createTempDirectory(String name) throws IOException {
return strategy.createTempDirectory(name);
}
-
- /**
- * @deprecated POI 3.15 beta 3. Moved to {@link
org.apache.poi.util.DefaultTempFileCreationStrategy}.
- */
- public static class DefaultTempFileCreationStrategy extends
org.apache.poi.util.DefaultTempFileCreationStrategy {}
}
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
---
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java
(original)
+++
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java
Mon Oct 23 20:27:47 2017
@@ -571,6 +571,7 @@ public class TestXSSFCellStyle {
}
@Test
+ @SuppressWarnings("deprecation")
public void testGetFillForegroundColor() throws IOException {
XSSFWorkbook wb = new XSSFWorkbook();
StylesTable styles = wb.getStylesSource();
@@ -581,11 +582,13 @@ public class TestXSSFCellStyle {
assertEquals(IndexedColors.AUTOMATIC.getIndex(),
defaultStyle.getFillForegroundColor());
assertEquals(null, defaultStyle.getFillForegroundXSSFColor());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
+ assertEquals(FillPatternType.NO_FILL,
defaultStyle.getFillPatternEnum());
XSSFCellStyle customStyle = wb.createCellStyle();
customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(FillPatternType.SOLID_FOREGROUND,
customStyle.getFillPattern());
+ assertEquals(FillPatternType.SOLID_FOREGROUND,
customStyle.getFillPatternEnum());
assertEquals(3, styles.getFills().size());
customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
---
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java
(original)
+++
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/BytePropertyNode.java
Mon Oct 23 20:27:47 2017
@@ -30,28 +30,8 @@ package org.apache.poi.hwpf.model;
public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends
PropertyNode<T>
{
- private final int startBytes;
- private final int endBytes;
-
- /**
- * @param fcStart The start of the text for this property, in _bytes_
- * @param fcEnd The end of the text for this property, in _bytes_
- * @deprecated
- */
- public BytePropertyNode(int fcStart, int fcEnd, CharIndexTranslator
translator, Object buf) {
- super(
- translator.getCharIndex(fcStart),
- translator.getCharIndex(fcEnd,
translator.getCharIndex(fcStart)),
- buf
- );
-
- if ( fcStart > fcEnd )
- throw new IllegalArgumentException( "fcStart (" + fcStart
- + ") > fcEnd (" + fcEnd + ")" );
-
- this.startBytes = fcStart;
- this.endBytes = fcEnd;
- }
+ private final int startBytes;
+ private final int endBytes;
public BytePropertyNode( int charStart, int charEnd, Object buf )
{
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java Mon Oct 23
20:27:47 2017
@@ -24,60 +24,42 @@ import org.apache.poi.util.Internal;
/**
* DANGER - works in bytes!
- *
+ * <p>
* Make sure you call getStart() / getEnd() when you want characters
- * (normal use), but getStartByte() / getEndByte() when you're
- * reading in / writing out!
+ * (normal use), but getStartByte() / getEndByte() when you're
+ * reading in / writing out!
*
* @author Ryan Ackley
*/
@Internal
-@SuppressWarnings( "deprecation" )
-public final class CHPX extends BytePropertyNode<CHPX>
-{
-
- @Deprecated
- public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[]
grpprl)
- {
- super(fcStart, translator.lookIndexBackward(fcEnd), translator, new
SprmBuffer(grpprl, 0));
- }
-
- @Deprecated
- public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator,
SprmBuffer buf)
- {
- super(fcStart, translator.lookIndexBackward(fcEnd), translator ,buf);
- }
-
- CHPX( int charStart, int charEnd, SprmBuffer buf )
- {
- super( charStart, charEnd, buf );
+@SuppressWarnings("deprecation")
+public final class CHPX extends BytePropertyNode<CHPX> {
+
+ CHPX(int charStart, int charEnd, SprmBuffer buf) {
+ super(charStart, charEnd, buf);
+ }
+
+ public byte[] getGrpprl() {
+ return ((SprmBuffer) _buf).toByteArray();
}
- public byte[] getGrpprl()
- {
- return ((SprmBuffer)_buf).toByteArray();
- }
-
- public SprmBuffer getSprmBuf()
- {
- return (SprmBuffer)_buf;
- }
-
- public CharacterProperties getCharacterProperties( StyleSheet ss, short
istd )
- {
- if ( ss == null )
- {
+ public SprmBuffer getSprmBuf() {
+ return (SprmBuffer) _buf;
+ }
+
+ public CharacterProperties getCharacterProperties(StyleSheet ss, short
istd) {
+ if (ss == null) {
// TODO Fix up for Word 6/95
return new CharacterProperties();
}
- CharacterProperties baseStyle = ss.getCharacterStyle( istd );
+ CharacterProperties baseStyle = ss.getCharacterStyle(istd);
return CharacterSprmUncompressor.uncompressCHP(
- ss, baseStyle, getGrpprl(), 0 );
+ ss, baseStyle, getGrpprl(), 0);
}
- public String toString() {
- return "CHPX from " + getStart() + " to " + getEnd() +
- " (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";
- }
+ public String toString() {
+ return "CHPX from " + getStart() + " to " + getEnd() +
+ " (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";
+ }
}
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
---
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java
(original)
+++
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CharIndexTranslator.java
Mon Oct 23 20:27:47 2017
@@ -31,32 +31,6 @@ public interface CharIndexTranslator {
int getByteIndex( int charPos );
/**
- * Calculates the char index of the given byte index. Look forward if index
- * is not in table
- *
- * @param bytePos
- * The character offset to check
- * @return the char index
- * @deprecated This API were based on incorrect assumption that single byte
- * offset corresponds to single char offset
- */
- @Deprecated
- int getCharIndex(int bytePos);
-
- /**
- * Calculates the char index of the given byte index.
- * Look forward if index is not in table
- *
- * @param bytePos The character offset to check
- * @param startCP look from this characted position
- * @return the char index
- * @deprecated This API were based on incorrect assumption that single byte
- * offset corresponds to single char offset
- */
- @Deprecated
- int getCharIndex(int bytePos, int startCP);
-
- /**
* Finds character ranges that includes specified byte range.
*
* @param startBytePosInclusive
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
---
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
(original)
+++
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
Mon Oct 23 20:27:47 2017
@@ -52,37 +52,15 @@ public final class PAPFormattedDiskPage
private ArrayList<PAPX> _papxList = new ArrayList<>();
private ArrayList<PAPX> _overFlow;
- /**
- * @deprecated Use {@link #PAPFormattedDiskPage()} instead
- */
- public PAPFormattedDiskPage( byte[] dataStream )
- {
- this();
- }
- public PAPFormattedDiskPage()
- {
- }
- /**
- * Creates a PAPFormattedDiskPage from a 512 byte array
- *
- * @deprecated Use
- * {@link #PAPFormattedDiskPage(byte[], byte[], int,
CharIndexTranslator)}
- * instead
- */
- public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream,
- int offset, int fcMin, TextPieceTable tpt )
- {
- this( documentStream, dataStream, offset, tpt );
- }
+ public PAPFormattedDiskPage() { }
/**
* Creates a PAPFormattedDiskPage from a 512 byte array
*/
public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream,
- int offset, CharIndexTranslator translator )
- {
+ int offset, CharIndexTranslator translator ) {
super( documentStream, offset );
for ( int x = 0; x < _crun; x++ )
{
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java Mon Oct 23
20:27:47 2017
@@ -40,15 +40,6 @@ public final class PAPX extends ByteProp
private ParagraphHeight _phe;
- public PAPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[]
papx, ParagraphHeight phe, byte[] dataStream)
- {
- super(fcStart, fcEnd, translator, new SprmBuffer(papx, 2));
- _phe = phe;
- SprmBuffer buf = findHuge(new SprmBuffer(papx, 2), dataStream);
- if(buf != null)
- _buf = buf;
- }
-
public PAPX( int charStart, int charEnd, byte[] papx, ParagraphHeight phe,
byte[] dataStream )
{
@@ -59,16 +50,6 @@ public final class PAPX extends ByteProp
_buf = buf;
}
- @Deprecated
- public PAPX(int fcStart, int fcEnd, CharIndexTranslator translator,
SprmBuffer buf, byte[] dataStream)
- {
- super(fcStart, fcEnd, translator, buf);
- _phe = new ParagraphHeight();
- buf = findHuge(buf, dataStream);
- if(buf != null)
- _buf = buf;
- }
-
public PAPX( int charStart, int charEnd, SprmBuffer buf )
{
super( charStart, charEnd, buf );
Modified:
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
Mon Oct 23 20:27:47 2017
@@ -86,6 +86,7 @@ public final class TestHSSFPalette {
/**
* Uses the palette from cell stylings
*/
+ @SuppressWarnings("deprecation")
@Test
public void testPaletteFromCellColours() {
HSSFWorkbook book =
HSSFTestDataSamples.openSampleWorkbook("SimpleWithColours.xls");
@@ -104,6 +105,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellA.getCellStyle().getFillBackgroundColor());
assertEquals(Font.COLOR_NORMAL,
cellA.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL,
cellA.getCellStyle().getFillPattern());
+ assertEquals(FillPatternType.NO_FILL,
cellA.getCellStyle().getFillPatternEnum());
assertEquals("0:0:0", p.getColor((short)64).getHexString());
assertEquals(null, p.getColor((short)32767));
@@ -113,6 +115,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellB.getCellStyle().getFillBackgroundColor());
assertEquals(10, cellB.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL,
cellB.getCellStyle().getFillPattern());
+ assertEquals(FillPatternType.NO_FILL,
cellB.getCellStyle().getFillPatternEnum());
assertEquals("0:0:0", p.getColor((short)64).getHexString());
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
@@ -122,6 +125,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellC.getCellStyle().getFillBackgroundColor());
assertEquals(10, cellC.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.SOLID_FOREGROUND,
cellC.getCellStyle().getFillPattern());
+ assertEquals(FillPatternType.SOLID_FOREGROUND,
cellC.getCellStyle().getFillPatternEnum());
assertEquals("0:FFFF:0", p.getColor((short)11).getHexString());
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
@@ -131,6 +135,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellD.getCellStyle().getFillBackgroundColor());
assertEquals(14, cellD.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL,
cellD.getCellStyle().getFillPattern());
+ assertEquals(FillPatternType.NO_FILL,
cellD.getCellStyle().getFillPatternEnum());
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
@@ -140,6 +145,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellE.getCellStyle().getFillBackgroundColor());
assertEquals(14, cellE.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL,
cellE.getCellStyle().getFillPattern());
+ assertEquals(FillPatternType.NO_FILL,
cellE.getCellStyle().getFillPatternEnum());
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
}
Modified: poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java?rev=1813085&r1=1813084&r2=1813085&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java Mon
Oct 23 20:27:47 2017
@@ -356,30 +356,7 @@ public class BaseTestCellUtil {
wb2.close();
}
}
-
- /**
- * bug 55555
- * @deprecated Replaced by {@link
#setFillForegroundColorBeforeFillBackgroundColorEnum()}
- * @since POI 3.15 beta 3
- */
- @Deprecated
- // bug 55555
- @Test
- public void setFillForegroundColorBeforeFillBackgroundColor() throws
IOException {
- Workbook wb1 = _testDataProvider.createWorkbook();
- Cell A1 = wb1.createSheet().createRow(0).createCell(0);
- Map<String, Object> properties = new HashMap<>();
- properties.put(CellUtil.FILL_PATTERN, FillPatternType.BRICKS);
- properties.put(CellUtil.FILL_FOREGROUND_COLOR,
IndexedColors.BLUE.index);
- properties.put(CellUtil.FILL_BACKGROUND_COLOR,
IndexedColors.RED.index);
-
- CellUtil.setCellStyleProperties(A1, properties);
- CellStyle style = A1.getCellStyle();
- assertEquals("fill pattern", FillPatternType.BRICKS,
style.getFillPattern());
- assertEquals("fill foreground color", IndexedColors.BLUE,
IndexedColors.fromInt(style.getFillForegroundColor()));
- assertEquals("fill background color", IndexedColors.RED,
IndexedColors.fromInt(style.getFillBackgroundColor()));
- wb1.close();
- }
+
/**
* bug 55555
* @since POI 3.15 beta 3
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]