# Deprecate/legacify old XAR import classes

**URL:** <https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300>\
**Category:** Development\
**Tags:** proposal\
**Created:** [November 4, 2022, 12:21pm UTC](https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300 "2022-11-04T12:21:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 4, 2022, 12:21pm UTC](https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300/1 "2022-11-04T12:21:17Z")

</div>

Hi devs,

Right now we have a config property named `xwiki.action.import.xar.usefilter` to decide whether to use the new filter stream-based XAR import or the old Packager-based one. It’s been there since XWiki 6.2. The original reason was to allow users to use the old system while we were stabilizing the new one.

It happens that there are some issues related to the Package-based code (security, etc) and in any case it’s almost dead code since the filter stream-based import is now stable enough and I don’t see any reason to want to use the old system.

This is a proposal to legacy the old XAR importer classes and remove the IF at [xwiki-platform/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java at f46d47d6c5fe2bfca32a1536163942e37e1d7054 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/blob/f46d47d6c5fe2bfca32a1536163942e37e1d7054/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java#L141)

Impl detail note: I see in the code that we have [xwiki-platform/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java at f46d47d6c5fe2bfca32a1536163942e37e1d7054 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/blob/f46d47d6c5fe2bfca32a1536163942e37e1d7054/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java#L352-L379) I’m not sure why this is needed and what we can do to remove the `Package` and `DocumentInfo` classes there.

WDYT?

Thanks

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 4, 2022, 12:34pm UTC](https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300/2 "2022-11-04T12:34:27Z")

</div>

> [@vmassol](#):
>
> Impl detail note: I see in the code that we have [xwiki-platform/ImportAction.java at f46d47d6c5fe2bfca32a1536163942e37e1d7054 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/blob/f46d47d6c5fe2bfca32a1536163942e37e1d7054/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java#L352-L379) I’m not sure why this is needed and what we can do to remove the `Package` and `DocumentInfo` classes there.

As indicated in the comment, that’s retro compatibility (the import action is expected to expose a report of the import in the context).

Note that this is not the only place where the old packer plugin is still used, we would need to refactor the packager Maven plugin too (which is still used for many tests). Of course, we could also decide to use the legacy JAR in the Maven plugin, but it’s not very nice.

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 17, 2022, 3:26pm UTC](https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300/3 "2022-11-17T15:26:46Z")

</div>

One first and easy step would be to remove the property and remove the IF at [xwiki-platform/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java at f46d47d6c5fe2bfca32a1536163942e37e1d7054 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/blob/f46d47d6c5fe2bfca32a1536163942e37e1d7054/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java#L141)

As second step would the deprecation and removal of old XAR import classes.

WDYT?

Thanks

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 17, 2022, 3:31pm UTC](https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300/4 "2022-11-17T15:31:51Z")

</div>

> [@vmassol](#):
>
> One first and easy step would be to remove the property and remove the IF at [xwiki-platform/ImportAction.java at f46d47d6c5fe2bfca32a1536163942e37e1d7054 · xwiki/xwiki-platform · GitHub](https://github.com/xwiki/xwiki-platform/blob/f46d47d6c5fe2bfca32a1536163942e37e1d7054/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/ImportAction.java#L141)

+1

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 17, 2022, 3:53pm UTC](https://forum.xwiki.org/t/deprecate-legacify-old-xar-import-classes/11300/5 "2022-11-17T15:53:12Z")

</div>

Step 1 done in [Loading...](https://jira.xwiki.org/browse/XWIKI-20382)
