jRockit 7.0 - IOException occurs in the transferTo() method of a FileChannel - CR087639

(Doc ID 771634.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle JRockit / JRockit / 7.0
Information in this document applies to any platform

Goal

DESCRIPTION:
When the transferTo() method of a FileChannel is executed so that the offset parameter is some odd number (e.g., 5),
JRockit throws the following IOException:

java.io.IOException: The base address or the file offset specified does not have the proper alignment
        at COM.jrockit.io.FileNativeIO.map(IIJJ)I(Unknown Source)
        at COM.jrockit.io.FileNativeIO.map(Ljava.io.FileDescriptor;IJJ)I(Unknown Source)
        at
COM.jrockit.nio.ch.FileChannelImpl.map(Ljava.nio.channels.FileChannel$MapMode;JJ)Ljava.nio.MappedByteBuffer;(Unknown
Source)
        at COM.jrockit.nio.ch.FileChannelImpl.transferTo(JJLjava.nio.channels.WritableByteChannel;)J(Unknown Source)
        at TransferBugTest2.main([Ljava.lang.String;)V(Unknown Source)

This is apparently against the specification, and there should be no need to throw such an exception. The provided
test case works fine (e.g., on Sun's JVM [1.4.1]).

CONFIGURATION : 
JRockit 7.0-1.4.0-win32-GARAK-20020830-1714

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms