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

ImageManagementServices.createContentAndDataResource() method might uses DataResource.dataResourceName field to store too long names

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Release Branch 11.04, Release Branch 12.04, Release Branch 13.07, Trunk
    • Fix Version/s: 14.12.01, 12.04.06, 13.07.02
    • Component/s: product
    • Labels:
      None

      Description

      So you get this kind of errors:

      ERROR 22001: A truncation error was encountered trying to shrink VARCHAR 'D:\projectsASF\ofbizClean\framework\images\webapp\images\pro&' to length 100.
      org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

        Activity

        Hide
        hongs bill hongs added a comment -

        like these:

        File file = new File(imageServerPath + "/" + productId + "/" + uploadFileName);
        String imageName = null;
        imagePath = imageServerPath + "/" + productId + "/" + uploadFileName;
        file = checkExistsImage(file);
        if (UtilValidate.isNotEmpty(file))

        { imageName = file.getPath(); imageName = imageName.substring(imageName.lastIndexOf("/") + 1); }

        Change to:

        File file = new File(imageServerPath + "/" + productId + "/" + uploadFileName);
        String imageName = null;
        imagePath = imageServerPath + "/" + productId + "/" + uploadFileName;
        file = checkExistsImage(file);
        if (UtilValidate.isNotEmpty(file))

        { imageName = file.getPath(); imageName = imageName.substring(imageName.lastIndexOf(File.separator) + 1); }
        Show
        hongs bill hongs added a comment - like these: File file = new File(imageServerPath + "/" + productId + "/" + uploadFileName); String imageName = null; imagePath = imageServerPath + "/" + productId + "/" + uploadFileName; file = checkExistsImage(file); if (UtilValidate.isNotEmpty(file)) { imageName = file.getPath(); imageName = imageName.substring(imageName.lastIndexOf("/") + 1); } Change to: File file = new File(imageServerPath + "/" + productId + "/" + uploadFileName); String imageName = null; imagePath = imageServerPath + "/" + productId + "/" + uploadFileName; file = checkExistsImage(file); if (UtilValidate.isNotEmpty(file)) { imageName = file.getPath(); imageName = imageName.substring(imageName.lastIndexOf(File.separator) + 1); }
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        No, the problem is the complete filename is too long to fit in DataResource.dataResourceName field which type is name or sql-type="VARCHAR(100)".

        Anyway there are other issues, and I'm not quite sure how to use this feature.

        Show
        jacques.le.roux Jacques Le Roux added a comment - No, the problem is the complete filename is too long to fit in DataResource.dataResourceName field which type is name or sql-type="VARCHAR(100)". Anyway there are other issues, and I'm not quite sure how to use this feature.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Could somebody explains/document-in-wiki how this feature is supposed to work? Else I'm afraid it will be removed as part of the (continued) slim-down effort...

        Show
        jacques.le.roux Jacques Le Roux added a comment - Could somebody explains/document-in-wiki how this feature is supposed to work? Else I'm afraid it will be removed as part of the (continued) slim-down effort...
        Hide
        arunpati Arun Patidar added a comment -

        Hi Jacques,

        I think we should close this issue now, WDYT?

        Show
        arunpati Arun Patidar added a comment - Hi Jacques, I think we should close this issue now, WDYT?
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Hi Arun,

        Why do you want to close this issue?

        I created it when working on http://svn.apache.org/viewvc?view=revision&revision=1559769 "Major update of jQuery and related" (see bottom of comment)

        Do you suggest it's ok now? That we remove the feature?

        Show
        jacques.le.roux Jacques Le Roux added a comment - Hi Arun, Why do you want to close this issue? I created it when working on http://svn.apache.org/viewvc?view=revision&revision=1559769 "Major update of jQuery and related" (see bottom of comment) Do you suggest it's ok now? That we remove the feature?
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        OK got it, it seems I already answered to myself at OFBIZ-5658. I will now check on WIndows to see if I can reproduce what I found at June 22th.

        Show
        jacques.le.roux Jacques Le Roux added a comment - OK got it, it seems I already answered to myself at OFBIZ-5658 . I will now check on WIndows to see if I can reproduce what I found at June 22th.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        OK, I now understand what you said bill hongs. I did not realise then that you spoke about Windows, thanks!

        Show
        jacques.le.roux Jacques Le Roux added a comment - OK, I now understand what you said bill hongs . I did not realise then that you spoke about Windows, thanks!
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        The issue bill hongs suggested to fix is not in createContentAndDataResource() method but addMultipleuploadForProduct().
        There is still a possiblity to have an image name (filename w/o path) longer than rDataResource.dataResourceName field (100 chars) but it's unlikely.

        Show
        jacques.le.roux Jacques Le Roux added a comment - The issue bill hongs suggested to fix is not in createContentAndDataResource() method but addMultipleuploadForProduct(). There is still a possiblity to have an image name (filename w/o path) longer than rDataResource.dataResourceName field (100 chars) but it's unlikely.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Bill Hongs,

        Your fix is in
        trunk r1642423
        R13.07 r1642424
        R12.04 r1642425

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Bill Hongs, Your fix is in trunk r1642423 R13.07 r1642424 R12.04 r1642425

          People

          • Assignee:
            jacques.le.roux Jacques Le Roux
            Reporter:
            jacques.le.roux Jacques Le Roux
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development