aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java3
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java16
-rw-r--r--test-data/spreadsheet/123233_charts.xlsxbin0 -> 12957 bytes
3 files changed, 11 insertions, 8 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java
index 459cbef831..b682cfc141 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/PackagePropertiesMarshaller.java
@@ -89,7 +89,8 @@ public class PackagePropertiesMarshaller implements PartMarshaller {
throws OpenXML4JException {
if (!(part instanceof PackagePropertiesPart))
throw new IllegalArgumentException(
- "'part' must be a PackagePropertiesPart instance.");
+ "'part' must be a PackagePropertiesPart instance, but had: " + part.getClass() +
+ ", check logs while reading.");
propsPart = (PackagePropertiesPart) part;
// Configure the document
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
index 18c69b616b..4f7aa91704 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
@@ -63,13 +63,15 @@ public final class XSSFGraphicFrame extends XSSFShape {
for (int i = 0; i < nodes.getLength(); i++) {
final Node node = nodes.item(i);
// if the frame references a chart, associate the chart with this instance
- Node namedItem = node.getAttributes().getNamedItem("r:id");
- if (node.getNodeName().equals("c:chart") && namedItem != null) {
- // this better succeed or the document is invalid
- POIXMLDocumentPart relation = drawing.getRelationById(namedItem.getNodeValue());
- // Do XWPF charts need similar treatment?
- if (relation instanceof XSSFChart) {
- ((XSSFChart) relation).setGraphicFrame(this);
+ if (node.getAttributes() != null) {
+ Node namedItem = node.getAttributes().getNamedItem("r:id");
+ if (node.getNodeName().equals("c:chart") && namedItem != null) {
+ // this better succeed or the document is invalid
+ POIXMLDocumentPart relation = drawing.getRelationById(namedItem.getNodeValue());
+ // Do XWPF charts need similar treatment?
+ if (relation instanceof XSSFChart) {
+ ((XSSFChart) relation).setGraphicFrame(this);
+ }
}
}
}
diff --git a/test-data/spreadsheet/123233_charts.xlsx b/test-data/spreadsheet/123233_charts.xlsx
new file mode 100644
index 0000000000..be3c1a2f91
--- /dev/null
+++ b/test-data/spreadsheet/123233_charts.xlsx
Binary files differ