From f4c52d16d8f4e30018f1d3c3f706504831be9bec Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Wed, 26 Nov 2014 21:11:02 +0000 Subject: [PATCH] Include root-cause exception information when constructing ContentTypeManager fails git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1641940 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/openxml4j/opc/internal/ContentTypeManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java index d03a40ba02..6b71d0dbe9 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java @@ -101,8 +101,12 @@ public abstract class ContentTypeManager { try { parseContentTypesFile(in); } catch (InvalidFormatException e) { - throw new InvalidFormatException( - "Can't read content types part !"); + InvalidFormatException ex = new InvalidFormatException("Can't read content types part !"); + + // here it is useful to add the cause to not loose the original stack-trace + ex.initCause(e); + + throw ex; } } } -- 2.39.5