harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r432333 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/FileInputStream.java main/java/org/apache/harmony/luni/util/ExternalMessages.properties test/java/tests/api/java/io/FileInputStreamTest.java
Date Thu, 17 Aug 2006 18:47:32 GMT
Author: tellison
Date: Thu Aug 17 11:47:31 2006
New Revision: 432333

URL: http://svn.apache.org/viewvc?rev=432333&view=rev
Log:
Fix for HARMONY-1104 ([classlib][io]Harmony does not throw IOException for java.io.FileInputStream.skip(Long
n) when n<0 while RI does.)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FileInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileInputStreamTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FileInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FileInputStream.java?rev=432333&r1=432332&r2=432333&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FileInputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/FileInputStream.java
Thu Aug 17 11:47:31 2006
@@ -20,6 +20,7 @@
 
 import org.apache.harmony.luni.platform.IFileSystem;
 import org.apache.harmony.luni.platform.Platform;
+import org.apache.harmony.luni.util.Msg;
 import org.apache.harmony.nio.FileChannelFactory;
 
 /**
@@ -310,6 +311,10 @@
     	if (count == 0) {
 			return 0;
 		}
+        if (count < 0){
+            // KA013=Number of bytes to skip cannot be negative
+            throw new IOException(Msg.getString("KA013")); //$NON-NLS-1$
+        }
 
 		// stdin requires special handling
 		if (fd == FileDescriptor.in) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties?rev=432333&r1=432332&r2=432333&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
Thu Aug 17 11:47:31 2006
@@ -304,3 +304,5 @@
 KA010=Cannot read back reference to unshared object
 KA011=Malformed reply from SOCKS server
 KA012=No such file or directory
+KA013=Number of bytes to skip cannot be negative
+

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileInputStreamTest.java?rev=432333&r1=432332&r2=432333&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileInputStreamTest.java
Thu Aug 17 11:47:31 2006
@@ -382,6 +382,25 @@
     }
     
     /**
+     * @tests java.io.FileInputStream#skip(long)
+     */
+    public void test_skipNegativeArgumentJ() throws IOException{
+        
+        FileInputStream fis = new java.io.FileInputStream(fileName);
+
+        try {
+            fis.skip(-5);
+            fail("IOException must be thrown if number of bytes to skip <0");
+        } catch (IOException e) {
+            // Expected IOException
+        } catch (Exception e) {
+            fail("IOException expected, but found: " + e.getMessage());
+        }
+        
+        fis.close();
+    } 
+    
+    /**
      * Sets up the fixture, for example, open a network connection. This method
      * is called before a test is executed.
      */



Mime
View raw message