ICEfaces
  1. ICEfaces
  2. ICE-2629

inputFile is reseting com.icesoft.faces.component.inputfile.InputFile properties

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7DR#3
    • Fix Version/s: 1.7RC1, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      normal JSF deployment
    • Workaround Exists:
      Yes
    • Workaround Description:
      Manualy copy InputFile properties into a new object.

      Description

      I was just reviewing the component showcase inputFile example and finally took the time to look into an issue that has been bugging me fore some time.

      When using inputFile component a user binds an method to it to which is called when the file is successfully uploaded. The user then can get the InputFile object that was uploaded.

      public void uploadFile(ActionEvent event) {
              InputFile inputFile = (InputFile) event.getSource();
      .....
      }

      The problem I have is that InputFile is reset right after the my uploadFile method is called leaving me with a useless object. The only work around is to copy the needed properties in to a new object or say good bye.

      Here's what I think would be acceptable solutions:
       - have Input file implement a deep clone method
      - better yet have the component create a new instance of InputFile so that I can decide on how they should be reset/disposed.

        Activity

        Hide
        Patrick Corless added a comment -

        Can you get Adnan to take a look.

        Show
        Patrick Corless added a comment - Can you get Adnan to take a look.
        Hide
        Mark Collette added a comment -

        I totally agree, whenever we clear out that object, we should just be making a new one. Then we could change the component-showcase example code to reflect how you won't have to pull out each of the data bits separately anymore.

        Show
        Mark Collette added a comment - I totally agree, whenever we clear out that object, we should just be making a new one. Then we could change the component-showcase example code to reflect how you won't have to pull out each of the data bits separately anymore.
        Hide
        Mark Collette added a comment -

        Wait, do you mean the FileInfo object gotten from InputFile, or the actual InputFile component itself?

        Show
        Mark Collette added a comment - Wait, do you mean the FileInfo object gotten from InputFile, or the actual InputFile component itself?
        Hide
        Patrick Corless added a comment -

        I mean the inputFile and of course the child FileInfo objct. Stop by and I'll show you the problem if you still don't get it.

        Show
        Patrick Corless added a comment - I mean the inputFile and of course the child FileInfo objct. Stop by and I'll show you the problem if you still don't get it.
        Hide
        Mark Collette added a comment -

        Made FileInfo Cloneable, and InputFile's FileInfo getter method use cloning, so that beans can just keep the FileInfo they get, without having to pick it apart.

        Subversion 15932
        icefaces\component\src\com\icesoft\faces\component\inputfile\FileInfo.java
        icefaces\component\src\com\icesoft\faces\component\inputfile\InputFile.java

        Show
        Mark Collette added a comment - Made FileInfo Cloneable, and InputFile's FileInfo getter method use cloning, so that beans can just keep the FileInfo they get, without having to pick it apart. Subversion 15932 icefaces\component\src\com\icesoft\faces\component\inputfile\FileInfo.java icefaces\component\src\com\icesoft\faces\component\inputfile\InputFile.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: