# HG changeset patch # User dxu # Date 1376941136 25200 # Node ID 7de6ae3cecad5afe1a3506d87406659ae3ed0080 # Parent 686e9330be89bb69c827f66e74ed1485f7d6fd14 8023203: Wrap RandomAccessFile.seek native method into a Java helper method Reviewed-by: alanb, chegar diff -r 686e9330be89 -r 7de6ae3cecad jdk/make/java/java/mapfile-vers --- a/jdk/make/java/java/mapfile-vers Fri Aug 16 12:31:57 2013 -0700 +++ b/jdk/make/java/java/mapfile-vers Mon Aug 19 12:38:56 2013 -0700 @@ -100,7 +100,7 @@ Java_java_io_RandomAccessFile_open; Java_java_io_RandomAccessFile_read; Java_java_io_RandomAccessFile_readBytes; - Java_java_io_RandomAccessFile_seek; + Java_java_io_RandomAccessFile_seek0; Java_java_io_RandomAccessFile_setLength; Java_java_io_RandomAccessFile_write; Java_java_io_RandomAccessFile_writeBytes; diff -r 686e9330be89 -r 7de6ae3cecad jdk/makefiles/mapfiles/libjava/mapfile-vers --- a/jdk/makefiles/mapfiles/libjava/mapfile-vers Fri Aug 16 12:31:57 2013 -0700 +++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers Mon Aug 19 12:38:56 2013 -0700 @@ -100,7 +100,7 @@ Java_java_io_RandomAccessFile_open; Java_java_io_RandomAccessFile_read; Java_java_io_RandomAccessFile_readBytes; - Java_java_io_RandomAccessFile_seek; + Java_java_io_RandomAccessFile_seek0; Java_java_io_RandomAccessFile_setLength; Java_java_io_RandomAccessFile_write; Java_java_io_RandomAccessFile_writeBytes; diff -r 686e9330be89 -r 7de6ae3cecad jdk/src/share/classes/java/io/RandomAccessFile.java --- a/jdk/src/share/classes/java/io/RandomAccessFile.java Fri Aug 16 12:31:57 2013 -0700 +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java Mon Aug 19 12:38:56 2013 -0700 @@ -518,7 +518,15 @@ * @exception IOException if {@code pos} is less than * {@code 0} or if an I/O error occurs. */ - public native void seek(long pos) throws IOException; + public void seek(long pos) throws IOException { + if (pos < 0) { + throw new IOException("Negative seek offset"); + } else { + seek0(pos); + } + } + + private native void seek0(long pos) throws IOException; /** * Returns the length of this file. diff -r 686e9330be89 -r 7de6ae3cecad jdk/src/share/native/java/io/RandomAccessFile.c --- a/jdk/src/share/native/java/io/RandomAccessFile.c Fri Aug 16 12:31:57 2013 -0700 +++ b/jdk/src/share/native/java/io/RandomAccessFile.c Mon Aug 19 12:38:56 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -123,7 +123,7 @@ } JNIEXPORT void JNICALL -Java_java_io_RandomAccessFile_seek(JNIEnv *env, +Java_java_io_RandomAccessFile_seek0(JNIEnv *env, jobject this, jlong pos) { FD fd;