Author: rgoers Date: Sun Sep 25 07:31:38 2011 New Revision: 1175312 URL: http://svn.apache.org/viewvc?rev=1175312&view=rev Log: Fix VFS-356. Throw an IOException if an attempt is made to seek to a position before the start of the file.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java commons/proper/vfs/trunk/src/changes/changes.xml Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java?rev=1175312&r1=1175311&r2=1175312&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileRandomAccessContent.java Sun Sep 25 07:31:38 2011 @@ -151,6 +151,9 @@ public class RamFileRandomAccessContent */ public void seek(long pos) throws IOException { + if (pos < 0) { + throw new IOException("Attempt to position before the start of the file"); + } this.filePointer = (int) pos; } Modified: commons/proper/vfs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1175312&r1=1175311&r2=1175312&view=diff ============================================================================== --- commons/proper/vfs/trunk/src/changes/changes.xml (original) +++ commons/proper/vfs/trunk/src/changes/changes.xml Sun Sep 25 07:31:38 2011 @@ -23,6 +23,9 @@ <body> <release version="2.1" date="TBD" description=""> + <action issue="VFS-356" dev="rgoers" type="fix"> + Throw an IOException if an attempt is made to seek to a position before the start of the file. + </action> <action issue="VFS-359" dev="rgoers" type="fix" due-to="Miroslav Pokorny"> Don't delete a RamFileObject if it is open. </action>