cancel
Showing results for 
Search instead for 
Did you mean: 

Backoffice Upload Error

Former Member
0 Kudos

I have created a editor for file upload and used OOB ImpExExportResultDownload for file download.I have called both of these in backoffice editor area,but whenever I download file and then try to upload file,on selecting the file for upload error popup is shown saying "The server is temporarily out of service". Its giving 410 zk error in response header.I am using ZK File Upload component in my renderer. It works fine after refreshing,but issue comes if I click download and then try to upload.

Former Member
0 Kudos

Hi,

I have a requirement to upload a file in backoffice. Can you please explain how did you implement file upload in backoffice?

Thank you!

Karthik

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi was this issue resolved? We're on Hybris 6.4, and it seems not changed:

 private void handleUploadEvent(final EditorContext<ImpExFileUploadResult> context, final UploadEvent event) {
     this.uploadedMedia = event.getMedia();
     final String name = this.uploadedMedia.getName();
     final String size = FileUtils.byteCountToDisplaySize(this.getUploadedMediaByteSize());
     this.showUploadedFileDetails((Component)this.uploadedFileDetails, context, name, size);
     this.buttonsUploadedState();
 }    

I'm actually receiving error uploading impex from "system->tools->impex import" just after choosing the file. It seems getUploadedMediaByteSize method cannot retrieve the media file to calculate the size, it just happens sometimes with every file size (tried from 1K to 1M)

 ERROR [UiEngineImpl] (UiEngineImpl.java:1481) java.lang.IllegalStateException: Use getReaderData() instead
     at org.zkoss.util.media.AMedia.newIllegalStateException(AMedia.java:358)
     at org.zkoss.util.media.AMedia.getStreamData(AMedia.java:342)
     at de.hybris.platform.platformbackoffice.widgets.impex.ImpExFileUploadEditor.getUploadedMediaByteSize(ImpExFileUploadEditor.java:242)
     at de.hybris.platform.platformbackoffice.widgets.impex.ImpExFileUploadEditor.handleUploadEvent(ImpExFileUploadEditor.java:265)
     at de.hybris.platform.platformbackoffice.widgets.impex.ImpExFileUploadEditor.lambda$0(ImpExFileUploadEditor.java:105)
     at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3163)
     at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3133)
     at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3075)
     at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)


former_member632755
Active Contributor
0 Kudos

Hi,

it seems you are right. I will report the issue as a critical bug to the responsible team.

Thanks, Wojtek

0 Kudos

Cool, thanks! :-)

0 Kudos

Its probably because of these lines here...

     private byte[] getUploadedMediaByteData() {
         return this.uploadedMedia.isBinary()?this.uploadedMedia.getByteData():this.uploadedMedia.getStringData().getBytes();
     }
 
     private void handleUploadEvent(EditorContext<ImpExFileUploadResult> context, UploadEvent event) {
         this.uploadedMedia = event.getMedia();
         String name = this.uploadedMedia.getName();
         String size = FileUtils.byteCountToDisplaySize((long)this.getUploadedMediaByteData().length);
         this.showUploadedFileDetails(this.uploadedFileDetails, context, name, size);
         this.buttonsUploadedState();
     }
 

For some reason, Hybris fills the heap with bytes (might also lead to out of memory exceptions) just to extract the size of the uploaded file. How silly is that???

@Hybris: Please fix that. ;-)

former_member632755
Active Contributor
0 Kudos

Hi,

do you get any errors in the log? The issue seems related to your custom implementation and I suggest creating a support ticket for that.

Cheers, Wojtek