Login | Register
My pages Projects Community openCollabNet

Discussions > issues > [Issue 49] New - SplitTask hangs processing File

antelope
Discussion topic

Back to topic list

[Issue 49] New - SplitTask hangs processing File

Author hopesea
Full name Sean Hope
Date 2010-11-03 17:23:56 PDT
Message http://antelope.tigr​is.org/issues/show_b​ug.cgi?id=49
                 Issue #|49
                 Summary|SplitTask hangs processing File
               Component|antelope
                 Version|current
                Platform|All
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|Ant Tasks
             Assigned to|danson
             Reported by|hopesea






------- Additional comments from hopesea at tigris dot org Wed Nov 3 17:23:55 -0700 2010 -------
Using the SplitTask to split a file causes the task to hang.

e.g.
<split file="myfile.bin" bytes="4096" prefix="A"/>

If the file is larger than 4096 in this example, the task never completes.

        int offset = 0;
        while ( true ) {
            bytes_read = from.read( buffer, 0, java.lang.Math.min( buffer_size,
size - offset ) );
System.out.println(">> read: "+bytes_read);
            if ( bytes_read == -1 )
                break;
            to.write( buffer, 0, bytes_read );
            total += bytes_read;
            offset += bytes_read;
        }
        to.flush();
        return total;

The while loop won't exit because once offset reads 4096 bytes, the logic
continues by trying to read 0 bytes in the buffer which means from.read will
never return -1.

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

[Issue 49] New - SplitTask hangs processing File hopesea Sean Hope 2010-11-03 17:23:56 PDT
Messages per page: