[jira] [Created] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)
Ashish Ambulkar created OFBIZ-4946:
--------------------------------------

             Summary: Getting error when uploading a file after creating a data resource.
                 Key: OFBIZ-4946
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
             Project: OFBiz
          Issue Type: Bug
          Components: content
    Affects Versions: Release Branch 11.04, SVN trunk
            Reporter: Ashish Ambulkar


Steps to generate error -

* Content -> DataResource -> Create New

Case 1 -
* Create a data resource of type '*_FILE' and remain objectInfo field empty.
* Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
* Browse and upload a file.
    - It throws an error -
    "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".

Case 2 -
* While creating a data resource with non-empty objectInfo field.
* Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
* Browse and upload a file.
    - It throws an error -
    "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".

on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.

* Found that 'createFile' service also gives error -
    "Error in Service [createFile]: Unable to obtain a reference to file".

The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Ambulkar updated OFBIZ-4946:
-----------------------------------

    Attachment: OFBIZ-4946.patch

Found a service 'attachUploadToDataResource' which serve both the purpose create/update a file. But it handles only 'OFBIZ_FILE' and 'LOCAL_FILE' dataResourceTypeId (in file types). While the dataResourceTypeId 'CONTEXT_FILE', 'OFBIZ_FILE_BIN', 'LOCAL_FILE_BIN' and 'CONTEXT_FILE_BIN' are not handled in this service. I have called this service from 'persistContentAndAssoc' and it works.

Also provided handling for the above mentioned types that were not handled earlier by the service 'attachUploadToDataResource'.
               

> Getting error when uploading a file after creating a data resource.
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-4946
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Ashish Ambulkar
>         Attachments: OFBIZ-4946.patch
>
>
> Steps to generate error -
> * Content -> DataResource -> Create New
> Case 1 -
> * Create a data resource of type '*_FILE' and remain objectInfo field empty.
> * Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".
> Case 2 -
> * While creating a data resource with non-empty objectInfo field.
> * Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".
> on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.
> * Found that 'createFile' service also gives error -
>     "Error in Service [createFile]: Unable to obtain a reference to file".
> The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Comment Edited] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401370#comment-13401370 ]

Ashish Ambulkar edited comment on OFBIZ-4946 at 6/26/12 1:05 PM:
-----------------------------------------------------------------

Found a service 'attachUploadToDataResource' which serve both the purpose create/update a file. But it handles only 'OFBIZ_FILE' and 'LOCAL_FILE' dataResourceTypeId (in file types). While the dataResourceTypeId 'CONTEXT_FILE', 'OFBIZ_FILE_BIN', 'LOCAL_FILE_BIN' and 'CONTEXT_FILE_BIN' are not handled in this service. I have called this service from 'persistContentAndAssoc' and it works.

Also provided handling for the above mentioned dataResourceTypeIds that were not handled earlier by the service 'attachUploadToDataResource'.
               
      was (Author: ashish18):
    Found a service 'attachUploadToDataResource' which serve both the purpose create/update a file. But it handles only 'OFBIZ_FILE' and 'LOCAL_FILE' dataResourceTypeId (in file types). While the dataResourceTypeId 'CONTEXT_FILE', 'OFBIZ_FILE_BIN', 'LOCAL_FILE_BIN' and 'CONTEXT_FILE_BIN' are not handled in this service. I have called this service from 'persistContentAndAssoc' and it works.

Also provided handling for the above mentioned types that were not handled earlier by the service 'attachUploadToDataResource'.
                 

> Getting error when uploading a file after creating a data resource.
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-4946
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Ashish Ambulkar
>         Attachments: OFBIZ-4946.patch
>
>
> Steps to generate error -
> * Content -> DataResource -> Create New
> Case 1 -
> * Create a data resource of type '*_FILE' and remain objectInfo field empty.
> * Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".
> Case 2 -
> * While creating a data resource with non-empty objectInfo field.
> * Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".
> on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.
> * Found that 'createFile' service also gives error -
>     "Error in Service [createFile]: Unable to obtain a reference to file".
> The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Assigned] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reassigned OFBIZ-4946:
--------------------------------------

    Assignee: Jacques Le Roux
   

> Getting error when uploading a file after creating a data resource.
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-4946
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Ashish Ambulkar
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4946.patch
>
>
> Steps to generate error -
> * Content -> DataResource -> Create New
> Case 1 -
> * Create a data resource of type '*_FILE' and remain objectInfo field empty.
> * Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".
> Case 2 -
> * While creating a data resource with non-empty objectInfo field.
> * Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".
> on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.
> * Found that 'createFile' service also gives error -
>     "Error in Service [createFile]: Unable to obtain a reference to file".
> The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux updated OFBIZ-4946:
-----------------------------------

    Attachment: OFBIZ-4946 labels.patch
                OFBIZ-4946.patch

Hi Ashish,

I have reviewed, tested and amended your patch not committed it.

Changes I did:
# I fixed the NPE you reported in DataResourceWorker class (only functional change, others are trivial)
# I removed some now useless commentted out lines
# I removed old slipped in Debug.logInfo in ContentManagementServices class
# I have commented out the rendering of the uoloaded file content in UploadImage screen. I unsuccessfully tried to improve. I let this part commented out, in case someone want to give it a go later...
# I have added objectInfo and imageData labels in ImageUpload form
# I have added dataResourceId labels in DataResourceForms file

Note that to work properly the last change needs the OFBIZ-4946 labels.patch to be applied before. With it, I have not only added ContentDataResourceId and ContentContentShow labels but used ContentDataResourceId in some fomrs. I's really appreciate if you could check that those labels additions in forms have not unwanted side effects.

Also I lately found a an error in you work. That's why I did not commit. CONTEXT_FILE and CONTEXT_FILE_BIN shown as "(rel to webapp root)" are not working. You get this error:
<<Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Could not commit transaction for service [persistContentAndAssoc] call: Roll back error, could not commit transaction, was rolled back instead because of: Error in Service [createAnonFile]: Cannot find CONTEXT_FILE with an empty context root!)>>


               

> Getting error when uploading a file after creating a data resource.
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-4946
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Ashish Ambulkar
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4946 labels.patch, OFBIZ-4946.patch, OFBIZ-4946.patch
>
>
> Steps to generate error -
> * Content -> DataResource -> Create New
> Case 1 -
> * Create a data resource of type '*_FILE' and remain objectInfo field empty.
> * Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".
> Case 2 -
> * While creating a data resource with non-empty objectInfo field.
> * Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".
> on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.
> * Found that 'createFile' service also gives error -
>     "Error in Service [createFile]: Unable to obtain a reference to file".
> The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux updated OFBIZ-4946:
-----------------------------------

    Attachment: OFBIZ-4946.patch

BTW I forgot to attach a newer patch I did while working on it, changes:
* msg if uploadPath is empty in saveContextFileDataResource => add a label
* I guess
uploadImage.put("rootDir", context.get("rootDir"));
should be
uploadImage.put("rootDir", context.get("objectInfo"));
in persistDataResourceAndDataMethod
               

> Getting error when uploading a file after creating a data resource.
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-4946
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Ashish Ambulkar
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4946 labels.patch, OFBIZ-4946.patch, OFBIZ-4946.patch, OFBIZ-4946.patch
>
>
> Steps to generate error -
> * Content -> DataResource -> Create New
> Case 1 -
> * Create a data resource of type '*_FILE' and remain objectInfo field empty.
> * Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".
> Case 2 -
> * While creating a data resource with non-empty objectInfo field.
> * Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".
> on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.
> * Found that 'createFile' service also gives error -
>     "Error in Service [createFile]: Unable to obtain a reference to file".
> The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4946) Getting error when uploading a file after creating a data resource.

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-4946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458913#comment-13458913 ]

Jacques Le Roux commented on OFBIZ-4946:
----------------------------------------

Who cares?
               

> Getting error when uploading a file after creating a data resource.
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-4946
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4946
>             Project: OFBiz
>          Issue Type: Bug
>          Components: content
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Ashish Ambulkar
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-4946 labels.patch, OFBIZ-4946.patch, OFBIZ-4946.patch, OFBIZ-4946.patch
>
>
> Steps to generate error -
> * Content -> DataResource -> Create New
> Case 1 -
> * Create a data resource of type '*_FILE' and remain objectInfo field empty.
> * Then go to upload tab, here getting an error in the file preview section - "java.lang.NullPointerException".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [persistContentAndAssoc]: org.ofbiz.service.GenericServiceException: Service [updateFile] target threw an unexpected exception (null)".
> Case 2 -
> * While creating a data resource with non-empty objectInfo field.
> * Then go to upload tab, here getting an error in the file preview section - "org.ofbiz.webapp.view.ViewHandlerException: No file found".
> * Browse and upload a file.
>     - It throws an error -
>     "Error in Service [updateFile]: Unable to open file for writing: /home/.../xyz.pdf".
> on upload, 'persistContentAndAssoc' service called which calls 'persistDataResourceAndDataMethod'. This method then call 'createFile' or 'updateFile' services after checking that data resource is already existed or newly created. While the screen flow in OFBiz CMS is such that, you will get an upload tab(to upload files) only after the creation of data resource. And in this case 'updateFile' service called and gives error.
> * Found that 'createFile' service also gives error -
>     "Error in Service [createFile]: Unable to obtain a reference to file".
> The reason, I have found is that both services 'createFile' and 'updateFile' gets the path as per the objectInfo specified, and then create/update a file at that location. While creating a new data resource, how can anybody specify the location at which file will place after uploading?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira