ICEmobile
  1. ICEmobile
  2. MOBI-220

Input/upload components fail to copy some uploaded files on windows platform

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 Final
    • Fix Version/s: 1.1 Beta
    • Component/s: None
    • Labels:
      None
    • Environment:
      Tomcat, windows, where tmp folder and server folder are not on the same system drive.

      Description

      After some recent changes to my windows machines, my server folder folder no longer resides on the same drive as my user tmp folder. As it turns out after this system change was made I was not longer able use the device input/upload components. The failure pointed at the file not being found in the servers download folder.

      The utility class org.icefaces.mobi.utils.Utils.createMapOfFile() makes all call to File.renameTo() which appears to be failing silently in my system setup ultimately resulting in the file not found exception.

      It would appear that doing a regular file stream copy works fine if the renameTo() mehtod fails.

        Activity

        Patrick Corless created issue -
        Hide
        Patrick Corless added a comment -

        Assigning to Ted.

        Show
        Patrick Corless added a comment - Assigning to Ted.
        Patrick Corless made changes -
        Field Original Value New Value
        Assignee Steve Maryka [ steve.maryka ] Ted Goddard [ ted.goddard ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #28734 Mon Apr 16 17:16:05 MDT 2012 ted.goddard copy bytes directly from part stream to destination file (MOBI-220)
        Files Changed
        Commit graph MODIFY /icemobile/trunk/icemobile/components/component/src/org/icefaces/mobi/utils/Utils.java
        Hide
        Ted Goddard added a comment -

        Unfortunately, the following does not work:

        ReadableByteChannel partChannel = Channels
        .newChannel(part.getInputStream());
        FileChannel newChannel = (new FileOutputStream(newFile))
        .getChannel();
        newChannel.transferFrom(partChannel, 0, partChannel.size());

        since the partChannel does not have a size.

        The temporary file will be dispensed with and the bytes will be copied directly to the destination (removing the following code):

        File tempDir = (File) ( request.getServletContext()
        .getAttribute(TEMP_DIR) );
        File tempFile = File.createTempFile("ice", ".tmp", tempDir);
        FileOutputStream tempStream = new FileOutputStream(tempFile);

        Show
        Ted Goddard added a comment - Unfortunately, the following does not work: ReadableByteChannel partChannel = Channels .newChannel(part.getInputStream()); FileChannel newChannel = (new FileOutputStream(newFile)) .getChannel(); newChannel.transferFrom(partChannel, 0, partChannel.size()); since the partChannel does not have a size. The temporary file will be dispensed with and the bytes will be copied directly to the destination (removing the following code): File tempDir = (File) ( request.getServletContext() .getAttribute(TEMP_DIR) ); File tempFile = File.createTempFile("ice", ".tmp", tempDir); FileOutputStream tempStream = new FileOutputStream(tempFile);
        Hide
        Ted Goddard added a comment -

        Changes are checked in. Please verify trunk on windows and assign back to me for deployment for commercial server testing.

        Show
        Ted Goddard added a comment - Changes are checked in. Please verify trunk on windows and assign back to me for deployment for commercial server testing.
        Ted Goddard made changes -
        Assignee Ted Goddard [ ted.goddard ] Patrick Corless [ patrick.corless ]
        Hide
        Patrick Corless added a comment -

        New copy code works well on my system. Back to you for deployment.

        Show
        Patrick Corless added a comment - New copy code works well on my system. Back to you for deployment.
        Patrick Corless made changes -
        Assignee Patrick Corless [ patrick.corless ] Ted Goddard [ ted.goddard ]
        Hide
        Ted Goddard added a comment -

        Verified on WebSphere and WebLogic.

        Show
        Ted Goddard added a comment - Verified on WebSphere and WebLogic.
        Ted Goddard made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.1 Beta [ 10320 ]
        Resolution Fixed [ 1 ]
        Migration made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: