aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorMarius Volkhart <mariusvolkhart@apache.org>2021-03-01 00:25:23 +0000
committerMarius Volkhart <mariusvolkhart@apache.org>2021-03-01 00:25:23 +0000
commit8ab53c6489bf86f9be47a1f599558b689d2cda26 (patch)
tree9371c3834100ce5af5a34957cbf4ef0c7824c95f /src/java
parent402d0fc5e56349b3d6f447d56c8eef77a91b73ff (diff)
downloadpoi-8ab53c6489bf86f9be47a1f599558b689d2cda26.tar.gz
poi-8ab53c6489bf86f9be47a1f599558b689d2cda26.zip
Deprecate functions that duplicate functionality
DrawingGroupRecord#processChildRecords and AbstractEscherHolderRecord#convertRawBytesToEscherRecords duplicate the functionality of AbstractEscherHolderRecord#decode. This makes the code harder to follow, as it is not clear when certain access patterns repeat. Accordingly, these functions are deprecated and flagged for removal. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887021 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/hssf/model/InternalWorkbook.java2
-rw-r--r--src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java12
-rw-r--r--src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java7
-rw-r--r--src/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java2
4 files changed, 18 insertions, 5 deletions
diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
index c5703dfca3..d49f2566a7 100644
--- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
+++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
@@ -1840,7 +1840,7 @@ public final class InternalWorkbook {
continue;
}
DrawingGroupRecord dg = (DrawingGroupRecord)r;
- dg.processChildRecords();
+ dg.decode();
drawingManager = findDrawingManager(dg, escherBSERecords);
if (drawingManager != null) {
return drawingManager;
diff --git a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
index 48d75056e3..0132e276e3 100644
--- a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
+++ b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
@@ -27,6 +27,7 @@ import org.apache.poi.ddf.EscherRecordFactory;
import org.apache.poi.ddf.NullEscherSerializationListener;
import org.apache.poi.hssf.util.LazilyConcatenatedByteArray;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.Removal;
/**
* The escher container record is used to hold escher records. It is abstract and
@@ -63,10 +64,17 @@ public abstract class AbstractEscherHolderRecord extends Record {
}
}
+ /**
+ * @deprecated Call {@link #decode()} instead.
+ */
+ @Removal(version = "5.3")
+ @Deprecated
protected void convertRawBytesToEscherRecords() {
+ // decode() does a check to see if raw bytes have already been interpreted. In the case that we did not eagerly
+ // interpret the bytes due to DESERIALIZE being false, decode() will interpret the bytes. If we did already
+ // interpret the bytes due to DESERIALIZE being true, decode skips doing the work again.
if (!DESERIALIZE) {
- byte[] rawData = getRawData();
- convertToEscherRecords(0, rawData.length, rawData);
+ decode();
}
}
private void convertToEscherRecords( int offset, int size, byte[] data )
diff --git a/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java b/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
index 68c8c24145..4dbbb70b58 100644
--- a/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
+++ b/src/java/org/apache/poi/hssf/record/DrawingGroupRecord.java
@@ -25,6 +25,7 @@ import org.apache.poi.ddf.EscherRecord;
import org.apache.poi.ddf.EscherRecordTypes;
import org.apache.poi.ddf.NullEscherSerializationListener;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.Removal;
/**
* Specifies a group of drawing objects.
@@ -81,9 +82,13 @@ public final class DrawingGroupRecord extends AbstractEscherHolderRecord {
* (Not done by default in case we break things,
* unless you set the "poi.deserialize.escher"
* system property)
+ *
+ * @deprecated Call {@link #decode()} instead.
*/
+ @Removal(version = "5.3")
+ @Deprecated
public void processChildRecords() {
- convertRawBytesToEscherRecords();
+ decode();
}
public int getRecordSize() {
diff --git a/src/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java b/src/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java
index f27c2b6c85..8c9743f4bd 100644
--- a/src/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java
+++ b/src/java/org/apache/poi/hssf/record/DrawingRecordForBiffViewer.java
@@ -42,7 +42,7 @@ public final class DrawingRecordForBiffViewer extends AbstractEscherHolderRecord
public DrawingRecordForBiffViewer(DrawingRecord r)
{
super(convertToInputStream(r));
- convertRawBytesToEscherRecords();
+ decode();
}
private static RecordInputStream convertToInputStream(DrawingRecord r)
{