Skip to content
Snippets Groups Projects
Commit 8b608faf authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-22313: The workspace migrator is using the standard Java temporary directory

(cherry picked from commit 247d1e11)
parent 386b3af7
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
import org.xwiki.environment.Environment;
import org.xwiki.model.reference.DocumentReference;
import com.xpn.xwiki.XWiki;
......@@ -57,6 +58,9 @@ public class DefaultDocumentRestorerFromAttachedXAR implements DocumentRestorerF
@Inject
private Provider<XWikiContext> xcontextProvider;
@Inject
private Environment environment;
private File getTemporaryZipFile(DocumentReference docReference, String attachmentName)
throws XWikiException, IOException
{
......@@ -79,7 +83,7 @@ private File getTemporaryZipFile(DocumentReference docReference, String attachme
// We need to copy the attachment to a temporary file because we want ti use ZipFile
// instead of ZipArchiveInputStream (see: http://commons.apache.org/proper/commons-compress/zip.html)
File tempFile = File.createTempFile(attachmentName, ".tmp");
File tempFile = File.createTempFile(attachmentName, ".tmp", this.environment.getTemporaryDirectory());
// We copy the content of the attachment
FileUtils.copyInputStreamToFile(xar.getContentInputStream(xcontext), tempFile);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment