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

        Hide
        Patrick Corless added a comment -

        Assigning to Ted.

        Show
        Patrick Corless added a comment - Assigning to Ted.
        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.
        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.
        Hide
        Ted Goddard added a comment -

        Verified on WebSphere and WebLogic.

        Show
        Ted Goddard added a comment - Verified on WebSphere and WebLogic.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: