public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: <jmr@fulcrummicro.com> To: gcc-gnats@gcc.gnu.org Subject: libgcj/7528: java.io.RandomAccessFile.skipBytes should return bytes skipped, not position Date: Wed, 07 Aug 2002 11:16:00 -0000 [thread overview] Message-ID: <200208071733.g77HXAB03378@churchill.internal.avlsi.com> (raw) >Number: 7528 >Category: libgcj >Synopsis: java.io.RandomAccessFile.skipBytes should return bytes skipped, not position >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Aug 07 10:36:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Jesse Rosenstock >Release: 3.3 20020807 (experimental) >Organization: >Environment: System: Linux churchill 2.4.3-12 #1 Fri Jun 8 15:05:56 EDT 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --enable-threads=posix --prefix=/home/user/jmr/app/gcc --enable-shared --enable-languages=c++,java : (reconfigured) : (reconfigured) : (reconfigured) >Description: java.io.RandomAccessFile.skipBytes should return the number of bytes skipped. It currently returns the position in the file. >How-To-Repeat: create RandomAccessFileTest.java: import java.io.IOException; import java.io.RandomAccessFile; public class RandomAccessFileTest { public static void main(String[] args) throws IOException { RandomAccessFile raf = new RandomAccessFile("foo", "rw"); raf.writeUTF("foobar"); raf.seek(0); int skipped; while ((skipped = raf.skipBytes(1)) == 1) System.out.println("skipped 1 byte"); boolean fail = false; if (skipped != 0) { fail = true; System.out.println("What's going on? skipped = " + skipped + ", not 0"); } if (raf.getFilePointer() != raf.length()) { fail = true; System.out.println("What's going on? filePointer != length!"); System.out.println(" filePointer = " + raf.getFilePointer()); System.out.println(" length = " + raf.length()); } System.out.println(fail ? "FAILED" : "PASSED"); } } ; gcj -v RandomAccessFileTest.java --main=RandomAccessFileTest -o raft Reading specs from /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs Reading specs from /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../../libgcj.spec rename spec lib to liborig Configured with: ../gcc/configure --enable-threads=posix --prefix=/home/user/jmr/app/gcc --enable-shared --enable-languages=c++,java : (reconfigured) : (reconfigured) : (reconfigured) Thread model: posix gcc version 3.3 20020807 (experimental) /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/jc1 RandomAccessFileTest.java -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase RandomAccessFileTest.java -auxbase RandomAccessFileTest -g1 -version -o /tmp/cc7Hot2X.s GNU Java version 3.3 20020807 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 3.3 20020804 (experimental). Class path starts here: ./ /home/user/jmr/app/gcc/share/java/libgcj-3.3.jar/ (system) (zip) as --traditional-format -V -Qy -o /tmp/ccOr5JsQ.o /tmp/cc7Hot2X.s GNU assembler version 2.12 (i686-pc-linux-gnu) using BFD version 2.12 /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/jvgenmain RandomAccessFileTestmain /tmp/ccx6MWrK.i /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/cc1 /tmp/ccx6MWrK.i -quiet -dumpbase RandomAccessFileTestmain.c -g1 -version -fdollars-in-identifiers -o /tmp/cc7Hot2X.s GNU C version 3.3 20020807 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 3.3 20020804 (experimental). as --traditional-format -V -Qy -o /tmp/ccgX694E.o /tmp/cc7Hot2X.s GNU assembler version 2.12 (i686-pc-linux-gnu) using BFD version 2.12 /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o raft /usr/lib/crt1.o /usr/lib/crti.o /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/crtbegin.o -L/home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3 -L/home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../.. /tmp/ccgX694E.o /tmp/ccOr5JsQ.o -lgcc_s -lgcc -lgcj -lm -lpthread -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/crtend.o /usr/lib/crtn.o ; ./raft skipped 1 byte What's going on? skipped = 2, not 0 What's going on? filePointer != length! filePointer = 2 length = 8 FAILED Sun's jdk gives: ; java RandomAccessFileTest skipped 1 byte skipped 1 byte skipped 1 byte skipped 1 byte skipped 1 byte skipped 1 byte skipped 1 byte skipped 1 byte PASSED >Fix: cvs diff java/io/RandomAccessFile.java Index: java/io/RandomAccessFile.java =================================================================== RCS file: /cvsroot/gcc/gcc/libjava/java/io/RandomAccessFile.java,v retrieving revision 1.7 diff -c -r1.7 RandomAccessFile.java *** java/io/RandomAccessFile.java 24 Jul 2002 17:48:41 -0000 1.7 --- java/io/RandomAccessFile.java 7 Aug 2002 17:25:20 -0000 *************** *** 171,177 **** public int skipBytes (int count) throws IOException { ! return count <= 0 ? 0 : fd.seek(count, FileDescriptor.CUR, true); } public void write (int oneByte) throws IOException --- 171,181 ---- public int skipBytes (int count) throws IOException { ! if (count <= 0) ! return 0; ! long startPos = fd.getFilePointer(); ! long endPos = fd.seek(count, FileDescriptor.CUR, true); ! return (int) (endPos - startPos); } public void write (int oneByte) throws IOException >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-08-07 17:36 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-08-07 11:16 jmr [this message] 2002-08-13 17:16 tromey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=200208071733.g77HXAB03378@churchill.internal.avlsi.com \ --to=jmr@fulcrummicro.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).