Index: test/test_file.rb
===================================================================
--- test/test_file.rb	(revision 4731)
+++ test/test_file.rb	(working copy)
@@ -297,4 +297,10 @@
     file.close
     File.delete(filename)
   end
+  
+  def test_file_size
+    size = File.size('build.xml')
+    assert(size > 0)
+    assert_equal(size, File.size(File.new('build.xml')))
+  end
 end
Index: src/org/jruby/RubyFileTest.java
===================================================================
--- src/org/jruby/RubyFileTest.java	(revision 4731)
+++ src/org/jruby/RubyFileTest.java	(working copy)
@@ -190,7 +190,13 @@
         return filename.getRuntime().newBoolean(file.isFile());
     }
     
-    private static JRubyFile newFile(IRubyObject path) {
+    private static JRubyFile newFile(IRubyObject pathOrFile) {
+        IRubyObject path;
+        if (pathOrFile.respondsTo("path")) {
+            path = pathOrFile.callMethod(pathOrFile.getRuntime().getCurrentContext(), "path");
+        } else {
+            path = pathOrFile;
+        }
         return JRubyFile.create(path.getRuntime().getCurrentDirectory(), path.convertToString().toString());
     }
 }

