You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/11/12 21:54:22 UTC
svn commit: r1769431 - in /poi: site/src/documentation/content/xdocs/
trunk/src/ooxml/java/org/apache/poi/xssf/model/
trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/
trunk/src/ooxml/testcases/org/apache/poi/xssf/model/
Author: kiwiwings
Date: Sat Nov 12 21:54:22 2016
New Revision: 1769431
URL: http://svn.apache.org/viewvc?rev=1769431&view=rev
Log:
#60331 - Remove deprecated classes (POI 3.16) - remove StylesTable.getNumberFormatAt(int)
Modified:
poi/site/src/documentation/content/xdocs/status.xml
poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDataFormat.java
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java
Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1769431&r1=1769430&r2=1769431&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Sat Nov 12 21:54:22 2016
@@ -64,6 +64,7 @@
<summary-item>Examples to encrypt temp files in SXSSF</summary-item>
</summary>
<actions>
+ <action dev="PD" type="remove" fixes-bug="60331" module="XSSF">Remove deprecated classes (POI 3.16) - remove StylesTable.getNumberFormatAt(int)</action>
<action dev="PD" type="add" fixes-bug="60345" module="HSLF">Handle corrupt PICT streams</action>
<action dev="PD" type="fix" fixes-bug="59273" module="XSLF,OOXML">Unable to create pptx file by potx file using Apache POI</action>
<action dev="PD" type="add" fixes-bug="github-42" module="SS Common">Add setFormattingRanges() to interface ConditionalFormatting</action>
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java?rev=1769431&r1=1769430&r2=1769431&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java Sat Nov 12 21:54:22 2016
@@ -258,17 +258,6 @@ public class StylesTable extends POIXMLD
/**
* Get number format string given its id
*
- * @param idx number format id
- * @return number format code
- * @deprecated POI 3.14-beta2. Use {@link #getNumberFormatAt(short)} instead.
- */
- public String getNumberFormatAt(int idx) {
- return getNumberFormatAt((short) idx);
- }
-
- /**
- * Get number format string given its id
- *
* @param fmtId number format id
* @return number format code
*/
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDataFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDataFormat.java?rev=1769431&r1=1769430&r2=1769431&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDataFormat.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDataFormat.java Sat Nov 12 21:54:22 2016
@@ -18,6 +18,7 @@ package org.apache.poi.xssf.usermodel;
import org.apache.poi.ss.usermodel.BuiltinFormats;
import org.apache.poi.ss.usermodel.DataFormat;
+import org.apache.poi.util.Removal;
import org.apache.poi.xssf.model.StylesTable;
/**
@@ -60,14 +61,6 @@ public class XSSFDataFormat implements D
*/
@Override
public String getFormat(short index) {
- return getFormat(index&0xffff);
- }
- /**
- * get the format string that matches the given format index
- * @param index of a format
- * @return string represented at index of format or <code>null</code> if there is not a format at that index
- */
- public String getFormat(int index) {
// Indices used for built-in formats may be overridden with
// custom formats, such as locale-specific currency.
// See org.apache.poi.xssf.usermodel.TestXSSFDataFormat#test49928()
@@ -78,6 +71,17 @@ public class XSSFDataFormat implements D
if(fmt == null) fmt = BuiltinFormats.getBuiltinFormat(index);
return fmt;
}
+ /**
+ * get the format string that matches the given format index
+ * @param index of a format
+ * @return string represented at index of format or <code>null</code> if there is not a format at that index
+ *
+ * @deprecated POI 3.16 beta 1 - use {@link #getFormat(short)} instead
+ */
+ @Removal(version="3.18")
+ public String getFormat(int index) {
+ return getFormat((short)index);
+ }
/**
* Add a number format with a specific ID into the number format style table.
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java?rev=1769431&r1=1769430&r2=1769431&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/model/TestStylesTable.java Sat Nov 12 21:54:22 2016
@@ -111,8 +111,8 @@ public final class TestStylesTable {
assertEquals(2, st.getFills().size());
assertEquals(1, st.getBorders().size());
- assertEquals("yyyy/mm/dd", st.getNumberFormatAt(165));
- assertEquals("yy/mm/dd", st.getNumberFormatAt(167));
+ assertEquals("yyyy/mm/dd", st.getNumberFormatAt((short)165));
+ assertEquals("yy/mm/dd", st.getNumberFormatAt((short)167));
assertNotNull(st.getStyleAt(0));
assertNotNull(st.getStyleAt(1));
@@ -150,7 +150,7 @@ public final class TestStylesTable {
assertEquals(1, st._getStyleXfsSize());
assertEquals(2, st.getNumDataFormats());
- assertEquals("yyyy-mm-dd", st.getNumberFormatAt(nf1));
+ assertEquals("yyyy-mm-dd", st.getNumberFormatAt((short)nf1));
assertEquals(nf1, st.putNumberFormat("yyyy-mm-dd"));
assertEquals(nf2, st.putNumberFormat("yyyy-mm-DD"));
@@ -177,7 +177,7 @@ public final class TestStylesTable {
assertEquals(1, st._getStyleXfsSize());
assertEquals(10, st.getNumDataFormats());
- assertEquals("YYYY-mm-dd", st.getNumberFormatAt(nf1));
+ assertEquals("YYYY-mm-dd", st.getNumberFormatAt((short)nf1));
assertEquals(nf1, st.putNumberFormat("YYYY-mm-dd"));
assertEquals(nf2, st.putNumberFormat("YYYY-mm-DD"));
@@ -216,22 +216,22 @@ public final class TestStylesTable {
@Test
public void removeNumberFormat() throws IOException {
- XSSFWorkbook wb = new XSSFWorkbook();
+ XSSFWorkbook wb1 = new XSSFWorkbook();
try {
final String fmt = customDataFormat;
- final short fmtIdx = (short) wb.getStylesSource().putNumberFormat(fmt);
+ final short fmtIdx = (short) wb1.getStylesSource().putNumberFormat(fmt);
- Cell cell = wb.createSheet("test").createRow(0).createCell(0);
+ Cell cell = wb1.createSheet("test").createRow(0).createCell(0);
cell.setCellValue(5.25);
- CellStyle style = wb.createCellStyle();
+ CellStyle style = wb1.createCellStyle();
style.setDataFormat(fmtIdx);
cell.setCellStyle(style);
assertEquals(fmt, cell.getCellStyle().getDataFormatString());
- assertEquals(fmt, wb.getStylesSource().getNumberFormatAt(fmtIdx));
+ assertEquals(fmt, wb1.getStylesSource().getNumberFormatAt(fmtIdx));
// remove the number format from the workbook
- wb.getStylesSource().removeNumberFormat(fmt);
+ wb1.getStylesSource().removeNumberFormat(fmt);
// number format in CellStyles should be restored to default number format
final short defaultFmtIdx = 0;
@@ -240,17 +240,17 @@ public final class TestStylesTable {
assertEquals(defaultFmt, style.getDataFormatString());
// The custom number format should be entirely removed from the workbook
- Map<Short,String> numberFormats = wb.getStylesSource().getNumberFormats();
+ Map<Short,String> numberFormats = wb1.getStylesSource().getNumberFormats();
assertNotContainsKey(numberFormats, fmtIdx);
assertNotContainsValue(numberFormats, fmt);
// The default style shouldn't be added back to the styles source because it's built-in
- assertEquals(0, wb.getStylesSource().getNumDataFormats());
+ assertEquals(0, wb1.getStylesSource().getNumDataFormats());
cell = null; style = null; numberFormats = null;
- wb = XSSFTestDataSamples.writeOutCloseAndReadBack(wb);
+ XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutCloseAndReadBack(wb1);
- cell = wb.getSheet("test").getRow(0).getCell(0);
+ cell = wb2.getSheet("test").getRow(0).getCell(0);
style = cell.getCellStyle();
// number format in CellStyles should be restored to default number format
@@ -258,15 +258,17 @@ public final class TestStylesTable {
assertEquals(defaultFmt, style.getDataFormatString());
// The custom number format should be entirely removed from the workbook
- numberFormats = wb.getStylesSource().getNumberFormats();
+ numberFormats = wb2.getStylesSource().getNumberFormats();
assertNotContainsKey(numberFormats, fmtIdx);
assertNotContainsValue(numberFormats, fmt);
// The default style shouldn't be added back to the styles source because it's built-in
- assertEquals(0, wb.getStylesSource().getNumDataFormats());
+ assertEquals(0, wb2.getStylesSource().getNumDataFormats());
+
+ wb2.close();
} finally {
- wb.close();
+ wb1.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org