X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.eclipse.ui.workbench%2Fsrc%2Forg%2Fargeo%2Feclipse%2Fui%2Fworkbench%2Fjcr%2Finternal%2Fparts%2FImportFileSystemWizard.java;h=871b73ad69f69b77ee9c8e412fd475242d8e19fb;hb=e6d2d877a7208a13c05a9c9a8b67641972f13870;hp=cded3a49d3d668c62921d47c71991f151dd4d61d;hpb=21a4ea1fb5380ce1dd763c1ea09067cdd2dfd0f3;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.eclipse.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/internal/parts/ImportFileSystemWizard.java b/org.argeo.eclipse.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/internal/parts/ImportFileSystemWizard.java index cded3a49d..871b73ad6 100644 --- a/org.argeo.eclipse.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/internal/parts/ImportFileSystemWizard.java +++ b/org.argeo.eclipse.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/internal/parts/ImportFileSystemWizard.java @@ -17,6 +17,7 @@ package org.argeo.eclipse.ui.workbench.jcr.internal.parts; import java.io.File; import java.io.FileInputStream; +import java.io.InputStream; import javax.jcr.Binary; import javax.jcr.Node; @@ -28,8 +29,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.ArgeoException; -import org.argeo.eclipse.ui.ErrorFeedback; -import org.argeo.eclipse.ui.specific.ImportToServerWizardPage; +import org.argeo.eclipse.ui.dialogs.ErrorFeedback; import org.argeo.eclipse.ui.specific.UploadFileWizardPage; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; @@ -67,23 +67,25 @@ public class ImportFileSystemWizard extends Wizard { final String objectPath = importPage.getObjectPath(); // We do not display a progress bar for one file only - if (ImportToServerWizardPage.FILE_ITEM_TYPE.equals(objectType)) { + if (UploadFileWizardPage.FILE_ITEM_TYPE.equals(objectType)) { // In Rap we must force the "real" upload of the file - importPage.performFinish(); + // importPage.performFinish(); try { Node fileNode = folder.addNode(importPage.getObjectName(), NodeType.NT_FILE); Node resNode = fileNode.addNode(Property.JCR_CONTENT, NodeType.NT_RESOURCE); Binary binary = null; + InputStream is = null; try { + is = importPage.getFileInputStream(); binary = folder.getSession().getValueFactory() - .createBinary(importPage.getFileInputStream()); + .createBinary(is); resNode.setProperty(Property.JCR_DATA, binary); } finally { if (binary != null) binary.dispose(); - IOUtils.closeQuietly(importPage.getFileInputStream()); + IOUtils.closeQuietly(is); } folder.getSession().save(); } catch (Exception e) { @@ -91,7 +93,7 @@ public class ImportFileSystemWizard extends Wizard { return false; } return true; - } else if (ImportToServerWizardPage.FOLDER_ITEM_TYPE.equals(objectType)) { + } else if (UploadFileWizardPage.FOLDER_ITEM_TYPE.equals(objectType)) { if (objectPath == null || !new File(objectPath).exists()) { ErrorFeedback.show("Directory " + objectPath + " does not exist");