import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Arrays;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.OldFileFormatException;
throw new IOException(t.getMessage(), t);
}
} catch (Exception e) {
- throw new IOException(e);
+ throw new IOException("While trying to invoke 'createWorkbook' on factory " + factoryClass +
+ " and arguments " + Arrays.toString(args), e);
}
}
-
}
assertNotNull(wb);
assertTrue(wb instanceof XSSFWorkbook);
closeOrRevert(wb);
+
+ // check what happens if the file is passed as "Object"
+
+ try {
+ //noinspection deprecation
+ WorkbookFactory.create((Object)altXLSX);
+ fail("Will throw an exception");
+ } catch(IOException e) {
+ // expected here because create() in this case expects an object of type "OPCPackage"
+ }
}
private static class TestFile extends File {