Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-4946

Getting error when uploading a file after creating a data resource.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Release Branch 11.04, Trunk
    • 14.12.01, 12.04.06, 13.07.02
    • content
    • None

    Description

      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?

      Attachments

        1. OFBIZ-4946.patch
          13 kB
          Ashish Ambulkar
        2. OFBIZ-4946.patch
          29 kB
          Jacques Le Roux
        3. OFBIZ-4946 labels.patch
          24 kB
          Jacques Le Roux
        4. OFBIZ-4946.patch
          31 kB
          Jacques Le Roux
        5. OFBIZ-4946-complete.patch
          54 kB
          Jacques Le Roux
        6. OFBIZ-4946-complete.patch
          53 kB
          Arun Patidar

        Activity

          People

            toashishvijay Ashish Vijaywargiya
            ashish18 Ashish Ambulkar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: