harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3085) [classlib][nio] FileChannel.transferTo() and FileChannel.map() throws IOException when used file is large and position is equal or greater than 4096
Date Wed, 07 Mar 2007 08:22:24 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478703
] 

Vera Petrashkova commented on HARMONY-3085:
-------------------------------------------

I think this issue was fixed.
testFileChannel finishes correctly.
See output for 
java -cp . testFileChannel from.txt 4096 10

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l
icensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r515167, (Mar  7 2007), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony
=====transferTo test=====
Test passed: trasfered == 10
=====map test=====
Test passed

> [classlib][nio] FileChannel.transferTo() and FileChannel.map() throws IOException when
used file is large and position is equal or greater than 4096
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3085
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3085
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows
>            Reporter: Vera Petrashkova
>         Assigned To: Alexei Zakharov
>         Attachments: H-3085.patch, H-3085_1.patch, testFileChannel.zip
>
>
> Reliability tests
>     api.nio.channels.filechannel.CopyFilesTest
>     api.nio.channels.filechannel.FileChannelMapTest
> fail with IOException when "position" parameter in 
>     FileChannel.tansferTo(long position, long count, WritableByteChannel target)    and

>     FileChannel.map(FileChannel.MapMode mode,  long position, long size)
> methods is equal or greater than 4096.
> The following test demonstrates this issue:
> ----------------testFileChannel.java-------------------
> import java.io.*;
> import java.nio.channels.FileChannel;
> public class testFileChannel {
>     public static void main (String[] argv) {
>         FileChannel from = null;
>         FileChannel to = null;
>         long pp = Integer.parseInt(argv[1]); 
>         long size = Integer.parseInt(argv[2]); 
>         try {
>             from = new FileInputStream(argv[0]).getChannel();
>             to = new FileOutputStream("to.txt").getChannel();
>         } catch (Throwable e) {
>             e.printStackTrace();
>             return;
>         }
>         System.err.println("=====transferTo test=====");
>         try {
>             from.position(pp); 
>             long transfered = from.transferTo(pp , size,  to);        
>             System.err.println("Test passed: trasfered == " +transfered);
>         } catch (Throwable e) {
>             System.err.println("Test failed ");
>             e.printStackTrace();
>         }
>         System.err.println("=====map test=====");
>         try {
>             from.position(pp); 
>             from.map(FileChannel.MapMode.READ_ONLY, pp,size);
>             System.err.println("Test passed ");
>         } catch (Throwable e) {
>             System.err.println("Test failed ");
>             e.printStackTrace();
>         }
>     }
> }
> ----------------------------
> 1) Create testFileChannel class
> 2) Run test using from.txt file from attachment and define position as 4095 and size
parameter
>      java -cp . testFileChannel from .txt 4095 10
> =====transferTo test=====
> Test passed: trasfered == 10
> =====map test=====
> Test passed
> 3) Run test using from.txt file from attachment and define position as 4096 and size
parameter
>      java -cp . testFileChannel from .txt 4096 10
> =====transferTo test=====
> Test failed
> java.io.IOException
>         at org.apache.harmony.luni.platform.OSMemory.mmap(OSMemory.java:544)
>         at org.apache.harmony.luni.platform.PlatformAddressFactory.allocMap(PlatformAddressFactory.java:37)
>         at org.apache.harmony.nio.internal.FileChannelImpl.mapImpl(FileChannelImpl.java:194)
>         at org.apache.harmony.nio.internal.ReadOnlyFileChannel.map(ReadOnlyFileChannel.java:87)
>         at org.apache.harmony.nio.internal.FileChannelImpl.transferTo(FileChannelImpl.java:446)
>         at testFileChannel.main(testFileChannel.java:20)
> =====map test=====
> Test failed
> java.io.IOException
>         at org.apache.harmony.luni.platform.OSMemory.mmap(OSMemory.java:544)
>         at org.apache.harmony.luni.platform.PlatformAddressFactory.allocMap(PlatformAddressFactory.java:37)
>         at org.apache.harmony.nio.internal.FileChannelImpl.mapImpl(FileChannelImpl.java:194)
>         at org.apache.harmony.nio.internal.ReadOnlyFileChannel.map(ReadOnlyFileChannel.java:87)
>         at testFileChannel.main(testFileChannel.java:31)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message