diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index b98efd167..43d6bb7b1 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + New class org.apache.poi.hssf.record.RecordFormatException, which DDF uses instead of the HSSF version, and the HSSF version inherits from 45431 - Partial support for .xlm files. Not quite enough for excel to load them though 45430 - Correct named range sheet reporting when no local sheet id is given in the xml diff --git a/src/documentation/content/xdocs/spreadsheet/converting.xml b/src/documentation/content/xdocs/spreadsheet/converting.xml index b9fcdcd0d..8d0e966e3 100644 --- a/src/documentation/content/xdocs/spreadsheet/converting.xml +++ b/src/documentation/content/xdocs/spreadsheet/converting.xml @@ -48,6 +48,17 @@ org.apache.poi.ss.usermodel.Row.MissingCellPolicy

+
DDF and org.apache.poi.hssf.record.RecordFormatException +

Previously, record level errors within DDF would throw an + exception from the hssf class heirachy. Now, record level errors + within DDF will throw a more general RecordFormatException, + org.apache.poi.util.RecordFormatException

+

In addition, org.apache.poi.hssf.record.RecordFormatException + has been changed to inherit from the new + org.apache.poi.util.RecordFormatException, so you may + wish to change catches of the hssf version to the new util version. +

+
Converting existing HSSF Usermodel code to SS Usermodel (for XSSF and HSSF) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index c4e6cc518..f1f81d069 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + New class org.apache.poi.hssf.record.RecordFormatException, which DDF uses instead of the HSSF version, and the HSSF version inherits from 45431 - Partial support for .xlm files. Not quite enough for excel to load them though 45430 - Correct named range sheet reporting when no local sheet id is given in the xml diff --git a/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java b/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java index 4ca1bfebc..f1d051d7b 100644 --- a/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java +++ b/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java @@ -18,7 +18,7 @@ package org.apache.poi.ddf; -import org.apache.poi.hssf.record.RecordFormatException; +import org.apache.poi.util.RecordFormatException; import java.lang.reflect.Constructor; import java.util.HashMap; diff --git a/src/java/org/apache/poi/ddf/EscherBlipWMFRecord.java b/src/java/org/apache/poi/ddf/EscherBlipWMFRecord.java index 54217e1bb..c307d2b0d 100644 --- a/src/java/org/apache/poi/ddf/EscherBlipWMFRecord.java +++ b/src/java/org/apache/poi/ddf/EscherBlipWMFRecord.java @@ -18,9 +18,9 @@ package org.apache.poi.ddf; -import org.apache.poi.hssf.record.RecordFormatException; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.RecordFormatException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/java/org/apache/poi/ddf/EscherDggRecord.java b/src/java/org/apache/poi/ddf/EscherDggRecord.java index cdc9281a8..cc0d3aef8 100644 --- a/src/java/org/apache/poi/ddf/EscherDggRecord.java +++ b/src/java/org/apache/poi/ddf/EscherDggRecord.java @@ -18,9 +18,9 @@ package org.apache.poi.ddf; -import org.apache.poi.hssf.record.RecordFormatException; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.RecordFormatException; import java.util.*; diff --git a/src/java/org/apache/poi/ddf/EscherSpgrRecord.java b/src/java/org/apache/poi/ddf/EscherSpgrRecord.java index 526f03eab..4ff8eb4e7 100644 --- a/src/java/org/apache/poi/ddf/EscherSpgrRecord.java +++ b/src/java/org/apache/poi/ddf/EscherSpgrRecord.java @@ -20,7 +20,7 @@ package org.apache.poi.ddf; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; -import org.apache.poi.hssf.record.RecordFormatException; +import org.apache.poi.util.RecordFormatException; /** * The spgr record defines information about a shape group. Groups in escher diff --git a/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java b/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java index 65a8427f6..5fc0f3603 100644 --- a/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java +++ b/src/java/org/apache/poi/ddf/EscherSplitMenuColorsRecord.java @@ -20,7 +20,7 @@ package org.apache.poi.ddf; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; -import org.apache.poi.hssf.record.RecordFormatException; +import org.apache.poi.util.RecordFormatException; /** * A list of the most recently used colours for the drawings contained in diff --git a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java index f6fa597b3..1a14dbb06 100644 --- a/src/java/org/apache/poi/ddf/EscherTextboxRecord.java +++ b/src/java/org/apache/poi/ddf/EscherTextboxRecord.java @@ -18,9 +18,9 @@ package org.apache.poi.ddf; -import org.apache.poi.hssf.record.RecordFormatException; import org.apache.poi.util.HexDump; import org.apache.poi.util.LittleEndian; +import org.apache.poi.util.RecordFormatException; /** * Holds data from the parent application. Most commonly used to store diff --git a/src/java/org/apache/poi/hssf/record/RecordFormatException.java b/src/java/org/apache/poi/hssf/record/RecordFormatException.java index b5da31c14..b1afd6f9b 100644 --- a/src/java/org/apache/poi/hssf/record/RecordFormatException.java +++ b/src/java/org/apache/poi/hssf/record/RecordFormatException.java @@ -25,7 +25,7 @@ package org.apache.poi.hssf.record; */ public class RecordFormatException - extends RuntimeException + extends org.apache.poi.util.RecordFormatException { public RecordFormatException(String exception) { diff --git a/src/java/org/apache/poi/util/RecordFormatException.java b/src/java/org/apache/poi/util/RecordFormatException.java new file mode 100644 index 000000000..d1643b8be --- /dev/null +++ b/src/java/org/apache/poi/util/RecordFormatException.java @@ -0,0 +1,42 @@ + +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + + +package org.apache.poi.util; + +/** + * A common exception thrown by our binary format parsers + * (especially HSSF and DDF), when they hit invalid + * format or data when processing a record. + */ +public class RecordFormatException + extends RuntimeException +{ + public RecordFormatException(String exception) + { + super(exception); + } + + public RecordFormatException(String exception, Throwable thr) { + super(exception, thr); + } + + public RecordFormatException(Throwable thr) { + super(thr); + } +}